| 1 | #!/bin/sh |
| 2 | # |
| 3 | # /etc/rc.d/dropbear: start/stop dropbear ssh daemon |
| 4 | # |
| 5 | |
| 6 | CONV=/usr/bin/dropbearconvert |
| 7 | KEYG=/usr/bin/dropbearkey |
| 8 | |
| 9 | RSA=/etc/dropbear/dropbear_rsa_host_key |
| 10 | DSS=/etc/dropbear/dropbear_dss_host_key |
| 11 | |
| 12 | case $1 in |
| 13 | start) |
| 14 | if [ ! -f $RSA ]; then |
| 15 | if [ -f /etc/ssh/ssh_host_rsa_key ]; then |
| 16 | $CONV openssh dropbear /etc/ssh/ssh_host_rsa_key $RSA |
| 17 | else |
| 18 | $KEYG -t rsa -f $RSA |
| 19 | fi |
| 20 | fi |
| 21 | if [ ! -f $DSS ]; then |
| 22 | if [ -f /etc/ssh/ssh_host_dsa_key ]; then |
| 23 | $CONV openssh dropbear /etc/ssh/ssh_host_dsa_key $DSS |
| 24 | else |
| 25 | $KEYG -t dss -f $DSS |
| 26 | fi |
| 27 | fi |
| 28 | /usr/sbin/dropbear |
| 29 | ;; |
| 30 | stop) |
| 31 | killall -q /usr/sbin/dropbear |
| 32 | ;; |
| 33 | restart) |
| 34 | $0 stop |
| 35 | sleep 2 |
| 36 | $0 start |
| 37 | ;; |
| 38 | *) |
| 39 | echo "usage: $0 [start|stop|restart]" |
| 40 | ;; |
| 41 | esac |
| 42 | |
| 43 | # End of file |