3 # Do not configure this file. Edit /etc/default/dropbear instead!
6 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
7 DAEMON=/usr/sbin/dropbear
9 DESC="Dropbear SSH server"
17 test ! -r /etc/default/dropbear || . /etc/default/dropbear
18 test "$NO_START" = "0" || exit 0
19 test -x "$DAEMON" || exit 0
20 test ! -h /var/service/dropbear || exit 0
23 for flag in `awk '{ if ($2 == "/") { split($4,FLAGS,",") } }; END { for (f in FLAGS) print FLAGS[f] }' </proc/mounts`; do
31 if [ $readonly_rootfs = "1" ]; then
32 mkdir -p /var/lib/dropbear
33 DROPBEAR_RSAKEY_DEFAULT="/var/lib/dropbear/dropbear_rsa_host_key"
34 DROPBEAR_DSSKEY_DEFAULT="/var/lib/dropbear/dropbear_dss_host_key"
36 DROPBEAR_RSAKEY_DEFAULT="/etc/dropbear/dropbear_rsa_host_key"
37 DROPBEAR_DSSKEY_DEFAULT="/etc/dropbear/dropbear_dss_host_key"
40 test -z "$DROPBEAR_BANNER" || \
41 DROPBEAR_EXTRA_ARGS="$DROPBEAR_EXTRA_ARGS -b $DROPBEAR_BANNER"
42 test -n "$DROPBEAR_RSAKEY" || \
43 DROPBEAR_RSAKEY=$DROPBEAR_RSAKEY_DEFAULT
44 test -n "$DROPBEAR_DSSKEY" || \
45 DROPBEAR_DSSKEY=$DROPBEAR_DSSKEY_DEFAULT
46 test -n "$DROPBEAR_KEYTYPES" || \
47 DROPBEAR_KEYTYPES="rsa"
50 for t in $DROPBEAR_KEYTYPES; do
53 test -f $DROPBEAR_RSAKEY || dropbearkey -t rsa -f $DROPBEAR_RSAKEY
56 test -f $DROPBEAR_DSSKEY || dropbearkey -t dss -f $DROPBEAR_DSSKEY
64 echo -n "Starting $DESC: "
67 test -f $DROPBEAR_DSSKEY && KEY_ARGS="$KEY_ARGS -d $DROPBEAR_DSSKEY"
68 test -f $DROPBEAR_RSAKEY && KEY_ARGS="$KEY_ARGS -r $DROPBEAR_RSAKEY"
69 start-stop-daemon -S \
70 -x "$DAEMON" -- $KEY_ARGS \
71 -p "$DROPBEAR_PORT" $DROPBEAR_EXTRA_ARGS
75 echo -n "Stopping $DESC: "
76 start-stop-daemon -K -x "$DAEMON"
80 echo -n "Restarting $DESC: "
81 start-stop-daemon -K -x "$DAEMON"
84 test -f $DROPBEAR_DSSKEY && KEY_ARGS="$KEY_ARGS -d $DROPBEAR_DSSKEY"
85 test -f $DROPBEAR_RSAKEY && KEY_ARGS="$KEY_ARGS -r $DROPBEAR_RSAKEY"
86 start-stop-daemon -S \
87 -x "$DAEMON" -- $KEY_ARGS \
88 -p "$DROPBEAR_PORT" $DROPBEAR_EXTRA_ARGS
93 echo "Usage: $N {start|stop|restart|force-reload}" >&2