Button script to toggle Force VPN


I’d like to be able to use the side switch to enable/disable the Force VPN (No internet if VPN is not connected) option.
Certain wifi hotspots require re-auth through their captive portal. It would be good if I can just slide the switch, re-auth to wifi, then turn on the force vpn back on so that if the tunnel goes down, so does internet.

Is this possible?

Yes. The UCI for “force_vpn” is in this file /etc/config/glconfig

You can modify the UCI value then execute /usr/bin/setvpnfirewall

Do you know how to modify the switch button script?

Actually you don’t need to modify the UCI value. The script does all these thing:

To use normal Internet:

setvpnfirewall --disable

To always use VPN

setvpnfirewall --force



I saw the various threads on Button scripts - but if i understand correctly, the default behavior is to output to console. I have tried that, but do not see anything on console.

Just to be clear - if I login and do nothing, slide switch left or right, I should see some message directly on:

OR do I need to look somewhere/run something to monitor the output?