VPNDaemon: monitor VPN connections

p2p_network_compMany of us use VPNs to connect to office network or protect our online footprints. However, a VPN disconnection may lead to malfunctioning of your applications or reveal your identity when connecting via the normal connection. VPNDaemon is a tool to monitor a VPN connection and kill any program when there is a disconnection.

VPNDemon listens to events from the NetworkManager. When a VPN connect or disconnect event is received, the signal is checked to see which state it relates to. If it’s a connect state, the status is simply displayed in the main window. If it’s a disconnect state, VPNDemon immediately issues a kill command for all processes that match the target process name entered by the user during configuration. Since the NetworkManager is being listened to, directly via the dbus-monitor, disconnect events are detected almost instantly. Likewise, the target process is killed almost instantly.

VPNDaemon creates a log file at /tmp/vpndemon, with the list of VPN connect or disconnect events and a list of processes terminated. The log is cleared on each run.


VPNDaemon should work on any system that uses NetworkManager. To install VPNDaemon, run:

$ git clone https://github.com/primaryobjects/vpndemon.git
$ cd vpndaemon
$ chmod +x vpndaemon.sh install.sh
$ ./install.sh

This will add VPNDaemon to the start menu.

To run manually:

$ sudo cp vpndaemon.sh /usr/bin/


For one-time runs, start VPNDaemon before connecting to the VPN:

$ vpndaemon.sh

Enter the name of the application to kill when asked. This can be a substring of the name, such as “chrome”, “firefox”, etc.

On GitHub: VPNDaemon

Leave a Reply

Your email address will not be published. Required fields are marked *