Skip to content

Cybersecurity Engineering Handbook / Chapter 38

Configuration, Hardening, and Drift Management

Keep production configuration secure by making baselines, changes, exceptions, and runtime drift observable and recoverable.

A production alert sends an operator into the cloud console. Invoice exports are timing out, so she adds a database firewall rule from the support network and raises a connection limit. Service recovers. The incident record captures the limit change, but not the firewall rule. The infrastructure repository still describes the old state. Three weeks later, a configuration scan reports an unexpected network path into the database.

Which state is authoritative: the repository, the incident record, or the running service? Until the team can answer, it does not have a secure configuration. It has three competing accounts of one system.

A baseline gives the expected state. Controlled deployment carries that state into production. Runtime observation reveals what production actually became. Reconciliation either restores the baseline or records a bounded decision to change it. Configuration remains secure only while that loop keeps all four claims connected.

Configuration drift control loop from baseline to deploy, runtime observation, drift detection, triage, remediation, and either baseline update or time-boxed exception.
Drift management is a control loop: define the secure state, deploy it, observe reality, and either restore the baseline or approve a time-boxed exception.

Write a baseline that can disagree with reality

A baseline is the expected secure state for a class of systems. It needs enough precision to produce a useful disagreement. “Enable logging” cannot tell an operator whether a production database is compliant. “Record authentication, privilege, schema, and configuration changes; export them to the security account within five minutes; retain them for the approved period; deny database administrators deletion access” can.

The invoice platform inherits library-wide requirements for individual administration, encryption, audit evidence, and restricted network access. Its service baseline then specializes those requirements for each surface:

  • the managed database accepts application traffic only from the production workload identity and administration only through the controlled access path;
  • the Kubernetes namespace rejects privileged containers, unapproved registries, host namespaces, and unbounded service accounts;
  • the export worker runs from an approved image digest with a read-only root filesystem and explicit resource limits;
  • the support SaaS tenant uses federation, strong authentication, separate administrator roles, and an export of role changes;
  • the edge and network controls expose only named application routes and preserve changes outside the reach of ordinary service administrators.

Operating-system controls still belong where the team manages an operating system. They do not automatically protect a managed database, serverless function, container workload, network appliance, or SaaS tenant. Each technology needs a baseline at the layer the team can actually configure. Inheritance should remove repetition without hiding applicability: a requirement should say whether it applies, does not apply, or is replaced by a platform control.

A usable baseline record contains:

  • a stable requirement identifier and the secure state in testable language;
  • the system classes and environments to which it applies;
  • the threat or failure the setting constrains;
  • the desired-state location and deployment mechanism;
  • the runtime observation and acceptable observation delay;
  • the control owner, review authority, and evidence location;
  • the rollback or safe-failure expectation;
  • the exception route and review trigger.

This is the secure configuration baseline template. It can live as policy-as-code metadata, repository configuration, or a small control catalogue, provided its identifiers connect requirements to deployments, observations, and exceptions. A prose document that cannot be joined to running resources is only a hardening opinion.

Turn hardening guidance into local engineering decisions

The team does not invent every setting. It draws from applicable CIS Benchmarks, vendor and cloud-provider hardening guides, platform recommendations, internal security standards, threat models, incident findings, and reliability experience. Those sources propose controls; they do not know the invoice platform’s tenant boundaries, failure budget, legacy dependencies, or administrative model.

For each recommendation, decide applicability before implementation. Identify the attacked capability, the systems that expose it, and the operational cost of the proposed setting. Then express the local requirement, verification method, owner, and exception route. If a benchmark recommends disabling a database feature, the resulting control should name the database population, the permitted value, the workload that still depends on the feature, and the evidence that will detect re-enablement.

Scores are weak substitutes for this reasoning. A host can score highly while its container workload has an overprivileged service account. A cloud project can satisfy dozens of settings while one untracked firewall rule opens the consequential path. Conversely, a justified deviation may reduce a benchmark percentage without weakening the relevant boundary. The baseline must defend the system’s threats, not the shape of an external worksheet.

Revisit decisions when the platform changes, a provider introduces a safer default, an incident reveals a gap, or operators repeatedly bypass a control. Repeated bypass is evidence. It may show careless operation, but it may also show that the baseline fights a legitimate service need and should be redesigned rather than ceremonially restored.

Preserve one configuration lineage

Ordinary changes should begin in version control or an equivalent reviewed system and end with observed production evidence. The change record needs the intended state, reason, affected population, security consequence, reviewer and approver, rollout, stop conditions, rollback, and the observation that will confirm the result.

Review consequence, not just syntax. A one-line change to public exposure, privileged identity, encryption, audit logging, deletion protection, cross-account trust, backup retention, or a SaaS administrator role can redraw a trust boundary. Route those changes to someone able to judge that boundary. Routine parameter tuning may use the normal peer-review path; not every configuration edit needs security ceremony.

The database incident cannot wait for a normal merge. The operator records both emergency actions, the target database, the source network, the reason, the approving incident commander, an expiry, and the command or console audit identifiers. That creates a temporary configuration lineage even though production changed first. Before the incident closes, the team must choose one of three outcomes:

  1. Revert the firewall rule because the baseline remains correct.
  2. Encode and review a narrower permanent route because the required operating model changed.
  3. Keep a temporary deviation through an approved exception while a safe design is built.

“Document the console change later” is too vague; it permits the repository and production to remain contradictory. Emergency access should automatically create reconciliation work with an owner and due time.

