From f72e4fedb87ce3840743ac0d13a3d626dfdc4965 Mon Sep 17 00:00:00 2001 From: Andrew S Erwin Date: Mon, 26 Oct 2026 15:09:04 -0500 Subject: [PATCH] Federated install: SMTP relay for the notification email channel on core The tier switch removed core's SMTP config when password reset became dead in oidc mode, but the notification engine's email channel needs the same relay. Reinstate the house pattern in config_superbrain (fcore submission on mail.$DOMAIN:587, credential read from authelia's secret or superpanel's .env, NETGUARD_TRUSTED_HOSTS pin for split-horizon DNS) and correct STRATEGY.md, including the stale 'app sends no outbound mail' claim in the suite-service notes. Deployed to core: migration 013 applied, SMTP+pin env verified in the app container, /api/notifications/* routes live behind auth (401 anonymous), clean app/web logs. The live /federated/lib/superbrain.sh was synced from this repo copy (backup kept as superbrain.sh.bak-20261026). --- deploy/federated/STRATEGY.md | 15 ++++++++++----- deploy/federated/lib-superbrain.sh | 28 ++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 5 deletions(-) diff --git a/deploy/federated/STRATEGY.md b/deploy/federated/STRATEGY.md index c896f15..90507bc 100644 --- a/deploy/federated/STRATEGY.md +++ b/deploy/federated/STRATEGY.md @@ -144,8 +144,11 @@ Written by `config_superbrain` into `/federated/apps/superbrain/.env` → Authelia and materializes locally on first SSO login. The hosted product is `TIER=multi`: `AUTH_MODE=password` derived (signup/login/ self-reset; OIDC bridge refused even with variables set) — SMTP-backed - password reset belongs to that tier (see RUNNING.md); core needs no SMTP - config. Longer term the multi tier is meant to grow ORGANIZATION-level + password reset belongs to that tier (see RUNNING.md). Core DOES carry + SMTP config (`mail.$DOMAIN:587` as shared sender `fcore`, plus a + `NETGUARD_TRUSTED_HOSTS` pin for split-horizon DNS): password reset is + refused in oidc mode, but the notification engine's email channel needs + the relay. Longer term the multi tier is meant to grow ORGANIZATION-level tenancy (tenant_id, memberships, per-tenant admin/billing) — decided 2026-10-26, not built yet; today it is multi-user. - Admin bootstrap on the core tier: an `ADMIN_EMAILS` address becomes ADMIN @@ -226,9 +229,11 @@ grows a real API-key mechanism; revisit then. ### Not applicable -- `email_superbrain`: the app sends no outbound mail (no SMTP config exists; - only IMAP/CardDAV ingest). Skip, or send the standard welcome mail with the - admin credentials using the suite's mail helpers. +- `email_superbrain`: since the notification engine (2026-10-26) the app + DOES send outbound mail through the house relay (`SMTP_*` = fcore + submission on mail.$DOMAIN:587). The suite's standard welcome mail is + still optional; superbrain's own mail is transactional only + (notifications; password reset is refused in the oidc tier). - `data/` volume: the app is stateless apart from postgres. No `/home/node/.superbrain` volume (that was n8n's). Nothing to `chown`. diff --git a/deploy/federated/lib-superbrain.sh b/deploy/federated/lib-superbrain.sh index 67b2b0a..a27bf98 100644 --- a/deploy/federated/lib-superbrain.sh +++ b/deploy/federated/lib-superbrain.sh @@ -57,6 +57,20 @@ config_superbrain() { SUPERBRAIN_AUTH_SECRET=$(create_password) SUPERBRAIN_ENCRYPTION_KEY=$(create_password) + # Shared house SMTP sender credential (fcore) for the notification + # engine's email channel. Reuse the secret other apps already hold; never + # generate a new one — the mail server is LDAP-provisioned and + # `setup email add` does not exist there (ACCOUNT_PROVISIONER is not + # FILE). Verified end-to-end 2026-10-26: net/smtp STARTTLS + AUTH PLAIN + # to mail.$DOMAIN:587 from the core network delivers with a per-app From + # address (sender != login user is allowed; authelia does the same). + if [ -f /federated/apps/authelia/data/secrets/NOTIFIER_SMTP_PASSWORD ]; then + SUPERBRAIN_SMTP_PASSWORD=$(cat /federated/apps/authelia/data/secrets/NOTIFIER_SMTP_PASSWORD) + else + SUPERBRAIN_SMTP_PASSWORD=$(sed -n 's/^EMAIL_HOST_PASSWORD=//p' /federated/apps/superpanel/.env | tail -1) + fi + [ -n "$SUPERBRAIN_SMTP_PASSWORD" ] || failcheck "could not find the fcore SMTP password (authelia secret or superpanel .env)" + # app is deliberately the FIRST service with an image: key — upgrade_app() # reads the first image: line and compares it to CONTAINER in the service file. cat > /federated/apps/superbrain/docker-compose.yml <