Skip to content

admin — Admin API and dashboard ​

Where the Admin API and dashboard listen and who can log in to them. sing-box does not have this section: it is an ours extension.

yaml
admin:
  listen: 127.0.0.1:9090
  users:
    - username: admin
      password_hash: "$argon2id$v=19$m=19456,t=2,p=1$…"
    - username: prometheus
      password_hash: "$argon2id$v=19$m=19456,t=2,p=1$…"
      role: metrics
FieldWhat it sets
listenThe Admin API address, as with ours run --dashboard: loopback IP:port only. The flag, if given, takes precedence. Without either, the Admin API is off
usersWho logs in with HTTP Basic. Empty: log in with the random token printed at startup

User fields:

FieldWhat it sets
usernameThe name; without colons and control characters, not repeated
password_hashAn argon2id password hash in PHC format: $argon2id$v=19$m=…,t=…,p=…$salt$hash. Made by ours generate password-hash (CLI)
roleadmin (default) — the dashboard and the whole API; metrics — only GET /api/v1/metrics

Checks at load time, with the location:

  • a password field is an error: the password is not stored in the configuration, only the hash;
  • a hash that is not argon2id ($2b$…, $argon2i$…, plain text), or a version other than v=19, is an error;
  • m below 19456 KiB or t below 2 is a "too weak" error with the minimum values (the OWASP recommendation; ours generate password-hash makes such a hash);
  • a non-local listen is an error with advice about ssh -L.

check --view replaces password_hash with REDACTED, like the other secrets.

Reload ​

New users apply immediately on SIGHUP, --watch and applying from the dashboard; remembered password checks are forgotten. A new listen too: the process listens on the new address instead of the old one. Turning the Admin API on or off as a whole takes a restart; the reload writes a warning about it. The section does not affect the proxy components: a reload because of it rebuilds nothing.

GPL-3.0-or-later