Skip to main content
The CLI talks to DNZ’s API, so it needs to know who you are. Sign in once with dnz login and the session is saved for later commands. In scripts, use an API token instead.

Signing in

dnz login asks for your username and password. If someone else set your password (a new account, or an admin reset it), dnz login asks you for a new one right away.

Where the session is saved

The session is saved in ~/.config/dnz/credentials.toml, readable only by you. If XDG_CONFIG_HOME is set, it goes to $XDG_CONFIG_HOME/dnz/credentials.toml instead, and DNZ_CREDENTIALS points it at any file you choose. The last server you signed in to becomes the default. Pick another one with --server or DNZ_SERVER.

Which server a command talks to

  1. --server
  2. DNZ_SERVER
  3. the last server you signed in to
  4. this machine’s http.addr from the config file

API tokens for scripts

For cron jobs, CI and other scripts, use an API token instead of a session. Pass it with --token dnz_… or the DNZ_TOKEN environment variable:
A token belongs to one division and only reaches zones, records and query logs. Commands for users, roles, settings and the rest need a normal sign-in. Create tokens with dnz token create; the token is printed once, on its own line, so a script can capture it:
See API tokens for what a token can and can’t do.

Passwords without a terminal

When there is no terminal to type a password in, the CLI reads it from the environment:
Passwords need at least 10 characters.

Servers with a private CA

If the server is on https:// with a certificate from a private CA (step-ca, an internal PKI), pass the CA certificates as a PEM bundle with --ca-cert (or DNZ_CA_CERT) when you sign in:
The path is saved with the session, so later commands trust it too. The public web roots stay trusted as well.

Sessions

You can be signed in from several places: the dashboard in a browser, the CLI on your laptop, the CLI on the server. List them and sign out the ones you don’t need:
The dashboard shows the same list under Account. Sessions last 168 hours and are signed out after 72 hours unused; DNZ_SESSION_TTL_HOURS and DNZ_SESSION_IDLE_HOURS change that (see Configuration).

Troubleshooting

There is no saved session for that server. Check which server the command picked (the order is above), then sign in to it, or pass --token.
Cron has no terminal: pass --yes to commands that delete or replace something, and give passwords through DNZ_PASSWORD / DNZ_NEW_PASSWORD, or better, use an API token. Also check that cron runs as the same user, since the credentials file is per user (or set DNZ_CREDENTIALS).
The server’s certificate comes from a CA your machine doesn’t trust. Sign in again with --ca-cert pointing at the CA bundle.