summaryrefslogtreecommitdiffhomepage
path: root/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'contrib')
-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