Skip to content

Server and agent CLI

The server binary is pf-central in the container image. With no arguments it prints help.

CommandWhat it does
pf-central serveStarts the server: runs database migrations, prepares NATS, starts the broker (embedded mode) and the web server. The image’s default command.
pf-central admin setup tokenCancels open setup links and prints a new one, valid 24 hours. The link creates an owner.
pf-central admin enroll tokenPrints a one-time enrollment token that any firewall can use.
pf-central admin seedDevelopment only. Creates test accounts for each role.
pf-central --versionPrints the version.

The admin commands read the same environment as serve and talk to the database directly. The server does not need to be running. They do not run migrations, so run them against a database that serve has started at least once.

Terminal window
# Docker Compose
docker compose exec pf-central pf-central admin setup token
# Kubernetes
kubectl exec -n pf-central deploy/pf-central -- pf-central admin enroll token --ttl 24h
FlagDefaultMeaning
--ttl1hHow long the token is valid, as a Go duration (30m, 24h, 168h).
--tenant-slugdefaultThe tenant the firewall joins. Leave the default.
$ pf-central admin enroll token --ttl 24h
╔══ pf-central device enrollment token ══════════════╗
║ Token: device_3f9a…_c21b…
║ Tenant: default Expires in: 24h0m0s Single-use
║ Give it to the agent as auth.bootstrap_token
…

A CLI token is not bound to a device. Any one firewall can use it, once. A token from Add device in the UI is bound to the UUID you entered. See Enroll firewalls.

The agent binary is /usr/local/bin/nats-agent on the firewall. The nats_agent service runs it; you rarely run it by hand.

CommandWhat it does
nats-agent run --config <file>Runs the agent. If the configuration has a bootstrap token and no connect-secret yet, it enrolls first. run is the default command.
nats-agent --versionPrints the version.

The service passes --config /usr/local/etc/nats-agent/config.yaml. See Environment variables → Agent for the keys.

Terminal window
service nats_agent status
service nats_agent restart
service nats_agent stop
service nats_agent start
tail -f /var/log/nats_agent.log

The same actions are on Services → pfCentral → Status in the pfSense GUI.

Stop the service, then run the agent with debug logs:

Terminal window
service nats_agent stop
PFCENTRAL_AGENT_LOG_LEVEL=debug nats-agent run --config /usr/local/etc/nats-agent/config.yaml

Press Ctrl+C to stop, then service nats_agent start.