WireGuard through CLI: key and config without starting the tunnel
Separate key/config stages, a named wireguard-tools install and actual VM checks. The private key stays on its node while the tunnel remains off.
After confirming the current-boot firewall, I moved to WireGuard. First prepare the key and server configuration while leaving the interface and service off. I reused existing original commands and joined them to two separate setup stages: key and config.
Prerequisite: one named package and a separate plan
I installed wireguard-tools on the VM through the original package module. The reviewed resolved closure contained only that package. Its actual fixture version was 1.0.20210914-3. This was no global system update; a separate verification followed. Key preparation does not install packages implicitly.
deploy-cli host packages plan \
--env-file "$ADMIN_ENV" --request-file "$CURRENT_ACCESS_REQUEST" \
--package wireguard-tools --plan-file "$TOOLS_PLAN"
# Review the exact resolved package closure first.
deploy-cli host packages apply \
--env-file "$ADMIN_ENV" --request-file "$CURRENT_ACCESS_REQUEST" \
--package wireguard-tools --plan-file "$TOOLS_PLAN" \
--plan-sha256 "$TOOLS_PLAN_SHA256" --approve-privileges
deploy-cli host packages verify \
--env-file "$ADMIN_ENV" --request-file "$CURRENT_ACCESS_REQUEST" \
--package wireguard-tools
Original bindings and a new console
The profile selects the original request whose key/recovery/trust/policy bindings match the accepted firewall. A separate current request carries new independent console evidence. Both use the same administrator, key paths and sudo password input. Original journals are not rewritten. Paths are fictional; replace the SHA placeholder with the independently reviewed digest.
{
"schema_version": 1,
"entry_mode": "clean",
"environment_file": "/private/example-administrator.env",
"wireguard_preparation": {
"stage": "key",
"request_file": "/private/example-original-request.json",
"node_file": "/private/example-server-node.json",
"current_boot": {
"request_file": "/private/example-new-boot-request.json",
"install_plan_file": "/private/example-original-install-plan.json",
"install_plan_sha256": "<EXACT_ORIGINAL_INSTALL_PLAN_SHA256>"
}
}
}
A separate node file supplies the original server contract. Values below are illustrative: adapt hostname, interface, ports and private addresses to the reviewed plan. Base policy must exactly match the accepted firewall; this example requires adaptation. clean describes the absent target key store or config, not an empty server.
{
"schema_version": 1,
"expected_hostname": "vps-demo",
"profile": {
"schema_version": 1,
"role": "server",
"base_policy": {
"schema_version": 1,
"uplink": "ens3",
"ssh_port": 22,
"window_seconds": 90
},
"firewall_policy": {
"schema_version": 1,
"interface": "wg-demo",
"udp_port": 51820,
"server_ipv4": "<WG_SERVER_PRIVATE_IPV4>",
"peer_ipv4": "<WG_PEER_PRIVATE_IPV4>"
}
},
"base_policy_file": "/private/example-original-management-policy.json"
}
Create the key only on its node
After current-boot and plan checks, apply key preparation. The original owner records its one-shot intent before invoking wg genkey on the node. The private key stays in its root store with mode 0600. Existing or partial state does not permit regeneration.
deploy-cli host setup plan \
--profile-file "$KEY_PROFILE" --plan-file "$KEY_SETUP_PLAN"
deploy-cli host setup apply \
--plan-file "$KEY_SETUP_PLAN" --plan-sha256 "$KEY_SETUP_PLAN_SHA256" \
--approve-local-write --approve-privileges
Selected actual CLI response fields follow. After exact key inspection, setup creates only the public export .public-key.json in the private operator prefix. Its public-key fingerprint matched the original report. This exports no private key. Key completion binds nine local control files.
{
"status": "passed",
"completed_stages": 1,
"host_write_performed": true,
"wireguard_prepared": "key-ready",
"runtime_ready": false,
"whole_host_ready": false
}
Exchange the peer public key between stages
Config needs a separate file containing only the other node’s public key. A server peer leaves Endpoint empty rather than fixing its client address in advance. The following input uses a placeholder. A client configuration uses explicit <SERVER_PUBLIC_IPV4>:<WG_PORT> for Endpoint.
{
"schema_version": 1,
"public_key": "<PEER_PUBLIC_KEY>",
"endpoint_ipv4": ""
}
This single-node fixture used a separate public test key generated through an ephemeral private pipe. It verifies server preparation, not a configured second node or handshake. A real run needs the prepared client’s public key here. Private keys stay on their nodes.
A separate config plan and installation
The config profile retains the same node and original request while adding public peer input. The original planner requires the owned key and absent configuration, and checks self-peer, backend and prerequisites. Installation starts neither the interface nor service.
{
"schema_version": 1,
"entry_mode": "clean",
"environment_file": "/private/example-administrator.env",
"wireguard_preparation": {
"stage": "config",
"request_file": "/private/example-original-request.json",
"node_file": "/private/example-server-node.json",
"current_boot": {
"request_file": "/private/example-new-boot-request.json",
"install_plan_file": "/private/example-original-install-plan.json",
"install_plan_sha256": "<EXACT_ORIGINAL_INSTALL_PLAN_SHA256>"
},
"peer_file": "/private/example-peer-public.json"
}
}
deploy-cli host setup plan \
--profile-file "$CONFIG_PROFILE" --plan-file "$CONFIG_SETUP_PLAN"
deploy-cli host setup apply \
--plan-file "$CONFIG_SETUP_PLAN" --plan-sha256 "$CONFIG_SETUP_PLAN_SHA256" \
--approve-local-write --approve-privileges
Selected actual config response fields follow. The server file uses standard /etc/wireguard/<WG_IF>.conf, root mode 0600 in a 0700 directory. Original installation checked it with wg-quick strip before publication. Four original key files remained exact. Config completion binds eight local controls.
{
"status": "passed",
"completed_stages": 1,
"host_write_performed": true,
"wireguard_prepared": "config-ready",
"runtime_ready": false,
"whole_host_ready": false
}
Read without regenerating or reinstalling
Verify and completion-pinned apply read only the exact native journal. Fingerprints preserve full stat integers without rounding through float. Repeat without completion SHA refuses before the writer. Key-ready and config-ready are separate states; key completion does not automatically become configuration readiness.
deploy-cli host setup verify \
--plan-file "$SETUP_PLAN" --plan-sha256 "$SETUP_PLAN_SHA256" \
--completion-sha256 "$PREPARATION_COMPLETION_SHA256"
After package installation, preparation preserved 24 original server files, packages and SSH/Nginx/network/firewall-loader observations. Reads retained 29 selected files after key and 32 after config. Interface absence was confirmed. Actual stdout from a separate wg-quick systemctl show follows:
ActiveState=inactive
SubState=dead
UnitFileState=disabled
A schematic file without private values
The following is an illustrative server configuration, not stdout from reading the real file. PrivateKey is a placeholder; the actual private key was not printed. The original owner created the actual VM file.
[Interface]
Address = <WG_SERVER_PRIVATE_IPV4>/32
PrivateKey = <NODE_LOCAL_PRIVATE_KEY>
ListenPort = <WG_PORT>
[Peer]
PublicKey = <PEER_PUBLIC_KEY>
AllowedIPs = <WG_PEER_PRIVATE_IPV4>/32
The frame below summarizes saved actual results in a genuine VTE terminal. Server commands were not rerun during capture. The VM shut down normally and parent disk SHA stayed exact. Rented E01, the main server and provider settings were unchanged.


Next: firewall successor and channel proof
config-ready does not establish a running tunnel. Accepted firewall transition, prepared client, startup, actual handshake/private SSH/sudo and automatic boot remain separate steps. runtime_ready and whole_host_ready remain false. Primary E01 backups remain in the Mirohost panel.