Dun
15-09-2004, 01:23
Dopo innumerevoli prove sono arrivato ad un insieme di regole per iptables che dovrebbero essere soddisfacenti. :D :D
Potete mica darmi un parere, come avvisarmi se ho dimenticato qsa di importante?
Thx mille :) :)
P.s.: Lasciate stare i commenti che li ho scritti in un momento di delirio pre esame :D :D :D
#!/bin/bash
# Let's flush all the chains
iptables -F
# Setting standard policies
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT
# Then allow incoming connection for Apache
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -p udp --dport 80 -j ACCEPT
# And for SSH
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -p udp --dport 22 -j ACCEPT
# Also for Samba. This time only from trusted network
iptables -A INPUT -s 10.0.0.0/24 -i eth1 -p tcp --dport 139 -j ACCEPT
iptables -A INPUT -s 10.0.0.0/24 -i eth1 -p udp --dport 138 -j ACCEPT
iptables -A INPUT -s 10.0.0.0/24 -i eth1 -p udp --dport 137 -j ACCEPT
# In the meanwhile allow routing from trusted to untrusted net
iptables -A FORWARD -s 10.0.0.0/24 -i eth1 -j ACCEPT
iptables -A FORWARD -d 10.0.0.0/24 -m state --state ESTABLISHED,RELATED -j ACCEPT
# Had to allow communications from server itself
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# Then allow ping, ping6 and ipv6
iptables -A INPUT -p icmp -j ACCEPT
iptables -A INPUT -p ipv6-icmp -j ACCEPT
iptables -A INPUT -p ipv6 -j ACCEPT
# Let's masquerade...february? Dont touch ipv6!
iptables -t nat -A POSTROUTING --proto ! 41 -o eth0 -j MASQUERADE
Potete mica darmi un parere, come avvisarmi se ho dimenticato qsa di importante?
Thx mille :) :)
P.s.: Lasciate stare i commenti che li ho scritti in un momento di delirio pre esame :D :D :D
#!/bin/bash
# Let's flush all the chains
iptables -F
# Setting standard policies
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT
# Then allow incoming connection for Apache
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -p udp --dport 80 -j ACCEPT
# And for SSH
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -p udp --dport 22 -j ACCEPT
# Also for Samba. This time only from trusted network
iptables -A INPUT -s 10.0.0.0/24 -i eth1 -p tcp --dport 139 -j ACCEPT
iptables -A INPUT -s 10.0.0.0/24 -i eth1 -p udp --dport 138 -j ACCEPT
iptables -A INPUT -s 10.0.0.0/24 -i eth1 -p udp --dport 137 -j ACCEPT
# In the meanwhile allow routing from trusted to untrusted net
iptables -A FORWARD -s 10.0.0.0/24 -i eth1 -j ACCEPT
iptables -A FORWARD -d 10.0.0.0/24 -m state --state ESTABLISHED,RELATED -j ACCEPT
# Had to allow communications from server itself
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# Then allow ping, ping6 and ipv6
iptables -A INPUT -p icmp -j ACCEPT
iptables -A INPUT -p ipv6-icmp -j ACCEPT
iptables -A INPUT -p ipv6 -j ACCEPT
# Let's masquerade...february? Dont touch ipv6!
iptables -t nat -A POSTROUTING --proto ! 41 -o eth0 -j MASQUERADE