Client WireGuard in local setup: key and configuration
Separate local authority, key and configuration preparation, and unchanged-network checks on an Ubuntu VM.
After the server WireGuard stages, I added separate client preparation. The local setup command runs on the client with its own authority. This pass prepares only a key and configuration file, without starting an interface or creating a NetworkManager profile. The actual run used a fresh isolated Ubuntu VM, not the work laptop.
The client has its own node file
The schematic example below supplies the client role, interface, private addresses, sudo password file and independent console confirmation. Replace angle-bracket placeholders with your values. Node and credential files remain private; the password does not travel through arguments or environment variables. The fixture ran CLI as an ordinary user through fresh password-sudo checks.
{
"schema_version": 1,
"expected_hostname": "client-demo",
"profile": {
"schema_version": 1,
"role": "client",
"base_policy": {
"schema_version": 1,
"uplink": "ens3",
"ssh_port": 22,
"window_seconds": 600
},
"firewall_policy": {
"schema_version": 1,
"interface": "wg-demo",
"udp_port": 51820,
"server_ipv4": "<WG_SERVER_PRIVATE_IPV4>",
"peer_ipv4": "<WG_CLIENT_PRIVATE_IPV4>"
}
},
"sudo_password_file": "/private/example-client-sudo-password",
"recovery_file": "/private/example-client-console.json"
}
Separate setup for the key
The client profile contains no server environment or SSH request. The key stage references only the original node file. Plan creates an upper workflow plan and retains the original lower candidate; apply requires the exact upper plan SHA and separate approval for local records and privileged work. Unknown results never trigger automatic key generation again.
{
"schema_version": 1,
"entry_mode": "clean",
"wireguard_client": {
"stage": "key",
"node_file": "/private/example-client-node.json"
}
}
deploy-cli local setup plan \
--profile-file "$CLIENT_KEY_PROFILE" --plan-file "$CLIENT_KEY_SETUP_PLAN"
deploy-cli local setup apply \
--plan-file "$CLIENT_KEY_SETUP_PLAN" --plan-sha256 "$CLIENT_KEY_SETUP_SHA256" \
--approve-local-write --approve-privileges
The key is ready, the tunnel is not running
Apply called original local key-create once. The private key stayed on the client; the original public-key exporter stored only public material in a private report beside the setup plan with the suffix .public-key.json. Selected actual response fields follow. Client and server effects are accounted for separately; key-ready does not mean a working network channel.
{
"status": "passed",
"scope": "offline-local-wireguard-client-key",
"wireguard_client_prepared": "key-ready",
"client_write_attempted": true,
"client_write_performed": true,
"client_write_state": "changed",
"host_write_attempted": false,
"host_write_performed": false,
"runtime_ready": false,
"whole_host_ready": false
}
Exchange only public material
Configuration needs the server public key and an explicit IPv4 Endpoint. The fixture used a public export from a separate prior server run, without copying a private key or journal. This prepares a file and does not test server connectivity. All values below are placeholders; the port comes from the agreed node policy.
{
"schema_version": 1,
"public_key": "<SERVER_PUBLIC_KEY>",
"endpoint_ipv4": "<SERVER_PUBLIC_IPV4>"
}
Configuration has a new profile and plan
I created another profile and setup plan for config. It uses the original client node and retains the key private bindings. A separate peer file contains only admitted public material. Planning and application do not rewrite the completed key workflow or replace its hashes.
{
"schema_version": 1,
"entry_mode": "clean",
"wireguard_client": {
"stage": "config",
"node_file": "/private/example-client-node.json",
"peer_file": "/private/example-server-public-peer.json"
}
}
deploy-cli local setup plan \
--profile-file "$CLIENT_CONFIG_PROFILE" --plan-file "$CLIENT_CONFIG_SETUP_PLAN"
deploy-cli local setup apply \
--plan-file "$CLIENT_CONFIG_SETUP_PLAN" --plan-sha256 "$CLIENT_CONFIG_SETUP_SHA256" \
--approve-local-write --approve-privileges
The installed file is root 0600
Original config-install created /etc/wireguard/${WG_IF}.conf owned by root with mode 0600. The private key did not enter a plan, response or article. Config-ready means an authenticated file and exact original journal, without nmcli connection up or wg-quick up. Selected actual apply fields follow.
{
"status": "passed",
"scope": "offline-local-wireguard-client-config",
"wireguard_client_prepared": "config-ready",
"client_write_attempted": true,
"client_write_performed": true,
"client_write_state": "changed",
"host_write_attempted": false,
"host_write_performed": false,
"runtime_ready": false,
"whole_host_ready": false
}
Verify and pinned reading
Separate verify and apply with a completion SHA authenticated immutable operator files and actual lower state without another writer. The apply parser retains explicit approvals, while a pinned completion selects reading. Apply without a completion SHA was refused. The JSON below contains selected actual verify fields; absent optional write fields have not been filled in.
deploy-cli local setup verify \
--plan-file "$CLIENT_CONFIG_SETUP_PLAN" --plan-sha256 "$CLIENT_CONFIG_SETUP_SHA256" \
--completion-sha256 "$CLIENT_CONFIG_COMPLETION_SHA256"
deploy-cli local setup apply \
--plan-file "$CLIENT_CONFIG_SETUP_PLAN" --plan-sha256 "$CLIENT_CONFIG_SETUP_SHA256" \
--completion-sha256 "$CLIENT_CONFIG_COMPLETION_SHA256" \
--approve-local-write --approve-privileges
{
"status": "passed",
"scope": "offline-local-wireguard-client-config",
"wireguard_client_prepared": "config-ready",
"local_write_attempted": false,
"client_write_state": "none",
"host_write_attempted": false,
"host_write_performed": false
}
The key completion is not renewed
After configuration installation, the original offline key-ready phase is no longer current. Old key verify refused config-ready without changing earlier control files. Selected actual refusal fields follow. Key history is not rewritten for the new phase; config has its own completion.
{
"status": "failed",
"error": "setup local client authority or current state refused; inspect private controls",
"client_write_state": "none",
"host_write_attempted": false,
"local_write_attempted": false
}
Host and local keep separate authority
Host setup refused the client profile before planning or privileged dispatch. Local setup also rejects server profiles and runtime stages. Wrong SHA and missing privilege approval were refused before key creation. Selected actual host refusal fields follow.
{
"status": "failed",
"error": "setup local client authority requires local setup, never host setup",
"host_write_attempted": false,
"local_write_attempted": false
}
Network state stayed unchanged
On the VM I compared packages, SSH and netplan files, interfaces and routes, and active and saved NetworkManager connections. They stayed unchanged; no WireGuard interface or client runtime was created. After config I separately checked managed files across verify and replay. These checks do not prove a handshake, private SSH or autoconnect.
The next boundary is client activation
The frame below summarizes saved results of the actual run; commands were not rerun during capture. The VM was shut down normally. The next separate stage is NetworkManager preparation and client runtime with explicit network-change approval and independent channel checks.

