NICo Admin CLI
nico-admin-cli is the command-line tool for managing a NICo site. It communicates with
nico-api over gRPC with mutual TLS (mTLS).
Building
From the repository root:
The binary is written to:
target/debug/nico-admin-cli(debug)target/release/nico-admin-cli(release)
Connecting to nico-api
The CLI needs three things to connect:
- API URL — where nico-api is listening
- Root CA certificate — to verify the server’s TLS certificate
- Client certificate + key — to authenticate this client to the server
TLS options
Settings prefer CLI flags, then environment variables, then config-file keys, then defaults or file-location fallbacks. The client certificate and key resolve independently. When both values are present, the CLI uses that pair, even when one comes from a CLI flag and the other from an environment variable. When either is absent, it uses the complete config-file pair, then the client-cert fallbacks.
Config file
Instead of passing flags every time, create
$HOME/.config/nico_api_cli.json:
Example invocations
SOCKS5 proxy
The CLI honors http_proxy / https_proxy (or their uppercase variants)
only when the URL scheme is socks5. HTTP/HTTPS proxies are rejected
with a “Only SOCKS5 Proxy supported” error. This is enforced in
get_proxy_info(); see crates/tls/src/client_config.rs.
Client-cert fallbacks
If neither flag, env var, nor config file supplies the client cert/key, the CLI tries these in order before giving up. Each step requires both the cert and the key to be present at the named path.
- SPIFFE workload identity —
/var/run/secrets/spiffe.io/tls.{crt,key}. Resolved automatically when running as a Kubernetes pod with the SPIFFE CSI driver mounted; no explicit configuration needed. - Compiled-in client default — paths baked into
crates/tls(tls_default::CLIENT_CERT/CLIENT_KEY). Used by binaries shipped onto x86 hosts or DPUs where the cert location is fixed. - In-repo dev certs —
$REPO_ROOT/dev/certs/server_identity.{pem,key}. Used when developing against a local stack.REPO_ROOTmust be set in the environment.
If none of those exist either, the CLI panics with the full enumerated list of where it looked. That message is the most reliable troubleshooting aid when a setup goes sideways — read it before guessing.
Logging
-d / --debug is a repeatable flag controlling the tracing level. The CLI
writes logs to stderr, leaving stdout for command output:
Quick verification
Use version for a read-only connectivity check:
This command does not verify the server certificate, sends no client
certificate, and is allowed anonymously. Success does not verify server trust,
the client cert/key, or admin permissions. With credentials configured and
DISABLE_TLS_ENFORCEMENT unset, use nico-admin-cli machine show to verify a
protected, read-only operation. An empty inventory is also a valid result.
mTLS and authorization
For Vault-issued or operator-managed admin certificates, API trust and authorization, installation, renewal, CA overlap, recovery, and the existing revocation support boundary, see NICo mTLS and authorization.
For the full command reference, see the CLI manual.