Skip to content

pfSense package

The agent ships as a pfSense package, pfSense-pkg-nats-agent. It needs pfSense 2.7.0 or later on amd64. It adds Services → pfCentral to the pfSense GUI with two tabs, Settings and Status, and the nats_agent service.

FieldMeaning
Device IDRead-only. The firewall’s SMBIOS UUID. pfCentral scopes this firewall’s credentials to it.
Device NameThe name shown in pfCentral. Defaults to the pfSense hostname.
SiteOptional location label, for example office-syd.
FieldMeaning
NATS URLRequired. Where the agent connects, for example nats://pf.example.com:24222, or tls://pf.example.com:24222 with TLS.
Enroll URLRequired. pfCentral’s enrollment address, for example https://pf.example.com/enroll.
NATS CAAutomatic downloads /nats-ca.crt from the Enroll URL’s host. Custom URL downloads it from another address. Only used with tls://.
NATS CA URLShown with Custom URL.

The section shows Enrolled or Awaiting enrollment.

FieldMeaning
Bootstrap TokenThe one-time token from pfCentral (Add device, or pf-central admin enroll token). Leave it empty once the firewall is enrolled. A new token makes the firewall enroll again: Save deletes the old credentials first.

The help text says server admin enroll token. The command is pf-central admin enroll token.

FieldMeaning
Binary SourceDefault uses the public release. Custom URL uses your own mirror.
Binary URLShown with Custom URL. The agent binary used by Download & Restart.
Log LevelDebug, Info, Warn or Error. Default Info.
  1. Stores the settings in the pfSense configuration.
  2. With tls://, downloads the NATS CA. If that fails, Save stops with “Configuration saved, but the NATS CA download failed. The agent was not restarted.”
  3. Writes /usr/local/etc/nats-agent/config.yaml.
  4. Restarts the agent. With a new token, the agent enrolls as it starts.

The page updates on its own every few seconds.

PartShows
BannerHealthy — connected & enrolled, Awaiting enrollment, Disconnected or Agent stopped
TilesProcess, NATS, Enrollment, Credential (auto-renews), Uptime, Version
ButtonsStart, Stop, Restart, Download & Restart
Identity & ConnectionDevice ID, name, the server it is connected to, the credential scope (pfsense.<id>.>), last update
SubjectsEvery NATS subject this agent answers

“Status file is stale (>30s old)” means the agent has not written its status for 30 seconds. It is stuck or stopped; check /var/log/nats_agent.log and restart it.

install.sh installs or upgrades the package and the agent, and on the first install writes the settings for you:

Terminal window
fetch -o - https://github.com/danielmichaels/pf-central-artifacts/releases/latest/download/install.sh | \
NATS_URL=tls://pf.example.com:24222 \
ENROLL_URL=https://pf.example.com/enroll \
NATS_CA_URL=https://pf.example.com/nats-ca.crt \
BOOTSTRAP_TOKEN=device_… \
SITE=office-syd \
sh

The variables are listed in Enroll firewalls. They only apply on the first install; later runs upgrade the package and binary and keep the settings.

Terminal window
pkg delete pfSense-pkg-nats-agent

This stops the agent and removes the binary, the service and /usr/local/etc/nats-agent/. Delete the device in pfCentral too; see Suspend or retire a firewall.