Firewall Problem mit DNS

Andreas-iz

Active Member
Hallo zu sammen

Ich habe ein Firewall Problem

Sobald ich die Firewall aktiviere habe ich kein zugriff mehr über die clienten aufs Internet.
Internet ist da.

DNS Sever 213.172.96.18
DNS Sever 213.172.97.18

DNS Server vom Anbieter

System FreeBSd 5.2.1

Ich habe die Firewall so Konfiguriert:
------------------------------------------------------------------
#!/bin/sh
# rl0

# rl0 externes interface
# rl1 internes interface

# Um die firewall regeln erneut einzulesen, sprich die firewall neu
# zu starten:
# cd /etc
# ./fw.rc
# Das liest dann alla das ein was hier steht und die firewall rennt
# mit diesen Angaben

ipfw add 10 divert natd all from any to any via tun0

ipfw add allow ip from any to any via lo0
ipfw add allow tcp from any to any via lo0
ipfw add allow udp from any to any via lo0
ipfw add allow icmp from any to any via lo0
ipfw add allow ip from any to any via rl1

# Erlaubt alle Verbindungen welche von hier initiiert wurden
ipfw add allow tcp from any to any out xmit tun0 setup

# Wenn die Verbindung einmal hergestellt wurde, erlaube dieser offen zu stehen
ipfw add allow tcp from any to any via tun0 established

ipfw add allow log tcp from any to any 80 setup
ipfw add allow log tcp from any to any 22 setup
ipfw add allow log tcp from any to any 25 setup
ipfw add allow log tcp from any to any 21 setup
ipfw add allow log tcp from any to any 20 setup
ipfw add allow log tcp from any to any 10000 setup

# This sends a RESET to all ident packets.
ipfw add reset log tcp from any to any 113 in recv tun0

# Erlaubt ausgehende DNS queries NUR auf die beiden angegebenen Server
ipfw add allow udp from any to 213.172.96.18 53 out xmit tun0
ipfw add allow udp from any to 213.172.97.18 53 out xmit tun0

ipfw add allow tcp from any to 213.172.97.18 53 out xmit tun0
ipfw add allow tcp from any to 213.172.96.18 53 out xmit tun0

# Erlaubt die Antwort der DNS Nachfragen
ipfw add allow udp from 213.172.97.18 53 to any in recv tun0
ipfw add allow udp from 213.172.96.18 53 to any in recv tun0
ipfw add allow tcp from 213.172.97.18 53 to any in recv tun0
ipfw add allow tcp from 213.172.96.18 53 to any in recv tun0
ipfw add allow tcp from 217.115.138.231 80 to any in recv tun0

# Loggt ICMP Anfragen (echo und dest. unreachable) == script kiddies
ipfw add allow log icmp from any to any in recv tun0 icmptype 3
ipfw add allow log icmp from any to any in recv tun0 icmptype 8

# 2049 == NFS
ipfw add deny log tcp from any to any 2049 in recv tun0 setup

# Loggt netbux connections
ipfw add deny log tcp from any to any 12345 in recv tun0
ipfw add deny log tcp from any to any 20034 in recv tun0

# Alles andere verbieten
ipfw add deny ip from any to any
----------------------------------------------------------------------------------

Im vorraus danke für eine schnelle Lösung

Gruß Andreas
 
Hallo

Für mich ist wichtig zu wissen warum es nicht geht!!!

Ich benutze doch nur einen anderren Provider mit anderen DNS, dann sollte es doch gehen!!!

Oder verstehe ich das verkehrt.

Wäre super wenn wir jemand das erklären kann.

Gruß Andreas
 
