Validate before load
pfctl -nf /etc/pf.conf
pfctl -sr
pfctl -si- -n parses without loading.
- -sr shows active filter rules.
Build a safe firewall mental model, validate rules before loading them, and combine network controls with account and package hygiene.
PF uses /etc/pf.conf by default when enabled. On a remote host, a bad ruleset can cut off administration, so validation and console recovery planning are mandatory.
Account policy, SSH configuration, package auditing, filesystem permissions, securelevels/capabilities and firewall policy solve different problems.
pfctl -nf /etc/pf.conf
pfctl -sr
pfctl -siGoal: Build and syntax-check a small PF ruleset without enabling PF or replacing the active firewall policy.
sysrc pf_enable 2>/dev/null || true
kldstat | grep -w pf || true
ls -l /dev/pf 2>/dev/null || true
# If the PF device is absent, load only the kernel module:
test -c /dev/pf || kldload pf
pfctl -si || truecat > /tmp/pf.academy.conf <<'EOF'
set skip on lo0
block all
pass out keep state
pass in proto tcp to port 22 keep state
EOF
cat /tmp/pf.academy.confpfctl -nf /tmp/pf.academy.conf
echo "pfctl exit=$?"
pfctl -nvf /tmp/pf.academy.confrm -f /tmp/pf.academy.confFirewall safety means separating syntax validation from activation and always preserving a management recovery path.
Open each answer only after you have tried to answer the question yourself.
pfctl -nf /path/to/pf.conf.
/etc/pf.conf.
A ruleset mistake can immediately block remote management.
Progress is saved in this browser immediately. When you sign in to My Learning, it can also sync across devices.
Attempt the core lab and knowledge checks before marking the module complete.