Firewall boot loading through CLI: installation and post-reboot verification

Install the firewall boot service through a separate CLI profile. A fresh VM proves actual reboot, SSH/sudo access and the exact accepted rules.

A server before a blue shield on a circular base, beside a gear and a block holding a key.

Accepted firewall rules protect the current boot, but that fact does not prove automatic loading. Next I joined the original boot-service installer to a separate CLI profile. A fresh Debian VM completed initial access, independent firewall acceptance, boot installation and a separate actual reboot.

Initial state and profile scope

Prerequisites are a key-only administrator, password-required sudo, verified host key, independent current-boot console, installed packages and an accepted management policy. The new profile references the same original request and policy. These paths are placeholders; they contain no secret values.

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

This installs into clean boot-service state. An existing or foreign loader is not automatically adopted. The policy SSH port belongs to the server; an operator-side forwarded port may differ. This profile installs no packages, configures no WireGuard and does not turn firewall acceptance into whole-server readiness.

Plan: accepted rules and systemd

The original module checks the accepted current-boot transaction, approval, journal and exact ruleset. Its plan binds those inputs, private files, system vendor units, machine and boot. Setup retains the exact plan bytes and executable CLI digest. Unaccepted runtime is a missing prerequisite, not an optional check.

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

Install without starting the loader now

After reviewing the plan, separately approve local records and privileged installation. CLI records intent before dispatch. The original module retains recovery SSH, installs its helper, manifest and systemd dependencies, enables boot loading without starting it immediately 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

Selected actual CLI JSON fields follow. persistence_installed=true means installation on the original boot. reboot_required=true leaves post-reboot acceptance open. Installation preserved current rules, packages and SSH/Nginx observations.

{
  "status": "passed",
  "completed_stages": 1,
  "host_write_performed": true,
  "persistence_installed": true,
  "reboot_required": true,
  "runtime_ready": false,
  "whole_host_ready": false
}

How SSH depends on the firewall

Dependencies cover the original systemd-networkd, ssh.service and ssh.socket. The following is actual VM content from /etc/systemd/system/ssh.service.d/40-deploy-cli-firewall-boot.conf. Requires names the required service; After orders it before SSH. Installation did not restart SSH or networking.

[Unit]
Requires=deploy-cli-firewall-boot.service
After=deploy-cli-firewall-boot.service

Verify installed state

Completion binds eight operator-local control files, not a replacement server manifest. Verify and completion-pinned reading use the exact original plan: matching rules with another manifest or approval are insufficient. The fixture preserved 18 original files; subsequent reads preserved 22 selected files exactly without writes. Apply without completion does not restart a writer.

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

A separate reboot of the test VM

After verifying installation, the fixture invoked ordinary systemctl reboot once. This is a separate fixture action, not a hidden setup stage or proof of the entire CLI reboot workflow. An independent serial console confirmed the same machine with a new boot; fresh SSH confirmed administrator and sudo access. I then ran the original reader:

deploy-cli host firewall-persistence verify \
  --env-file "$ADMIN_ENV" --request-file "$ACCESS_REQUEST" \
  --policy-file "$MANAGEMENT_POLICY"

Selected actual response fields follow. current-boot-verified and reboot=observed describe this actual new boot. Selected preboot files retained their contents; packages and normalized rules matched. Separate network-namespace checks also passed. They verify the fixture, not public Internet or provider networking.

{
  "status": "passed",
  "action": "current-boot-verified",
  "write_performed": false,
  "access_verified": true,
  "checks": {
    "persistence": "current-boot-verified",
    "reboot": "observed"
  }
}

Old completion does not authorize a new boot

After reboot I separately submitted old setup verify with the original completion. It refused without local or server writes. Original controls were not rewritten and old console evidence was not renewed automatically. Continuing the higher workflow still requires separate new-boot acceptance.

{
  "status": "failed",
  "host_write_attempted": false,
  "host_write_performed": false,
  "local_write_attempted": false,
  "runtime_ready": false,
  "whole_host_ready": false
}

The following summary combines two saved systemctl show results; it is not raw stdout from one command. After installation the loader is enabled but inactive; after separate reboot it is active/exited with a successful result.

{
  "after_install": {
    "Id": "deploy-cli-firewall-boot.service",
    "UnitFileState": "enabled",
    "ActiveState": "inactive",
    "SubState": "dead",
    "Result": "success"
  },
  "after_separate_VM_reboot": {
    "Id": "deploy-cli-firewall-boot.service",
    "UnitFileState": "enabled",
    "ActiveState": "active",
    "SubState": "exited",
    "Result": "success"
  }
}

The frame below summarizes saved actual results in a genuine VTE terminal. Server commands were not executed again during capture. The VM was shut down normally after verification.

A genuine VTE frame summarizing saved results: separate setup installation followed by one ordinary test-VM reboot. A new boot, SSH/sudo access and loaded rules were confirmed. Old setup completion refused without writes. Commands were not executed again during capture.

Next: WireGuard and renewed access proof

Private transport and separate current-boot verification precede further setup work. Automatic firewall loading does not establish PHP, database or whole-server readiness. This VM run changed neither rented E01, the main server nor provider settings. Primary E01 backups remain in the Mirohost panel.

  1. Operations & Security nftables default-deny without losing server control
  2. Operations & Security When to restrict root and password-based SSH
  3. Operations & Security WireGuard on Debian: private SSH access and a post-reboot check
  4. Operations & Security Recovering VPS access when SSH stops working
  5. Operations & Security Firewall acceptance through CLI: provisional rules and independent approval