OpenWrt Firewall

Hi,

ich kann mich mit der Firewall Config von Openwrt irgendwie nicht anfreunden. Soweit ich iptables verstehe ist die hälfte der Rules sinnlos und den Grund für diese "Zonen" hab ich auch nicht wirklich verstanden.

Kann jemand helfen? Macht das mit den Zonen Sinn? Hat jemand auch OpenWrt laufen? Wie habt ihr das gemacht?

Könnt ihr bestätigen, dass hier alles doppelt und dreifach geregelt ist?

Code:
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
DROP       all  --  anywhere             anywhere            state INVALID 
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED 
ACCEPT     all  --  anywhere             anywhere            
input_rule  all  --  anywhere             anywhere            
input      all  --  anywhere             anywhere            

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
DROP       all  --  anywhere             anywhere            state INVALID 
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED 
forwarding_rule  all  --  anywhere             anywhere            
forward    all  --  anywhere             anywhere            

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         
DROP       all  --  anywhere             anywhere            state INVALID 
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED 
ACCEPT     all  --  anywhere             anywhere            
output_rule  all  --  anywhere             anywhere            
output     all  --  anywhere             anywhere            

Chain forward (1 references)
target     prot opt source               destination         
zone_lan_forward  all  --  anywhere             anywhere            
zone_wan_forward  all  --  anywhere             anywhere            

Chain forwarding_lan (1 references)
target     prot opt source               destination         

Chain forwarding_rule (1 references)
target     prot opt source               destination         

Chain forwarding_wan (1 references)
target     prot opt source               destination         

Chain input (1 references)
target     prot opt source               destination         
ACCEPT     udp  --  anywhere             anywhere            
ACCEPT     tcp  --  anywhere             anywhere            
zone_lan   all  --  anywhere             anywhere            
zone_wan   all  --  anywhere             anywhere            

Chain input_lan (1 references)
target     prot opt source               destination         

Chain input_rule (1 references)
target     prot opt source               destination         

Chain input_wan (1 references)
target     prot opt source               destination         

Chain output (1 references)
target     prot opt source               destination         
zone_lan_ACCEPT  all  --  anywhere             anywhere            
zone_wan_ACCEPT  all  --  anywhere             anywhere            

Chain output_rule (1 references)
target     prot opt source               destination         

Chain reject (4 references)
target     prot opt source               destination         
REJECT     tcp  --  anywhere             anywhere            reject-with tcp-reset 
REJECT     all  --  anywhere             anywhere            reject-with icmp-port-unreachable 

Chain zone_lan (1 references)
target     prot opt source               destination         
input_lan  all  --  anywhere             anywhere            
zone_lan_ACCEPT  all  --  anywhere             anywhere            

Chain zone_lan_ACCEPT (4 references)
target     prot opt source               destination         
ACCEPT     all  --  anywhere             anywhere            
ACCEPT     all  --  anywhere             anywhere            

Chain zone_lan_DROP (0 references)
target     prot opt source               destination         
DROP       all  --  anywhere             anywhere            
DROP       all  --  anywhere             anywhere            

Chain zone_lan_MSSFIX (0 references)
target     prot opt source               destination         
TCPMSS     tcp  --  anywhere             anywhere            tcp flags:SYN,RST/SYN TCPMSS clamp to PMTU 

Chain zone_lan_REJECT (0 references)
target     prot opt source               destination         
reject     all  --  anywhere             anywhere            
reject     all  --  anywhere             anywhere            

Chain zone_lan_forward (1 references)
target     prot opt source               destination         
zone_wan_MSSFIX  all  --  anywhere             anywhere            
zone_wan_ACCEPT  all  --  anywhere             anywhere            
forwarding_lan  all  --  anywhere             anywhere            
zone_lan_ACCEPT  all  --  anywhere             anywhere            

Chain zone_wan (1 references)
target     prot opt source               destination         
input_wan  all  --  anywhere             anywhere            
zone_wan_ACCEPT  all  --  anywhere             anywhere            

Chain zone_wan_ACCEPT (4 references)
target     prot opt source               destination         
ACCEPT     all  --  anywhere             anywhere            
ACCEPT     all  --  anywhere             anywhere            

Chain zone_wan_DROP (0 references)
target     prot opt source               destination         
DROP       all  --  anywhere             anywhere            
DROP       all  --  anywhere             anywhere            

Chain zone_wan_MSSFIX (1 references)
target     prot opt source               destination         
TCPMSS     tcp  --  anywhere             anywhere            tcp flags:SYN,RST/SYN TCPMSS clamp to PMTU 

Chain zone_wan_REJECT (0 references)
target     prot opt source               destination         
reject     all  --  anywhere             anywhere            
reject     all  --  anywhere             anywhere            

Chain zone_wan_forward (1 references)
target     prot opt source               destination         
zone_lan_ACCEPT  all  --  anywhere             anywhere            
forwarding_wan  all  --  anywhere             anywhere            
zone_wan_ACCEPT  all  --  anywhere             anywhere


EDIT:
Vllt versteh ich iptables auch noch nicht ganz:

Code:
root@gateway:~# iptables -L INPUT
Chain INPUT (policy DROP)
target     prot opt source               destination         
DROP       all  --  anywhere             anywhere            state INVALID 
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED 
ACCEPT     all  --  anywhere             anywhere            
syn_flood  tcp  --  anywhere             anywhere            tcp flags:FIN,SYN,RST,ACK/SYN 
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:22 
input_rule  all  --  anywhere             anywhere            
input      all  --  anywhere             anywhere            
root@gateway:~# iptables -L syn_flood
Chain syn_flood (1 references)
target     prot opt source               destination         
RETURN     tcp  --  anywhere             anywhere            tcp flags:FIN,SYN,RST,ACK/SYN limit: avg 25/sec burst 50 
DROP       all  --  anywhere             anywhere            
root@gateway:~# iptables -L input_rule
Chain input_rule (1 references)
target     prot opt source               destination         
root@gateway:~# iptables -L input     
Chain input (1 references)
target     prot opt source               destination         
zone_lan   all  --  anywhere             anywhere            
zone_wan   all  --  anywhere             anywhere            
root@gateway:~#

In der INPUT chain:
1. er droppt alles mit dem Status INVALID
2. er accepted alles was zu einer bestehenden Verbindung gehört oder eine solche ist
3. jetzt acceptet er alles

Müsste jetzt nicht iptables abbrechen? Denn es wurde ja eine Rule gefunden auf die das Packet matcht! Scheint aber entweder nicht zu matchen oder diese Annahme stimmt nicht, denn Regel 5 ist definitiv aktiv (ACCEPT tcp -- anywhere anywhere tcp dpt:22)!

cu
serow
 
Zuletzt bearbeitet:
Das "ACCEPT all anywhere anywhere" bezeichnet wohl die Regel für das loopback-Device auf dem für "gewöhnlich" alles erlaubt ist.
Das Parameter -L gibt die Regeln für die gesamte Chain aus, allerdings ohne die Interfaces auf die sich die Regeln beziehen, zu listen.
Insofern sieht Dein erstes Listing "normal" aus.
 
Hi,

achso läuft das - und wie kann ich iptables -L dazu kriegen mir die Regeln komplett anzuzeigen also mit Interface?

cu
serow
 
Tatsächlich! Ich hab dir ganze Zeit nach "interfaces" in der man page gesucht ... Das gut alte verbose :)

cu
serow
 
Zurück
Oben