Patrick Jacques | dc808ff | 2010-08-28 05:25:45 -0700 | [diff] [blame] | 1 | #!/system/bin/sh |
| 2 | # |
| 3 | # Generate keys for the Dropbear SSH server |
| 4 | # Steve Kondik (cyanogen) |
| 5 | # |
| 6 | |
| 7 | DROPBEAR_HOME=/data/dropbear |
| 8 | DROPBEARKEY=/system/xbin/dropbearkey |
| 9 | |
| 10 | if [ ! -d $DROPBEAR_HOME ] || [ ! -f $DROPBEAR_HOME/dropbear_rsa_host_key ] || [ ! -f $DROPBEAR_HOME/dropbear_dsa_host_key ]; |
| 11 | then |
| 12 | if [ ! -d $DROPBEAR_HOME ]; |
| 13 | then |
| 14 | mkdir /data/dropbear; |
| 15 | chmod 750 /data/dropbear |
| 16 | fi |
| 17 | for k in dss rsa; |
| 18 | do |
| 19 | if [ ! -e $DROPBEAR_HOME/dropbear_${k}_host_key ]; |
| 20 | then |
| 21 | $DROPBEARKEY -t $k -f $DROPBEAR_HOME/dropbear_${k}_host_key; |
| 22 | chmod 640 $DROPBEAR_HOME/dropbear_${k}_host_key; |
| 23 | fi |
| 24 | done |
| 25 | fi |