diff options
author | Michael Olbrich <m.olbrich@pengutronix.de> | 2010-02-12 12:15:01 +0100 |
---|---|---|
committer | Michael Olbrich <m.olbrich@pengutronix.de> | 2010-04-20 10:10:29 +0200 |
commit | 0e0f5d31e0e004717320d732154d700405a13b31 (patch) | |
tree | eff432b5036a81255c8cce9786088d869166f7e8 /generic/etc/rc.once.d | |
parent | dc40bf7e4d924345da9e6bde340ac487c11f9515 (diff) | |
download | ptxdist-0e0f5d31e0e004717320d732154d700405a13b31.tar.gz ptxdist-0e0f5d31e0e004717320d732154d700405a13b31.tar.xz |
[dropbear] use rc-once to create server keys
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'generic/etc/rc.once.d')
-rw-r--r-- | generic/etc/rc.once.d/dropbear | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/generic/etc/rc.once.d/dropbear b/generic/etc/rc.once.d/dropbear new file mode 100644 index 000000000..d5d1843e6 --- /dev/null +++ b/generic/etc/rc.once.d/dropbear @@ -0,0 +1,33 @@ +#!/bin/sh + +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin + +DROPBEAR_RSAKEY_DEFAULT="/etc/dropbear/dropbear_rsa_host_key" +DROPBEAR_DSSKEY_DEFAULT="/etc/dropbear/dropbear_dss_host_key" + +test -n "$DROPBEAR_RSAKEY" || \ + DROPBEAR_RSAKEY=$DROPBEAR_RSAKEY_DEFAULT +test -n "$DROPBEAR_DSSKEY" || \ + DROPBEAR_DSSKEY=$DROPBEAR_DSSKEY_DEFAULT + +gen_key() { + + key_type=$1 + key_file=$2 + + rm -f $key_file > /dev/null 2>&1 + + echo -n "generating $key_type key..." + dropbearkey -t $key_type -f $key_file > /dev/null 2>&1 + + if [ "$?" = "0" ]; then + echo "done" + else + echo "failed" + exit 1 + fi +} + +gen_key rsa "$DROPBEAR_RSAKEY" +gen_key dss "$DROPBEAR_DSSKEY" + |