01 | *filter |
02 |
03 | # Allows all loopback (lo0) traffic and drop all traffic to 127/8 that doesn't use lo0 |
04 | -A INPUT -i lo -j ACCEPT |
05 | -A INPUT -i ! lo -d 127.0.0.0/8 -j REJECT |
06 |
07 | # Accepts all established inbound connections |
08 | -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT |
09 |
10 | # Allows all outbound traffic |
11 | # You could modify this to only allow certain traffic |
12 | -A OUTPUT -j ACCEPT |
13 |
14 | # Allows HTTP and HTTPS connections from anywhere (the normal ports for websites) |
15 | -A INPUT -p tcp --dport 80 -j ACCEPT |
16 | -A INPUT -p tcp --dport 443 -j ACCEPT |
17 |
18 | # Allows SSH connections for script kiddies |
19 | # THE -dport NUMBER IS THE SAME ONE YOU SET UP IN THE SSHD_CONFIG FILE |
20 | -A INPUT -p tcp -m state --state NEW --dport 22 -j ACCEPT |
21 |
22 | # Now you should read up on iptables rules and consider whether ssh access |
23 | # for everyone is really desired. Most likely you will only allow access from certain IPs. |
24 |
25 | # Allow ping |
26 | -A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT |
27 |
28 | # log iptables denied calls (access via 'dmesg' command) |
29 | -A INPUT -m limit --limit 5/min -j LOG --log-prefix "iptables denied: " --log-level 7 |
30 |
31 | # Reject all other inbound - default deny unless explicitly allowed policy: |
32 | -A INPUT -j REJECT |
33 | -A FORWARD -j REJECT |
34 |
35 | COMMIT |