-
-
Save Qwertylex/2dfd09d6f65835c94324f4669e0b366d to your computer and use it in GitHub Desktop.
This file contains hidden or 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/bash | |
| #IPv4 Firewall | |
| iptables -F | |
| iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT | |
| iptables -A INPUT -p icmp -j ACCEPT | |
| iptables -A INPUT -i lo -j ACCEPT | |
| #meow | |
| iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT #HTTPd | |
| iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT #SSH | |
| iptables -A INPUT -m state --state NEW -m udp -p udp --dport 60000:61000 -j ACCEPT #Mosh | |
| iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 1723 -j ACCEPT #pptpd | |
| iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 6697 -j ACCEPT #znc | |
| iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 5060:5061 -j ACCEPT #sip-tcp | |
| iptables -A INPUT -m state --state NEW -m udp -p udp --dport 5060:5061 -j ACCEPT #sip | |
| iptables -A INPUT -m state --state NEW -m udp -p udp --dport 4569 -j ACCEPT #iax | |
| iptables -A INPUT -m state --state NEW -m udp -p udp --dport 16384:32767 -j ACCEPT #rtp | |
| iptables -A INPUT -m state --state NEW -m multiport -p tcp --dport 9091,51413 -j ACCEPT #Transmission | |
| #iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 25565 -j ACCEPT #Minecraft | |
| #iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 27960 -j ACCEPT #Quake 3 | |
| #iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 64738 -j ACCEPT #Mumble | |
| #iptables -A INPUT -j DROP #Uncomment this and comment the next 4 lines to disable logging of dropped packets | |
| iptables -N LOGGING | |
| iptables -A INPUT -j LOGGING | |
| iptables -A LOGGING -m limit --limit 2/min -j LOG --log-prefix "iptables-Dropped: " --log-level 4 | |
| iptables -A LOGGING -j DROP | |
| #IPv6 Firewall | |
| ip6tables -F | |
| ip6tables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT | |
| ip6tables -A INPUT -p icmpv6 -j ACCEPT | |
| ip6tables -A INPUT -i lo -j ACCEPT | |
| #meow | |
| ip6tables -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT #HTTPd | |
| ip6tables -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT #SSH | |
| ip6tables -A INPUT -m state --state NEW -m udp -p udp --dport 60000:61000 -j ACCEPT #Mosh | |
| ip6tables -A INPUT -m state --state NEW -m tcp -p tcp --dport 1723 -j ACCEPT #pptpd | |
| ip6tables -A INPUT -m state --state NEW -m tcp -p tcp --dport 6697 -j ACCEPT #znc | |
| ip6tables -A INPUT -m state --state NEW -m tcp -p tcp --dport 5060:5061 -j ACCEPT #sip-tcp | |
| ip6tables -A INPUT -m state --state NEW -m udp -p udp --dport 5060:5061 -j ACCEPT #sip | |
| ip6tables -A INPUT -m state --state NEW -m udp -p udp --dport 4569 -j ACCEPT #iax | |
| ip6tables -A INPUT -m state --state NEW -m udp -p udp --dport 16384:32767 -j ACCEPT #rtp | |
| ip6tables -A INPUT -m state --state NEW -m multiport -p tcp --dport 9091,51413 -j ACCEPT #Transmission | |
| #ip6tables -A INPUT -m state --state NEW -m tcp -p tcp --dport 25565 -j ACCEPT #Minecraft | |
| #ip6tables -A INPUT -m state --state NEW -m tcp -p tcp --dport 27960 -j ACCEPT #Quake 3 | |
| #ip6tables -A INPUT -m state --state NEW -m tcp -p tcp --dport 64738 -j ACCEPT #Mumble | |
| #ip6tables -A INPUT -j DROP #Uncomment this and comment the next 4 lines to disable logging of dropped packets | |
| ip6tables -N LOGGING | |
| ip6tables -A INPUT -j LOGGING | |
| ip6tables -A LOGGING -m limit --limit 2/min -j LOG --log-prefix "ip6tables-Dropped: " --log-level 4 | |
| ip6tables -A LOGGING -j DROP |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment