57. Hardening batches: many controls on many hosts, one approval
This guide describes Lawliet 1.6.3.b (the current release, a beta: earlier releases are beta. The first stable release will be 2.0.0). Screens, commands and procedures may change in later versions; the usage guide is updated with each release. Check the version your server runs under Settings > Platform or with ./lawliet version, and see the Releases page for what changed.
A batch hardens a set of hosts with a set of controls in one request. It is approved once, under exactly the approval policy of a single live run, and every host then starts at the same time. Each host runs an ordinary hardening run (chapter 26): the same checks when the batch is created and again when it is approved, the same validation (a control is marked compliant only after the host passes the check again), the same rollback. One host failing never stops the others.
A batch is started from two places:
- Hardening > Planner, after Plan N hosts (57.2);
- a completed scan's Fix plan (57.3).
It is followed, approved, cancelled and rolled back on the Hardening page, under Batches (57.4 - 57.6). A batch can also be approved now and applied later, inside a maintenance window (chapter 58).
| Task | Permission | Four-eyes |
|---|---|---|
| Create a batch (live or dry run) | Run hardening | no - a live batch waits for approval; a dry run needs none |
| Approve a batch | Run hardening | as a single run: yes when dual control is on for "Execute remediation"; with a lockout risk accepted, never the person who requested it |
| Roll back a batch, or one host of it | Run hardening | yes - "Execute remediation" |
| Cancel a batch | Run hardening | no |
| See batches and their hosts | View hardening | - |
Limits: up to 500 hosts and 1000 controls in one batch (a whole profile fits: the largest built-in profile has 533 controls).
57.1 What a host runs, and what it skips#
You choose controls and hosts; each host runs only what applies to it. Every control a host does not run is listed under that host as skipped, with the reason - nothing is dropped silently:
| Reason shown | Meaning |
|---|---|
| Host refused: "Windows host: CIS Linux Benchmark is for Linux hosts only. ..." | The host runs another OS than the scan's benchmark; nothing is planned or sent to it |
| "no result for this host in scan N (another OS or benchmark)" | The scan has no result for the control on that host - for example a Windows control on a Linux host |
| "not in this host's results (another OS or benchmark, or not scanned yet)" | Planner batch: the host's latest results do not include the control |
| "does not apply to this host: ..." | The catalog says the control is not for that role or OS version |
| "already passing on this host" | The control passes there; a batch runs only the failing ones on each host |
| "not assessed on this host: nothing measured to fix" | The scan could not read the control on that host |
| "GUARD_BLOCKED: ...", "ORDER_BLOCKED: ...", "AUDIT_STAGE_REQUIRED: ...", "BREAKAGE_PREDICTED: ...", "ALREADY_REQUESTED: ..." | The planner's checks refuse it on that host now (41.4). Fix the cause, or work on that host in the planner (stage the audit, acknowledge breakage, override with approval) |
| "refused by the access guards: ..." | The change would cut how Lawliet reaches the host, or needs per-host input it was not given (26) |
| "No remediation script available", "Control status 'compliant' not eligible for hardening" | The run could not build a step for it on that host |
A control that can lock an operator out, or one that breaks how Lawliet reaches a host, is not skipped: the whole batch is refused until you accept the risk (57.2 step 6).
57.2 Procedure: enforce from the planner#
- Open Hardening > Planner, click the hosts (up to 500) and press Plan N hosts (41.1).
- Under the summary line, the picker lists every control failing on at least one of the hosts, grouped by section (the catalog family: ssh, auditd, kernel, ...). Each row says "fails on K/N".
- Choose the controls with any of:
- Select all failing - every control failing on any chosen host (each host runs only the ones failing there);
- a section checkbox - ticks or clears the whole section; it shows a dash when only part of the section is ticked;
- the Filter controls box, any severity and any section lists, then Select all visible (N) - adds what the filter shows (what is ticked and hidden stays ticked);
- Standard profile / Strict profile - every control of that catalog level (40.2); the buttons appear only when the controls carry the level;
- single control boxes; Clear to start again.
The count on the right reads "N controls x M hosts".
- Press Enforce on M hosts, or Audit on M hosts (dry run) to see what each host would run without changing anything (a dry run needs no approval).
- What you see: "Batch #id: waiting for approval - K of M hosts have work, S control(s) skipped with a reason." and one line per host, "host: N to run, S skipped", then Open Hardening to approve. Nothing has changed on any host.
- If the batch is refused:
- a control that can lock you out: the lockout box names each control, its risk, the hosts and the recovery to take first; issue the recovery artifacts (26.5), type the phrase and confirm;
- "These controls break how Lawliet reaches some hosts": each control and host with what breaks and what to change first; change it first, or tick I accept that these changes break how Lawliet reaches those hosts. and press Go ahead;
- "No selected control can run on any chosen host." with the reasons per host: nothing was created.
57.3 Procedure: start hardening from a scan's Fix plan#
- Open the completed scan. Fix plan says "N fixable here, K need a manual change".
- Hosts (M of M): every host the scan covered is chosen. Click a host to leave it out.
- Choose the controls with the same tools as 57.2 step 3. Every fixable control of the scan is listed (by section); the quick fixes failing on a chosen host are ticked to start with.
- For an NTLM deny control, type the servers that may keep NTLM on every chosen host; for the WinRM address filter, the addresses WinRM may still accept (both apply to every chosen host). To review the NTLM uses each host saw, use One host in detail below the Fix plan (22.4).
- Press Start hardening on M hosts (or Dry run on M hosts). The result and refusals are as in 57.2 steps 5 and 6.
57.4 Procedure: approve a batch (four-eyes)#
- Open Hardening. Batches lists each batch: number, live or dry run, its state, "N controls x M hosts", the applied / failed / skipped counts and where it came from.
- Press Approve batch, then Confirm: change M hosts now.
- The same policy as a single run (26.2): with dual control on for "Execute remediation", the request is held - give the reason, a second officer signs it in Approvals, and the person who asked presses Execute now there (appendix B). With dual control off, your confirmation starts it. A batch whose lockout risk was accepted is never approved by its requester alone: "This batch accepts a lockout risk and needs a second administrator: it cannot be approved by the person who requested it." A batch marked auto-baseline (prepared for a host that joined a group, 42.9) is approved exactly the same way; its requester is the person who turned auto-baseline on. A review item link opens the batch directly (
/hardening?batch=N).
What you see: every host starts at once; the state becomes executing, then completed, partial, failed, or applied, awaiting restart while changes wait for a host restart. "N hosts need a restart before the changes are validated." counts those hosts; each such host shows restart pending. The changes are validated after the host restarts.
A host whose checks refuse at the moment of approval (the host changed since the batch was created), or whose wait expired, is cancelled and shows why; the other hosts run.
57.5 Reading the hosts of a batch#
Press Batch #id to open it. One row per host: its state, "N applied, N failed, N skipped", "N waiting for approval" before the approval, restart pending when it applies. Press the host name for every control: its step state (and error), and each skipped control with the reason.
57.6 Procedure: roll back or cancel a batch#
- Roll back batch > Confirm: roll back M hosts: every host's applied changes are rolled back (four-eyes, as above). Roll back host on a host row (press it twice) rolls back that host only. "Nothing to roll back" when no host has a change that can be reverted.
- Cancel batch > Confirm cancel: stops every host's commands not yet delivered; a command already on a host cannot be recalled, and its result is recorded but not acted on.
Rollback works as for single runs (26.3): the host reads rolled back only once its agent confirms; a later scan shows the actual state.
57.7 API#
| Call | What it does |
|---|---|
POST /api/v1/hardening/batches | Create: source (scan with scan_id, or planner), control_ids, agent_ids, selection (failing or explicit), is_dry_run, accept_lockout_risk, accept_dependency_risk, optional ntlm_exceptions, winrm_ip_ranges |
GET /api/v1/hardening/batches, GET .../batches/{id} | List, and one batch with every host's steps and skips |
POST .../batches/{id}/approve | Approve (four-eyes) |
POST .../batches/{id}/rollback | Roll back; body {"agent_ids": [...]} for chosen hosts, {} for all (four-eyes) |
POST .../batches/{id}/cancel | Cancel |
GET .../batches/scan-options/{scan_id} | The hosts of a scan and its fixable controls with where each fails |
POST .../batches/lockdown-preview | Lockdown confirmation (57.8): the create body; returns per host what runs, every skip with its reason, and what is waived. Creates nothing |
Each create, approval, rollback and cancel is in the audit trail (hardening_batch, hardening_batch_rollback). A run of a batch cannot be approved on its own: "Execution N is part of batch M: approve the batch."
57.8 Lockdown: everything that can be rolled back#
WARNING - Lockdown can break applications, remote management (WinRM/SSH/RDP from other hosts) and user access on these hosts. It applies every failing control of the hosts' benchmark and accepts every predicted risk - breakage, dependency and lockout - without recovery (break-glass) artifacts. The Lawliet agent keeps working and everything Lockdown applies can be rolled back with one click. Use it on hosts you can afford to lose access to by any path other than Lawliet.
Lockdown hardening is a profile next to Standard and Strict (not the same as Under Attack's lockdown mode). It is offered:
- in Hardening > Planner: Profile =
lockdown, then Plan host (a Lockdown hardening: 1 host button above the plan) or Plan N hosts (a Lockdown hardening: N hosts button under the picker); - in a scan's Fix plan, under the picker: Lockdown hardening: N hosts.
Lockdown runs on Linux and Windows hosts (the safety timer is a systemd timer on Linux and a SYSTEM scheduled task on Windows). A macOS host is refused with "Lockdown is not available on macOS".
Lockdown always takes every control in view on every chosen host, whatever is ticked in the picker; per host only the controls failing there run.
What Lockdown applies, and what it skips#
| Skipped, with this reason | Why |
|---|---|
| "no automatic rollback: Lockdown applies only what it can roll back - apply it by hand if you want it" | The control has no rollback script, or its rollback only prints. Lockdown never applies what one click cannot undo; the list is what to apply by hand if you want it |
| "rollback not exact: ..." | The rollback is known not to put the host back exactly: it sets a fixed value instead of the value the host had (the sysctl -w rollbacks of the older CIS Linux content), removes a package but not what installing it pulled in, or filters a crontab instead of restoring it. Skipped until the content is fixed |
| "would cut the Lawliet agent: ..." | The change could stop the agent working: making the audit rules immutable (-e 2, Ubuntu UBU-AUDIT-IMMUTABLE - the agent's file monitoring and EDR change audit rules), or stop it reaching the server: outbound default-deny (Ubuntu UBU-FW-DEFAULT-DENY-OUT), stopping the agent or a service it needs (DNS client, network, cryptography, WMI, event log, task scheduler; a local DNS server the host itself may use), the Defender ASR prevalence and obfuscated-script rules (they can block the agent binary and its PowerShell), application control (AppLocker, WDAC, SRP), PowerShell constrained language or an AllSigned execution policy, proxy settings, permissions on the agent's files, FIPS / FUTURE crypto policies, resolver changes |
| any other reason (a guard, not applicable, already passing) | As for every batch (57.1) - see below |
The firewall controls that only restrict inbound traffic or switch the firewall on are applied: the agent only connects out to the server, and established replies stay allowed. SChannel (TLS) changes are applied: the agent uses its own TLS library. Time-service, user-rights and UAC changes are applied: the agent's command signing uses the server's clock, and the agent runs as SYSTEM / root.
What Lockdown waives (recorded)#
Only for a Lockdown run, and every waiver is listed on the batch per host and control and written to the audit trail:
- the breakage, dependency and lockout acknowledgements (accepted for you);
- the do-not-disrupt baseline guard - Lockdown does not wait for baseline learning or approval;
- the recovery artifact guard - no break-glass account or key is needed or made;
- the audit stage wait and the NTLM, Kerberos RC4 and RPC audit periods;
- a prerequisite that is applied earlier in the same run.
Every other guard stays exactly as it is, and its controls are listed as skipped: the domain controller built-in Administrator / Guest rename (CIS 2.3.1.5 / 2.3.1.6) stays refused, a control of another operating system or a domain-only control on a workgroup host cannot run, and the guards that protect Lawliet's own access (its credentials, the agent's ports and Defender exclusion, a single domain controller) still refuse.
Procedure: lock hosts down#
- Open the Planner (profile
lockdown) or the scan's Fix plan, choose the hosts. - Press Lockdown hardening: N hosts. The confirmation shows the red warning and, per host: "N controls to apply, M skipped (no rollback), K skipped (would cut the agent), J skipped (other reasons)", and Accepted and waived on this host (the lockout and dependency risks accepted and every waived check, control by control); open each group for the controls and reasons.
- Press Request Lockdown (one approval). The batch appears under Hardening > Batches with a red Lockdown hardening badge, waiting for approval. Its row says what is accepted and waived and how many controls are skipped; the host rows list them.
- A second administrator presses Approve batch (57.4). The requester can never approve a Lockdown alone, whatever the dual-control setting. One approval covers every host and control. The approval request names it ("Approve LOCKDOWN hardening batch N ... every predicted risk is accepted ... without recovery artifacts; ... checks are waived for W controls; S controls are skipped"); an approval that does not name Lockdown with those counts is refused.
The audit trail records hardening_lockdown: the request ("lockdown requested by X: breakage, dependency and lockout risks accepted without recovery artifact") and the approval ("lockdown: lockout risk accepted without recovery artifact by X, approved by Y"), each with what was waived per host.
Waves and the health gate#
Lockdown does not send everything at once. Each host gets its changes in waves of 15: what other changes depend on first, then ordinary settings, then services, then remote access and authentication, and the firewall last. The next wave is sent only after the host has returned every result of the wave before and its agent has reported again afterwards - proof that the agent still reaches the server. The host row reads "Lockdown wave W of N".
The safety timer. Before each wave Lawliet sets up a safety timer on the host, through the agent: a persistent systemd timer lockdown-deadman-<run>.timer that checks every minute and survives a restart, with a copy of the files the wave may change and every rollback applied so far. While the run is live the server sends the agent a signed contact every minute; the agent runs it and so proves both that it is alive and that it talks to the real Lawliet server (nothing else can sign it). The timer counts its one-minute ticks, not clock time, so a clock that jumps (Lockdown's own time-sync controls, a resumed VM) neither fires nor delays it. If 5 ticks in a row pass without a new signed contact, or with the Lawliet agent itself not running, the timer rolls the run back by itself - within about 6 minutes of the last contact - newest change first, and restores the copied files. After the host restarts, the agent first gets 10 minutes to come back before a missed tick counts - once: the next grace needs a real contact first, and missed ticks are kept across restarts, so a host stuck in a restart loop without contact is still rolled back. A restart runs the timer twice (the catch-up and the minute); runs less than 30 seconds apart count as one tick. It undoes only the changes that actually ran in this run (each one marks itself when it starts and takes the mark back if it refused itself), so a change that never ran is never "rolled back" from an older backup. A rollback that fails (dpkg busy with an automatic update, say) is tried three times.
The timer is removed on every way a run ends - completed, cancelled, halted, or Roll back Lockdown. After a cancel or a halt, changes already sent to the host still run there: the timer stays armed (and contacted) until each has reported - the row says "Stopping: waiting for N steps already sent" - and is removed then (at most 15 minutes later). Then: Lawliet first tells it to stand down (it never fires after that, even if removing it fails; a change or a timer set-up for that run arriving later is refused; the host keeps that "stopped" mark, named after this Lawliet server and the run, for 30 days), then removes it, and keeps retrying until the host confirms; until then the host row says "Safety timer still armed on the host". As a last resort the timer removes itself, without rolling anything back, once the run's maximum duration plus 2 hours has passed while the agent is still answering.
Lockdown needs an agent that understands this signed contact: before anything else it asks the agent once, and an agent that does not know it is refused ("the Lawliet agent on this host does not know Lockdown's signed safety-timer contact; upgrade the agent first").
If the timer fires, the host reports it as soon as its agent is back: the changes it undid read "rolled back" (by the safety timer), the row says "Rolled back by the safety timer at <time>", the run halts and nothing more is applied on top of the restored host. If a host refuses to set the timer up, Lockdown sends it no wave and halts. A host that already has a Lockdown run with the same number from this server (usually after the server's database was restored from a backup, so run numbers repeat) refuses it: "this host already has a Lockdown run N from this server ... Start the batch again: it takes a new run number"; the details name the host's mark to remove if the next attempt is refused too. If the agent answers a contact with "not armed" (the timer's records are gone, or the run was stopped on the host) while the run goes on, the run halts the same way: "the host reports its safety timer is not armed ...". Note: a Lawliet server that is down for more than 5 minutes while a Lockdown run is live counts as no contact - its hosts roll the run back. The contact is never withheld by the licence (it is safety work, like a rollback).
If the agent goes silent for more than 10 minutes while a wave is on the host and then comes back, the run on that host halts: whatever was queued and not delivered is withdrawn, the rest is skipped with "Lockdown halted after wave W: the agent was silent ...", the timer is removed, and the row says so in red. An agent that never comes back gets nothing more either, and its safety timer rolls the host back. Roll back what was applied (below), or fix the host by hand.
Procedure: roll back Lockdown#
- Roll back Lockdown on the batch (whole run), or Roll back Lockdown on this host on a host row; four-eyes as any batch rollback (57.6). Every applied change is rolled back, newest first.
- Controls Lockdown skipped were never applied, so there is nothing else to undo.