Skip to content

Instantly share code, notes, and snippets.

@melissaboiko
Created December 27, 2019 11:56
Show Gist options
  • Save melissaboiko/a053ca5fc27db563a2810094cda3d70b to your computer and use it in GitHub Desktop.
Save melissaboiko/a053ca5fc27db563a2810094cda3d70b to your computer and use it in GitHub Desktop.
ufw vpn kill switch
#!/bin/bash
if=tun0
ufw --force reset
ufw default deny incoming
ufw default deny outgoing
ufw allow out on $if from any to any
ufw allow in on $if from any to any
# openvpn conffile needs dns
ufw allow out 53
# openvpn port
ufw allow in 1194/udp
ufw allow out 1194/udp
# legacy/alternative openvpn ports
ufw allow in 443/tcp
ufw allow out 443/tcp
ufw allow in 943/tcp
ufw allow out 943/tcp
ufw allow in 1198/udp
ufw allow out 1198/udp
ufw allow in 5000/udp
ufw allow out 5000/udp
ufw enable
#!/bin/bash
ufw --force reset
ufw default deny incoming
ufw default allow outgoing
ufw enable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment