Killswitch is a Linux utility that enforces a VPN killswitch using UFW (Uncomplicated Firewall). It ensures all internet traffic is blocked unless your VPN connection is active, protecting your privacy and preventing accidental data leaks.
- Automatically configures UFW rules for VPN interfaces (OpenVPN and WireGuard).
- Adds sudoers rules for seamless script execution without password prompts.
- Adds services for start killswitch after boot.
You can install Killswitch in two ways: manual setup or via a .deb
package.
During instalation process you need to provide script with absolute path of .ovpn config file.
If you have cloned or downloaded the killswitch repository:
-
Make the setup script executable:
chmod +x ./usr/local/bin/setup.sh
-
Run the setup script:
sudo ./usr/local/bin/setup.sh
This will guide you through the setup process, where you'll be prompted to specify the path to your
.ovpn
file.
-
Build the package:
From inside the killswitch repository folder:
dpkg-deb --build killswitch
This will create the
killswitch.deb
file in the current directory. -
Install the package:
sudo dpkg -i killswitch.deb
-
Run the setup script:
Whether you installed via
.deb
or manually:sudo /usr/local/bin/setup.sh
During the setup, you'll be prompted to enter the full path to your
.ovpn
file. -
Enable the killswitch:
sudo /usr/local/bin/killswitch-on.sh
-
Disable the killswitch:
sudo /usr/local/bin/killswitch-off.sh
- Setup: The setup script configures UFW to only allow internet traffic through the VPN tunnel (
tun0
orwg0
). - Block Traffic: All other outgoing traffic is blocked, ensuring no data leaks if the VPN disconnects.
- Simplicity: Sudoers rules are added so you can toggle the killswitch scripts without entering your password.
- Automation: Creates killswitch.service and killswitch-notify.service that manage start killswitch and notify user about it after boot.
-
VPN not connecting?
Double-check the path to your.ovpn
file and verify your VPN credentials. -
No internet after VPN disconnects?
Disable the killswitch to restore normal connectivity:sudo /usr/local/bin/killswitch-off.sh
-
Permission errors?
Ensure you're running the scripts withsudo
.
To remove the package:
sudo dpkg -r SAFEKillswitch
MIT License
This version includes clear instructions for both manual and .deb
installation methods, ensuring setup is straightforward for all users.