Skip to content

Drift detection

After every deploy and rollback FireHawk records the part of the live firewall it manages as a baseline. It then checks the host regularly and marks it drifted when that part changed: a rule added or removed by hand, a changed chain policy, edited set contents, or a rule inserted above a FireHawk jump that bypasses FireHawk’s rules.

Drift is different from undeployed changes: drift is a change on the host, undeployed changes are edits in FireHawk not deployed yet.

Only what FireHawk manages:

Backend Compared
iptables, managed-chain mode FireHawk’s chains (FIREHAWK, FIREHAWK_OUTPUT, FIREHAWK_FORWARD), base chain policies, and the position of each jump to a FireHawk chain (a rule above it counts as a bypass).
nftables, managed-chain mode The inet firehawk table (counters ignored).
iptables and nftables, full mode The whole ruleset minus other software.
ufw ufw’s user rules (numbering ignored), status and defaults.
firewalld The default zone.

Sets are compared entry by entry: FireHawk’s fh_* ipsets and every ipset the compared rules use, and nftables named sets. Sets whose entries expire on their own (with a timeout, dynamic sets, or sets filled by a rule) are compared by definition only.

Rules owned by other tools (Docker, fail2ban, …) are ignored. In the nat table, only the presence of FireHawk’s jumps is checked, not their position.

  • Every DRIFT_CHECK_INTERVAL_MINUTES (default 30; 0 turns periodic checks off), as background jobs on the workers. See Configuration.
  • On demand: Check drift now on the host’s Drift tab, or Check drift on all hosts on the Jobs page.

Hosts with a pending safe deploy are skipped until its outcome is known.

The Hosts page and the host header show:

Badge Meaning
in sync The managed part matches the baseline.
drifted It changed since the last deploy or rollback.
drift check failed The check could not run, usually because the host is unreachable.
drift: not tracked No baseline yet: the host was never deployed by FireHawk.
undeployed changes The desired rules, an alias, or an inherited policy changed since the last deploy.

Drift and unreachable hosts can be sent as notifications (Drift detected, Drift cleared, Host unreachable, Host reachable again).

The host’s Drift tab shows the baseline time and the last check, then:

  • Rules added on host (not deployed by FireHawk);
  • Rules missing on host (deployed by FireHawk, now gone);
  • Set entries added on host and Set entries missing on host;
  • Policy / structure changes, with the value at the last deploy and now on the host.

Choose one:

  • Restore FireHawk’s rules: deploy again from the Deploy tab. The preview lists the manual changes the deploy will undo. On iptables this also moves the FireHawk jumps back to the top of their chains, which removes a bypass.
  • Keep the change: update the desired rules to match, for example with Load from host on the Desired tab, then deploy so the baseline is recorded again.

Hosts start being tracked at their first deploy. After an upgrade that compares more than before (for example set contents), the old baseline is compared without the new parts until the next deploy records a full one, so an upgrade never reports drift by itself.