Und nun schon mal meine erste iptables-spezifische Frage, dazu hier mein Grundgerüst:
Code:
# Delete Existing Rules
iptables -F
# Set default chain policies to DROP
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT DROP
# Allow loopback access
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT
# Allow Ping from inside to outside
iptables -A OUTPUT -p icmp --icmp-type echo-request -j ACCEPT
iptables -A INPUT -p icmp --icmp-type echo-reply -j ACCEPT
# Allow incoming HTTP
iptables -A INPUT -i eth0 -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -o eth0 -p tcp --sport 80 -m state --state ESTABLISHED -j ACCEPT
# Allow outgoing HTTP
iptables -A OUTPUT -o eth0 -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A INPUT -i eth0 -p tcp --sport 80 -m state --state ESTABLISHED -j ACCEPT
# Allow incoming HTTPS
iptables -A INPUT -i eth0 -p tcp --dport 443 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -o eth0 -p tcp --sport 443 -m state --state ESTABLISHED -j ACCEPT
# Allow outgoing HTTPS
iptables -A OUTPUT -o eth0 -p tcp --dport 443 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A INPUT -i eth0 -p tcp --sport 443 -m state --state ESTABLISHED -j ACCEPT
So wie ich es verstehe, muss ich eigentlich für alle "erwünschten Dienste" sowohl eingehende, als auch ausgehende Verbindungen erlauben (habe ich hier ja für HTTP und HTTPS bereits getan).
Muss ich das für Pings auch so handhaben (also auch noch "Allow Ping from outside to inside" hinzufügen)?
Wie sieht das bei folgenden Diensten aus?
DNS, FTP, IMAP, MAIL, NTP, POP3, SMTP (habe ich grundlegende vergessen?)
Ich selbst nutze diese Dienste nur "extern", habe also keinen FTP-, Mail-Server oder sonstiges in meinem Netzwerk, der von außen erreichbar sein muss! Muss ich also auch beispielsweise für meine FTP-Downloads incoming & outgoing auf Port 20 und 21 erlauben?
Und:
Lohnt es sich überhaupt, "erweiterten Schutz" (wie
bei diesem Generator angegeben) mit zu integrieren, wenn der Router mit iptables hinter der Fritzbox (als Modem und Router) hängt (iptables sitzen dahinter, bringen also der Fritze direkt am Internet nix)?
Muss ich generell noch sowas wie
Code:
# Add new policy
iptables -N GARBAGE
# Allow...
# Move invalid packages to GARBAGE
iptables -A INPUT -m state --state NEW,INVALID -j GARBAGE
einfügen, oder ist dies nur bei gewünschtem Logging der verworfenen Pakete notwendig (und es wird automatisch gedropt)?