ipfw add allow ip from any to any via lo0
ipfw add allow tcp from any to any via lo0
ipfw add allow udp from any to any via lo0
ipfw add allow icmp from any to any via lo0
Regeln 2-4 sind redundant. Bitte entfernen
ipfw add allow tcp from any to any out xmit tun0 setup
Da sollte ein keep-state mit ran. Und dann fehlt natuerlich noch die check-state Regel
ipfw add allow log tcp from any to any 80 setup
ipfw add allow log tcp from any to any 22 setup
ipfw add allow log tcp from any to any 25 setup
ipfw add allow log tcp from any to any 21 setup
ipfw add allow log tcp from any to any 20 setup
ipfw add allow log tcp from any to any 10000 setup
Was spricht gegen: ipfw add allow log tcp from any to any 20,21,22,25,80,10000 setup?
ipfw add allow udp from any to 213.172.96.18 53 out xmit tun0
ipfw add allow udp from any to 213.172.97.18 53 out xmit tun0
ipfw add allow tcp from any to 213.172.97.18 53 out xmit tun0
ipfw add allow tcp from any to 213.172.96.18 53 out xmit tun0
Das gleiche wie oben. Du willst 'keep-state' damit sind naemlich die nachfolgenden Regeln ueberfluessig.
# Erlaubt die Antwort der DNS Nachfragen
ipfw add allow udp from 213.172.97.18 53 to any in recv tun0
ipfw add allow udp from 213.172.96.18 53 to any in recv tun0
ipfw add allow tcp from 213.172.97.18 53 to any in recv tun0
ipfw add allow tcp from 213.172.96.18 53 to any in recv tun0
ipfw add allow tcp from 217.115.138.231 80 to any in recv tun0

Du solltest dir mit 'ipfw show' erstmal einen Ueberblick verschaffen, welche Regeln ueberhaupt getroffen werden.
 
Hallo



ipfw add allow tcp from any to any out xmit tun0 setup

--------------------------------------------------------------------------------


Da sollte ein keep-state mit ran. Und dann fehlt natuerlich noch die check-state Regel

keep-state mit ran und check-state Regel
Kannst du mir das bitte erklären?

Gruß Andreas
 
Original geschrieben von MrFixit
Das gleiche wie oben. Du willst 'keep-state' damit sind naemlich die nachfolgenden Regeln ueberfluessig.

quote:
# Erlaubt die Antwort der DNS Nachfragen
ipfw add allow udp from 213.172.97.18 53 to any in recv tun0
ipfw add allow udp from 213.172.96.18 53 to any in recv tun0
ipfw add allow tcp from 213.172.97.18 53 to any in recv tun0
ipfw add allow tcp from 213.172.96.18 53 to any in recv tun0
ipfw add allow tcp from 217.115.138.231 80 to any in recv tun0


Hm, interessant. Die Regeln für meinen ISDN-Router mit FreeBSD 5.2.1p1 sind ähnlich - möglicherweise fehlerhaft - aufgebaut:

Code:
#!/bin/sh
fwmd="/sbin/ipfw -q"
natd_interface="tun0"
nic0="xl0"
nic1="rl0"
# nic2="sis0"
# nic3="sis1"
mathematix="192.168.0.1"
pingunix="192.168.1.1"
# asterix="192.168.2.1"
# obelix="192.168.3.1"
routerip0="192.168.0.250"
routerip1="192.168.1.250"
# routerip2="192.168.2.250
# routerip3="192.168.3.250"
${fwmd} -f flush
${fwmd} add 100 allow ip from any to any via lo0
${fwmd} add 200 deny all from any to 127.0.0.0/8
${fwmd} add 300 deny all from 127.0.0.0/8 to any
${fwmd} add 400 divert natd all from any to any via ${natd_interface}
${fwmd} add 500 check-state
${fwmd} add 600 allow ip from any to any via ${nic0} keep-state
${fwmd} add 700 allow ip from any to any via ${nic1} keep-state
${fwmd} add 800 allow ip from ${mathematix} to ${routerip0} 22 in recv ${nic0} keep-state
${fwmd} add 900 allow ip from ${pingunix} to ${routerip1} 22 in recv ${nic0} keep-state
${fwmd} add 1000 allow tcp from any to any out xmit ${natd_interface} setup keep-state
${fwmd} add 2000 deny all from any to any frag in via ${natd_interface}
${fwmd} add 3000 deny tcp from any to any
${fwmd} add 4000 allow udp from any to any 53 out xmit ${natd_interface} keep-state
${fwmd} add 5000 allow udp from any to any 53 out xmit ${natd_interface} keep-state
${fwmd} add 6000 allow udp from any 53 to any in recv ${natd_interface} keep-state
${fwmd} add 7000 allow udp from any 53 to any in recv ${natd_interface} keep-state
${fwmd} add 8000 deny udp from any to any
${fwmd} add 40000 allow log logamount 1000 tcp from any to any 20 setup
${fwmd} add 41000 allow log logamount 1000 tcp from any to any 21 setup
${fwmd} add 42000 allow log logamount 1000 tcp from any to any 80 setup
${fwmd} add 43000 allow log logamount 1000 tcp from any to any 443 setup

