refactor(mail): send via the SSO app registration, drop SMTP basic auth
Docker Image bauen und veroeffentlichen / build-and-push (push) Successful in 2m25s

Mail now uses the same Entra ID app registration as "Sign in with
Microsoft" (ENTRA_TENANT_ID, ENTRA_CLIENT_ID, ENTRA_CLIENT_SECRET), so
only one enterprise application is needed. The app additionally gets
the SMTP.SendAsApp permission; Exchange still limits it to the mailbox
granted via Add-MailboxPermission.

Password (basic auth) sending is removed entirely: SMTP_HOST, SMTP_PORT,
SMTP_PASSWORD and the separate SMTP_OAUTH_* settings are gone. The
transport is fixed to smtp.office365.com:587 with required STARTTLS.
SMTP_USER (sending mailbox) and SMTP_FROM remain.

- lib/entra.ts exposes readEntraAppCredentials(), shared by SSO and mail
- diagnosis drops basic-auth-only causes; hints name the ENTRA_* values
  and warn that an expired secret breaks sign-in and mail together
- admin e-mail test, .env.example, docker-compose, k8s manifests,
  preflight and README updated

Verified against Entra ID with fake values: token error classified,
client secret never exposed, missing ENTRA_CLIENT_SECRET reported.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
Nick SzaunigandClaude Opus 5.5 committed 2026-09-26 19:23:05 +02:00
1 parent 0620e9d79a
commit 11910dd6dd
15 files changed
+211 -309

No files matched your search

+2 -15
View File
@@ -28,19 +28,10 @@ data:
# Absenderadresse aller Transaktions-E-Mails. Sollte auf einer eigenen
# Domain liegen, sonst landen die Mails regelmaessig im Spam-Ordner.
# Muss die Adresse des Postfachs aus SMTP_USER (Secret) sein — der Versand
# laeuft ueber Microsoft 365 mit OAuth 2.0, siehe README "E-Mail-Versand".
SMTP_FROM: "Wabenhain <[email protected]>"
# Microsoft 365 per OAuth 2.0 (empfohlen, siehe README "E-Mail-Versand").
# Beide Werte sind nicht geheim und stehen im Entra Admin Center unter
# App-Registrierungen → <App> → Uebersicht. Zusammen mit
# SMTP_OAUTH_CLIENT_SECRET im Secret schaltet das den Versand auf OAuth um
# (SMTP_PASSWORD wird dann nicht gebraucht, SMTP_HOST ist optional).
# Leer lassen fuer Anmeldung per Passwort bei einem anderen Anbieter.
# Verzeichnis-ID (Mandanten-ID) oder z. B. wabenhain.onmicrosoft.com:
SMTP_OAUTH_TENANT_ID: ""
# Anwendungs-ID (Client-ID) der App-Registrierung:
SMTP_OAUTH_CLIENT_ID: ""
# ---------------------------------------------------------------------
# VORGABEN — koennen so bleiben
# ---------------------------------------------------------------------
@@ -62,10 +53,6 @@ data:
# welche. Entweder diesen Wert senken oder max_connections anheben.
DATABASE_POOL_SIZE: "20"
# Port des SMTP-Anbieters. 587 ist STARTTLS (der Normalfall, auch fuer
# Microsoft 365), 465 waere implizites TLS.
SMTP_PORT: "587"
# Verzeichnis fuer hochgeladene Bilder und Videos. MUSS exakt dem mountPath
# des "uploads"-Volumes in 05-app-deployment.yaml entsprechen — die App
# weiss nicht, was dort gemountet ist, sie schreibt nur in diesen Pfad.