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
+11
View File
@@ -0,0 +1,11 @@
# Delete its mail account from the Core's LDAP (only if it's this app's)
LDAP_BASE="$(sed -n 's/^LDAP_SEARCH_BASE=ou=people,//p' /federated/apps/mail/.env)"
LDAP_ADMIN_PW="$(cat /federated/apps/ldap/.ldap.secret)"
MAIL_DN="uid=coreapp-{{NAME}},ou=people,$LDAP_BASE"
if docker exec ldap ldapsearch -LLL -x -H ldap://localhost -D "cn=admin,$LDAP_BASE" \
-w "$LDAP_ADMIN_PW" -b "$MAIL_DN" -s base description 2>/dev/null \
| grep -qx "description: coreapps: {{NAME}}"; then
docker exec ldap ldapdelete -x -H ldap://localhost -D "cn=admin,$LDAP_BASE" \
-w "$LDAP_ADMIN_PW" "$MAIL_DN"
fi
unset LDAP_BASE LDAP_ADMIN_PW MAIL_DN