EGR003 - Egress Rules Could Not Be Restored
Agent error code #EGR003 indicates that the egress rules knocker installed are missing from the kernel and the agent could not put them back. On pf that is the anchor knocknoc_egress, which the agent reapplies from /etc/knocknoc-agent/knocknoc-egress.pf.
nftables, iptables and Windows never report this code: the agent installs no rules of its own there. A knoc whose users set is missing reports #EGR061, one whose chain is missing #EGR059, and one whose Windows Firewall rule is missing #EGR064.
Those rules hold every egress knoc's fence. While they are missing, every account can reach every knoc's destinations, so whenever the agent finds them gone it puts them back before anything else: on OpenBSD it reapplies the file and the fences it saved. This code means reapplying failed, and the grant was not applied.
Common causes include:
- The file was deleted or edited by hand and no longer loads
- The installed firewall tools are too old to read it
- Another firewall manager holds the rules and refuses changes while it reloads
The usual reason the rules go missing in the first place is a firewall reload that replaced the anchor's contents.
Steps to Resolve
Check the File Loads
doas pfctl -n -a knocknoc_egress -f /etc/knocknoc-agent/knocknoc-egress.pf
Any error printed is what stopped the agent.
Rewrite the File
Re-run doas knocker enable egress. It regenerates the file, checks it, applies it with the saved fences, and restarts the agent so each knoc's grants are rebuilt.
Restore the Rules Now
If the file is fine, apply it straight away with doas pfctl -f /etc/pf.conf. Then confirm with knocker status egress. The Enforcing line should read Yes.
Stop the Rules Being Flushed
If a reload keeps removing the rules, check /etc/pf.conf still has the anchor "knocknoc_egress" line, and reapply the rules from the reload hook of whatever manages your firewall.