1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2006 OpenWrt.org
4 # Copyright (C) 2006 Carlos Sobrinho
7 local cfg
="$CONFIG_SECTION"
10 config_get cfgt
"$cfg" TYPE
14 config_get passauth
$cfg PasswordAuth
15 config_get port
$cfg Port
18 no|off|disabled|
0) nopasswd
=1;;
20 DROPBEAR_ARGS
="${nopasswd:+-s }${port:+-p $port}"
26 for keytype
in rsa dss
; do
28 key
=dropbear
/dropbear_
${keytype}_host_key
29 [ -f /tmp
/$key -o -s /etc
/$key ] ||
{
30 # generate missing keys
31 mkdir
-p /tmp
/dropbear
32 [ -x /usr
/bin
/dropbearkey
] && {
33 /usr
/bin
/dropbearkey
-t $keytype -f /tmp
/$key 2>&- >&- && exec /etc
/rc.common
"$initscript" start
39 lock
/tmp
/.switch2jffs
40 mkdir
-p /etc
/dropbear
41 mv /tmp
/dropbear
/dropbear_
* /etc
/dropbear
/
42 lock
-u /tmp
/.switch2jffs
43 chown root
/etc
/dropbear
44 chmod 0700 /etc
/dropbear
48 [ -s /etc
/dropbear
/dropbear_rsa_host_key
-a \
49 -s /etc
/dropbear
/dropbear_dss_host_key
] || keygen
52 /usr
/sbin
/dropbear
$DROPBEAR_ARGS