WireGuard firewall through CLI: separate acceptance and explicit rollback
Apply firewall rules with independent SSH/sudo/console checks, exact acceptance and separate explicit VM rollback. A working tunnel needs its own proof.
The WireGuard key and server configuration are prepared, while the tunnel remains off. The next separate step permits the required uplink UDP and management SSH from the agreed peer through the WireGuard interface. I joined the original firewall transition to host setup and checked two cases: explicit acceptance and explicit rollback before acceptance.
What the transition changes
The original management policy is already accepted and verified after boot. The original transition atomically adds two rules and two counters: IPv4 UDP admission on the selected uplink/port and management SSH from the selected private peer through the selected WireGuard interface. Existing public SSH remains available. This neither starts WireGuard nor opens web ports or proves private SSH.
Keep the original bindings
The following profile is illustrative. Original request and server node must exactly match the accepted firewall, including key/recovery/trust/policy bindings. A separate current request supplies new independent console evidence for the current boot. Original documents are not rewritten to bypass checks. clean means the target transition and its local controls are absent, not an empty server. Replace fictional paths and SHA with reviewed values.
{
"schema_version": 1,
"entry_mode": "clean",
"environment_file": "/private/example-administrator.env",
"wireguard_firewall": {
"request_file": "/private/example-original-request.json",
"node_file": "/private/example-server-node.json",
"current_boot": {
"request_file": "/private/example-current-request.json",
"install_plan_file": "/private/example-original-install-plan.json",
"install_plan_sha256": "<EXACT_ORIGINAL_INSTALL_PLAN_SHA256>"
}
}
}
Apply does not establish acceptance
The plan binds the exact parent state, current boot, insertion position and original policy. After review, apply that exact SHA. The lower owner retains nftables, journal and file replacement responsibilities; setup coordinates original commands.
deploy-cli host setup plan \
--profile-file "$TRANSITION_PROFILE" --plan-file "$SETUP_PLAN"
deploy-cli host setup apply \
--plan-file "$SETUP_PLAN" --plan-sha256 "$SETUP_PLAN_SHA256" \
--approve-local-write --approve-privileges
Selected actual VM CLI response fields follow. awaiting-acceptance retains a separate acceptance step. Eight provisional local files bind the plan, intent, apply result and separate .commit.plan.json. Keep applied_sha256 from the full response for accept.
{
"status": "awaiting-acceptance",
"scope": "same-boot-wireguard-firewall-transition",
"completed_stages": 1,
"host_write_performed": true,
"firewall_applied": true,
"acceptance_required": true,
"runtime_ready": false,
"whole_host_ready": false
}
Check access through independent channels
After apply I made a fresh public key-based SSH connection, used password sudo and logged in through a separate serial-console session on the same VM. Passwordless sudo was denied. Actual UDP packets forwarded by QEMU reached the guest’s actual uplink: the permitted-port counter rose by three and the blocked control-port counter also rose by three. The following summarizes actual counters; it is neither raw nft stdout nor a public Internet probe. Separate network probes confirmed ports80/443 blocked and removed their temporary namespace.
{
"actual_uplink_UDP_admission_packets": 3,
"wrong_UDP_port_drop_packets": 3,
"not_public_Internet_probe": true
}
The operator acknowledges completed checks
This is a schematic separate approval file, not an acknowledgement automatically produced by setup. The three original labels — new_public_ssh, password_sudo, console — become true only after actual independent checks. Evidence remains outside the local control directory; setup retains its path and SHA and checks unchanged bytes.
{
"schema_version": 1,
"plan_sha256": "<ORIGINAL_COMMIT_PLAN_FILE_SHA256>",
"acceptance": {
"new_public_ssh": true,
"password_sudo": true,
"console": true
},
"proof_file": "/private/example-independent-proof.json",
"proof_sha256": "<INDEPENDENT_PROOF_FILE_SHA256>"
}
Keep the digests distinct: the upper setup-plan SHA, native transition-plan SHA and outer .commit.plan.json file SHA serve different bindings. The original approval’s plan_sha256 pins the bytes of that last commit-plan file. --acceptance-sha256 separately pins the approval file itself. An incorrect approval SHA was refused before copying the file, recording commit intent or changing the server.
deploy-cli host setup accept \
--plan-file "$SETUP_PLAN" --plan-sha256 "$SETUP_PLAN_SHA256" \
--applied-sha256 "$APPLIED_SHA256" \
--acceptance-file "$INDEPENDENT_APPROVAL" \
--acceptance-sha256 "$INDEPENDENT_APPROVAL_SHA256" \
--approve-local-write --approve-privileges
Explicit acceptance
Setup records one-shot commit intent before dispatch. Original commit compares current inspect against the reviewed plan and independent acknowledgement. Successful completion binds 15 local artifacts, including exact approval bytes and the evidence reference. Selected actual accept response fields follow.
{
"status": "passed",
"completed_stages": 2,
"host_write_performed": true,
"wireguard_firewall_ready": true,
"runtime_ready": false,
"whole_host_ready": false
}
Read again without applying again
Verify and completion-pinned apply only read the exact original plan, boot and phase. Altered evidence invalidates this reading. Apply without completion SHA refuses. Partial or unknown outcomes do not trigger a hidden retry, resume or rearm.
deploy-cli host setup verify \
--plan-file "$SETUP_PLAN" --plan-sha256 "$SETUP_PLAN_SHA256" \
--completion-sha256 "$TRANSITION_COMPLETION_SHA256"
deploy-cli host setup apply \
--plan-file "$SETUP_PLAN" --plan-sha256 "$SETUP_PLAN_SHA256" \
--completion-sha256 "$TRANSITION_COMPLETION_SHA256" \
--approve-local-write --approve-privileges
Selected actual verify fields follow. Verify and pinned replay preserved all 36 selected server files. Zero attempted writes describes this accepted reading case.
{
"status": "passed",
"local_write_attempted": false,
"host_write_attempted": false,
"host_write_performed": false,
"wireguard_firewall_ready": true,
"runtime_ready": false,
"whole_host_ready": false
}
A separate VM for explicit rollback
On a second new overlay I applied the same transition without accepting it. I reviewed the original rollback-plan and ran rollback once for the known unaccepted state within the same boot. This module has no automatic rollback timer. The commands below are a separate explicit recovery path, not an emergency retry of any unknown write. They do not delete an accepted transition.
deploy-cli host wireguard firewall-rollback-plan \
--env-file "$ADMIN_ENV" --request-file "$ORIGINAL_REQUEST" \
--node-file "$SERVER_NODE" --plan-file "$ROLLBACK_PLAN"
# Review the exact original rollback plan before applying it.
deploy-cli host wireguard firewall-rollback \
--env-file "$ADMIN_ENV" --request-file "$ORIGINAL_REQUEST" \
--node-file "$SERVER_NODE" --plan-file "$ROLLBACK_PLAN" \
--plan-sha256 "$ROLLBACK_PLAN_SHA256" --approve-privileges
The following summarizes actual second-fixture results, rather than quoting rollback stdout. Original file bytes and normalized rules were restored; inode and modification times after atomic replacement are not claimed original. Transition history remained. Old accept after rollback refused without writes; no setup completion was produced. A separate original persistence verification confirmed the current boot again. History was not cleared for reuse.
{
"original_rollback_plan_and_single_apply": true,
"original_parent_contents_and_normalized_rules_restored": true,
"retained_transition_history": true,
"old_accept_refused_without_write_or_commit_intent": true,
"final_completion_absent": true,
"no_automatic_timer_or_rollback": true
}
What the results establish
The following combines first-VM observations and normal shutdown of both fixtures. Apply replaced only three original boot-owner files: controller, manifest and install-state. Original receipt/runtime, key and configuration remained intact; packages and SSH/Nginx/network/loader observations stayed unchanged. Both overlays preserved their parent disk content.
Original server files observed: 32
Original files preserved exactly: 29
Original boot-parent files replaced: 3
Selected files unchanged during verification/replay: 36
Original operator files preserved: 75
Provisional control files: 8
Accepted control files: 15
Host/local writes during pinned verification/replay: 0
VMs shut down normally: 2
Parent disk content preserved: yes
The frame below is a genuine VTE terminal summarizing saved evidence. Server commands were not rerun during capture. Work was confined to local VMs: rented E01, production and provider settings were unchanged. No native SIGKILL was exercised; unknown writer responses have model coverage.
Next: a prepared client and a working channel
wireguard_firewall_ready establishes only accepted rules in the same boot. A prepared client, public-key exchange, actual handshake, private-channel SSH/sudo, runtime and startup each need separate evidence. runtime_ready and whole_host_ready remain false. Private keys stay on their nodes; primary E01 backups remain in the Mirohost panel.