bundles/wireguard: clean up leftovers

This commit is contained in:
Franzi 2023-12-25 10:19:34 +01:00
parent 9cf5fa2e5f
commit 3b7e14755c
Signed by: kunsi
GPG key ID: 12E3D2136B818350
3 changed files with 0 additions and 63 deletions

View file

@ -1,10 +0,0 @@
#!/bin/bash
# We need to send some traffic over the wireguard tunnel to make sure
# it gets connected. Easiest way is to simply send some pings to the
# other side.
% for peer, config in sorted(node.metadata.get('wireguard/peers', {}).items()):
# refresh connection to ${peer}
/usr/bin/ping -c 4 ${config['their_ip']}
% endfor

View file

@ -1,46 +0,0 @@
#!/bin/bash
if [[ -e "/var/lib/bundlewrap/hard-${node.name}/info" ]]
then
# make sure we're not restarting during bw apply
echo "bw apply running"
exit 0
fi
now="$(date +%s)"
everything_up=1
% for peer, ip in sorted(peers.items()):
# ${peer}
if ! /usr/bin/ping -c 4 ${ip} >/dev/null 2>&1
then
echo "${peer} was not reachable!"
everything_up=0
fi
% endfor
if [[ "$everything_up" -eq 1 ]]
then
echo "Everything is up as expected"
echo "$now" > /var/tmp/wg_all_reached
exit 0
fi
five_min_ago="$(expr $now - 300)"
last_reached="$(cat /var/tmp/wg_all_reached)"
if [[ "$last_reached" -lt "$five_min_ago" ]]
then
echo "RESTART"
systemctl restart systemd-networkd
# only restart once an hour
echo "$(expr $now + 3300)" > /var/tmp/wg_all_reached
elif [[ "$last_reached" -gt "$now" ]]
then
echo "Something's broken, but we have recently restarted"
else
echo "Something's broken, but still in grace time"
fi

View file

@ -34,10 +34,3 @@ for peer, config in sorted(node.metadata.get('wireguard/peers', {}).items()):
'svc_systemd:systemd-networkd:restart',
},
}
if node.has_bundle('pppd'):
files['/etc/ppp/ip-up.d/reconnect-wireguard'] = {
'source': 'pppd-ip-up',
'content_type': 'mako',
'mode': '0755',
}