Users and access
Nyquist ships without any users, passwords or streams, so nobody gets in before you do. The panel, the API and /metrics all share the same users.
The setup code
Section titled “The setup code”A fresh server with no users prints a one time setup code in its log:
Nyquist isn't set up yet! Open /admin on port 8080 of this server and enter the setup code XXXX-XXXX-XXXX to create your admin accountType it into the panel along with a user name and a password, and that’s your first admin. The code stops working right after, and a new one only shows up if every user is gone again.
Turned the panel off? Send the code to the API instead:
curl http://192.0.2.10:8080/api/v1/setup -H 'content-type: application/json' \ -d '{"code": "XXXX-XXXX-XXXX", "name": "YOUR_NAME", "password": "YOUR_PASSWORD"}'Wrong codes count as failed logins, so nobody can guess their way in. Want a longer code? That’s setup_code_length.
Admins and viewers
Section titled “Admins and viewers”Every user is either an admin or a viewer.
| Admin | Viewer | |
|---|---|---|
| Look at streams, publishers, viewers, charts and settings | Yes | Yes |
Read /metrics |
Yes | Yes |
| Change their own password | Yes | Yes |
| Create, change and remove streams and templates | Yes | No |
| Kick publishers | Yes | No |
| Change settings, edit the config file, reload | Yes | No |
| Manage users | Yes | No |
Viewers are great for your support team, a wall of monitors or Prometheus. There’s always at least one admin, Nyquist won’t remove or demote the last one.
Add users
Section titled “Add users”Admins add users on the Users page of the panel, or through the API:
curl -u admin:YOUR_PASSWORD -X PUT http://192.0.2.10:8080/api/v1/users/monitoring \ -H 'content-type: application/json' -d '{"role": "viewer", "password": "YOUR_NEW_PASSWORD"}'Users live in nyquist.toml as [[api.user]] entries. The panel and the API look after them for you and store passwords as argon2id hashes:
[[api.user]]name = "monitoring"password_hash = "$argon2id$v=19$..."role = "viewer"You can also write a user by hand with a plain password instead of password_hash. It works, but the password sits in the file as plain text until someone changes it from the panel.
Passwords
Section titled “Passwords”Passwords need a minimum number of characters, min_password_length says how many.
- Anybody can change their own password from the menu in the panel.
- When an admin gives somebody a new password, that user gets logged out everywhere else.
- Removing a user logs them out right away.
- Saving or reloading the config file logs out every user whose password changed or who’s gone.
Sessions
Section titled “Sessions”The panel keeps you logged in with a cookie. A session ends after a while without a visit (session_idle), and after a longer while no matter what (session_max). Both are in [access].
Scripts use HTTP basic auth instead, like curl -u admin:YOUR_PASSWORD. Checking a password is slow on purpose, so Nyquist remembers a correct login for a few minutes (basic_auth_cache) and your scripts don’t wait every time.
Running Nyquist behind a reverse proxy over HTTPS? Have the proxy send X-Forwarded-Proto: https and the cookie gets the Secure flag.
Lockouts
Section titled “Lockouts”Too many wrong passwords from one address lock it out for a while. While it’s locked out, the API answers 429 with a Retry-After header saying how many seconds to wait. The knobs are lockout_attempts and lockout_window in [access].
Other sites can’t change things
Section titled “Other sites can’t change things”The API turns away any request that changes something when it comes from another website, so a page you happen to visit can’t use your panel login behind your back. Scripts and curl aren’t affected.
Several Nyquists on one host
Section titled “Several Nyquists on one host”Browsers share cookies between ports of the same host. If you run more than one Nyquist on the same machine, give each one its own session_cookie, or logging into one logs you out of the other.
Locked out of your own server?
Section titled “Locked out of your own server?”Forgot the admin password? You still have the config file:
- Open
nyquist.tomland find your[[api.user]]entry. - Replace the
password_hashline withpassword = "a-new-password". - Reload the config file with
kill -HUPon the Nyquist process, or restart it. - Log in with the new password and change it from the panel, so it gets stored as a hash again.
Or take out every [[api.user]] entry and reload, and Nyquist prints a fresh setup code.
Stream and template passwords
Section titled “Stream and template passwords”Stream and template passwords are different from user passwords. Your encoders need the real thing, so they’re stored as plain text in nyquist.toml, and only admins can see them in the panel and the API. See Publishing.