Skip to content

Configuration Reference

NDCLI uses a YAML configuration file and supports environment variable overrides. This reference covers all configuration options.

~/Library/Application Support/ndcli/config.yaml

Use --conf to specify a custom config file path:

Terminal window
ndcli --conf /path/to/config.yaml device list
oauth2:
provider: netdefense
domain: auth.netdefense.io
client_id: your-client-id
audience: authcli
scopes: openid profile email offline_access
controlplane:
host: https://control.netdefense.io
ssl_verify: true
organization:
name: my-organization
output:
format: detailed
timezone: America/Sao_Paulo
auth:
storage: keyring
account: user@example.com
path: ""

Settings for OAuth2 authentication provider.

KeyTypeDefaultDescription
oauth2.providerstring(built-in)OAuth2 provider type
oauth2.domainstringauth.netdefense.ioOAuth2 domain
oauth2.client_idstring(built-in)OAuth2 client ID
oauth2.audiencestringauthcliOAuth2 audience
oauth2.scopesstringopenid profile email offline_accessOAuth2 scopes

Settings for the NetDefense API connection.

KeyTypeDefaultDescription
controlplane.hoststringhttps://control.netdefense.ioAPI host URL
controlplane.ssl_verifybooltrueVerify SSL certificates

This default is compiled into the binary and is the same in every ndcli build — there is no separate development default. A fresh install with no config.yaml writes one containing host: https://control.netdefense.io.

It is also a different hostname from the one the device-side agent uses, by design. See Service Endpoints for every NetDefense hostname and which component talks to which.

To use a different API host (e.g., self-hosted or staging):

controlplane:
host: https://control.example.com
ssl_verify: true

The relay that carries remote access sessions opened with ndcli device connect. Note the wss:// scheme — this is a WebSocket endpoint, not the HTTPS API host above.

KeyTypeDefaultDescription
pathfinder.hoststringwss://pathfinder.netdefense.ioPathFinder relay URL
pathfinder.ssl_verifybooltrueVerify SSL certificates

The device has its own copy of this setting, configured separately in the OPNsense plugin. Both ends must point at the same relay — see Service Endpoints.

Default organization for commands.

KeyTypeDefaultDescription
organization.namestring""Default organization name

Set via command:

Terminal window
ndcli config set org my-organization

Override per-command:

Terminal window
ndcli device list --org other-organization

Output formatting preferences.

KeyTypeDefaultDescription
output.formatstringdetailedDefault output format
output.timezonestring(system local)IANA timezone used to render timestamps and to read --at values typed without an offset

Valid formats:

FormatDescription
tableTabular format, good for lists
simpleCompact bullet-point format
detailedRich Unicode box drawing
jsonMachine-readable JSON

Set via command:

Terminal window
ndcli config set output json
ndcli config set timezone America/Sao_Paulo

Override the format per-command:

Terminal window
ndcli device list -f table

Settings for credential storage.

KeyTypeDefaultDescription
auth.storagestringkeyringStorage backend: keyring or file
auth.accountstring""Account email for keyring lookup
auth.pathstring""Custom path for file storage

There is no ndcli config set auth.storage — config set only accepts org, output and timezone. Two routes work instead.

Edit config.yaml by hand and add a nested auth block:

auth:
storage: file

Or set the environment variable, which takes precedence over the file and is the easier option for a single command, a container, or a CI job:

Terminal window
export NDCLI_AUTH_STORAGE=file

Credentials are stored in the system keyring:

  • macOS: Keychain
  • Linux: Secret Service (GNOME Keyring, KWallet)
  • Windows: Credential Manager
auth:
storage: keyring
account: user@example.com

If keyring is unavailable, credentials are stored in a file:

auth:
storage: file
path: /custom/path/auth.json

Default file locations:

  • macOS: ~/Library/Application Support/ndcli/auth.json
  • Linux: ~/.config/ndcli/auth.json
  • Windows: %APPDATA%\ndcli\auth.json

NDCLI_TOKEN is a special case, separate from the auth.storage keyring/file choice above. Set it to a Personal Access Token (PAT) — a credential with an ndpat_ prefix, minted with ndcli auth token create — and ndcli skips keyring/file lookup and interactive login entirely for that invocation:

