From a1ce6b9a603221332ffc8aef22dde419d0c84439 Mon Sep 17 00:00:00 2001 From: Manuel Munz Date: Thu, 26 Jul 2012 09:45:48 +0000 Subject: contrib/meshwizard: Allow to setup dropbear autorized_keys --- .../files/usr/bin/meshwizard/helpers/setup_ssh.sh | 26 ++++++++++++++++++++++ .../meshwizard/files/usr/bin/meshwizard/wizard.sh | 1 + 2 files changed, 27 insertions(+) create mode 100755 contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_ssh.sh (limited to 'contrib/package/meshwizard/files/usr/bin') 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 0000000000..38b331e71b --- /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 eae4de87e6..b45c83987c 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 -- cgit v1.2.3