Die Option IPFIREWALL_DEFAULT_TO ACCEPT habe ich absichtlich nicht in den Kernel kompiliert, blackhole steht für UDP und TCP auf 2, TCP_DROP_SYNFIN wird über rc.conf geladen und kern.securelevel=3. Die Firewall funktioniert meines Erachtens ohne funktionelle Probleme, nur frage ich mich vom rein akademischen Standpunkt, ob ich hier nicht ebenfalls redundanten Code geschrieben habe? Die DNS-Regeln (Regeln 4000 - 8000) sind doch bei mir nur auf UDP beschränkt, während dem natd_interface in Regel 1000 nur TCP erlaubt ist. Wer von den ipfw2-Experten kann sein 2 Cents beisteuern?
 
Zuletzt bearbeitet:
Hallo zusammen

Ich habe ein wenig rumprobiert und bekomme die DNS sache nicht in griff.


Hier meine Einstellungen

12.03.2003

Webserver# ipfw show
00050 0 0 divert 8668 ip from any to any via rl0
00150 0 0 allow ip from any to any via lo0
00250 2130 102387 allow ip from any to any via rl1
00350 0 0 allow tcp from any to any out xmit rl0 setup
00450 0 0 allow tcp from any to any via rl0 established
00550 4 224 allow tcp from any to any dst-port 20,21,22,25,80,49152-65535 setup
00650 0 0 reset tcp from any to any dst-port 113 in recv rl0
00750 0 0 allow udp from any to 213.172.96.18 dst-port 53 out xmit rl0
00850 0 0 allow tcp from any to 213.172.96.18 dst-port 53 out xmit rl0
00950 0 0 allow udp from 213.172.96.18 53 to any in recv rl0
01050 0 0 allow tcp from 213.172.96.18 53 to any in recv rl0
01150 0 0 allow log icmp from any to any in recv rl0 icmptypes 3
01250 0 0 allow log icmp from any to any in recv rl0 icmptypes 8
01350 0 0 allow icmp from any to any
01450 49 2755 deny ip from any to any
65535 0 0 deny ip from any to any


Webserver# ipfw list
00050 divert 8668 ip from any to any via rl0
00150 allow ip from any to any via lo0
00250 allow ip from any to any via rl1
00350 allow tcp from any to any out xmit rl0 setup
00450 allow tcp from any to any via rl0 established
00550 allow tcp from any to any dst-port 20,21,22,25,80,49152-65535 setup
00650 reset tcp from any to any dst-port 113 in recv rl0
00750 allow udp from any to 213.172.96.18 dst-port 53 out xmit rl0
00850 allow tcp from any to 213.172.96.18 dst-port 53 out xmit rl0
00950 allow udp from 213.172.96.18 53 to any in recv rl0
01050 allow tcp from 213.172.96.18 53 to any in recv rl0
01150 allow log icmp from any to any in recv rl0 icmptypes 3
01250 allow log icmp from any to any in recv rl0 icmptypes 8
01350 allow icmp from any to any
01450 deny ip from any to any
65535 deny ip from any to any

Webserver# ping www.heise.de
ping: cannot resolve www.heise.de: Host name lookup failure

Webserver# ifconfig
rl0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=8<VLAN_MTU>
inet6 fe80::2c0:26ff:fea1:8384%rl0 prefixlen 64 scopeid 0x1
ether 00:c0:26:a1:83:84
media: Ethernet autoselect (10baseT/UTP)
status: active
rl1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=8<VLAN_MTU>
inet 192.168.0.100 netmask 0xffffff00 broadcast 192.168.0.255
inet6 fe80::250:fcff:fe6e:120e%rl1 prefixlen 64 scopeid 0x2
ether 00:50:fc:6e:12:0e
media: Ethernet autoselect (100baseTX <full-duplex>)
status: active
plip0: flags=8810<POINTOPOINT,SIMPLEX,MULTICAST> mtu 1500
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
inet 127.0.0.1 netmask 0xff000000
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x4
tun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1492
inet IP --> andere IP netmask 0xffffffff
Opened by PID 213

