summaryrefslogtreecommitdiffstats
path: root/prebuilt/common/xbin/dropbear-keygen
blob: c61de42e68af6da38ccb62cc9b97dee7d058bc2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/system/bin/sh
#
# Generate keys for the Dropbear SSH server
# Steve Kondik (cyanogen)
#

DROPBEAR_HOME=/data/dropbear
DROPBEARKEY=/system/xbin/dropbearkey

if [ ! -d $DROPBEAR_HOME ] || [ ! -f $DROPBEAR_HOME/dropbear_rsa_host_key ] || [ ! -f $DROPBEAR_HOME/dropbear_dsa_host_key ];
then
    if [ ! -d $DROPBEAR_HOME ];
    then
        mkdir /data/dropbear;
        chmod 750 /data/dropbear
    fi
    for k in dss rsa;
    do
        if [ ! -e $DROPBEAR_HOME/dropbear_${k}_host_key ];
        then
            $DROPBEARKEY -t $k -f $DROPBEAR_HOME/dropbear_${k}_host_key;
            chmod 640 $DROPBEAR_HOME/dropbear_${k}_host_key;
        fi
    done
fi