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
Every setting follows the same priority: CLI flag → environment variable → config file key → hard-coded default (where one exists).
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
Once credentials are in place, version is the cheapest end-to-end check —
it exercises auth without mutating anything:
If it succeeds, the API URL, root CA, and client cert/key are all working.
nico-admin-cli machine show --all is a good first real query.
mTLS and authorization
For generating client certificates, configuring the server-side TLS and Casbin policy, and understanding how certificate fields map to authorization roles, see NICo mTLS and authorization.
For the full command reference, see the CLI manual index