summaryrefslogtreecommitdiffstats
path: root/projectroot/etc/rc.once.d/dropbear
diff options
context:
space:
mode:
authorMarc Kleine-Budde <mkl@pengutronix.de>2015-06-11 12:18:01 +0200
committerMarc Kleine-Budde <mkl@pengutronix.de>2015-06-18 16:22:13 +0200
commit28db1773524eb763569939d4066e32dbf50c69a0 (patch)
tree964e2f4165b48179d7ac39ac8d472788d60f99f0 /projectroot/etc/rc.once.d/dropbear
parent878707bd943a04fc8e3a55a151499359e81ce780 (diff)
downloadptxdist-28db1773524eb763569939d4066e32dbf50c69a0.tar.gz
ptxdist-28db1773524eb763569939d4066e32dbf50c69a0.tar.xz
generic: rename generic -> projectroot
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'projectroot/etc/rc.once.d/dropbear')
-rw-r--r--projectroot/etc/rc.once.d/dropbear33
1 files changed, 33 insertions, 0 deletions
diff --git a/projectroot/etc/rc.once.d/dropbear b/projectroot/etc/rc.once.d/dropbear
new file mode 100644
index 000000000..a126b26db
--- /dev/null
+++ b/projectroot/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="@KEYDIR@/dropbear_rsa_host_key"
+DROPBEAR_DSSKEY_DEFAULT="@KEYDIR@/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
+}
+
+[ -e "$DROPBEAR_RSAKEY" ] || gen_key rsa "$DROPBEAR_RSAKEY"
+[ -e "$DROPBEAR_DSSKEY" ] || gen_key dss "$DROPBEAR_DSSKEY"
+