Skip to content

Tutorial 2: Connect your first firewall

In this tutorial you connect one pfSense firewall to the server from Tutorial 1. It takes about 15 minutes.

You will learn:

  • how to find a firewall’s hardware ID;
  • how a one-time token turns into the firewall’s own credentials;
  • how to tell “enrolled” from “online”.

You need:

  • the server from Tutorial 1, at http://192.168.1.50:2808;
  • a pfSense 2.7.0 or later firewall (amd64) with shell access: SSH as root, or Diagnostics → Command Prompt in the pfSense GUI;
  • a route from the firewall to the server on TCP 2808 and 24222. Test it from the firewall with nc -vz 192.168.1.50 24222.

Before you start, here is everything that will happen. You do steps 1 to 3; the agent does the rest.

Sequence of messages when a firewall enrolls with pfCentral and then connects to NATS. You admin pfCentral web + API NATS broker Agent on pfSense Add device: SMBIOS UUID one-time token (shown once) paste token on the firewall POST /enroll token + UUID connect-secret + sentinel creds connect: creds + UUID + secret callout: is this device allowed? yes: pass for pfsense.<uuid>.> (1 h) connected ✓
  1. 1. You add the device

    In Devices → Add device you enter the firewall's hardware ID (SMBIOS UUID) and a name. The device now exists, waiting for enrollment.

  2. 2. pfCentral gives you a one-time token

    The token works once, expires, and only works for that UUID. pfCentral stores a hash of it, never the token itself.

  3. 3. You give the token to the firewall

    Paste it in Services → pfCentral → Settings, or pass it to the install script. This is the only secret a person ever handles.

  4. 4. The agent trades the token in

    Over HTTPS the agent sends the token and its UUID to /enroll. pfCentral checks both and burns the token so nobody can use it again.

  5. 5. The agent gets its long-term credentials

    pfCentral returns a per-device connect-secret and the shared sentinel credentials. The agent saves them on the firewall with owner-only permissions.

  6. 6. The agent dials NATS

    It connects outbound to port 24222 and presents the sentinel credentials, its UUID and its connect-secret.

  7. 7. NATS asks pfCentral

    NATS does not decide by itself. It forwards the login to pfCentral (the authorization callout), which checks the secret and that the device is approved and not suspended.

  8. 8. pfCentral signs a short-lived pass

    The pass (a JWT) allows only this device's own subjects and expires. Nothing durable to steal or revoke on the broker.

  9. 9. The firewall is online

    From now on every reconnect repeats only the last four steps. The token is never needed again.

fig. — enrollment, then every connect

Each firewall is identified by its SMBIOS UUID, a hardware ID that survives reinstalls. On the firewall, run:

Terminal window
kenv smbios.system.uuid
4c4c4544-0042-5a10-8048-b4c04f4d3132

Copy the output.

  1. Add device dialog with SMBIOS UUID and display name fields
    Full size ↗
    Step 1 of 3 Open Add device

    On the fleet page click Add device, or Add at the top of the left rail. You need the admin or owner role.

  2. Add device dialog with a UUID and the name fw-hq-01 filled in
    Full size ↗
    Step 2 of 3 Paste the UUID and name it

    Paste the UUID. The display name is optional; the agent reports the firewall's hostname when it connects, and that name replaces this one.

  3. Add device dialog showing a one-time enrollment token with a Copy button
    Full size ↗
    Step 3 of 3 Copy the token

    Click Add & generate token. Copy the token now: it is shown once, works once, expires in one hour, and only works for this UUID. The left rail lists the device as awaiting enrollment.

fig. — Add device

Pick one way. Both install the same package; the first one also enrolls the firewall in the same step.

Run this as root on the firewall. Put your token in BOOTSTRAP_TOKEN:

Terminal window
fetch -o - https://github.com/danielmichaels/pf-central-artifacts/releases/latest/download/install.sh \
| NATS_URL=nats://192.168.1.50:24222 \
ENROLL_URL=http://192.168.1.50:2808/enroll \
BOOTSTRAP_TOKEN=device_paste_your_token_here \
SITE="Brisbane HQ" \
sh

The script installs the pfCentral package, downloads the agent, writes its settings, starts it, and prints a summary.

Within a few seconds, two things change:

  • On the firewall, Services → pfCentral → Status shows Healthy — connected & enrolled, with the credential scope pfsense.<uuid>.>.
  • In pfCentral the device leaves Awaiting enrollment and shows online, with live CPU, memory, disk, temperature and traffic.
Live telemetry arrives every few seconds over the agent's connection.
  • A firewall that keeps one outbound connection open to pfCentral.
  • Credentials on the firewall, in /usr/local/etc/nats-agent/, that only allow it to use its own subjects.
  • A live view of the firewall in pfCentral.

Next: Tutorial 3: Make your first change.