PPP.conf


#################################################################
# PPP Sample Configuration File
# Originally written by Toshiharu OHNO
# Simplified 5/14/1999 by wself@cdrom.com
#
# See /usr/share/examples/ppp/ for some examples
#
# $FreeBSD: src/etc/ppp/ppp.conf,v 1.2.2.1 2000/08/18 08:33:02 jhb Exp $
#################################################################

default:
set device PPPoE:rl0
set MRU 1492
set MTU 1492
#set log Phase tun command # you can add more detailed logging if you wish
set dial
set login
set ifaddr 10.0.0.1/0 10.0.0.2/0
add default HISADDR
nat enable yes
enable lqr
# enable dns
disable pred1 deflate
deny pred1 deflate
set server /var/run/ppp-adsl "" 0177
interdsl:
set authname "123456789"
set authkey 12345

#RC.CONF
gateway_enable="YES"
hostname="Webserver"
ifconfig_rl1="inet 192.168.0.100 netmask 255.255.255.0"
linux_enable="YES"
moused_enable="YES"
sshd_enable="YES"
usbd_enable="YES"
keymap="german.iso"
inetd_enable="YES"
kern_securelevel_enable="NO"
sendmail_enable="NONE"

# PPP
ppp_nat="NO"
ppp_enable="YES"
ppp_mode="ddial"
ppp_profile="t-online"

keymap="german.iso"
network_interfaces="rl0 rl1 lo0"
ifconfig_rl0="up"
ifconfig_lo0="inet 127.0.0.1"

#NTP
#ntpdate_enable="YES"
#ntpdate_flags="ntp.easynet.de"


# NAT
natd_program="/sbin/natd"
natd_enable="YES"
natd_interface="tun0"
#natd_flags="-dynamic -f /etc/natd.conf"

# IPFW
firewall_enable="YES"
firewall_script="/etc/fw.rc"
firewall_logging="YES"
#firewall_type="OPEN"

# shutdown PC
apm_enable="YES"
apmd_enable="YES"

Einwahl mit DSL funktioniert, bekomme meine IP

Ping im Netzwerk funktioniert auch

Im vorraus Danke

Gruß Andreas





Im Vorraus danke für die hilfe
 
Funktioniert die Namensauflösung auf dem Rechner der sich einwählt nicht, oder funktioniert sie dort, aber nicht auf den Clients die hinter dem Rechner hängen?
Was steht in der /etc/resolv.conf drin? Die nameserver Deines Providers?
 
Hallo

richtig nameserver der Providers

resolf.conf

nameserver 213.172.96.18
nameserver 213.172.97.18
nameserver 127.0.0.1

ping 213.172.96.18 funktioniert mit dem Freebsd rechner

aber ping www.heise.de funktioniert nicht

keine namensauflösung

alle rechner im netzwerk haben keine internetverbindung

ping im netzwerk funktioniert

Gruß Andreas
 
Original geschrieben von Andreas-iz

Webserver# ipfw list
00050 divert 8668 ip from any to any via rl0
00150 allow ip from any to any via lo0
00250 allow ip from any to any via rl1
00350 allow tcp from any to any out xmit rl0 setup
00450 allow tcp from any to any via rl0 established
00550 allow tcp from any to any dst-port 20,21,22,25,80,49152-65535 setup
00650 reset tcp from any to any dst-port 113 in recv rl0
00750 allow udp from any to 213.172.96.18 dst-port 53 out xmit rl0
00850 allow tcp from any to 213.172.96.18 dst-port 53 out xmit rl0
00950 allow udp from 213.172.96.18 53 to any in recv rl0
01050 allow tcp from 213.172.96.18 53 to any in recv rl0
01150 allow log icmp from any to any in recv rl0 icmptypes 3
01250 allow log icmp from any to any in recv rl0 icmptypes 8
01350 allow icmp from any to any
01450 deny ip from any to any
65535 deny ip from any to any

Statt "rl0" welches Dein externes Interface darstellt an dem das DSL "Modem" hängt, gebe "tun0" an.
 
Hi asg

int_interface="rl1" # ${int_interface} Internes Interface
natd_interface="tun0" # ${natd_interface} Externes Interface

Webserver# ping 213.172.96.18
PING 213.172.96.18 (213.172.96.18): 56 data bytes
ping: sendto: Permission denied
ping: sendto: Permission denied
ping: sendto: Permission denied

ping www.heise.de

kein ping möglich

Webserver# ipfw list
00050 divert 8668 ip from any to any via tun0
00150 allow ip from any to any via lo0
00250 allow ip from any to any via rl1
00350 allow tcp from any to any out xmit tun0 setup
00450 allow tcp from any to any via tun0 established
00550 allow tcp from any to any dst-port 20,21,22,25,80,49152-65535 setup
00650 reset tcp from any to any dst-port 113 in recv tun0
00750 allow udp from any to 213.172.96.18 dst-port 53 out xmit tun0
00850 allow tcp from any to 213.172.96.18 dst-port 53 out xmit tun0
00950 allow udp from 213.172.96.18 53 to any in recv tun0
01050 allow tcp from 213.172.96.18 53 to any in recv tun0
01150 allow log icmp from any to any in recv tun0 icmptypes 3
01250 allow log icmp from any to any in recv tun0 icmptypes 8
01350 allow icmp from any to any
01450 deny ip from any to any
65535 deny ip from any to any

dmesg

sc0: VGA <16 virtual consoles, flags=0x300>
vga0: <Generic ISA VGA> at port 0x3c0-0x3df iomem 0xa0000-0xbffff on isa0
Timecounter "TSC" frequency 1532905861 Hz quality 800
Timecounters tick every 10.000 msec
ipfw2 initialized, divert disabled, rule-based forwarding enabled, default to deny, logging limited to 100 packets/entry by default
GEOM: create disk ad0 dp=0xc491bc60
ad0: 58644MB <IC35L060AVER07-0> [119150/16/63] at ata0-master UDMA100
Mounting root from ufs:/dev/ad0s1a

geht leider immer noch nicht

gruß andreas
 
Setz doch mal die rule "ipfw allow ip from any to any" hinter die rule 00050. Gehts dann?
Dann wieder verschieben....
 
Hi

mir ist gerade aufgefallen wenn ich das fw.rc neu einlesen will mit ./fw.rc nix passiert

chmod 755 fw.rc habe ich gemacht.

ist das villeicht der fehler??

gruß andreas
 
hi asg

Ich habe nochmal ein wenig rum probiert.

#!/bin/sh
#

# Mach "Quiet"
fwcmd="/sbin/ipfw -q"

# Erstmal alles saubermachen bevor wir anfangen
${fwcmd} -f flush

# Das setzen unserer eigenen Variabeln
int_interface="rl1" # ${int_interface} Internes Interface
natd_interface="rl0" # ${natd_interface} Externes Interface
dns_server="213.172.96.18" # ${dns_server} DNS-Server
open_ports="20,21,22,25,80,49152-65535" # ${open_ports} Offene Ports

# Hiermit dürfen alle ins Internet
${fwcmd} add 50 divert natd all from any to any via ${natd_interface}

${fwcmd} add allow ip from any to any

# Erlaubt Loopbackverbindungen
${fwcmd} add allow ip from any to any via lo0
#${fwcmd} add 100 pass all from any to any via lo0
#${fwcmd} add 200 deny all from any to 127.0.0.0/8
#${fwcmd} add 300 deny ip from 127.0.0.0/8 to any

# Erlaubt internen Verkehr
${fwcmd} add allow ip from any to any via ${int_interface}

# Erlaubt alle Verbindungen welche von hier initiiert wurden
${fwcmd} add allow tcp from any to any out xmit ${natd_interface} setup

# Wenn die Verbindung einmal hergestellt wurde, erlaube dieser offen zu stehen
${fwcmd} add allow tcp from any to any via ${natd_interface} established

# Erlaubte Dienste die ausm Internet erreicht werden dürfen
${fwcmd} add allow tcp from any to any ${open_ports} setup

# This sends a RESET to all ident packets.
${fwcmd} add reset tcp from any to any 113 in recv ${natd_interface}

# Erlaubt ausgehende DNS queries NUR auf angegebenem DNS-Server
${fwcmd} add allow udp from any to ${dns_server} 53 out xmit ${natd_interface}
${fwcmd} add allow tcp from any to ${dns_server} 53 out xmit ${natd_interface}
${fwcmd} add allow udp from ${dns_server} 53 to any in recv ${natd_interface}
${fwcmd} add allow tcp from ${dns_server} 53 to any in recv ${natd_interface}

# Loggt ICMP Anfragen (echo und dest. unreachable) == script kiddies
${fwcmd} add allow log icmp from any to any in recv ${natd_interface} icmptype 3
${fwcmd} add allow log icmp from any to any in recv ${natd_interface} icmptype 8

# ICMP erlauben
${fwcmd} add allow icmp from any to any

# Alles andere verbieten (Wird nicht geloggt)
${fwcmd} add deny ip from any to any

So funktioniert es


${fwcmd} add allow ip from any to any

Wenn ich die regel raus nehme geht es nicht mehr.

Gruß Andreas

I
 
#!/bin/sh

#Mach "Quiet"
fwcmd="/sbin/ipfw -q"

#Erstmal alles saubermachen bevor wir anfangen
${fwcmd} -f flush

#Das setzen unserer eigenen Variabeln
interface="rl0" # ${interface} Netzwerkkarte
dns_server="194.25.2.131" # ${dns_server} DNS-Server
open_tcpports="22,80" # ${open_tcpports} Offene TCP-Ports
open_udpports="22" # ${open_udpports} Offene UDP-Ports

#Erlaubt Loopbackverbindungen
${fwcmd} add allow ip from any to any via lo0

#Erlaubt Verbindungen welche von hier initiiert wurden
${fwcmd} add allow tcp from any to any out xmit ${interface} setup
${fwcmd} add allow udp from any to any out xmit ${interface} setup

#Erlaubt der Verbindung offen zu bleiben
${fwcmd} add allow tcp from any to any via ${interface} established
${fwcmd} add allow tcp from any to any via ${interface} established

#Erlaubte Dienste die aus dem Netzwerk erreicht werden duerfen
${fwcmd} add allow tcp from any to any ${open_tcpports} setup
${fwcmd} add allow udp from any to any ${open_udpports} setup
${fwcmd} add allow tcp from any to any ${open_tcpports} out xmit ${interface}
${fwcmd} add allow udp from any to any ${open_udpports} out xmit ${interface}
${fwcmd} add allow tcp from any to any ${open_tcpports} in recv ${interface}
${fwcmd} add allow udp from any to any ${open_udpports} in recv ${interface}

#Sendet RESET an alle ident Packete
${fwcmd} add reset tcp from any to any 113 in recv ${interface}

#Erlaubt ausgehende DNS-Anfragen NUR auf angegebenem DNS-Server
#${fwcmd} add allow udp from any to ${dns_server} 53 out xmit ${interface}
#${fwcmd} add allow tcp from any to ${dns_server} 53 out xmit ${interface}
#${fwcmd} add allow udp from ${dns_server} 53 to any in recv ${interface}
#${fwcmd} add allow tcp from ${dns_server} 53 to any in recv ${interface}
${fwcmd} add allow ip from any to 194.25.2.129 53
${fwcmd} add allow ip from 194.25.2.129 53 to any

#X11 login
${fwcmd} add allow ip from 192.168.0.1 to 192.168.0.7 6000
${fwcmd} add allow ip from 192.168.0.1 to 192.168.0.7 177
${fwcmd} add allow ip from 192.168.0.7 6000 to 192.168.0.1
${fwcmd} add allow ip from 192.168.0.7 177 to 192.168.0.1

#Loggt ICMP Anfragen (echo und dest. unreachable)[/I]
${fwcmd} add allow log icmp from any to any in recv ${interface} icmptype 3
${fwcmd} add allow log icmp from any to any in recv ${interface} icmptype 8

#ICMP erlauben
${fwcmd} add allow icmp from any to any

#Alles andere verbieten (Wird nicht geloggt)
${fwcmd} add deny ip from any to any

____________________________

nur in dieser form hatte ich bist jetzt erfolg.
warum die variablen fuer den dns traffic nicht durch die firewall kommen weiss ich beim besten willen nicht.
sehr seltsam das ganze.

mfg
 
Hallo

Ich habe nochmal rumprobiert und ich bekomme die Firewall nicht zum Laufen.

Kann mir vielleicht jemand sagen wo bei mir der Fehler im script liegt sagen.
Sobald ich die Firewall starte komme ich nicht mehr ins netz.

Kein ping möglich 194.25.2.129 oder www.heise.de keine rückmeldung

Firewall script

!/bin/sh
# rl0

# rl0 externes interface
# rl1 internes interface

# Um die firewall regeln erneut einzulesen, sprich die firewall neu
# zu starten:
# cd /etc
# ./fw.rc
# Das liest dann alla das ein was hier steht und die firewall rennt
# mit diesen Angaben

ipfw add 10 divert natd all from any to any via tun0

ipfw add allow ip from any to any via lo0
ipfw add allow ip from any to any via rl1

# Erlaubt alle Verbindungen welche von hier initiiert wurden
ipfw add allow tcp from any to any out xmit tun0 setup keep-state

# Wenn die Verbindung einmal hergestellt wurde, erlaube dieser offen zu stehen
ipfw add allow tcp from any to any via tun0 established

ipfw add allow log tcp from any to any 20,21,22,25,80,10000 setup

# This sends a RESET to all ident packets.
ipfw add reset log tcp from any to any 113 in recv tun0

ipfw add check-state

# Erlaubt ausgehende DNS queries NUR auf die beiden angegebenen Server
ipfw add allow udp from any to 213.172.97.18 53 out xmit tun0 keep-state
ipfw add allow udp from any to 213.172.96.18 53 out xmit tun0 keep-state
ipfw add allow tcp from any to 213.172.97.18 53 out xmit tun0 keep-state
ipfw add allow tcp from any to 213.172.96.18 53 out xmit tun0 keep-state
ipfw add allow tcp from 217.115.138.231 80 to any in recv tun0
# Loggt ICMP Anfragen (echo und dest. unreachable) == script kiddies
ipfw add allow log icmp from any to any in recv tun0 icmptype 3
ipfw add allow log icmp from any to any in recv tun0 icmptype 8

# 2049 == NFS
ipfw add deny log tcp from any to any 2049 in recv tun0 setup

# Loggt netbux connections
ipfw add deny log tcp from any to any 12345 in recv tun0
ipfw add deny log tcp from any to any 20034 in recv tun0

# Alles andere verbieten
#ipfw add deny ip from any to any


Webserver# ./fw.rc
00010 divert 8668 ip from any to any via tun0
00200 allow ip from any to any via lo0
00300 allow ip from any to any via rl1
00400 allow tcp from any to any out xmit tun0 setup keep-state
00500 allow tcp from any to any via tun0 established
00600 allow log tcp from any to any dst-port 20,21,22,25,80,10000 setup
00700 reset log tcp from any to any dst-port 113 in recv tun0
00800 check-state
00900 allow udp from any to 213.172.97.18 dst-port 53 out xmit tun0 keep-state
01000 allow udp from any to 213.172.96.18 dst-port 53 out xmit tun0 keep-state
01100 allow tcp from any to 213.172.97.18 dst-port 53 out xmit tun0 keep-state
01200 allow tcp from any to 213.172.96.18 dst-port 53 out xmit tun0 keep-state
01300 allow tcp from 217.115.138.231 80 to any in recv tun0
01400 allow log icmp from any to any in recv tun0 icmptypes 3
01500 allow log icmp from any to any in recv tun0 icmptypes 8
01600 deny log tcp from any to any dst-port 2049 in recv tun0 setup
01700 deny log tcp from any to any dst-port 12345 in recv tun0
01800 deny log tcp from any to any dst-port 20034 in recv tun0


Webserver# ipfw list
00010 divert 8668 ip from any to any via tun0
00100 allow ip from any to any
00200 allow ip from any to any via lo0
00300 allow ip from any to any via rl1
00400 allow tcp from any to any out xmit tun0 setup keep-state
00500 allow tcp from any to any via tun0 established
00600 allow log tcp from any to any dst-port 20,21,22,25,80,10000 setup
00700 reset log tcp from any to any dst-port 113 in recv tun0
00800 check-state
00900 allow udp from any to 213.172.97.18 dst-port 53 out xmit tun0 keep-state
01000 allow udp from any to 213.172.96.18 dst-port 53 out xmit tun0 keep-state
01100 allow tcp from any to 213.172.97.18 dst-port 53 out xmit tun0 keep-state
01200 allow tcp from any to 213.172.96.18 dst-port 53 out xmit tun0 keep-state
01300 allow tcp from 217.115.138.231 80 to any in recv tun0
01400 allow log icmp from any to any in recv tun0 icmptypes 3
01500 allow log icmp from any to any in recv tun0 icmptypes 8
01600 deny log tcp from any to any dst-port 2049 in recv tun0 setup
01700 deny log tcp from any to any dst-port 12345 in recv tun0
01800 deny log tcp from any to any dst-port 20034 in recv tun0
65535 deny ip from any to any

Webserver# ipfw show
00010 6 336 divert 8668 ip from any to any via tun0
00100 1003 107909 allow ip from any to any
00200 0 0 allow ip from any to any via lo0
00300 0 0 allow ip from any to any via rl1
00400 0 0 allow tcp from any to any out xmit tun0 setup keep-state
00500 0 0 allow tcp from any to any via tun0 established
00600 0 0 allow log tcp from any to any dst-port 20,21,22,25,80,10000 setup
00700 0 0 reset log tcp from any to any dst-port 113 in recv tun0
00800 0 0 check-state
00900 0 0 allow udp from any to 213.172.97.18 dst-port 53 out xmit tun0 keep-state
01000 0 0 allow udp from any to 213.172.96.18 dst-port 53 out xmit tun0 keep-state
01100 0 0 allow tcp from any to 213.172.97.18 dst-port 53 out xmit tun0 keep-state
01200 0 0 allow tcp from any to 213.172.96.18 dst-port 53 out xmit tun0 keep-state
01300 0 0 allow tcp from 217.115.138.231 80 to any in recv tun0
01400 0 0 allow log icmp from any to any in recv tun0 icmptypes 3
01500 0 0 allow log icmp from any to any in recv tun0 icmptypes 8
01600 0 0 deny log tcp from any to any dst-port 2049 in recv tun0 setup
01700 0 0 deny log tcp from any to any dst-port 12345 in recv tun0
01800 0 0 deny log tcp from any to any dst-port 20034 in recv tun0
65535 18 2213 deny ip from any to any
Webserver#

Auf ein lösung würde ich mich sehr freuen

Gruß Andreas
 
Hallo Andreas-iz,

00900 0 0 allow udp from any to 213.172.97.18 dst-port 53 out xmit tun0 keep-state
01000 0 0 allow udp from any to 213.172.96.18 dst-port 53 out xmit tun0 keep-state
01100 0 0 allow tcp from any to 213.172.97.18 dst-port 53 out xmit tun0 keep-state
0200 0 0 allow tcp from any to 213.172.96.18 dst-port 53 out xmit tun0 keep-state

Äh, mal ne Frage: wie sollen die Datenpakete wieder zurück?
Du schreibst immer nur "out" aber "in" fehlt da irgendwie.

Deine Anwendungen brauchen ja auch die Antwort vom DNS. Mit "out" legst Du die Richtung des Datentransfers fest.

Grüße

Jürgen
 
also bei mir kann ich auch nicht namen auflösen wenn ich
ipfw allow udp from any to any 53
ipfw allow tcp from any to any 53

eingebe sprich von überall nach überall erlaube
 
Zurück
Oben