Post date: 15-Dec-2012 03:39:49
Most of us using a VPN connection to our workplace have had the secure connection occasionally drop. When that occurs and we don't notice, all of the connections applications make to our office go unsecured and become prone to malicious snooping. More often than not we cannot afford that, which is why we never leave a computer connected via VPN unattended or we employ other inconvenient schemes to avoid information leakage.
What we have here is a simple open source tool for Ubuntu that monitors the state of your VPN connection. Whenever your connections drops, vpnmon will either immediately disable your entire networking, or it will execute a custom command in case you provided one. The tool will also display a notification whenever it takes an action.
vpnmon should work fine on any Linux distribution that satisfies its dependencies. In general it needs python, gobject, dbus, NetworkManager and pynotify. There isn't any sort of dependency checking mechanism at this time, so running Ubuntu is considered a requirement. This requirement makes sure all dependencies are satisfied. Naturally, if you know what you're doing, you don't need to stick to it.
Unfortunately I haven't packaged vpnmon for Ubuntu yet, but I may end up doing that in the future. For now you can follow the steps below. They were tested on Ubuntu 12.04, but should also work on most recent version as well:
cd /tmp
wget -O vpnmon.tar.gz https://github.com/lightrush/vpnmon/archive/v0.1.2.tar.gz
tar zxf vpnmon.tar.gz
cd vpnmon-0.1.2
./install
rm -rf /tmp/vpnmon*
Make sure to test it out and make sure it works before leaving your VPN connection unattended. That's about it!
The source for vpnmon can be found here. Please do not hesitate to fork it, modify it or do whatever else permissible by the license. You can also email me if you encounter any issues I may be able to help with.