Skip to content

Commit 8d53360

Browse files
committed
Add an example set of rules for iptables
1 parent ab115e7 commit 8d53360

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

iptables.rules

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
*filter
2+
:INPUT DROP [0:0]
3+
:FORWARD DROP [0:0]
4+
:OUTPUT DROP [0:0]
5+
6+
# Handle loopback addresses
7+
-A INPUT -i lo -j ACCEPT
8+
-A OUTPUT -o lo -j ACCEPT
9+
10+
# Allow outbound packets if state related, and inbound if established
11+
-A OUTPUT -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
12+
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
13+
14+
# Drop stealth scans
15+
-A INPUT -i eth0 -p tcp -m tcp --tcp-flags FIN,SYN,RST,PSH,ACK,URG NONE
16+
-A INPUT -i eth0 -p tcp -m tcp --tcp-flags SYN,FIN SYN,FIN
17+
-A INPUT -i eth0 -p tcp -m tcp --tcp-flags SYN,RST SYN,RST
18+
-A INPUT -i eth0 -p tcp -m tcp --tcp-flags FIN,RST FIN,RST
19+
-A INPUT -i eth0 -p tcp -m tcp --tcp-flags ACK,FIN FIN
20+
-A INPUT -i eth0 -p tcp -m tcp --tcp-flags ACK,URG URG
21+
22+
# Allow ICMP pings
23+
-A OUTPUT -p icmp -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
24+
-A INPUT -p icmp -m state --state ESTABLISHED,RELATED -j ACCEPT
25+
26+
# Allow port 22 for SSH
27+
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
28+
29+
# Allow port 80 for HTTP
30+
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
31+
32+
# Allow port 443 for HTTPS
33+
-A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
34+
35+
# Allow ports 25565 - 25575 for Minecraft world servers
36+
-A INPUT -m state --state NEW -m tcp -p tcp --dport 25565:25575 -j ACCEPT
37+
38+
COMMIT

0 commit comments

Comments
 (0)