Ich versuche, Iptable Regeln zu erstellen, die eingehende und ausgehende SSH-Verbindungen zulassen und dann ausgehende Verbindungen zu bestimmten Ports zulassen, dann schließlich alles fallen lassen, die nicht übereinstimmt.Erlaube SSH eingehende/ausgehende und blockiert alle ausgehenden neben bestimmten Ports
Das sind die Regeln, die ich mir ausgedacht habe, die SSH-Regeln funktionieren, aber wenn ich in die Box eintaue, kann ich anscheinend nicht auf http (Port 80) zugreifen, obwohl ich es zugelassen habe. Kann jemand den Fehler erkennen?
#!/bin/bash
#clear iptables
iptables -F
iptables -X
#set default policy to drop
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP
#accept everything no matter port on localhost
iptables -A INPUT -i lo -j ACCEPT
#allow established connections
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
#allow input on port 22, (established connections auto accepted)
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
#allow traffic going to specific outbound ports
iptables -A OUTPUT -p tcp --dport 80 -j ACCEPT
iptables -A OUTPUT -p tcp --dport 443 -j ACCEPT
iptables -A OUTPUT -p tcp --dport 6667 -j ACCEPT
iptables -A OUTPUT -p tcp --dport 6697 -j ACCEPT
#...
#drop anything that doesnt match the rules above
iptables -A INPUT -j DROP
iptables -A OUTPUT -j DROP
Danke für Ihre Zeit.
Danke, ich nicht über DNS-Ports dachte. Es funktioniert jetzt. –