Rollback also belongs to the lineage. Hardening can break name resolution, health checks, administrative recovery, database replication, or customer traffic. A rollback should restore a known state, retain the failed deployment evidence, and reopen the security decision. Silently disabling the control restores service by losing the boundary.

Observe what production became

Drift is a difference between expected and observed configuration, not merely a difference between a repository and a console. The observed state needs reliable resource identity, environment, collection time, and source. Otherwise a stale replica, deleted cluster, or similarly named tenant can generate convincing noise.

No single observation method covers the platform. Infrastructure plans compare managed desired state with provider state. Cloud configuration services and scheduled scans inspect account resources. Kubernetes admission controls prevent some states, while audit and runtime observation catch changes or controllers that admission did not settle. Endpoint posture checks inspect managed hosts. Database queries and SaaS exports reveal settings behind service APIs. Network-device configuration archives expose direct administrative edits. Systems without useful APIs need a named manual review and an honest statement about the evidence gap.

Preventive controls and detection should reinforce each other. Admission policy may reject a privileged pod before it runs, but the team should still observe workload privilege at runtime. A policy may block public object storage, but a configuration export should show the current account population. Prevention limits unsafe states; observation detects blind spots, policy failures, and changes made outside the expected path.

The database finding records the expected firewall set, observed rule, database identity, first and last observation, collection source, change actor where available, and affected boundary. Triage then proceeds in consequence order:

  1. Confirm that the observation is current and belongs to the named production resource.
  2. Find the change record, incident action, platform event, or actor that explains it. An unknown privileged change may be an incident, not housekeeping.
  3. Trace what new access, privilege, data, or control loss the drift creates. Disabled audit logging, broad administrator roles, public routes, weakened encryption, missing backup protection, and deletion changes deserve particular attention.
  4. Decide whether to contain immediately, restore the expected state, adopt a reviewed new baseline, or create a bounded exception.
  5. Name the owner and deadline, then choose closure evidence from the runtime system rather than from ticket status.

For the firewall rule, the scanner identity and cloud audit event confirm a real emergency change. The support network is broader than the administrative path allowed by the baseline, and the incident has ended. The operator removes the rule through a reviewed change. A fresh provider export and policy result prove that the database again accepts administration only through the controlled path.

This drift triage checklist is deliberately sequential. Verification comes first because stale data should not trigger risky remediation; provenance comes next because an unexplained administrator action changes the response; consequence determines urgency; disposition determines the work; runtime evidence closes it.

Automate only reversals you understand

Auto-remediation shortens exposure when the expected state is unambiguous and restoring it has bounded operational effect. Re-enabling a required audit sink, removing an unauthorized public-storage flag, or rejecting a privileged workload may be suitable when the affected population, dependencies, and failure behavior are known.

Automation should identify the baseline rule and resource, preserve the before-state, emit a change record, alert an owner, verify the after-state, and stop after repeated failure. It also needs suppression tied to an approved change window or exception. Without that connection, a deployment and remediator can fight each other while both claim compliance.

Do not let a generic remediation engine rewrite database parameters, identity policies, network routes, or production workloads merely because a scanner found a difference. The database connection limit from the incident is drift too, but automatically lowering it during peak traffic could recreate the outage. The team first tests the old limit under current load, then either deploys it safely or updates the baseline through review.

Make deviations explicit and temporary

Some systems cannot meet a requirement immediately. An exception is a controlled disagreement with the baseline, not permission to stop looking. Record the requirement and exact resources, observed deviation, business need, risk and reachable consequence, accountable business and security owners, compensating controls with their evidence, remediation plan, expiry, review date, and triggers for early reconsideration.

Suppose a legacy network appliance cannot yet export administrative events to the protected audit account. A useful exception still requires individual administration, restricted management routes, local tamper-resistant retention where supported, daily export verification, and a replacement owner and date. “Legacy network devices exempt” would unnecessarily discard controls the appliance can meet and conceal how much risk remains.

Exceptions must appear in the same drift view as unknown deviations. That lets an operator distinguish “observed and approved until 30 September” from “observed with no explanation” without teaching the scanner to ignore the setting forever. On expiry, restore the baseline or make a new risk decision using current evidence. Repeated renewal should force a harder choice: revise an unrealistic baseline, replace the platform, or elevate a persistent risk to someone with authority to own its consequence.

Read the loop as evidence

Healthy configuration evidence answers four linked questions: what state was required, how it was deployed, what state was observed, and who authorized every difference. Repositories and policy definitions answer the first two only when deployment records connect them to resources. Provider exports, runtime checks, Kubernetes audit events, SaaS tenant exports, and network archives answer the third. Change and exception records answer the fourth.

Prefer machine-readable, resource-bound evidence to screenshots. A screenshot often omits the account, tenant, collection time, surrounding settings, and means of reproduction. Where a system offers no export, a screenshot may be the available evidence; record who collected it, from which system, when, and what blind spot remains.

Preserve failed checks and failed hardening deployments as well as clean results. A control that repeatedly breaks service is telling the team something about the design. A drift queue that grows without owners is telling the team something about the operating model. Evidence should cause a choice, not merely fill an archive.

The invoice database now has one configuration story again: the baseline names the allowed path, the emergency record explains the temporary rule, the audit log identifies the actor, the reviewed reconciliation removes it, and runtime evidence confirms the boundary. A team that can produce that chain can recover from drift. A team that must open consoles one at a time is still discovering what it operates.