I'm trying to set up my router so that I can toggle my VPN client with the press of a button. I don't use the WPS or WiFi buttons at all, so I'm fine with using either (or both) to run a custom script to toggle the VPN client. I can easily write the script, but I just don't know how to attach it to the button press.
Can someone point me in the right direction?
I'm positive this will break with an update, but if anyone is curious, I found a way to do it.
First, I edited /etc/openvpn/ovpnclient-up.sh and /etc/openvpn/ovpnclient-down.sh to manage a file when the vpn client is up/down:
If you have a script monitoring the vpn client and automatically bringing it up (like /usr/bin/vpncmon.sh https://www.myopenrouter.com/article/how-set-openvpn-client-netgear-r780...), that needs to be edited so it won't try to revive your vpn client if it shouldn't be alive. The beginning of my /usr/bin/vpncmon.sh now looks like:
Finally, I settled on editing /sbin/wps_pbc to detect the WPS button press. At the very top, I added:
I have a feeling the last change will get overwritten when I upgrade, so it's not the best place to put it, but I couldn't find a better place for it. It seems like hotplug.d takes care of the logic for flashing the WPS light, but I couldn't find where I could cause it to replace the WPS button functinoality.
Thank you for sharing this!