Verständnisfrage iptables

ronin

New Member
Hallo,

habe mir ein Script gebastelt damit ich meinen Webserver dicht machen kann. Allerdings bekomme ich bei INPUT das
Code:
 ACCEPT     all  --  anywhere             anywhere
nicht weg. Bedeutet das, dass die Regeln unwirksam sind?
Danke schonmal!

Code:
#!/bin/sh
/sbin/iptables -F INPUT
/sbin/iptables -F FORWARD
/sbin/iptables -F OUTPUT
/sbin/iptables -P INPUT DROP
/sbin/iptables -P FORWARD DROP
/sbin/iptables -P OUTPUT ACCEPT
/sbin/iptables -A INPUT -i lo -j ACCEPT
/sbin/iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
/sbin/iptables -A INPUT -p icmp -m icmp --icmp-type 5 -j DROP
/sbin/iptables -A INPUT -p icmp -j ACCEPT
/sbin/iptables -A INPUT -p tcp --dport 21 -j ACCEPT
/sbin/iptables -A INPUT -p tcp --dport 25 -j ACCEPT
/sbin/iptables -A INPUT -p tcp --dport 53 -j ACCEPT
/sbin/iptables -A INPUT -p tcp --dport 80 -j ACCEPT
/sbin/iptables -A INPUT -p tcp --dport 110 -j ACCEPT
/sbin/iptables -A INPUT -p tcp --dport 995 -j ACCEPT
/sbin/iptables -A INPUT -p tcp --dport 1546 -j ACCEPT
echo "Firewall aktiv"

Code:
Chain INPUT (policy DROP)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED
DROP       icmp --  anywhere             anywhere            icmp redirect
ACCEPT     icmp --  anywhere             anywhere
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:ftp
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:smtp
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:www
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:pop3
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:pop3s
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:1546

Chain FORWARD (policy DROP)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
 
Dafür verantwortlich ist dies:
Code:
/sbin/iptables -A INPUT -i lo -j ACCEPT

Über localhost wird alles aktzeptiert.
Ist allso soweit in Ordnung.

Edit:
Im übrigen, steht der Rechner bei dir?
Falls nicht, achte auf den SSH Port und verleg das INPUT Drop an das Ende des Scriptes.
Sonst sperrst du dich selbst aus, wenn du das Script von Hand ausführst.
 
Last edited by a moderator:
danke!
habe inzwischen auch festgestellt daß es funktioniert durch ports eines admin tools die gesperrt wurden
 
Back
Top