viwib: all in stage2

This commit is contained in:
Nico Schottelius 2020-12-15 23:43:20 +01:00
parent 8f161e2137
commit 1b0d8220e6
2 changed files with 15 additions and 0 deletions

View File

@ -42,6 +42,10 @@ if [ $? -ne 0 ]; then
exit 1
fi
root_password=$(pwgen -1 32)
echo $root_password > ${viwib_hostname}.rootpw
cat <<EOF | ssh -t "root@${viwib_ip}"
set -x
# Setup lan to also retrieve an ip address via dhcp
@ -173,15 +177,26 @@ uci set firewall.@zone[1].network='wan wan6 wg0'
uci commit
# Remove our ssh keys
rm -f /etc/dropbear/authorized_keys
# Setup root password
printf "${root_password}\n${root_password}\n" | passwd
reboot
EOF
echo "Wireguard public key and id: ${id} ${public_key}"
echo "Root password: ${root_password}"
echo ${public_key} > ${viwib_hostname}.public_key
# change to ipv6
viwib_ip=${my_lan_ip}
sleep 15
while ! ping -c5 ${viwib_ip}; do
echo "Waiting for viwib ${id}"
sleep 2