Sign-In and the API
gpsu always serves the web UI, the JSON API, and browser sign-in.
Web UI and API
GPSU_PUBLIC_URL=https://gpsu.example.com GPSU_TRUSTED_PROXIES=10.0.0.0/8 gpsu serve| Variable | Flag | Default | Description |
|---|---|---|---|
GPSU_PUBLIC_URL | --public-url | The URL browsers use to reach gpsu. gpsu needs it. gpsu answers only at its host. | |
GPSU_LISTEN | --listen | :8080 | The address and port the web UI and the API listen on |
GPSU_TRUSTED_PROXIES | --trusted-proxies | Comma-separated proxy addresses whose X-Forwarded-For header names the client |
Ways to sign in
Users sign in two ways:
| Method | Needs | Managed in |
|---|---|---|
| Local accounts | Nothing | Users |
| Identity provider | An OpenID Connect provider | Settings › Sign-in |
Identity provider
gpsu keeps the identity provider in its database. Admins manage it from any of these:
| Interface | Where |
|---|---|
| Web UI | Settings › Sign-in |
| CLI | gpsu provider |
| API | /api/v1/provider |
Changes apply at once.
Register gpsu at the provider with two clients:
- a confidential web client with the redirect URI
<GPSU_PUBLIC_URL>/auth/callback - a public command-line client with the device code flow enabled
| Item | Detail |
|---|---|
name | Labels the provider’s button beside the local password form |
| Client secret | Encrypted with the seal key, or kept in Vault with --client-secret-vault. gpsu never shows a saved secret. |
| Validation | gpsu checks that each issuer responds before it saves a change. |
| Roles from groups | Settings › Sign-in maps the provider’s groups to roles. A user gets the highest role their groups map to at their next sign-in. |
Warning
Changing the issuer or removing the provider signs out the provider’s users. It also revokes their tokens. A new provider could otherwise issue the same user ID to someone else. Local accounts stay signed in.
The web UI asks you to confirm. gpsu provider set with a new issuer and gpsu provider remove both need --yes.
Local accounts
Users with a local account sign in at /auth/login with a username and password.
- Local sign-in is always enabled.
- Local accounts suit a homelab without an identity provider.
- Local accounts let an admin sign in while the provider is down.
| Item | Detail |
|---|---|
| Username | Lowercase letters, digits, ., -, and _ |
| User ID | local:<username>. No identity provider can claim it. |
| Role | The one set on the account’s page |
| Password | At least 15 characters |
| Stored as | An Argon2id hash. Restoring a backup keeps each account’s password. |
Set and reset passwords
| Action | Who | Result |
|---|---|---|
| Add an account | An admin, on Users | A one-time setup link, shown once and valid for 24 hours. The user opens it and sets a password. |
| Create a reset link | An admin, on the user’s page | A one-time reset link, valid for 24 hours. The old password works until someone uses the link. Using it ends all of the user’s other logins and tokens. |
| Change your password | The user, on My account | The user’s other logins end. |
gpsu stores only a SHA-256 hash of each link.
Second factors
A local account can add an authenticator app or a passkey. gpsu then asks for a code from the app or the passkey after the password.
| Account | Second factor |
|---|---|
| Admin | Required. An admin without an app or a passkey adds one at their next sign-in. |
| Viewer or operator | Optional. Required when an admin enables Require for every local account in the sign-in limits. |
| Identity provider user | Never asked. The provider handles its own second factor. |
Add the app
Select Add authenticator app on My account, or follow the prompt at sign-in. The prompt also offers Add a passkey instead. Scan the QR code with an authenticator app such as Aegis or 1Password. You can type the key into the app instead.
Confirm it
Enter the app’s current code. On My account, enter your current password too. A wrong code keeps the same QR code for 10 minutes.
Save the recovery codes
gpsu shows ten recovery codes once. Keep them somewhere safe.
| Item | Detail |
|---|---|
| App | Any app that reads otpauth:// QR codes. Codes have six digits and change every 30 seconds. |
| Code | Each code works once. gpsu accepts the code before and after the current one to allow for clock drift. |
| Recovery code | Signs in once in place of a code. Case, spaces, and the dash don’t matter. |
| App’s key | Encrypted with the seal key |
| Recovery codes | Stored as SHA-256 hashes |
| Time to finish | 10 minutes after the password. After that, sign in again. |
My account shows the app and how many recovery codes are left. Each change asks for a code from the app or a recovery code:
| Action | Effect |
|---|---|
| New recovery codes | Shows ten new codes once. The old codes stop working. |
| Remove app | gpsu stops asking for a code. The recovery codes stop working unless a passkey remains. An account that must have a second factor adds a new one at its next sign-in. |
An admin can remove the second factors of a user who lost their devices and their recovery codes. They do it with Remove second factors on the user’s page under Users. It removes the user’s app, passkeys, and recovery codes.
It needs no code. The admin confirms first.
The user keeps their password, logins, and tokens.
An admin removes their own second factors on My account, which asks for a code.
Only the owner can remove the owner’s second factors. An owner who lost theirs can reset their access.
Wrong codes count with wrong passwords toward the sign-in limits. A right password doesn’t clear the count while a code follows.
The audit log records each app added, each set of new recovery codes, each recovery code used, and each removal.
Without a seal key, gpsu asks no one to add an app.
Passkeys
A passkey signs in with a device’s fingerprint, face, or PIN. My account lists each passkey and adds, renames, and removes them.
| Sign-in | What the passkey does |
|---|---|
| Sign in with a passkey on the sign-in page | Signs in alone. The device’s PIN or biometric makes it both factors. |
| Use a passkey after the password | Stands in for the code from the app |
| The prompt for a second factor | Add a passkey instead adds one in place of an app |
| Action | Asks for |
|---|---|
| Add passkey | A name and your current password. Your browser then asks your device to make the passkey. |
| Rename | The new name |
| Remove | A code from your app or a recovery code |
| Item | Detail |
|---|---|
| Second factor | A passkey counts as one. The first passkey of an account without an app brings ten recovery codes. |
| Name | 1 to 64 characters, such as the device it lives on |
| Stored as | The credential record, encrypted with the seal key, under a random user handle |
| Script | Adding a passkey needs JavaScript. gpsu bundles the SimpleWebAuthn browser library for it. |
Important
Passkeys belong to the host of GPSU_PUBLIC_URL. That host must be a name, such as gpsu.example.com. An IP address can’t have passkeys. A different host later can’t use the passkeys made for the old one.
- Removing a passkey in gpsu doesn’t remove it from the device. Remove it there too.
- A passkey sign-in signs in only to an account that still has a password. A password reset doesn’t remove the account’s passkeys.
- The audit log records each passkey added and removed.
The owner
One admin owns gpsu. The owner always has a local password. That lets them sign in while the identity provider is down.
Other admins can’t do any of these to the owner:
- change their role
- disable them
- create a reset link for them
- remove their authenticator app
- revoke their logins or tokens
First owner
When gpsu starts without an owner:
| Eligible admins | What happens |
|---|---|
| Exactly one enabled admin with a local password | That admin becomes the owner. |
| None, or more than one | gpsu writes a setup code to its log. |
Until setup is done, the sign-in page shows Set up gpsu. Enter the code there to create the owner’s admin account.
Each start writes a new code. The old code stops working.
Hand over ownership
The owner transfers ownership from another admin’s page under Users. The API does the same through POST /api/v1/users/{subject}/owner. That route needs a browser session.
- The new owner must be an enabled admin with a local password.
- gpsu refuses to restore a backup whose owner isn’t an enabled admin with a local password.
Reset a lost owner password or app
Run this on gpsu’s host:
gpsu owner resetIn a container, run it there. The image keeps gpsu at /gpsu:
docker compose exec gpsu /gpsu owner reset- It reads the same startup settings and database as
gpsu serve.gpsu servecan keep running. - It enables the owner and gives them the admin role.
- It removes the owner’s authenticator app, passkeys, and recovery codes. The owner adds a new second factor at their next sign-in.
- It prints a one-time link that sets a new password. The link works for 24 hours.
- Using the link signs out the owner’s other logins and tokens.
- The audit log records the reset.
- It never creates or upgrades a database.
- If gpsu has no owner yet, it tells you to use the setup code from gpsu’s log.
Sign-in limits
Admins set how long a browser stays signed in, how failed sign-ins slow down, and who needs a second factor. They do it under Settings › Sign-in or at /api/v1/settings/sign-in-limits. A limit left blank uses its default.
| Limit | Default | Range | Effect |
|---|---|---|---|
| Idle timeout | 12h | 5m to 720h | Signs out a browser unused this long |
| Session length | 168h | the idle timeout to 2160h | Signs out a browser this long after it signs in |
| Failures before a wait | 5 | 1 to 20 | Failed sign-ins in a row before a username waits |
| First wait | 30s | 1s to 10m | The first wait. It doubles with each later failure. |
| Longest wait | 15m | the first wait to 1h | The longest a wait grows |
| Require for every local account | Disabled | Enabled or Disabled | Every local account adds an authenticator app at its next sign-in. Admins always need one. |
- A browser login ends at whichever comes first: the idle timeout after its last use, or the session length after it began.
- A shorter limit signs out at once every browser past its new end.
- Command-line logins and API tokens keep their own expiry.
With the defaults, failed sign-ins slow down like this:
| Failures in a row | Wait before the next attempt |
|---|---|
| 1 to 4 | None |
| 5 | 30 seconds |
| Each after that | Double the last wait, up to 15 minutes |
- Unknown usernames wait the same way and take just as long to refuse. That hides which usernames exist.
- The log names a refused username only when it belongs to an account. People sometimes type a password into the username field.
Roles
gpsu records each user at their first browser sign-in. Their groups set their role. See Roles from groups.
| Role | Can |
|---|---|
| Viewer | See status and history |
| Operator | Everything a viewer can, plus set overrides |
| Admin | Everything an operator can, plus manage servers, settings, and users |
- An admin can set a different role for a user. That role takes precedence over their groups.
- An admin can disable a user.
- Every change applies to the user’s next request.
- gpsu refuses any change that would leave no enabled admin.
Capabilities
Each role also has capabilities. Two examples are building dashboards and creating API tokens. Admins change the capabilities of viewers and operators in Settings › Access or at /api/v1/access. Admins always have every capability.
| Role | Starts with |
|---|---|
| Viewer | Shared dashboards. Charts reach back 24 hours. |
| Operator | Everything a viewer has, plus their own dashboards. Charts reach back 30 days. |
| Admin | Every capability |
gpsu checks capabilities on every request. The API refuses whatever the web UI hides.
Command line and API tokens
| Who | Signs in the command line with |
|---|---|
| Identity provider users | gpsu login and the device code flow. They must sign in with a browser once first. |
| Local account users | A personal API token in GPSU_TOKEN |
Viewers and operators can create personal API tokens only when an admin grants the capability. A token acts this way:
| Token owner’s role | Token can |
|---|---|
| Viewer or operator | Only read, unless an admin lets it act with the owner’s role |
| Admin | Act with the admin role |
- gpsu shows the token once.
- A token expires within a year.
- A token can’t create tokens or change users.
My account lists each of your logins. You can end any of them. Sign out everywhere ends every login and token issued before you select it.
Overrides
Settings › Defaults sets:
| Setting | Default | Accepts |
|---|---|---|
| Maximum duration | 24 hours | 1 hour to 7 days |
It also sets:
- the durations the override form offers
- the lifetimes the token form offers
- how close to expiry a token is highlighted