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
+33 -2
View File
@@ -44,6 +44,12 @@ What we learned provisioning (2026-12-02/03):
- [ ] The Core shows as Active in the dashboard
- [ ] Tell Federated (2026-12-03):
- Apps send mail as `fcore` (an `inetOrgPerson` in the `admins` group)
with the Core's admin password (`MAIL_PASSWORD=$ADMINPASS` in e.g.
`lib/bookstack.sh`), so every app holds the admin password. The
mail server also has no `SPOOF_PROTECTION`, so any account can send
as any address. coreapps gives each app its own sending-only
account instead (see Coreapps, step 4)
- On this image, disabling systemd-resolved isn't enough: networkd's
`systemd-networkd-resolve-hook.socket` starts it at boot, it takes
port 53 and pdns can't start after a reboot. coreapp-dev masks it
@@ -289,8 +295,33 @@ Steps:
data may not survive that. Refuse, or warn?
- [ ] Pin the image digest at install (from the registry at that moment)
so a re-pushed tag can't change what's installed
4. [ ] Email and AI needs (findings below), then other services: PowerDNS
records beyond the wildcard, if an app needs other hostnames
4. Email (2026-12-03): `needs = ["email"]` (`coreapp new --email`) gives
the app its own mail account for sending: an LDAP entry
`uid=coreapp-<name>,ou=people` with `objectClass: account`,
`simpleSecurityObject`, `PostfixBookMailAccount`, `mail:
coreapp-<name>@<domain>`, `mailEnabled: FALSE` (no mailbox), `description:
coreapps: <name>` (whose it is), password from `.env` set with
`ldappasswd` (hashed by the server). Not a person, so Authelia
(`objectClass=person`), Nextcloud (`inetOrgPerson`) and Superpanel don't
see it; Federated's shared `fcore` account is an `inetOrgPerson` in
`admins`, hidden only by Superpanel's `HIDDEN_USERS`, and apps get the
admin password with it. Its own address so a person's mail login (by
mail or uid) never finds two entries. `SMTP_*` settings: mail.<domain>,
587, STARTTLS, user, password, `SMTP_FROM=<name>@<domain>`. Setup leaves
an entry that isn't the app's alone and the installer warns. Tested on
dev.fedcom.net: login from the core network with a valid certificate,
sender and a local recipient accepted (nothing sent), wrong password
refused (535), password stored `{SSHA}`, Authelia sign-in refused (401),
not in Nextcloud or Superpanel users, teardown, a foreign entry left
alone (with a warning), email added to an existing app on update
- [ ] Send a real message, to an address outside the Core (through the
relay)
- [ ] Spoofing: the mail server has no `SPOOF_PROTECTION`, so any
authenticated account (Federated's apps' `fcore` too) can send as any
address. Tell Federated; with it on, an app could only send as its
account's address
- [ ] AI needs (findings below; needs Federated), then other services:
PowerDNS records beyond the wildcard, if an app needs other hostnames
5. The skill (moved ahead of 2-4, 2026-12-03): `skills/coreapp/SKILL.md`,
linked into `~/.claude/skills/coreapp` by `update.sh`, so any Claude Code
agent on this computer can use it. Rehearsed with a small app