Skip to content

Instantly share code, notes, and snippets.

@mcorybillington
Last active February 27, 2022 19:20
Show Gist options
  • Save mcorybillington/279084c7a033db2b858ec2658c0cc6a4 to your computer and use it in GitHub Desktop.
Save mcorybillington/279084c7a033db2b858ec2658c0cc6a4 to your computer and use it in GitHub Desktop.
UFW script to only allow traffic out on UDP port 53 (DNS lookups) and 1194 (common VPN port). Safety precaution for bug bounty to make sure you don't accidentally hit stuff from your home IP if VPN drops/etc.
#!/bin/bash
VPN_INTERFACE="tun0"
LAN_INTERFACE="enp1s0"
UFW="/usr/sbin/ufw"
"${UFW}" enable
"${UFW}" --force reset
"${UFW}" default deny incoming
"${UFW}" default deny outgoing
"${UFW}" allow out on "${VPN_INTERFACE}"
"${UFW}" allow out on "${LAN_INTERFACE}" to any port 53,1194 proto udp
"${UFW}" enable
"${UFW}" status verbose
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment