Firewall acceptance through CLI: provisional rules and independent approval

A fresh Debian VM, exact firewall plan, independent checks and rule acceptance. A separate fixture demonstrates actual automatic rollback after expiry.

A shield between an hourglass with a return arrow and an acceptance card.
A shield between an hourglass with a return arrow and an acceptance card.

After creating the administrator and restricting SSH, the next step was firewall setup. I joined it to a separate host setup scope and tested two cases on fresh Debian VMs: acceptance after independent checks, and a real rollback when approval did not arrive in time. Initial access and firewall ran on the same machine within one boot.

Prerequisites and a separate profile

The VM already has a key-only administrator, password-required sudo, verified SSH policy, base Nginx and the required nftables packages. Independent console evidence identifies the machine and current boot. The firewall profile references the existing access request and original management policy. These paths are placeholders:

{
  "schema_version": 1,
  "entry_mode": "clean",
  "environment_file": "/private/example-administrator.env",
  "firewall": {
    "request_file": "/private/example-access-request.json",
    "policy_file": "/private/example-management-policy.json"
  }
}

The policy names the server interface and server SSH port. An operator-side forwarded port may differ. The run does not guess these values or select another profile as fallback. It also does not add rule persistence, WireGuard or open web ports.

A plan for clean state only

The plan retains the original firewall command’s exact candidate and binds inputs and the executable CLI. Existing, foreign or incomplete rules do not become a new installation. Subsequent reading also checks the original transaction: matching policy with a different nonce is insufficient.

deploy-cli host setup plan \
  --profile-file "$FIREWALL_PROFILE" --plan-file "$SETUP_PLAN"

Application leaves time for approval

After reviewing the plan, approve local records and the specific privileged action. The original module retains a recovery connection, arms its rollback timer, applies rules and verifies a fresh SSH session with sudo.

deploy-cli host setup apply \
  --plan-file "$SETUP_PLAN" --plan-sha256 "$SETUP_PLAN_SHA256" \
  --approve-local-write --approve-privileges

Successful apply returned awaiting-acceptance. This is completed provisional application that still needs independent approval. Retain applied_sha256 from the full response. Selected actual CLI JSON fields follow, with digests omitted:

{
  "status": "awaiting-acceptance",
  "completed_stages": 1,
  "host_write_attempted": true,
  "host_write_performed": true,
  "firewall_applied": true,
  "acceptance_required": true,
  "runtime_ready": false,
  "whole_host_ready": false
}

Independent checks before accept

On the VM I ran network checks from a separate network namespace: web-port connections were blocked, the drop counter increased and the created test interfaces were removed. An independent serial console confirmed access and the same machine/boot again. These are fixture-local checks; they do not establish public Internet reachability.

The approval file belongs to the operator and contains the original plan, target and observation bindings plus four acknowledged checks. CLI does not manufacture it from its own successful SSH session. SHA binds exact bytes; the checks themselves must actually occur.

Separate accept receives the plan, provisional-completion and independent-file digests. The original finite file schema is checked first: an accidental secret file or incomplete acknowledgements are not copied into controls. Original commit then checks live state and the timer deadline. Selected actual result fields follow:

deploy-cli host setup accept \
  --plan-file "$SETUP_PLAN" --plan-sha256 "$SETUP_PLAN_SHA256" \
  --applied-sha256 "$APPLIED_SHA256" \
  --acceptance-file "$INDEPENDENT_ACCEPTANCE" \
  --acceptance-sha256 "$INDEPENDENT_ACCEPTANCE_SHA256" \
  --approve-local-write --approve-privileges
{
  "status": "passed",
  "completed_stages": 2,
  "host_write_performed": true,
  "firewall_ready": true,
  "runtime_ready": false,
  "whole_host_ready": false
}

Read accepted state without reinstalling

The completion binds 13 operator-local control files, including exact approval bytes and actual results. Subsequent verify and digest-pinned reading do not call apply or commit. All 13 selected original access files, package state and SSH/Nginx observations were preserved; 18 selected files stayed exact during reads.

deploy-cli host setup verify \
  --plan-file "$SETUP_PLAN" --plan-sha256 "$SETUP_PLAN_SHA256" \
  --completion-sha256 "$FIREWALL_COMPLETION_SHA256"

After commit I separately read the original service and timer state. The two commands’ actual stdout follows. The timer command exited with code 3 and inactive; the service exited with code 0 and active.

systemctl is-active deploy-cli-firewall-runtime.service
systemctl is-active deploy-cli-firewall-runtime-rollback.timer
active
inactive

Second fixture: approval arrived too late

On another fresh VM I selected a short 30-second window. Independent checks were completed, but accept was not run before the window ended. The original timer restored the initial empty ruleset itself. Later accept refused before writes or a commit intent. The following summary contains two saved CLI responses: setup refusal and a separate successful read of rolled-back state.

{
  "setup_accept": {
    "status": "failed",
    "host_write_attempted": false,
    "host_write_performed": false,
    "local_write_attempted": false
  },
  "firewall_inspect": {
    "status": "passed",
    "action": "rolled-back",
    "write_performed": false,
    "checks": {
      "ownership": "rolled-back",
      "persistence": "not-enabled"
    }
  }
}

An incorrect approval SHA also refused before copying it or creating commit intent. Apply replay without a completion digest does not restart a writer. Lost write acknowledgements are covered by model tests; no real process interruption is claimed for these VMs.

The frame below summarizes saved actual results in a genuine VTE terminal. Server commands were not executed again during capture.

Saved firewall acceptance and actual automatic rollback results from separate VMs
A genuine VTE frame summarizing saved results from two VMs: independent checks and rule acceptance, plus automatic rollback after expiry. Network checks ran in a separate fixture namespace, not across the public Internet. Commands were not executed again during capture.

Next step

firewall_ready=true covers the accepted runtime policy within the current boot. Rule persistence, WireGuard, data services and joining PHP/Symfony/HTTPS have separate stages. runtime_ready and whole_host_ready remain false here. Both test VMs were shut down normally after verification.

  1. Operations & Security nftables default-deny without losing server control
  2. Operations & Security A separate administrator: from key login to the right privileges
  3. Operations & Security When to restrict root and password-based SSH
  4. Operations & Security Recovering VPS access when SSH stops working
  5. Operations & Security From root password to key-only administrator: initial access through CLI

A project by the author · Weather Solution200

After reading, a look outside.

Temperature, rain and wind in your city. Check the forecast and plan the hours ahead.

Check the forecast
Next article