From 03483fd7165ed066b7fcff97af67e71a67bca772 Mon Sep 17 00:00:00 2001 From: Alexander Zhirov Date: Thu, 14 Mar 2024 18:56:29 +0300 Subject: [PATCH] added dropbear package --- packages/d/dropbear/Pkgfile | 33 +++++++++++++++++++++ packages/d/dropbear/dropbear.pam | 14 +++++++++ packages/d/dropbear/dropbear.rc | 50 ++++++++++++++++++++++++++++++++ 3 files changed, 97 insertions(+) create mode 100644 packages/d/dropbear/Pkgfile create mode 100644 packages/d/dropbear/dropbear.pam create mode 100644 packages/d/dropbear/dropbear.rc diff --git a/packages/d/dropbear/Pkgfile b/packages/d/dropbear/Pkgfile new file mode 100644 index 0000000..47c7289 --- /dev/null +++ b/packages/d/dropbear/Pkgfile @@ -0,0 +1,33 @@ +# Description: Small and secure SSH2 server and client +# URL: https://matt.ucc.asn.au/dropbear/dropbear.html +# Maintainer: Alexander Zhirov +# Depends on: zlib linux-pam + +name=dropbear +version=2022.83 +release=1 +source=( + https://matt.ucc.asn.au/$name/releases/$name-$version.tar.bz2 + dropbear.rc + dropbear.pam +) + +build() { + cd $name-$version + + sed '/pam_start/s/sshd/dropbear/' -i svr-authpam.c + + echo '#define SFTPSERVER_PATH "/usr/lib/ssh/sftp-server"' > localoptions.h + echo '#define DROPBEAR_SVR_PASSWORD_AUTH 0' >> localoptions.h + echo '#define DROPBEAR_SVR_PAM_AUTH 1' >> localoptions.h + echo '#define DROPBEAR_PIDFILE "/run/dropbear.pid"' >> localoptions.h + + ./configure --prefix=/usr --enable-pam + + make + make DESTDIR=$PKG install + + install -d $PKG/etc/{rc.d,pam.d,dropbear} + install -m 755 $SRC/dropbear.rc $PKG/etc/rc.d/dropbear + install -m 644 $SRC/dropbear.pam $PKG/etc/pam.d/dropbear +} diff --git a/packages/d/dropbear/dropbear.pam b/packages/d/dropbear/dropbear.pam new file mode 100644 index 0000000..a739be4 --- /dev/null +++ b/packages/d/dropbear/dropbear.pam @@ -0,0 +1,14 @@ +# +# /etc/pam.d/dropbear - dropbear service module configuration +# + +auth include common-auth + +account required pam_nologin.so +account include common-account + +password include common-password + +session include common-session +session required pam_limits.so + diff --git a/packages/d/dropbear/dropbear.rc b/packages/d/dropbear/dropbear.rc new file mode 100644 index 0000000..c5d5821 --- /dev/null +++ b/packages/d/dropbear/dropbear.rc @@ -0,0 +1,50 @@ +#!/bin/sh +# +# /etc/rc.d/dropbear: start/stop dropbear ssh daemon +# + +SSD=/sbin/start-stop-daemon +PROG=/usr/sbin/dropbear +PID=/run/dropbear.pid + +KEYG=/usr/bin/dropbearkey + +RSA=/etc/dropbear/dropbear_rsa_host_key +DSS=/etc/dropbear/dropbear_dss_host_key +ECDSA=/etc/dropbear/dropbear_ecdsa_host_key +ED25519=/etc/dropbear/dropbear_ed25519_host_key + +create_keys() { + [ -f $RSA ] || $KEYG -t rsa -s 4096 -f $RSA + [ -f $DSS ] || $KEYG -t dss -f $DSS + [ -f $ECDSA ] || $KEYG -t ecdsa -s 521 -f $ECDSA + [ -f $ED25519 ] || $KEYG -t ed25519 -f $ED25519 +} + +case $1 in +start) + create_keys + $SSD --start --pidfile $PID --exec $PROG + ;; +stop) + $SSD --stop --retry 10 --pidfile $PID + ;; +restart) + $0 stop + $0 start + ;; +status) + $SSD --status --pidfile $PID + case $? in + 0) echo "$PROG is running with pid $(cat $PID)" ;; + 1) echo "$PROG is not running but the pid file $PID exists" ;; + 3) echo "$PROG is not running" ;; + 4) echo "Unable to determine the program status" ;; + esac + ;; +*) + echo "usage: $0 [start|stop|restart|status]" + ;; +esac + +# End of file