Created
March 6, 2020 17:03
-
-
Save bradfitz/99413ad5767dcf2166245e6c12adc05c to your computer and use it in GitHub Desktop.
hacky scripts to toggle UDP access on a machine
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
set -x | |
./udp-on.sh | |
iptables -A INPUT -p udp --sport 53 -j ACCEPT | |
iptables -A INPUT -p udp -j DROP | |
iptables -A OUTPUT -p udp --dport 53 -j ACCEPT | |
iptables -A OUTPUT -p udp -j DROP | |
ip6tables -A INPUT -p udp --sport 53 -j ACCEPT | |
ip6tables -A INPUT -p udp -j DROP | |
ip6tables -A OUTPUT -p udp --dport 53 -j ACCEPT | |
ip6tables -A OUTPUT -p udp -j DROP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
set -x | |
iptables -D INPUT -p udp --sport 53 -j ACCEPT || true | |
iptables -D INPUT -p udp -j DROP || true | |
iptables -D OUTPUT -p udp --dport 53 -j ACCEPT || true | |
iptables -D OUTPUT -p udp -j DROP || true | |
ip6tables -D INPUT -p udp --sport 53 -j ACCEPT || true | |
ip6tables -D INPUT -p udp -j DROP || true | |
ip6tables -D OUTPUT -p udp --dport 53 -j ACCEPT || true | |
ip6tables -D OUTPUT -p udp -j DROP || true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment