PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : openBSD-Firewall pf blockiert t-online Mails



Hein B.
03.07.07, 10:58
Hi,

ich habe das Problem aus anderer Sicht schon mal hier (http://www.linuxforen.de/forums/showthread.php?t=238424)gepostet.

Kurz zusammengefasst: Mails von t-online.com kommen nicht an, da nach dem EHLO keine Antwort mehr von t-online zu meinem postfix durchkommt.

Mittlerweile weiss ich ganz sicher, dass die Firewall-Einstellungen schuld an dem Problem sind.
Allerdings habe ich keine Ahnung, was ich da falsch gemacht habe ...
Meine Firewall ist ein eigener openBSD-Rechner, der vor den Mailserver gestellt ist.

hier ist die pf.conf:

oext_if="sis0"
ext_net="sis0:network"
int_if="sis1"
int_net="sis1:network"
trusted_mailsrv = "{ 194.25.134.0/24 }"
special = "*myNet*.157" # can do anything - see below
untrusted = "*myNet*.157" # block SSH to self from NAT addr
tunnel = "*myNet*.149" # allow SSH to tunnel-servers
priv_nets = "{ *myNet*.0/28 }"
provider = "{ *myNet*.0/24 }"

nat on $ext_if from !($ext_net) -> ($ext_if:0)

rdr pass on $int_if proto tcp from any to any port 21 -> 127.0.0.1 port 8021

block in log
pass out keep state
pass quick on lo
pass out quick on $int_if
pass in log on $int_if from $special keep state
pass in proto { icmp } keep state
pass from $trusted_mailsrv to any
pass in proto tcp from any to any user proxy keep state
pass in on $int_if from *myNet*.149/32 to *myNet*.157/32 keep state
pass out on $int_if from *myNet*.157/32 to *myNet*.149/32 keep state
pass in on $int_if inet proto { udp, tcp } to port domain keep state
pass in on $int_if inet proto tcp to !self port ssh keep state
pass in on $int_if inet proto tcp to port www keep state
pass in on $int_if inet proto tcp to port https keep state
pass in on $int_if inet proto tcp from any to any port 25 keep state
pass in on $int_if inet proto { udp, tcp } from any to any port ntp keep state
pass in on $int_if inet proto tcp from $int_net port www keep state
pass in on $int_if inet proto tcp from $int_net port https keep state
pass in on $int_if inet proto tcp from $int_net port smtp keep state
pass in on $int_if inet proto tcp from $int_net port ftp keep state
pass in on $int_if inet proto tcp from $int_net port ssh keep state
pass in on $ext_if inet proto { udp, tcp } from any to *myNet*.157 port 5900 keep state
block in on $ext_if inet proto tcp to self port ssh
pass in on $ext_if inet proto tcp to $tunnel port ssh keep state
pass in on $ext_if inet proto tcp from $provider to port ssh keep state
pass in on $ext_if inet proto tcp to port ftp keep state
pass in on $ext_if inet proto tcp to port www keep state
pass in on $ext_if inet proto tcp to port https keep state
pass in on $ext_if inet proto tcp from any to any port 25 keep state
pass in on $int_if proto tcp from any to self port ssh keep state
block in log on $int_if proto tcp from $untrusted to self port ssh
pass in on $ext_if proto { udp, tcp } to self port ntp keep state
pass in on $int_if inet proto udp to port 33434:33626


Ich bin ziemlich ratlos - die Mails kommen nur, wenn ich die Firewall komplett abschalte, selbst ein

pass from 194.25.134.0/24 to any
hilft nicht (194.25.134.0/24 ist das t-online-mailout Netz).

Hat jemand eine Idee?

schöne Grüße,
Hein B.

$kuLL
03.07.07, 11:41
Ohne dein Skript jetzt im Einzelnen durchgegangen zu sein:
schon mit

pass quick from 194.25.134.0/24 to any
versucht?
Wenn das nicht hilft, dann wird noch irgendwas anderes essentielles geblockt. Dann einfach mal tcpdump auf das pflog Device loslassen und schauen, was es genau ist.

Edit: btw, http://www.bsdforen.de/ oder http://www.bsdgroup.de/ wären die besseren Anlaufstellen gewesen ;)

Hein B.
03.07.07, 15:41
Thx Skull!

Deine Idee hat mich auf die richtige Spur gebracht.

Ich habe die pf.conf komplett neu aufgebaut und nun die Mailserverregeln mit quick vor die rule "block all" gestellt - dann gings.

D.h. ich weiss nun immer noch nicht genau warum und was gefehlt hat,
aber so tuts:


ext_if="sis0"
ext_net="sis0:network"
int_if="sis1"
int_net="sis1:network"

dmz = "*myNet*.157" # can do anything - see below

lan_net = "*myNet*.0/24"
mailsrv = "*myNet*.145"

# tabelle, die alle IP-Adressen beinhaltet, die der firewall zugewiesen
# worden sind
table <firewall> const { self }

# ,scrub' auf alle eingehenden pakete anwenden
scrub in all

# ,spoofing'-schutz fr das externe interface
antispoof for $ext_if inet

# Spezialregeln fuer den Mailserver - muss vor block all stehen!
pass in quick proto { tcp, udp } to $mailsrv port smtp keep state
pass in quick proto { icmp } to $mailsrv keep state
pass out quick from $mailsrv

pass quick to $dmz
pass quick from $dmz

# das hier kann auch hinter block all stehen ....
pass in quick proto tcp from $lan_net port ssh
pass in quick on $ext_if proto { tcp, udp } to $mailsrv port { smtp, 57 } keep state
pass in quick on $ext_if proto { tcp, udp } to $lan_net port { http, https }

# eine richtlinie zum standardmaessigen blocken errichten
block all

# nur ssh-verbindungen vom lokalen netzwerk erlauben, wenn es von dem
# lan_net kommt, dem man vertrauen kann. verwende
# ,block return', so dass ein TCP-RST gesendet wird, um blockierte
# Verbindungen sofort zu schlieen. verwende ,quick', sodass diese
# regel nicht von der ,pass'-regel weiter unten berschrieben wird.
block return in quick on $int_if proto tcp from ! $lan_net \
to $int_if port ssh

# den gesamten verkehr von und zum lokalen netzwerk durchlassen.
# diese regeln werden statuseintrge erstellen, da die standardoption
# "keep state" automatisch bernommen wird.
pass in on $int_if from $lan_net to any
pass out on $int_if from any to $lan_net

# tcp, udp und icmp durch das externe (internet-)interface rauslassen.
# tcp-verbindungen werden reguliert, udp/icmp-verbindungen werden
# statusberwacht.
pass out on $ext_if proto { tcp udp icmp } all modulate state


schöne Grüße,
Hein B.