Don't send a single packet until you know you're behind the VPN.
A small, dependency-light opsec guard for WireGuard. It brings your tunnel up, proves your traffic is actually being tunnelled, checks for DNS and IPv6 leaks, and can fail traffic closed, so the classic mistake of scanning while you only think you're anonymous can't happen.
Shared as a note on VPN opsec hygiene. If it saves one person a leaked source IP, it did its job.
wg-quick up reports success the moment the interface exists. It tells you
nothing about whether your traffic is really leaving through the tunnel. Four
ways you get burned:
- No route: the tunnel is up but traffic still egresses on your real interface; your public IP never changed.
- DNS leak: traffic tunnels fine, but your resolver still queries over your ISP, so what you look up leaks even when where you connect from doesn't.
- IPv6 leak: the VPN is IPv4-only and your box happily reaches the world over native IPv6, straight past the tunnel.
- Tunnel drop mid-task: the VPN flaps and everything silently reverts to your real IP while your work keeps running.
wireguardian refuses the green light unless (1)–(3) check out, and
--killswitch handles (4) by failing closed.
- Exit-IP proof: records your public IP before and after
wg-quick upand aborts if it didn't change. - DNS-leak canary: resolves
whoami.akamai.net, which replies with the egress IP of your resolver. If that's still your pre-VPN path, DNS is leaking even though your traffic isn't. - IPv6 probe: a
curl -6that flags any public IPv6 reachable outside the tunnel. - Kill-switch: an
iptablesrule that drops every egress packet that is neither on thewginterface, nor the tunnel's own encrypted packets (matched by WireGuard'sfwmark), nor destined to your local LAN. SSH and shared folders keep working; everything else is fail-closed. The appliedfwmarkis stashed under/runso the rule tears down cleanly even after the interface is gone.
sudo apt install -y wireguard iptables curl dnsutilsPut your WireGuard config at /etc/wireguard/proton.conf and chmod 600 it,
since it holds a private key. (Default tunnel name is proton; pass another as the
first argument.)
git clone https://github.com/n4uu/wireguardian.git
cd wireguardian
./wireguardian up --killswitch # bring up, prove no leaks, fail closed
./wireguardian status # UP? kill-switch on? exit IP + country
./wireguardian check # re-run the leak checks any time
./wireguardian down # remove kill-switch and drop the tunnel- Your
.confis a credential. It contains a private key:chmod 600it, never commit it (.gitignorehere blocks*.conf/*.key), and don't leave it in a shared or cloud-synced folder. - Know the AUP. Most VPN providers prohibit port scanning over their network, and exit IPs are shared and often blocklisted. Only test targets you own or are authorised to.
- With the kill-switch on, a tunnel drop cuts your internet on purpose;
that's the point.
./wireguardian downrestores it.
MIT © n4uu