Passives FTP im LAN mit ipfw2

Heidegger

Well-Known Member
Hallo! Mit gFTP kann ich im LAN kein passives FTP betreiben, mit ncftp geht es. Ich komme nicht auf ftp.freebsd.org und ftp.netbsd.org, um nur mal zwei Beispiele zu nennen. Als Fehlermeldung erhalte ich:

"Cannot bind a port: Can't assign a requested address!"

Hier sind meine ipfw2-Regeln für den Router:

Code:
#!/bin/sh
flush="/sbin/ipfw -q -f flush"
fwmd="/sbin/ipfw -q add"
natd_interface="tun0"
iif_0="lo0"
iif_1="xl0"
iif_2="rl0"
# iif_3="sis0"
# iif_4="sis1"
mathematix="192.168.0.1"
pingunix="192.168.1.1"
${flush}
${fwmd} 100 allow all from any to any via ${iif_0}
${fwmd} 200 deny log all from any to 127.0.0.0/8
${fwmd} 300 deny log all from 127.0.0.0/8 to any
${fwmd} 400 divert natd all from any to any via ${natd_interface}
${fwmd} 500 check-state
${fwmd} 600 allow all from any to any via ${iif_1} keep-state
${fwmd} 700 allow all from any to any via ${iif_2} keep-state
${fwmd} 800 deny all from any to any frag in recv ${natd_interface}
${fwmd} 900 deny tcp from any to any in recv ${natd_interface} established
${fwmd} 1000 deny log logamount 1000 ip from 0.0.0.0/8 to any in recv ${natd_interface}
${fwmd} 1100 deny log logamount 1000 ip from 10.0.0.0/8 to any in recv ${natd_interface}
${fwmd} 1200 deny log logamount 1000 ip from 169.254.0.0/16 to any in recv ${natd_interface}
${fwmd} 1300 deny log logamount 1000 ip from 172.16.0.0/12 to any in recv ${natd_interface}
${fwmd} 1400 deny log logamount 1000 ip from 192.0.2.0/24 to any in recv ${natd_interface}
${fwmd} 1500 deny log logamount 1000 ip from 192.168.0.0/16 to any in recv ${natd_interface}
${fwmd} 1600 deny log logamount 1000 ip from 204.152.64.0/23 to any in recv ${natd_interface}
${fwmd} 1700 deny log logamount 1000 ip from 224.0.0.0/3 to any in recv ${natd_interface}
${fwmd} 1800 allow tcp from any to any 80 out xmit ${natd_interface} setup keep-state
${fwmd} 1900 allow tcp from any to any 443 out xmit ${natd_interface} setup keep-state
${fwmd} 2000 allow udp from any to any 53 out xmit ${natd_interface} keep-state
${fwmd} 2100 allow tcp from any to any 25  out xmit ${natd_interface} setup keep-state
${fwmd} 2200 allow tcp from any to any 110 out xmit ${natd_interface} setup keep-state
${fwmd} 2300 allow tcp from me to any out xmit ${natd_interface} setup keep-state uid root
${fwmd} 2400 allow ip from any to any 10000-60000 out xmit ${natd_interface} keep-state  
${fwmd} 2500 allow log icmp from any to any icmptype 3,11 in recv ${natd_interface} keep-state
${fwmd} 2600 allow icmp from any to any icmptypes 8 out xmit ${natd_interface} keep-state
${fwmd} 2650 allow tcp from any to any 20 out xmit ${natd_interface} setup keep-state
${fwmd} 2700 allow tcp from any to any 21 out xmit ${natd_interface} setup keep-state
${fwmd} 2800 allow tcp from any to any 10000-65000 out xmit ${natd_interface} setup keep-state
${fwmd} 2900 allow tcp from any to any 22 out xmit ${natd_interface} setup keep-state
${fwmd} 3000 allow udp from any to any 123 out xmit ${natd_interface} keep-state
# Allow out IRC
# ${fwmd} 3001 allow tcp from any to any 194 out xmit ${natd_interface} setup keep-state
# ${fwmd} 3002 allow udp from any to any 194 out xmit ${natd_interface} keep-state
${fwmd} 3100 allow tcp from any to any 43 out xmit ${natd_interface} setup keep-state
${fwmd} 3200 allow udp from any to any 43 out xmit ${natd_interface} keep-state
${fwmd} 3300 allow tcp from any to any 63 out xmit ${natd_interface} setup keep-state
${fwmd} 3400 allow udp from any to any 63 out xmit ${natd_interface} keep-state
${fwmd} 3500 allow tcp from any to any 119 out xmit ${natd_interface} setup keep-state
${fwmd} 3600 allow udp from any to any 119 out xmit ${natd_interface} keep-state
${fwmd} 3700 allow tcp from any to any 80 in recv ${natd_interface} setup keep-state
${fwmd} 3800 allow tcp from any to any 21 in recv ${natd_interface} setup keep-state
${fwmd} 3900 allow tcp from any 20 to any 1024-49151 in recv ${natd_interface} setup keep-state
${fwmd} 4000 allow log tcp from ${mathematix} to me 22 in recv $iif_1 setup keep-state
${fwmd} 4100 allow log tcp from ${pingunix} to me 22 in recv $iif_2 setup keep-state
${fwmd} 4200 allow log icmp from any to any icmptype 0 in recv ${natd_interface}
${fwmd} 4300 deny log icmp from any to any icmptype 5 in recv ${natd_interface}
${fwmd} 4400 deny log ip from me to me in recv ${natd_interface}
${fwmd} 4500 deny log tcp from any to any setup in recv ${natd_interface}
${fwmd} 4600 deny log tcp from any to any 137,138,139  in recv ${natd_interface}
${fwmd} 4700 deny log udp from any to any 137,138,139  in recv ${natd_interface}
${fwmd} 4800 deny tcp from any to any 80 out xmit ${natd_interface}

Hat jemand einen Hinweis?
 
Hm, ich glaube, ich sollte mich mal ernsthaft mit pf auseinandersetzen und ipfw in die Tonne treten. Zu pf gibt es viel mehr Dokomentation online als zu ipfw, und Jacek Artymiak hat sogar ein recht brauchbares Buch über pf (ist gerade in der 2. Auflage erschienen) geschrieben. AUf ALTQ kann ich unter FreeBSD notgedrungen erst mal verzichten ...
 
Heute nachmittage habe ich ipfw2 verbannt, der Router wird nun mit pf-2.03 betrieben, und obwohl ich in meiner pf.conf mit Ausnahme der set block-policy drop nicht eine einzige block-Regel festfelegt habe (alles steht auf pass in all - pass out all), ist die Kiste auf den ersten, unkritischen Blick dicht. Ein Scan mit nmap -sS -sR -sV -O -PI -PT routername zeigte keinerlei Informationen und offene Ports an, ein Besuch auf grc.com und scan.sygate.com brachte ebenfalls keine Schwäche. Damit ist für mich der Favorit entschieden.
 
Zurück
Oben