device
Device management commands for NDCLI. These commands allow you to list, approve, rename, and remove firewall devices in your organization.
Commands
Section titled “Commands”| Command | Description |
|---|---|
device list | List devices |
device describe | Show device details |
device health | Show the device’s instantaneous health snapshot |
device connect | Connect to a device through the connection relay |
device approve | Approve a pending device |
device approve-all | Approve all pending devices |
device rename | Rename a device |
device remove | Remove a device |
device rebind-token | Issue a one-time re-bind token for the device’s signing key |
device list
Section titled “device list”List devices in your organization with optional filtering and sorting.
ndcli device list [flags]| Flag | Type | Default | Description |
|---|---|---|---|
--name | string | Filter by name (regex pattern) | |
--status | string | Filter by status: PENDING, ENABLED, DISABLED | |
--ou | string | Filter by organizational unit | |
--created-after | string | Filter by created date | |
--created-before | string | Filter by created date | |
--heartbeat-after | string | Filter by last heartbeat | |
--heartbeat-before | string | Filter by last heartbeat | |
--synced-after | string | Filter by last sync | |
--synced-before | string | Filter by last sync | |
--drift-status | string | Filter by drift status: IN_SYNC, DRIFT, NEVER_SYNCED, UNKNOWN, ERROR | |
--sort-by | string | name:asc | Sort field and direction |
--page | int | 1 | Page number |
--per-page | int | 30 | Items per page |
Date Filter Formats
Section titled “Date Filter Formats”Date filters accept two formats:
- Relative:
30m,2h,7d,2w(minutes, hours, days, weeks ago) - ISO 8601:
2024-01-15T10:30:00Z. A time with an offset, such as2024-01-15T10:30:00-03:00, is converted. A time without an offset, or a date alone, is read as UTC
From ndcli 1.40.0, a relative time is counted from the current moment whatever timezone your computer is set to. Earlier releases moved the window by the computer’s offset from UTC.
Sort Fields
Section titled “Sort Fields”Available sort fields: name, status, created_at, heartbeat, synced_at, drift_status
Direction: asc or desc (e.g., name:asc, created_at:desc)
Examples
Section titled “Examples”ndcli device list
ndcli device list --status PENDING
ndcli device list --ou production
ndcli device list --heartbeat-before 7d
ndcli device list --created-after 24h
ndcli device list --name "fw-.*-prod"
ndcli device list --sort-by heartbeat:desc
ndcli device list --page 2 --per-page 50
ndcli device list --drift-status DRIFT
ndcli device list --drift-status DRIFT --ou productiondevice describe
Section titled “device describe”Show detailed information about a specific device.
ndcli device describe [device]Arguments
Section titled “Arguments”| Argument | Required | Description |
|---|---|---|
device | Yes | Device name |
Output
Section titled “Output”Shows comprehensive device information:
- Device name and UUID
- Status (PENDING, ENABLED, DISABLED)
- Whether it’s online now (online, offline, or unknown)
- Organizational unit assignment
- Last heartbeat timestamp
- Last sync timestamp and hash
- Drift status (IN_SYNC, DRIFT, NEVER_SYNCED, UNKNOWN, ERROR)
- Creation date
- Hardware/software details
Examples
Section titled “Examples”ndcli device describe my-firewall
ndcli device describe my-firewall -f jsondevice health
Section titled “device health”Show a device’s latest telemetry: uptime, load, memory and swap, disk use, OPNsense service states, pending updates and certificate expiry.
ndcli device health [device]Arguments
Section titled “Arguments”| Argument | Required | Description |
|---|---|---|
device | Yes | Device name |
Output
Section titled “Output”A header gives the device’s status and whether it’s online, its agent version, the age of its last heartbeat and of its last telemetry, its OUs and its sync state. Below it:
- Resources: uptime, CPU count, load averages over 1, 5 and 15 minutes, memory use and, when the device has swap, swap use.
- Disks: use per mount point.
- Services: how many OPNsense services are running, and which ones aren’t.
- Updates: the update status, the last check, how many packages are pending, and whether a reboot is required.
- Certificates: the days left on each certificate, flagged at 30 days or fewer and shown as
expiredonce past, and whether it’s in use.
The data is live, with no history. It refreshes with each heartbeat, every 60 seconds, and the agent re-reads services, updates and certificates every 15 minutes. A device that hasn’t reported for about 3 minutes prints No recent telemetry. under the header; the web app’s device page keeps its last report instead.
Examples
Section titled “Examples”ndcli device health my-firewall
ndcli device health my-firewall -f jsondevice connect
Section titled “device connect”Connect to a device interactively through the NetDefense connection relay. Opens an interactive PTY shell on the device and, unless --no-webadmin is set, a local WebAdmin tunnel to the device’s web interface on an automatically assigned port. The WebAdmin tunnel stays open after the shell exits, until you press Ctrl-C at the keep-alive prompt.
ndcli device connect [device] [flags]Arguments
Section titled “Arguments”| Argument | Required | Description |
|---|---|---|
device | Yes | Device name |
| Flag | Type | Default | Description |
|---|---|---|---|
--timeout | duration | 5m | Connection timeout |
--webadmin-port | int | auto | Local port for the WebAdmin tunnel |
--no-webadmin | bool | false | Disable the WebAdmin tunnel |
--webadmin-only | bool | false | Skip the interactive terminal and keep the WebAdmin tunnel open until you quit with Ctrl-C |
Examples
Section titled “Examples”# Connect with default settingsndcli device connect my-firewall
# Connect with a custom timeoutndcli device connect my-firewall --timeout 15m
# Connect without the WebAdmin tunnelndcli device connect my-firewall --no-webadmin
# Open only the WebAdmin tunnel, with no terminalndcli device connect my-firewall --webadmin-only
# Connect with the WebAdmin tunnel on a specific portndcli device connect my-firewall --webadmin-port 8443device connectfalls back to--webadmin-onlyon its own when the device refuses a terminal, as in a read-only session, or when its output isn’t a terminal. When its output isn’t a terminal it doesn’t print the tunnel’s local URL, so set--webadmin-portto know where it listens.device connectneeds an interactive login, fromndcli auth login. WithNDCLI_TOKENset, the control plane refuses the session with400andJWT must contain jti claim for session tracking: a personal access token can’t open a remote session.NDCLI_TOKENtakes precedence over a cached login (see How NDCLI picks a credential), so unset it, then runndcli auth loginif you have no cached session.
device approve
Section titled “device approve”Approve a pending device, allowing it to receive configurations and participate in the organization.
ndcli device approve [device]Arguments
Section titled “Arguments”| Argument | Required | Description |
|---|---|---|
device | Yes | Device name to approve |
Examples
Section titled “Examples”ndcli device approve new-firewall- Approves a device waiting for approval:
PENDING, orUNREGISTEREDafter a re-bind. A device that is alreadyENABLEDis left as it is. - Refused with
409DEVICE_REBIND_PENDINGwhile the device hasn’t registered its key: its rebind token is still unused, or it has no key bound. Wait for it to register with the token, or issue a new token withndcli device rebind-tokenif that one has expired. - After approval, the device status changes to
ENABLED - Approved devices can receive configuration syncs
device approve-all
Section titled “device approve-all”Approve all pending devices in the organization at once.
ndcli device approve-allExamples
Section titled “Examples”ndcli device approve-alldevice rename
Section titled “device rename”Rename a device.
ndcli device rename [device] [new-name]Arguments
Section titled “Arguments”| Argument | Required | Description |
|---|---|---|
device | Yes | Current device name |
new-name | Yes | New name for the device |
Examples
Section titled “Examples”ndcli device rename old-name new-name- Device names must be unique within the organization
- The rename takes effect immediately
- The device UUID remains unchanged
device remove
Section titled “device remove”Remove a device from the organization.
ndcli device remove [device]Arguments
Section titled “Arguments”| Argument | Required | Description |
|---|---|---|
device | Yes | Device name to remove |
Examples
Section titled “Examples”ndcli device remove decommissioned-firewalldevice rebind-token
Section titled “device rebind-token”Issue a one-time Re-bind Token for a device: the first step of re-binding its signing key.
ndcli device rebind-token [device] [flags]Arguments
Section titled “Arguments”| Argument | Required | Description |
|---|---|---|
device | Yes | Device name |
| Flag | Type | Default | Description |
|---|---|---|---|
--ttl | duration | 24h | How long the token stays valid, at most 7 days (168h) |
Examples
Section titled “Examples”# Issue a token valid for 24 hoursndcli device rebind-token fw-branch-01
# Issue a token valid for 3 daysndcli device rebind-token fw-branch-01 --ttl 72h- The token is printed once and can’t be recovered: NetDefense keeps only a hash of it. Running the command again issues a new token, and the earlier one stops working.
- With
-f json, the token is inbootstrap_tokenand its expiry inexpires_at. - The device drops to
UNREGISTEREDas soon as the token is issued, because NetDefense clears its registered public key. It stays there until the agent registers a new key with the token and you approve the device withdevice approve. --ttltakes hours, minutes or seconds (72h,90m); there is no day unit. A value above168his refused.- Needs the Read-Write or Superuser role.
- Where to paste the token on the device, and the rest of the procedure: Re-binding.