]> git.friedersdorff.com Git - max/glocker.git/blob - iptables.rules
Allow admin to specify exceptions to blocklist
[max/glocker.git] / iptables.rules
1 # This set of IPTABLES rules is adapted from:
2 # https://wiki.archlinux.org/index.php/Simple_stateful_firewall
3 # Retrieved: 2018-09-11
4 # Generated by iptables-save v1.8.0 on Tue Sep 11 14:41:53 2018
5 *mangle
6 :PREROUTING ACCEPT [40249:20804765]
7 :INPUT ACCEPT [39481:20735931]
8 :FORWARD ACCEPT [0:0]
9 :OUTPUT ACCEPT [8471:887466]
10 :POSTROUTING ACCEPT [8392:882867]
11 COMMIT
12 # Completed on Tue Sep 11 14:41:53 2018
13 # Generated by iptables-save v1.8.0 on Tue Sep 11 14:41:53 2018
14 *filter
15 :INPUT DROP [0:0]
16 :FORWARD DROP [0:0]
17 :OUTPUT ACCEPT [317:30781]
18 :TCP - [0:0]
19 :UDP - [0:0]
20
21 # First allow all related connections.  Avoids the overhead
22 # of checking thousands of IP addresses first
23 -A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
24 # Packets on the loopback interface cannot come from the outside world
25 -A INPUT -i lo -j ACCEPT
26 # Invalid packets are always dropped
27 -A INPUT -m conntrack --ctstate INVALID -j DROP
28 # Drop all packets coming from the ban list
29 -A INPUT -m set --match-set glocker src -j DROP
30 -A INPUT -p icmp -m icmp --icmp-type 8 -m conntrack --ctstate NEW -j ACCEPT
31 -A INPUT -p udp -m conntrack --ctstate NEW -j UDP
32 -A INPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -m conntrack --ctstate NEW -j TCP
33 -A INPUT -p udp -j REJECT --reject-with icmp-port-unreachable
34 -A INPUT -p tcp -j REJECT --reject-with tcp-reset
35 -A INPUT -j REJECT --reject-with icmp-proto-unreachable
36 # Explicitly allow outgoing traffic to the following IP addresses.  This is
37 # for things like Google cloud addresses which are owned by but not operated
38 # by google.
39 -A OUTPUT -m set --match-set glocker-except dst -j ACCEPT
40 # Prevent all outgoing traffic to banned IP addresses also
41 -A OUTPUT -m set --match-set glocker dst -j DROP
42
43 -A TCP -p tcp -m tcp --dport 22 -j ACCEPT
44
45 COMMIT
46 # Completed on Tue Sep 11 14:41:53 2018