Skip to main content

patchbase-agent CLI

The PatchBase agent binary provides three subcommands.

patchbase-agent enroll

Registers the host with a PatchBase server and writes the config file to disk. Run this once per host.

patchbase-agent enroll <server-url> <token> [flags]

Arguments

ArgumentDescription
server-urlThe PatchBase server URL (e.g., https://patchbase.example.com:5199)
tokenA registration token created from the dashboard (e.g., pb_reg_xxxxxx)

Flags

FlagShortTypeDefaultDescription
--config-cstring/etc/patchbase-agent/config.jsonConfig file path to write
--ca-certstring(empty)Path to CA certificate for verifying the server
--allow-insecure-http-kboolfalseAllow plain HTTP (no TLS)

Examples

# Basic enrollment
patchbase-agent enroll https://patchbase.example.com:5199 pb_reg_abc123

# With self-signed certificate
patchbase-agent enroll https://patchbase.example.com:5199 pb_reg_abc123 \
--ca-cert /etc/patchbase-agent/ca.pem

# Development with plain HTTP
patchbase-agent enroll http://localhost:5199 pb_reg_abc123 -k

# Write config to a custom location
patchbase-agent enroll https://server:5199 pb_reg_abc123 -c /tmp/agent-config.json

patchbase-agent sync

Collects a system snapshot and sends it to the PatchBase server.

patchbase-agent sync [flags]

Flags

FlagShortTypeDefaultDescription
--config-cstring/etc/patchbase-agent/config.jsonConfig file path
--server-url-sstring(from config)Override server URL
--token-tstring(from config)Override host token
--ca-certstring(from config)CA certificate path
--allow-insecure-http-kboolfalseAllow plain HTTP
--debugboolfalsePrint snapshot JSON to stdout instead of sending

Examples

# Normal sync (reads config from /etc/patchbase-agent/config.json)
patchbase-agent sync

# Sync with debug output
patchbase-agent sync --debug

# Sync without a config file
patchbase-agent sync --server-url https://server:5199 --token pb_host_xxx

What happens on failure

If the server rejects the snapshot (e.g., host not approved, token revoked), the agent prints the error code and message. The exit code is non-zero. Check the host approval status in the dashboard if you see rejection errors.

patchbase-agent version

Prints the agent version and exits.

patchbase-agent version