forked from MinecraftServerControl/mscs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathiptables.rules
38 lines (29 loc) · 1.25 KB
/
iptables.rules
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT DROP [0:0]
# Handle loopback addresses
-A INPUT -i lo -j ACCEPT
-A OUTPUT -o lo -j ACCEPT
# Allow outbound packets if state related, and inbound if established
-A OUTPUT -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# Drop stealth scans
-A INPUT -i eth0 -p tcp -m tcp --tcp-flags FIN,SYN,RST,PSH,ACK,URG NONE
-A INPUT -i eth0 -p tcp -m tcp --tcp-flags SYN,FIN SYN,FIN
-A INPUT -i eth0 -p tcp -m tcp --tcp-flags SYN,RST SYN,RST
-A INPUT -i eth0 -p tcp -m tcp --tcp-flags FIN,RST FIN,RST
-A INPUT -i eth0 -p tcp -m tcp --tcp-flags ACK,FIN FIN
-A INPUT -i eth0 -p tcp -m tcp --tcp-flags ACK,URG URG
# Allow ICMP pings
-A OUTPUT -p icmp -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -m state --state ESTABLISHED,RELATED -j ACCEPT
# Allow port 22 for SSH
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
# Allow port 80 for HTTP
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
# Allow port 443 for HTTPS
-A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
# Allow ports 25565 - 25575 for Minecraft world servers
-A INPUT -m state --state NEW -m tcp -p tcp --dport 25565:25575 -j ACCEPT
COMMIT