I need to block incoming TCP to a certain port for a project. pfctl seems like the right option but so far I haven’t had any luck. I’m frustrated with the vague “syntax errors” it’s giving me.
The command I ran:
me@box ~ % sudo pfctl -e -f /Users/me/vpn/pf.conf
Password:
pfctl: Use of -f option, could result in flushing of rules
present in the main ruleset added by the system at startup.
See /etc/pf.conf for further details.
No ALTQ support in kernel
ALTQ related functions disabled
/Users/me/vpn/pf.conf:1: syntax error
pfctl: Syntax error in config file: pf rules not loaded
The contents of pf.conf:
block drop in proto tcp from any to any port 12345
What I’ve tried so far:
- Read the guide at https://www.openbsd.org/faq/pf/filter.html
- Asked ChatGPT