Trying to figure out proper Firewall using PF for my Bridge

I have decided to use port 9200 and 9300 for my bridge.

I have my provider’s box in front of the rpi running FreeBSD and TOR. Port forwarding is enabled for both UDP and TCP on the provider’s box for the aforementioned ports.

I have the following configuration

root@rpi4:~ # grep -v ^# /usr/local/etc/tor/torrc

SOCKSPort 0 # Default: Bind to localhost:9050 for local connections.

RunAsDaemon 1

ORPort 9200 IPv4Only

Nickname Zyglute

BridgeRelay 1

ServerTransportPlugin obfs4 exec /usr/local/bin/obfs4proxy
ServerTransportListenAddr obfs4 0.0.0.0:9300 IPv4Only
ExtORPort auto
AvoidDiskWrites 1

when the firewall on the bridge machine is off my bridge is green on metrics.

I want to use pf as my firewall, my pf config is as follow:

root@rpi4:~ # cat /etc/pf.conf
tcp_services = "{ ssh, 9200, 9300 }"

#scrub in all
block in all

pass out all keep state

pass in proto {tcp, udp} to any port $tcp_services
root@rpi4:~ #

When pf is enabled I get a red status on metrics. I don’t understand why. What else should I permit and why should I permit it to keep bridge green.

Ludovic

Tor Project actually has some guidance here: Tor Project | FreeBSD

Here’s what they say:

Are you using FreeBSD’s firewall with a “default deny” policy? If so, make sure that your obfs4proxy can talk to your Tor process over the loopback interface. Don’t forget to whitelist Tor’s ExtORPort.

Try adding this to the top of your conf file:

set skip on lo0

That did it. Thank you.