mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-07-14 18:10:33 +02:00
Test : periodically check VPN is up
https://github.com/alexbelgium/hassio-addons/issues/377
This commit is contained in:
@@ -27,11 +27,29 @@ if [ -f /currentip ]; then
|
|||||||
# Inform by message
|
# Inform by message
|
||||||
bashio::log.info "VPN is up and running with ip $(cat /vpnip), based in country : $COUNTRY"
|
bashio::log.info "VPN is up and running with ip $(cat /vpnip), based in country : $COUNTRY"
|
||||||
|
|
||||||
rm /vpnip
|
|
||||||
rm /currentip
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
bashio::log.info "Starting NGinx..."
|
bashio::log.info "Starting NGinx..."
|
||||||
|
|
||||||
|
# Check vpn is working
|
||||||
|
if [ -f /currentip ]; then
|
||||||
|
exec nginx & \
|
||||||
|
while true; do
|
||||||
|
sleep 15m
|
||||||
|
# Get vpn ip
|
||||||
|
if bashio::config.true 'openvpn_alt_mode'; then
|
||||||
|
curl -s ipecho.net/plain > /vpnip
|
||||||
|
else
|
||||||
|
curl -s ipecho.net/plain --interface tun0 > /vpnip
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Verify ip has changed
|
||||||
|
if [[ "$(cat /vpnip)" = "$(cat /currentip)" ]]; then
|
||||||
|
bashio::log.fatal "VPN is not properly configured. Your ip is exposed. Please fix this, or do not use the vpn alt mode"
|
||||||
|
bashio::exit.nok
|
||||||
|
fi
|
||||||
|
true
|
||||||
|
done
|
||||||
|
else
|
||||||
exec nginx
|
exec nginx
|
||||||
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user