Federated install: SMTP relay for the notification email channel on core
release gate / check (push) Failing after 6m54s

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).
This commit is contained in:
Andrew S Erwin
2026-10-26 15:09:04 -05:00
parent 451312c3cf
commit f72e4fedb8
2 changed files with 38 additions and 5 deletions
+10 -5
View File
@@ -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`.
+28
View File
@@ -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 <<EOF
@@ -186,6 +200,20 @@ ADMIN_EMAILS=admin@$DOMAIN
TIER=core
COOKIE_SECURE=1
# TRUSTED_PROXY deliberately unset — traefik does not send X-Real-IP.
# --- Transactional mail (notification engine email channel) ---
# House pattern: authenticated submission via mail.$DOMAIN:587 as the
# shared sender account fcore with a per-app From address (authelia and
# superpanel do the same). Password reset stays refused on this tier
# (oidc mode); this relay exists for notification deliveries.
# Split-horizon DNS: mail.$DOMAIN resolves to the private container IP
# inside the core network, hence the netguard pin (verified 2026-10-26).
SMTP_HOST=mail.$DOMAIN
SMTP_PORT=587
SMTP_USERNAME=fcore
SMTP_PASSWORD=$SUPERBRAIN_SMTP_PASSWORD
SMTP_FROM=superbrain@$DOMAIN
NETGUARD_TRUSTED_HOSTS=mail.$DOMAIN
EOF
chmod 600 /federated/apps/superbrain/.env