contrib/meshwizard: Allow to setup dropbear autorized_keys
This commit is contained in:
parent
c8ae5c37c5
commit
a1ce6b9a60
2 changed files with 27 additions and 0 deletions
26
contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_ssh.sh
Executable file
26
contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_ssh.sh
Executable file
|
@ -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
|
||||||
|
|
|
@ -59,6 +59,7 @@ $dir/helpers/setup_dnsmasq.sh
|
||||||
$dir/helpers/setup_system.sh
|
$dir/helpers/setup_system.sh
|
||||||
$dir/helpers/setup_olsrd.sh
|
$dir/helpers/setup_olsrd.sh
|
||||||
$dir/helpers/setup_firewall.sh
|
$dir/helpers/setup_firewall.sh
|
||||||
|
$dir/helpers/setup_ssh.sh
|
||||||
|
|
||||||
if [ "$wan_proto" == "static" ] && [ -n "$wan_ip4addr" ] && [ -n "$wan_netmask" ]; then
|
if [ "$wan_proto" == "static" ] && [ -n "$wan_ip4addr" ] && [ -n "$wan_netmask" ]; then
|
||||||
$dir/helpers/setup_wan_static.sh
|
$dir/helpers/setup_wan_static.sh
|
||||||
|
|
Loading…
Reference in a new issue