ltcp/aufgabe2.3/iptables.rules

59 lines
1.3 KiB
Plaintext

*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [0:0]
# allow established connections
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
# allow traffic from private LAN
-A INPUT -i eth1 -j ACCEPT
-A FORWARD -i eth1 -j ACCEPT
# allow icmp
-A INPUT -p icmp -j ACCEPT
# allow loopback
-A INPUT -i lo -j ACCEPT
# uni subnets
:uni - [0:0]
-A INPUT -s 141.30.0.0/16 -j uni
-A INPUT -s 141.76.0.0/16 -j uni
# reject unknown traffic with nice errors
-A INPUT -p tcp -j REJECT --reject-with tcp-reset
-A INPUT -p udp -j REJECT --reject-with icmp-port-unreachable
-A INPUT -j REJECT --reject-with icmp-proto-unreachable
# ---------------------------------------------------------------
# internal traffic
#
:internal - [0:0]
-A uni -j internal
-A internal -p tcp --dport 22 -j ACCEPT
-A internal -p tcp --dport 80 -j ACCEPT
-A internal -p tcp --dport 443 -j ACCEPT
# ---------------------------------------------------------------
# public traffic
:public - [0:0]
-A INPUT -j public
# ---------------------------------------------------------------
COMMIT
*nat
:PREROUTING ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
# masquerading
-A POSTROUTING -o eth0 -j MASQUERADE
COMMIT