Terminal window
export NDCLI_TOKEN=ndpat_your_token_here
ndcli device list

This is the mechanism for CI/CD pipelines, headless servers, and any script that runs without a human present to click through a browser login. See the Personal Access Tokens guide for how to create, scope, and rotate tokens, and the full precedence order below.

Thirteen configuration keys can be overridden with an NDCLI_-prefixed environment variable. Each one sets the config.yaml key beside it, taking precedence over the file:

Environment VariableConfig Key
NDCLI_CONTROLPLANE_HOSTcontrolplane.host
NDCLI_CONTROLPLANE_SSL_VERIFYcontrolplane.ssl_verify
NDCLI_PATHFINDER_HOSTpathfinder.host
NDCLI_PATHFINDER_SSL_VERIFYpathfinder.ssl_verify
NDCLI_ORGANIZATION_NAMEorganization.name
NDCLI_OUTPUT_FORMAToutput.format
NDCLI_OUTPUT_TIMEZONEoutput.timezone
NDCLI_AUTH_STORAGEauth.storage
NDCLI_AUTH_PATHauth.path
NDCLI_AUTH_ACCOUNTauth.account
NDCLI_UPDATE_CHECK_ENABLEDupdate.check_enabled
NDCLI_DEBUG_ENABLEDdebug.enabled
NDCLI_DEBUG_LOG_FILEdebug.log_file

These are also recognised, but they are not config keys: ndcli reads them at the moment it needs them, they have no config.yaml equivalent, and they are outside the flags → env → file → defaults precedence chain that governs the table above.

Environment VariableEffect
NDCLI_TOKENAuthenticate with a Personal Access Token — see NDCLI_TOKEN above
NDCLI_NO_UPDATE_CHECKSkip the check for a newer ndcli on this invocation
NDCLI_IGNORE_MIN_VERSIONProceed even if the control plane reports a higher minimum client version
NDCLI_TUI_REFRESHRefresh interval for interactive full-screen views
NDCLI_DEBUGDump goroutine state when an ndcli device connect session tears down

If you set an NDCLI_-prefixed variable that is not in either table above, ndcli prints a warning to standard error naming the variable. The setting has no effect — the warning is there so a typo, or a variable that never existed, does not look like a silent failure.

The warning appears when you run a command. Shell completion stays silent by design, so an unrecognised variable will not disrupt your tab-completion with a warning on every keystroke — if you notice the difference, nothing is broken.

Terminal window
export NDCLI_ORGANIZATION_NAME=production
export NDCLI_OUTPUT_FORMAT=json
export NDCLI_CONTROLPLANE_HOST=https://api.example.com

Configuration values are resolved in this order (highest to lowest priority):

  1. Command-line flags (--org, -f)
  2. Environment variables (NDCLI_*)
  3. Config file (config.yaml)
  4. Built-in defaults

Authentication is resolved separately from the general config precedence above, in this order:

  1. NDCLI_TOKEN — if set and it validates as an ndpat_... token, it is used for every request and the keyring/file/interactive paths below are skipped entirely, even if a valid cached session also exists.
  2. Cached session — the tokens stored by a prior ndcli auth login (keyring or file, per auth.storage).
  3. Interactive login — if neither of the above is available, ndcli prompts you to run ndcli auth login.

Overriding the built-in controlplane.host to point at a development control plane instead of the production default:

controlplane:
host: https://dev-control.netdefense.io
ssl_verify: true
organization:
name: dev-environment
output:
format: detailed
auth:
storage: keyring
controlplane:
host: https://control.netdefense.io
ssl_verify: true
organization:
name: production
output:
format: json
auth:
storage: file
path: /secrets/ndcli-auth.json
controlplane:
host: https://control.netdefense.io
organization:
name: ""
output:
format: table
Terminal window
ndcli config show
Terminal window
ndcli config reset

Open the config file directly:

Terminal window
$EDITOR ~/.config/ndcli/config.yaml
code ~/Library/Application\ Support/ndcli/config.yaml