The Tin Hat

VPN Killswitch | Stop Application on Disconnect

Image By Yutaka Tsutano

Category: misc
A 2 Minute Read

Support The Tin Hat on Patreon! Just one dollar makes all the difference in helping me write more content!

VPNs are a good way to increase your privacy, but it's not uncommon for them to disconnect. Unfortunately, when this happens it can completely nullify the benefit of using the VPN in the first place. Because of this, its important to take measures to protect you when your VPN drops.

Many VPN companies include a killswitch feature in their clients, which can make the task of protecting yourself monumentally easier. But most Linux users tend not to use the company's VPN client, often because it doesn't exist on Linux, and even more often because the NetworkManager with OpenVPN is more convenient and robust.

The downside of the NetworkManager though is that it includes no killswitch, leaving Linux users to have to resort to other options. Fortunately, there are a few ways you can protect yourself, such as setting up IPTables firewalls, configuring connections to go through proxies only accessible through the VPN, etc. While these setups definitely work, I've come across another method that works best for me: VPNDemon. This won't be long like most of my tutorials, but I thought many people might find VPNDemon useful, so I wanted to point it out.

VPNDemon is a small application which can be installed to your system, or just run as a bash script. It monitors your NetworkManager for events, specifically a VPN disconnect. When it receives this message, it will kill a particular application that you choose during setup. For example, you can connect your VPN, start up VPNDemon, set it to kill Transmission upon VPN disconnect, and it will start to monitor for when the VPN drops. If it does drop, Transmission will be killed instantly. The way I use it on my Qubes setup is to kill the NetworkManager itself, cutting the connection to the entire system.

You can find VPNDemon on GitHub. It simply needs to be extracted and executed in the terminal.


I personally use NordVPN and Digital Ocean.
Show some love by signing up using my affiliate links:
Or support me directly on Patreon

Help Me Out: Share, Follow, & Comment

Latest Posts

What is Device Fingerprinting?

Learn what browser fingerprinting is and how it canb e used to track you online.

How To Torrent Privately & Anonymously For Free

Learn the pros and cons of using a VPN to torrent, as well as how to use I2P to anonymously torrent for free!

VPN Drop Protection Using Simple Linux Firewall Rules

Learn how to protect against your VPN dropping using these simply Linux firewall rules

Ledger Nano S Review | Why You Need a Bitcoin Hardware Wallet

A review of the Ledger Nano S, and an explanation of why hardware wallets just make life better when using Bitcoin

What is Two Factor Authentication (2FA) And Why Use It?

What 2FA is, why you should use it, and why we need FIDO U2F.

Support The Tin Hat on Patreon!

The Tin Hat now has a few more ways to support the site.

What is a hash?

A simple explanation of what hashing is, and how hashes are used.

Trump's Toolbox | Future Attribute Screening Technology

FAST is a program that attempts to wirelessly detect whether youre a terrorist, and its in Trump's back pocket.

uBlock Origin, The Best AdBlock Alternative

For AdBlock (Plus) alternatives, look no further than uBlock Origin. This tutorial explains why, and how, you should use it.

I2P Browser Setup Tutorial | Using The Tor Browser For I2P

Learn how to browse I2P using the Tor Browser with this short guide

Privacy On Android | 2017 Android Privacy Guide

A tutorial on how to build privacy on your Android device. Learn what you need to do to stay safe and secure.

New I2P Portal For TheTinHat

TheTinHat has moved to a new server, with a new I2P hidden service to accompany it.

Rebranding 'The Dark Net'

Disassociating decentralized networks with the term 'darknets'.

In Defense of Browser-Based Email Encryption

Why I've reversed my opinion on Protonmail and Tutanota

Privacy Focused Blog Platform

A rundown of the tools I use to power my blog, hidden services.

A Lighter-weight Firefox

How I've set up a lightweight, yet still private browser.