Add the email need: each app gets its own sending-only mail account

needs = ["email"] (coreapp new --email) makes an LDAP account
coreapp-<name> (not a person, no mailbox) and adds SMTP_* settings.
Teardown removes it only if it's the app's; the installer warns about
an entry it left alone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-03 15:01:11 -07:00
co-authored by Claude Opus 5.5
parent bef3b86970
commit 6ab1db839b
12 changed files with 173 additions and 13 deletions
+25
View File
@@ -270,6 +270,31 @@ has the `DB_*` variables, `.coreapp` says `needs=postgres`.
`/federated/bin/reconcile-authelia-sso` doesn't bring it back; Authelia
healthy, other clients (Nextcloud) still work. Deploy again: one block.
### With email
1. `coreapp new --email mail-test`: `needs = ["email"]`, deploy. On the
Core, `.env` has `SMTP_HOST=mail.<domain>`, `SMTP_PORT=587`,
`SMTP_SECURITY=starttls`, `SMTP_USER=coreapp-mail-test`, a random
`SMTP_PASSWORD`, `SMTP_FROM=mail-test@<domain>`; `service` has
`DEPENDS="mail"`; LDAP has `uid=coreapp-mail-test,ou=people,<base>` with
`objectClass` account, simpleSecurityObject, PostfixBookMailAccount (no
person), `mailEnabled: FALSE`, `description: coreapps: mail-test`, and
a `{SSHA}` password.
2. From a container on the `core` network with the app's `.env`
(`docker run --rm --network core --env-file /federated/apps/mail-test/.env ...`),
Python's `smtplib`: STARTTLS with certificate checking, login, `MAIL FROM`
`SMTP_FROM` and `RCPT TO postmaster@<domain>` both 250 (then `RSET`; nothing
sent). A wrong password: 535.
3. Authelia's `/api/firstfactor` as `coreapp-mail-test` with its real
password: 401. `occ user:list` in Nextcloud and Superpanel's
`user_store` (after `superpanel-sync-users`) don't have it.
4. `coreapp remove`: the LDAP entry is gone.
5. An LDAP entry `uid=coreapp-mail-test` that isn't the app's (another
`description`): deploy prints "Warning: mail-test can't send mail", the
entry is unchanged (its password too), and remove leaves it.
6. Adding `"email"` to an installed app's `needs` and deploying makes the
account and adds the `SMTP_*` settings.
### With both
1. `coreapp new --postgres --sso team-visits`: `needs = ["postgres",