Roles and proxy lists of the panel accounts

Accounts

Each panel account has a role. An editor or a viewer can also have a proxy list. The admin panel, the admin API and the Admin Session authentication of the proxies use the same accounts.

Roles

ActionAdminEditorEditor with a proxy listViewer
Read the proxiesevery proxyevery proxythe proxies of its listevery proxy, or the proxies of its list
Add a proxyyesyesyes, and its list gets the new proxyno
Change or delete a proxy, purge its cacheyesyesthe proxies of its listno
Read the ports, the certificates, the ACME entries and the access listsyesyesyesyes
Change the ports, the certificates, the ACME entries and the access lists, download a certificate, refresh the CDN IP rangesyesyesnono
Read or change the settings and the accounts, read the audit logyesnonono

Rules

accounts.toml in the configuration directory holds the accounts with their password hashes. r3v3rs3 writes the file with mode 0600. A cluster keeps the accounts encrypted in the store.

Create an Account

The "Accounts" page of the WebUI lists, adds, changes and deletes the accounts. Only an admin opens the page. When you add an account with TOTP, the page shows the TOTP secret once. Add it to your authenticator app at that time.

On the command line, add-user adds an account. Without --role, the account is an admin:

$ r3v3rs3 add-user alice --role editor
$ r3v3rs3 add-user bob --role viewer --totp

--role accepts admin, editor or viewer. The command asks for the password when --password is not set. An account from the command line has no proxy list. Set a proxy list on the "Accounts" page or through the admin API.

Admin API

Only an admin account can call these endpoints.

EndpointAction
GET /api/accountsLists the accounts with the role, the proxy list and whether TOTP is on.
POST /api/accountsAdds an account. The response holds totp_secret when TOTP is on.
PUT /api/accounts/{username}Changes the role, the proxy list and, optionally, the password.
DELETE /api/accounts/{username}Deletes the account.
$ curl -b cookies.txt -H 'Content-Type: application/json' \
    -d '{"username":"alice","password":"correct horse","role":"editor","proxies":["a1b2c3d"],"totp":false}' \
    http://localhost:46492/api/accounts
$ curl -b cookies.txt -X PUT -H 'Content-Type: application/json' \
    -d '{"role":"viewer"}' \
    http://localhost:46492/api/accounts/alice

An update without proxies removes the proxy list, and an update without password keeps the password.

ResponseCause
400 password_too_shortThe password has fewer than 8 characters.
400 invalid_usernameThe username breaks the username rules.
400 invalid_account_scopeAn admin account has a proxy list.
409 account_existsAn account with the username exists.
404 account_not_foundNo account has the username.

GET /api/session returns the username, the role and the proxy list of the signed-in account.

The audit log records each change of an account and each sign-in.