Every firewall estate runs two configurations: the one declared in your policy repository, and the one actually loaded on the appliance. The gap between them is drift, and it opens the moment an engineer with a console session fixes something at 2am and never files the change record. Collecting the config is the easy half — a nightly show running-config pull will tell you something moved. The hard half is deciding which of several hundred changed lines altered your security posture, and doing it before the next change window. Most teams build the collector, then quietly abandon it because nobody built the classifier.

A raw line diff is a noise generator

Firewall CLIs churn constantly. Timestamps, sequence numbers, session and hit counters, DNS-resolved object names, and access lists that get rewritten in a different order on every commit all appear as "changes" to a text diff. None of them change which packets are permitted.

Do the arithmetic on your own estate: if the nightly diff flags 300 lines and, after review, four were genuine policy changes, your signal-to-noise ratio is 75:1. At that ratio a reviewer either stops reading carefully or mutes the alert, and both outcomes are the same failure. A detector nobody trusts is a detector you don't have.

Parse to objects, then diff as sets

The answer isn't a smarter diff algorithm. It's parsing the config into typed objects and comparing those objects as sets, so a change to a group definition surfaces as one logical change rather than forty downstream rule edits. A workable pipeline has eight stages:

  1. Capture — poll on a schedule and subscribe to the vendor's config-change syslog trap or API event.
  2. Parse — a vendor- and OS-version-specific parser emitting zones, address objects, services, rules, NAT, and routes.
  3. Normalize — strip volatile fields, canonicalize rule ordering, expand groups.
  4. Diff — set difference on rule tuples (zone, src, dst, service, action), never on lines.
  5. Classify — cosmetic, behavioral, or policy-violating.
  6. Correlate — join against change tickets and CI/CD pipeline runs.
  7. Score — reachability analysis to rank by real exposure.
  8. Route — auto-reconcile, open a ticket, or page someone.

Stages 3 and 5 are where homegrown tools die, because both need per-vendor knowledge that must be maintained across OS upgrades.

Anchor the baseline to intent, not to yesterday

If your baseline is "the config we observed yesterday," every drift silently becomes the new truth. That's a rubber band, not a control. The baseline has to be declared intent — the Terraform state, the management platform's policy export, the reviewed commit.

With intent as the baseline, drift sorts into three classes, and only the third is safe to automate:

  • Unauthorized — no change record, no pipeline run. This is the class auditors care about, and the one that occasionally turns out to be a departing contractor.
  • Authorized but unreconciled — an engineer made a legitimate emergency change in the console and never updated intent. The next pipeline apply reverts it, and your remediation causes the outage. This class breaks more networks than intrusions do.
  • Authorized and reconciled — intent was updated correctly; the baseline just needs to catch up. Auto-close it.

Detection latency is exposure time

A nightly scan gives you up to 24 hours of blind spot. Work it through: a change lands at 02:15, the scan ran at 02:00, and the notification arrives at 02:03 the following morning — 23 hours and 45 minutes with an over-permissive rule live. Event-driven detection via syslog traps or API subscriptions collapses that to seconds.

The trade is deduplication. One logical change often emits five events: partial apply, commit, rollback, retry, commit. Give the pipeline a settle window — 30 to 120 seconds of quiet before it diffs — or you'll swap a nightly noise problem for a real-time one.

Rank drift by reachability, not by line count

A new permit for any → any → tcp/3389 at the perimeter is one line. A rule reorder that shadows an existing deny is one line. A description change is one line. A diff sees three identical events; your network does not.

Score each drift by asking whether it creates a new permitted path between a zone that accepts untrusted input and a zone holding sensitive data. That path analysis is usually what turns a 40-item drift list into three items worth waking someone for.

The drift you can't classify is the drift you'll eventually auto-remediate into an outage.

The drift record outlives the alert

Detection without a durable record fails the audit. For every change you need device, timestamp, actor, rule-level delta, correlated ticket, disposition, and remediation time — retained long enough to satisfy whatever framework you're held to. Auditors don't ask whether you detect drift; they ask to see the record for one specific change on one specific date. Rebuilding that by hand, months later, from raw syslog is the expensive version of this problem, and it's the version most teams are running today.

Where this is heading

Drift detection is converging into the control plane rather than sitting beside it. Intent gets declared in code, devices are continuously reconciled to that intent, and the drift record becomes a byproduct of normal operation instead of a nightly report. The remaining human work is approving exceptions — everything else, classification included, should be machinery.