2006-02-23 15:26:10 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# /etc/rc.d/dropbear: start/stop dropbear ssh daemon
|
|
|
|
#
|
|
|
|
|
2015-02-20 12:29:37 +01:00
|
|
|
SSD=/sbin/start-stop-daemon
|
|
|
|
PROG=/usr/sbin/dropbear
|
2022-02-16 17:35:25 +01:00
|
|
|
PID=/run/dropbear.pid
|
2015-02-20 12:29:37 +01:00
|
|
|
|
2006-02-23 15:26:10 +00:00
|
|
|
KEYG=/usr/bin/dropbearkey
|
|
|
|
|
|
|
|
RSA=/etc/dropbear/dropbear_rsa_host_key
|
2015-01-18 15:14:23 +01:00
|
|
|
ECDSA=/etc/dropbear/dropbear_ecdsa_host_key
|
2021-05-22 18:25:50 +02:00
|
|
|
ED25519=/etc/dropbear/dropbear_ed25519_host_key
|
2006-02-23 15:26:10 +00:00
|
|
|
|
2015-02-20 12:29:37 +01:00
|
|
|
create_keys() {
|
2022-04-02 11:34:28 +02:00
|
|
|
[ -f $RSA ] || $KEYG -t rsa -s 4096 -f $RSA
|
|
|
|
[ -f $ECDSA ] || $KEYG -t ecdsa -s 521 -f $ECDSA
|
|
|
|
[ -f $ED25519 ] || $KEYG -t ed25519 -f $ED25519
|
2015-02-20 12:29:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
case $1 in
|
|
|
|
start)
|
|
|
|
create_keys
|
|
|
|
$SSD --start --pidfile $PID --exec $PROG
|
2006-02-23 15:26:10 +00:00
|
|
|
;;
|
|
|
|
stop)
|
2015-02-20 12:29:37 +01:00
|
|
|
$SSD --stop --retry 10 --pidfile $PID
|
2006-02-23 15:26:10 +00:00
|
|
|
;;
|
|
|
|
restart)
|
|
|
|
$0 stop
|
|
|
|
$0 start
|
|
|
|
;;
|
2015-02-20 12:29:37 +01:00
|
|
|
status)
|
|
|
|
$SSD --status --pidfile $PID
|
|
|
|
case $? in
|
2015-06-29 17:08:22 +02:00
|
|
|
0) echo "$PROG is running with pid $(cat $PID)" ;;
|
2015-02-20 12:29:37 +01:00
|
|
|
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
|
|
|
|
;;
|
2006-02-23 15:26:10 +00:00
|
|
|
*)
|
2015-02-20 12:29:37 +01:00
|
|
|
echo "usage: $0 [start|stop|restart|status]"
|
2006-02-23 15:26:10 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# End of file
|