The Core's admin account is always an admin of the app

Every app's .env gets CORE_ADMIN_EMAIL (admin@<domain>, the Core's own
admin, as Federated's apps use). The skill says apps make that account an
admin on each Core sign-in, trusting only Authelia's email, instead of a
setup link; the sso example apps show the check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-03 18:34:36 -07:00
co-authored by Claude Opus 5.5
parent da36a669bf
commit dca8837487
8 changed files with 54 additions and 13 deletions
+21 -7
View File
@@ -54,6 +54,7 @@ What the Core gives every app:
| `APP_SECRET` | 32 random letters and digits, for signing cookies, sessions |
| `IMAGE_VERSION` | The installed version (`coreapp deploy` builds with plain `docker build .`, no build args, so read the version from here, not a build-time `VERSION`) |
| `CORE_DOMAIN` | The Core's domain (`<domain>`). Set only on a Core: an app that also runs elsewhere can use it to tell |
| `CORE_ADMIN_EMAIL` | `admin@<domain>`, the Core's admin account: always an admin of the app (see `sso`) |
`APP_SECRET` isn't hex or base64: an app that wants key bytes (e.g. 32
bytes for encryption) derives them, e.g. SHA-256 of `APP_SECRET`. It
@@ -187,10 +188,23 @@ may log; it should retry).
today's Cores: they have two groups, `admins` and `everybody`, but
Authelia's settings don't find them yet (for Federated to fix). Read `groups`
if the app can use it, but don't depend on it for roles.
- The app's first admin: not "whoever signs in first" (any employee could
be first). Prefer a one-time setup link or code the app prints in its log
(`coreapp logs`, or `coreapp shell '<app's command>'`), then admins it
names in its own settings. Later, the Core's `admins` group.
- **The app's admin is the Core's admin.** On a Core, the account
`CORE_ADMIN_EMAIL` (`admin@<domain>`, the Core's own admin, as in
Federated's apps) is always an admin of the app, from its first sign-in:
no setup link, no first-come owner. It can then make other people admins
in the app. Two rules:
- Trust it only from the Core's sign-in: the `email` in Authelia's
userinfo or ID token, compared case-insensitively. Never make a local
account, a sign-up or an invitation with that address an admin; anyone
could type it.
- Every time, not only the first: if its admin role was taken away in
the app, its next Core sign-in gives it back.
If the app has its own first-run setup (an owner to create, a setup
link), skip it on a Core: the Core's admin is the owner. The example app
(`coreapp new --sso`) shows the check in `oidc.py`. `coreapp signin`
signs in as the test account, not the admin, so ask the user to sign in
once as `admin@<domain>` in a browser and check it gets the admin pages.
- Discovery: `$OIDC_ISSUER/.well-known/openid-configuration`. The Core
routes `authelia.<domain>` from inside the app's container to the real
HTTPS endpoint, with a valid certificate, so normal TLS verification works.
@@ -377,9 +391,9 @@ state (a server-side callback page) refuses it: use the path form for those.
Authelia bans an account for a few minutes after repeated failed sign-ins,
so don't loop on it.
Still ask the user to sign in once in a browser with their own account
before a release: it checks what a script can't (the app's pages, and a
real person's account).
Still ask the user to sign in once in a browser before a release, as the
Core's admin (`admin@<domain>`): it checks what a script can't (the app's
pages, and that the admin gets the admin role).
### 4. When something fails