added dropbear package

This commit is contained in:
Alexander Zhirov 2024-03-14 18:56:29 +03:00
parent e790b74a15
commit 03483fd716
3 changed files with 97 additions and 0 deletions

View File

@ -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
}

View File

@ -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

View File

@ -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