Apps are a coreapp.toml; a trusted installer makes the Core side

An app's repository now has only coreapp.toml, its Dockerfile, its code
and an icon: no install scripts or compose file, so installing an app
from someone else's repository can't run their code as root on a Core.

core/coreapps runs on the Core (coreapp deploy puts it in /opt/coreapps).
It checks the manifest, refuses Federated's app names and the Core's
hostnames, picks a free address on that Core, writes the generic app
format from its own templates, sets up the needs (postgres, sso) and
installs through installapp. Updates keep the address, secrets and data,
add settings for new needs and delete old images; dropping a need is
refused. remove rebuilds Superpanel's catalog afterwards.

PLAN.md: the Coreapps direction and steps, and what the Core offers apps
(Superpanel's AI features, mcpserver, hermes, email, PowerDNS).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-03 13:36:47 -07:00
co-authored by Claude Opus 5.5
parent d8c6d1011f
commit b4d47fb1c5
36 changed files with 1046 additions and 413 deletions
-1
View File
@@ -1 +0,0 @@
authelia
+1
View File
@@ -0,0 +1 @@
sso
+3 -3
View File
@@ -1,6 +1,6 @@
# The app's image. coreapp deploy builds it as coreapp/{{NAME}}:<VERSION>
# and copies it to the Core. Replace this with your own app; keep it
# listening on the port in docker-compose.yml.in (8080).
# The app's image. coreapp deploy builds it as image:version (from
# coreapp.toml) and copies it to the Core. Replace this with your own app;
# keep it listening on the port in coreapp.toml (8080).
FROM python:3.13-slim
COPY app.py oidc.py /app/
USER nobody
+8 -13
View File
@@ -1,20 +1,15 @@
## Sign-in
People sign in with their Core account, through the Core's Authelia
(OpenID Connect, authorization code flow with PKCE):
`needs = ["sso"]`: people sign in with their Core account, through the
Core's Authelia (OpenID Connect, authorization code flow with PKCE).
- `install` registers the client `coreapp-{{NAME}}` in Authelia's
`idproviders.yml` (between `### coreapp-{{NAME}} begin/end` markers), with
the random `OIDC_CLIENT_SECRET` from `.env`, hashed. It checks Authelia's
configuration before restarting it and puts the old one back if the check
fails. `uninstall` removes the client.
- Its redirect URI is `https://{{NAME}}.<domain>/auth/callback`. Change it in
`install` if your app uses another path.
- Authelia decides whether a second factor is needed (the Core's 2FA policy
is applied to every client after each install).
- The app reaches `https://authelia.<domain>` through traefik
(`extra_hosts` in `docker-compose.yml.in`).
- At install, the client `coreapp-{{NAME}}` is registered in Authelia, with
the random `OIDC_CLIENT_SECRET` from `.env`. `coreapp remove` removes it.
- Its redirect URI is `https://{{NAME}}.<domain>/auth/callback`, so the app
has to handle that path.
- Authelia decides whether a second factor is needed (the Core's 2FA
policy).
- `oidc.py` does the whole flow with Python's standard library, and `app.py`
uses it for `/login`, `/auth/callback` and `/logout`. For a real app, use
your framework's OpenID Connect library with `OIDC_ISSUER`,
-27
View File
@@ -1,27 +0,0 @@
services:
{{NAME}}:
image: coreapp/{{NAME}}:${IMAGE_VERSION}
container_name: {{NAME}}
hostname: {{NAME}}.@DOMAIN@
restart: always
networks:
core:
ipv4_address: {{IP}}
# Reach Authelia's https address through traefik on the core network
# (inside it, authelia.@DOMAIN@ is Authelia's own plain-http container)
extra_hosts:
- "authelia.@DOMAIN@:@TRAEFIK_IP@"
env_file:
- ./.env
volumes:
- ./data:/data
labels:
- "traefik.enable=true"
- "traefik.http.routers.{{NAME}}.rule=Host(`{{NAME}}.@DOMAIN@`)"
- "traefik.http.routers.{{NAME}}.entrypoints=websecure"
- "traefik.http.routers.{{NAME}}.tls.certresolver=letsencrypt"
- "traefik.http.services.{{NAME}}.loadbalancer.server.port=8080"
networks:
core:
external: true
-5
View File
@@ -1,5 +0,0 @@
# Sign-in through the Core's Authelia (OpenID Connect); install registers
# the client
OIDC_ISSUER=https://authelia.@DOMAIN@
OIDC_CLIENT_ID=coreapp-{{NAME}}
OIDC_CLIENT_SECRET=@OIDC_CLIENT_SECRET:RANDOM:LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL@
-43
View File
@@ -1,43 +0,0 @@
# Register it with the Core's Authelia as an OpenID Connect client, with the
# secret from .env (hashed), between markers so uninstall can remove it.
# Safe to run again. Authelia is checked with the new client before it
# restarts; if the check fails, its old configuration is put back.
IDP=/federated/apps/authelia/data/config/idproviders.yml
OIDC_CLIENT_SECRET="$(sed -n 's/^OIDC_CLIENT_SECRET=//p' /federated/apps/{{NAME}}/.env)"
OIDC_HASH="$(docker exec authelia authelia crypto hash generate pbkdf2 --password "$OIDC_CLIENT_SECRET" | awk '/Digest:/ {print $2}')"
cp -p "$IDP" "$IDP.coreapp-{{NAME}}.bak"
sed -i '/^ ### coreapp-{{NAME}} begin$/,/^ ### coreapp-{{NAME}} end$/d' "$IDP"
cat >> "$IDP" <<OIDC
### coreapp-{{NAME}} begin
- client_id: 'coreapp-{{NAME}}'
client_name: '{{TITLE}}'
client_secret: '$OIDC_HASH'
consent_mode: 'implicit'
public: false
authorization_policy: 'one_factor'
require_pkce: true
pkce_challenge_method: 'S256'
redirect_uris:
- 'https://{{NAME}}.$DOMAIN/auth/callback'
scopes:
- 'openid'
- 'profile'
- 'email'
- 'groups'
response_types:
- 'code'
grant_types:
- 'authorization_code'
token_endpoint_auth_method: 'client_secret_basic'
userinfo_signed_response_alg: 'none'
### coreapp-{{NAME}} end
OIDC
if docker exec authelia authelia validate-config > /dev/null 2>&1; then
rm -f "$IDP.coreapp-{{NAME}}.bak"
restart_service authelia
else
echo "Authelia rejected the new client; left its configuration as it was." >&2
mv "$IDP.coreapp-{{NAME}}.bak" "$IDP"
fi
unset IDP OIDC_CLIENT_SECRET OIDC_HASH
-4
View File
@@ -1,4 +0,0 @@
# ...and its Authelia client
sed -i '/^ ### coreapp-{{NAME}} begin$/,/^ ### coreapp-{{NAME}} end$/d' \
/federated/apps/authelia/data/config/idproviders.yml
restart_service authelia