Problem mit pf

pchris

Well-Known Member
Hallo!

Vielen Dank nocheinmal für die Beantwortung meiner Fragen in diesem Thread. Die Hardware und das Basissystem sind installiert und die Jails sind vorbereitet.

Jetzt habe ich mich an die Konfiguration von pf gemacht. Aber da steckt irgendwo noch ein großer Fehler drinnen, da sobald ich sie aktiviere, keine Verbindungen per SSH mehr möglich sind.
Code:
bizfs1# pfctl -s nat
No ALTQ support in kernel
ALTQ related functions disabled
nat on em1 inet from ! (em1) to any -> (em1) round-robin
rdr pass on em1 inet proto tcp from any to 128.131.x.y port = http -> 192.168.97.101 port 80
rdr pass on em1 inet proto tcp from any to 128.131.x.y port = ftp -> 192.168.97.100 port 21

bizfs1# pfctl -s rules
No ALTQ support in kernel
ALTQ related functions disabled
scrub in all fragment reassemble
block drop in log all
block drop in quick from urpf-failed to any
block drop in quick from no-route to any
block drop in quick on em1 from <private> to any
block drop out quick on em1 from any to <private>
pass on em1 inet proto icmp all icmp-type echoreq code 0 keep state
pass in on em1 proto tcp from any to any port = ssh flags S/SA keep state

Braucht ihr noch mehr Ausgaben? Oder sieht man den Fehler schon so?

mfg
christoph
 
Zuletzt bearbeitet:
hi

du gibts beim ersten block drop keine interfaces an ergo machst du ein

block drop in on all interfaces

desweiteren ist block drop first match d.h. die zeilen
block drop in on em1

matchen nicht mehr.

im uebrigen kannst du das dann so schreiben

block drop { in,out} on em1 log

ein block drop quick

bewirkt das das packet wirklich dort terminiert und keine weitere regel mehr sieht.



holger
 
Zuletzt bearbeitet:
du gibts beim ersten block drop keine interfaces an ergo machst du ein
Ich habe ein set skip on lo0, em0 aktiviert. Die Paketfilterung sollte also nur auf der externen Netzwerkkarte (em1) aktiv sein.

Bei pf-Fragen ist es sehr hilfreich, die pf.conf zu posten.
Ist eigentlich logisch. Habe mir nur gedacht, vielleicht reicht auch die Ausgabe von pfctl.

Code:
> cat /etc/pf.conf
## Macros
int_if = "em0"
ext_if = "em1"
pub_ip1 = "128.131.x.w"
pub_ip2 = "128.131.x.y"
pub_ip3 = "128.131.x.z"
jail_bizscan = "192.168.97.100"
jail_baufak = "192.168.97.101"

## Tables
table <private> const { 10/8, 172.16/12, 192.168/16 }

## Options
# unlimited traffic  for loopback and lan
set skip on {lo0, $int_if}

## Traffic Normalization
scrub in all fragment reassemble

## Queueing

## Translation
# NAT
nat on $ext_if inet from ! ($ext_if) to any -> ($ext_if)
# http for baufak-wiki
rdr pass on $ext_if inet proto tcp from any to $pub_ip2 port 80 -> $jail_baufak                port 80
# ftp for bizscan
rdr pass on $ext_if inet proto tcp from any to $pub_ip2 port 21 -> $jail_bizscan                port 21

## Packet Filtering

# block in all and log by default
block in log all

# activate spoofing protection for all interfaces
#block in quick from urpf-failed to any
#block in quick from no-route to any
#Block RFC 1918 addresses
#block drop in quick on $ext_if from <private> to any
#block drop out quick on $ext_if from any to <private>

# icmp
pass on $ext_if inet proto icmp all icmp-type 8 code 0

# ssh
pass in on $ext_if inet proto tcp from any to $pub_ip1 port 22
 
Und mit der Config ist es nicht möglich, vom Internet auf die pf-Box per ssh zuzugreifen?

Das ist übrigens eine andere als du ursprünglich hattest, da die quick-blocks auskommentiert sind.

Lad es mal ganz neu: pfctl -F rules -f /etc/pf.conf
 
Zurück
Oben