L
Lightstorm
Foren As
Ich habe einen Script womit ich die Firewall Regeln einstelle (nutze Debian):
Ich habe es aus einem Lehrbuch, ich habe es auch einigermaßen verstanden und nicht nur blind abgeschrieben, bin aber halt noch am lernen.
Nachdem ausführen bekomme ich einige Fehlermeldungen:
Das bedeutet das er mit den selbst erstellten Cahins MYDROP und MYACCEPT nicht klar kommt oder? Oder stimmt nur was mit MYACCEPT nicht?
Da weiß ich jetzt auch nicht weiter, so ist auch die Syntax aus dem Buch, sind die eigenen Chains falsch konfiguriert oder Syntaxfehler?
Code:
#!/bin/sh
echo "Initalisiere Firewall ..."
iptables -F
iptables -X
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP
iptables -Z
#Eigene Chains erstellen
iptables -N MYDROP
iptables -N MYACCEPT
# Lokale Kommunikation erlauben
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT
# Stateful Inspection aktivieren
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -m state --state INVALID -j MYDROP
iptables -A OUTPUT -m state --state ESTABLISHED -j ACCEPT
# Eigene Chains MYDROP und MYACCEPT konfigurieren
iptables -A MYDROP -j LOG --log-prefix "FW-DROP: "
iptables -A MYDROP -j DROP
iptables -A MYACCEPT -j LOG --log-prefix "FW-ACCEPT: "
iptables -A MYACCEPT -j ACCEPT
# SSH Zugang erlauben
iptables -A INPUT -p tcp --dport 22 -j MYACCEPT
# ICMP erlauben
iptables -A INPUT -p icmp -j MYACCEPT
iptables -A OUTPUT -p icmp -j MYACCEPT
# DNS
iptables -A INPUT -p udp --dport 53 MYACCEPT
iptables -A INPUT -p tcp --dport 53 MYACCEPT
iptables -A OUTPUT -p udp --dport 53 MYACCEPT
iptables -A OUTPUT -p tcp --dport 53 MYACCEPT
# WWW
iptables -A INPUT -p tcp --dport 80 -j MYACCEPT
iptables -A OUTPUT -p tcp --dport 80 -j MYACCEPT
#DHCP
iptables -A INPUT -p udp --dport 67 -j MYACCEPT
echo "Firewall ist konfiguriert und aktiv"
Ich habe es aus einem Lehrbuch, ich habe es auch einigermaßen verstanden und nicht nur blind abgeschrieben, bin aber halt noch am lernen.
Nachdem ausführen bekomme ich einige Fehlermeldungen:
Initalisiere Firewall ...
iptables: No chain/target/match by that name
iptables: No chain/target/match by that name
Bad argument `MYACCEPT'
Try `iptables -h' or 'iptables --help' for more information.
Bad argument `MYACCEPT'
Try `iptables -h' or 'iptables --help' for more information.
Bad argument `MYACCEPT'
Try `iptables -h' or 'iptables --help' for more information.
Bad argument `MYACCEPT'
Try `iptables -h' or 'iptables --help' for more information.
Firewall ist konfiguriert und aktiv
Das bedeutet das er mit den selbst erstellten Cahins MYDROP und MYACCEPT nicht klar kommt oder? Oder stimmt nur was mit MYACCEPT nicht?
Da weiß ich jetzt auch nicht weiter, so ist auch die Syntax aus dem Buch, sind die eigenen Chains falsch konfiguriert oder Syntaxfehler?