WireGuard client through CLI: private SSH and sudo
A separate Ubuntu client, node-local keys and actual private SSH, sudo and public recovery access checks.
With server keys prepared and firewall accepted, I moved to a real client. I configured a separate Ubuntu node through original CLI commands, started both ends and checked private-channel SSH and sudo. Public administrative access remained available.
Two isolated nodes
The fixture uses Debian 13 for the server and Ubuntu 24.04 with NetworkManager for the client. Each VM has 1 GiB RAM and both processes share one available CPU. These are actual kernels and packages, not substituted responses. Local QEMU forwarding carries transport between the VMs; this does not test public Internet or Cloudflare delivery.
Client profile and local authority
The client path starts with local: the command runs local sudo on the client itself. It needs that hostname, separate console evidence and a protected sudo-password file. The node profile below is illustrative. Match names, interfaces, addresses and ports to the reviewed plan; these demonstration values are not my work laptop configuration.
{
"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"
}
The private key stays on its node
Each end generates its own key. After reviewing key-plan, run one-shot key-create and a separate public-key export. Existing or partial state prohibits regeneration. This follows the private/public key distinction in WireGuard Quick Start. The second block contains selected actual client CLI response fields.
deploy-cli local wireguard key-plan \
--node-file "$CLIENT_NODE" --plan-file "$CLIENT_KEY_PLAN"
deploy-cli local wireguard key-create \
--node-file "$CLIENT_NODE" --plan-file "$CLIENT_KEY_PLAN" \
--plan-sha256 "$CLIENT_KEY_PLAN_SHA256" --approve-privileges
deploy-cli local wireguard public-key \
--node-file "$CLIENT_NODE" --report-file "$CLIENT_PUBLIC_KEY_REPORT"
{
"mode": "local-wireguard-key-create",
"status": "passed",
"write_performed": true,
"write_state": "changed",
"action": "key-create"
}
Exchange the public parts
I gave the client only the server public key and the server only the client public key. The peer input below is schematic. endpoint_ipv4 contains no port; the agreed profile provides it. The full client Endpoint is <SERVER_PUBLIC_IPV4>:<WG_PORT>. WireGuard supports other Endpoint forms; this verified CLI contract explicitly selects IPv4.
{
"schema_version": 1,
"public_key": "<SERVER_PUBLIC_KEY>",
"endpoint_ipv4": "<SERVER_PUBLIC_IPV4>"
}
Configuration and an inactive NetworkManager profile
After config-install I ran separate stage-plan and stage commands. They create an inactive unsaved profile without autoconnect; preparation does not start the tunnel. The prepared root-owned mode-0600 configuration is /etc/wireguard/${WG_IF}.conf; the NetworkManager profile itself remains unsaved. The private key is not printed. Only a /32 server route is added, while default route and DNS remain intact. See the AllowedIPs and peer-routes relationship in the NetworkManager reference. The second block selects actual stage fields.
deploy-cli local wireguard config-plan \
--node-file "$CLIENT_NODE" --peer-file "$SERVER_PUBLIC_PEER" \
--plan-file "$CLIENT_CONFIG_PLAN"
deploy-cli local wireguard config-install \
--node-file "$CLIENT_NODE" --plan-file "$CLIENT_CONFIG_PLAN" \
--plan-sha256 "$CLIENT_CONFIG_PLAN_SHA256" --approve-privileges
deploy-cli local wireguard stage-plan \
--node-file "$CLIENT_NODE" --plan-file "$CLIENT_STAGE_PLAN"
deploy-cli local wireguard stage \
--node-file "$CLIENT_NODE" --plan-file "$CLIENT_STAGE_PLAN" \
--plan-sha256 "$CLIENT_STAGE_PLAN_SHA256" --approve-privileges
{
"mode": "local-wireguard-stage",
"status": "passed",
"write_performed": true,
"write_state": "changed",
"action": "stage"
}
Start server and client separately
Server runtime requires the accepted firewall transition and its own configuration. Client runtime requires the prepared NetworkManager profile. Each has a separate plan and SHA. Startup commands and selected actual server response fields follow. A successful start still needs a private-access check.
deploy-cli host wireguard runtime-plan \
--env-file "$ADMIN_ENV" --request-file "$ORIGINAL_REQUEST" \
--node-file "$SERVER_NODE" --plan-file "$SERVER_RUNTIME_PLAN"
deploy-cli host wireguard runtime-start \
--env-file "$ADMIN_ENV" --request-file "$ORIGINAL_REQUEST" \
--node-file "$SERVER_NODE" --plan-file "$SERVER_RUNTIME_PLAN" \
--plan-sha256 "$SERVER_RUNTIME_PLAN_SHA256" --approve-privileges
deploy-cli local wireguard runtime-plan \
--node-file "$CLIENT_NODE" --plan-file "$CLIENT_RUNTIME_PLAN"
deploy-cli local wireguard runtime-start \
--node-file "$CLIENT_NODE" --plan-file "$CLIENT_RUNTIME_PLAN" \
--plan-sha256 "$CLIENT_RUNTIME_PLAN_SHA256" --approve-privileges
{
"mode": "host-wireguard-runtime-start",
"status": "passed",
"write_performed": true,
"write_state": "changed",
"action": "runtime-start",
"access_verified": true
}
SSH through the tunnel and password sudo
I generated a separate SSH verification key on the client and authorized only its public part on the server. The server host key was pinned before login. A fresh private-address SSH connection reached sudo: passwordless access refused, while password sudo returned 0 from id. The commands below illustrate an interactive manual sudo check; the fixture supplied the password through stdin without printing it. The separate 0 block is actual id stdout without the password dialogue.
ssh -F /dev/null -o BatchMode=yes -o IdentitiesOnly=yes \
-o StrictHostKeyChecking=yes -o UserKnownHostsFile="$WG_KNOWN_HOSTS" \
-i "$WG_SSH_KEY" "${ADMIN_USER}@${WG_SERVER_PRIVATE_IPV4}" \
'sudo -k -n -- /usr/bin/id -u'
# A separate interactive password-sudo check:
ssh -t -F /dev/null -o IdentitiesOnly=yes -o StrictHostKeyChecking=yes \
-o UserKnownHostsFile="$WG_KNOWN_HOSTS" -i "$WG_SSH_KEY" \
"${ADMIN_USER}@${WG_SERVER_PRIVATE_IPV4}" 'sudo -k -- /usr/bin/id -u'
0
Check traffic before acceptance
Both runtime verifiers confirmed a handshake and bidirectional transfer. Named UDP and SSH counters increased. A control HTTP listener worked locally, while its WireGuard request was blocked and the drop counter increased. Fresh public SSH with password sudo also worked; console remained a separate channel. Each check serves a different purpose, so a successful ping does not replace them.
deploy-cli host wireguard runtime-verify \
--env-file "$ADMIN_ENV" --request-file "$ORIGINAL_REQUEST" \
--node-file "$SERVER_NODE"
deploy-cli local wireguard runtime-verify --node-file "$CLIENT_NODE"
Separate acceptance for both roles
After the checks I created runtime-commit-plan and a separate six-label approval for each role. The following is schematic: true means an actual completed check, not a value to copy blindly. Approval SHA selects the corresponding commit-plan; proof_file and its SHA bind independent evidence. Server and client plans are not interchangeable. Partial or unknown outcomes never retry automatically.
{
"schema_version": 1,
"plan_sha256": "<RUNTIME_COMMIT_PLAN_SHA256>",
"acceptance": {
"new_wireguard_ssh": true,
"wireguard_password_sudo": true,
"new_public_ssh": true,
"public_password_sudo": true,
"console": true,
"negative_controls": true
},
"proof_file": "/private/example-independent-channel-proof.json",
"proof_sha256": "<INDEPENDENT_PROOF_SHA256>"
}
deploy-cli host wireguard runtime-commit-plan \
--env-file "$ADMIN_ENV" --request-file "$ORIGINAL_REQUEST" \
--node-file "$SERVER_NODE" --plan-file "$SERVER_COMMIT_PLAN"
# Inspect this plan and supply independent proof before commit.
deploy-cli host wireguard runtime-commit \
--env-file "$ADMIN_ENV" --request-file "$ORIGINAL_REQUEST" \
--node-file "$SERVER_NODE" --plan-file "$SERVER_COMMIT_PLAN" \
--plan-sha256 "$SERVER_COMMIT_PLAN_SHA256" \
--acceptance-file "$SERVER_CHANNEL_APPROVAL" --approve-privileges
# The client has its own plan, approval and local privilege boundary.
deploy-cli local wireguard runtime-commit-plan \
--node-file "$CLIENT_NODE" --plan-file "$CLIENT_COMMIT_PLAN"
deploy-cli local wireguard runtime-commit \
--node-file "$CLIENT_NODE" --plan-file "$CLIENT_COMMIT_PLAN" \
--plan-sha256 "$CLIENT_COMMIT_PLAN_SHA256" \
--acceptance-file "$CLIENT_CHANNEL_APPROVAL" --approve-privileges
When to enable startup
Separate acceptance of both roles establishes a working current-boot channel. The client profile retains autoconnect disabled; client reboot would need a separate decision. The server can now move to startup-plan and then check tunnel recovery after a controlled reboot. The terminal frame below shows saved results from this run.