NFS & PF Firewall (Die x te:-))

fred123

Well-Known Member
Hallo
.
Ich bekomme NFS/ZFS export einfach nicht durch den PF:-(
.
Mit ausgeschaltetem PF/Server läuft das vorzüglich. Mit PF ON bringt der Client
.
tcp] 192.168.123.100:/tank1: nfsd: RPCPROG_NFS: RPC: Remote system error - Connection refused
.

Server rpcinfo :
==================schnipp==========
#rpcinfo -p
program vers proto port service
100000 4 tcp 111 rpcbind
100000 3 tcp 111 rpcbind
100000 2 tcp 111 rpcbind
100000 4 udp 111 rpcbind
100000 3 udp 111 rpcbind
100000 2 udp 111 rpcbind
100000 4 local 111 rpcbind
100000 3 local 111 rpcbind
100000 2 local 111 rpcbind
100005 1 udp 624 mountd
100005 3 udp 624 mountd
100005 1 tcp 624 mountd
100005 3 tcp 624 mountd
100003 2 udp 2049 nfs
100003 3 udp 2049 nfs
100024 1 udp 703 status
100024 1 tcp 703 status
100003 2 tcp 2049 nfs
100003 3 tcp 2049 nfs
100021 0 udp 656 nlockmgr
100021 0 tcp 880 nlockmgr
100021 1 udp 656 nlockmgr
100021 1 tcp 880 nlockmgr
100021 3 udp 656 nlockmgr
100021 3 tcp 880 nlockmgr
100021 4 udp 656 nlockmgr
100021 4 tcp 880 nlockmgr
=================schnapp=============
Diese Port sind im PF/Server auch freigegeben :-((
.
tcpdump -r /var/log/pflog | grep CLIENT auf dem Server
zeigt Kontakte des Clienten auf var. Ports. Kann man das Andern?

Was habe ich jetzt noch übersehen oder schon wieder vergessen??
.
Danke für Tips.
Fred
 
Die pf.conf:
#less /etc/pf.conf

set skip on lo0
set block-policy return
scrub in all
antispoof quick for lo0 inet
block in from no-route to any

# Block all other incoming
block in log

# Allow all outgoing traffic
pass out keep state

# Block blacklist
table <blacklist> persist file "/etc/blacklist"
block from <blacklist> to any

# Enable ICMP for IPv4 IPv6
pass proto icmp all
pass proto icmp6 all

# Nic Specific Rules

pass in quick on re0 proto {tcp,udp} from any to (re0) port 49152:65535 keep state
pass in quick on re0 proto udp from any to (re0) port 137 keep state
pass in quick on re0 proto udp from any to (re0) port 138 keep state
pass in quick on re0 proto udp from any to (re0) port 111 keep state
pass in quick on re0 proto udp from any to (re0) port 1110 keep state
pass in quick on re0 proto udp from any to (re0) port 2049 keep state
pass in quick on re0 proto udp from any to (re0) port 4045 keep state
pass in quick on re0 proto udp from any to (re0) port 5353 keep state
pass in quick on re0 proto udp from any to (re0) port 5353 keep state
pass in quick on re0 proto tcp from any to (re0) port 445 keep state
pass in quick on re0 proto tcp from any to (re0) port 137 keep state
pass in quick on re0 proto tcp from any to (re0) port 139 keep state
pass in quick on re0 proto tcp from any to (re0) port 111 keep state
pass in quick on re0 proto tcp from any to (re0) port 1110 keep state
pass in quick on re0 proto tcp from any to (re0) port 4045 keep state
pass in quick on re0 proto tcp from any to (re0) port 5353 keep state
pass in quick on re0 proto tcp from any to (re0) port 22 keep state
pass in quick on re0 proto tcp from any to (re0) port 10022 keep state
pass in quick on re0 proto tcp from any to (re0) port 80 keep state
pass in quick on re0 proto tcp from any to (re0) port 443 keep state
pass in quick on re0 proto tcp from any to (re0) port 652 keep state
pass in quick on re0 proto tcp from any to (re0) port 1020 keep state
pass in quick on re0 proto tcp from any to (re0) port 953 keep state
pass in quick on re0 proto udp from any to (re0) port 111 keep state
pass in quick on re0 proto udp from any to (re0) port 652 keep state
pass in quick on re0 proto udp from any to (re0) port 2049 keep state
pass in quick on re0 proto udp from any to (re0) port 769 keep state
pass in quick on re0 proto tcp from any to (re0) port 865 keep state
pass in quick on re0 proto tcp from any to (re0) port 880 keep state
pass in quick on re0 proto tcp from any to (re0) port 703 keep state



.
Danke für Tips.
Fred[/QUOTE]
 
Erst mal etwas Allgemeines, ist das so nicht übersichtlicher?

Code:
set skip on lo0
set block-policy return
scrub in all
antispoof quick for lo0 inet   ### Das wird doch schon wegen Zeile 1 nicht beachtet?
block in from no-route to any

# Block all other incoming
block in log

# Allow all outgoing traffic
pass out

# Block blacklist
table <blacklist> persist file "/etc/blacklist"
block from <blacklist> to any

# Enable ICMP for IPv4 IPv6
pass proto icmp all
pass proto icmp6 all

# Nic Specific Rules
good_ports_in_udp = { 111, 137, 138, 652, 769, 1110, 2049, 4045, 5353 };
good_ports_in_tcp = { 22, 80, 111, 137, 139, 443, 445, 652, 703, 865, 880, 953, 1020, 1110, 4045, 5353, 10022 };

pass in quick on re0 proto {tcp,udp} from any to (re0) port 49152:65535

pass in quick on re0 proto tcp from any to (re0) port $good_ports_in_tcp
pass in quick on re0 proto tcp from any to (re0) port $good_ports_in_udp


"keep state" kann man übrigens weglassen. Das ist seit langer Zeit implizit gesetzt.
 
Erst mal etwas Allgemeines, ist das so nicht übersichtlicher?
"keep state" kann man übrigens weglassen. Das ist seit langer Zeit implizit gesetzt.
.
Ja grins. Ich habe einfach nir cut&paste gemacht und die conf ist mit PC-BSD und der Maus, nicht per Hand gebaut.
.
Aber selbst die geänderte Form lässt NFS durch den PF nicht zu:-(
.
Gruss
Fred
 
Du musst mindestens noch mountd per Option -p an einen Port binden und diesen Port in pf freigeben. Denn sonst wählt er sich einen zufällig und das gefällt pf nicht.
 
Du musst mindestens noch mountd per Option -p an einen Port binden und diesen Port in pf freigeben. Denn sonst wählt er sich einen zufällig und das gefällt pf nicht.
Hallo Yamagi
.
da hast du aber wei ein Blindenhund gebellt :-))
###
mountd_enable="YES"
mountd_flags="-r -p 1000"
###
Kaum kriegt man gesagt wie es geht, schon klappts.

Dake für die Hilfe. Muss vernagelt gewesen sein.
.
Gruss
Fred
 
Da die Ports zur Laufzeit statisch bleiben, mache ich einfach folgendes in rc.local

Code:
rpcinfo -p localhost \
| while read program version protocol port name; do
    case "${name}" in
        portmapper|mountd|nfs|nlockmgr|status)
            echo "pass quick proto ${protocol} to port ${port} modulate state (if-bound)"
            ;;
    esac
done \
| sort -n -k 7,7 -k 4,4 \
| uniq \
| pfctl -a "mgmt/in/rpc" -f -

Das ist auf OpenBSD, wo man nicht jeden Dienst auf einen Port festnageln kann.
 
Zurück
Oben