summaryrefslogtreecommitdiffhomepage
path: root/contrib/package/meshwizard/files
diff options
context:
space:
mode:
authorManuel Munz <freifunk@somakoma.de>2012-07-26 09:45:48 +0000
committerManuel Munz <freifunk@somakoma.de>2012-07-26 09:45:48 +0000
commita1ce6b9a603221332ffc8aef22dde419d0c84439 (patch)
tree2f40182087314e134465c43feeb256f5fa0d10be /contrib/package/meshwizard/files
parentc8ae5c37c50ccce92b8874683ef1f3e12e401d81 (diff)
contrib/meshwizard: Allow to setup dropbear autorized_keys
Diffstat (limited to 'contrib/package/meshwizard/files')
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_ssh.sh26
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/wizard.sh1
2 files changed, 27 insertions, 0 deletions
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_ssh.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_ssh.sh
new file mode 100755
index 000000000..38b331e71
--- /dev/null
+++ b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_ssh.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+# Setup ssh. At this point only used to store pubkeys.
+
+[ ! "$(uci -q get meshwizard.ssh)" == "system" ] && exit
+
+. /lib/functions.sh
+. $dir/functions.sh
+authorized="/etc/dropbear/authorized_keys"
+
+
+config_load meshwizard
+
+i=0
+handle_pubkeys() {
+ local k="$1"
+ ( [ -f "$authorized" ] && grep -q "$k" $authorized) || {
+ echo "$k" >> $authorized
+ i=`expr $i + 1`
+ }
+}
+
+config_list_foreach ssh pubkey handle_pubkeys
+
+uci delete meshwizard.ssh
+uci_commitverbose "Added $i pubkeys to authorized_keys" meshwizard
+
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/wizard.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/wizard.sh
index eae4de87e..b45c83987 100755
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/wizard.sh
+++ b/contrib/package/meshwizard/files/usr/bin/meshwizard/wizard.sh
@@ -59,6 +59,7 @@ $dir/helpers/setup_dnsmasq.sh
$dir/helpers/setup_system.sh
$dir/helpers/setup_olsrd.sh
$dir/helpers/setup_firewall.sh
+$dir/helpers/setup_ssh.sh
if [ "$wan_proto" == "static" ] && [ -n "$wan_ip4addr" ] && [ -n "$wan_netmask" ]; then
$dir/helpers/setup_wan_static.sh