mail: verify the ADR 0116 app-password capability against the pinned kanidm (#229 split) #320

Closed
opened 2026-08-06 21:48:23 +00:00 by ben · 1 comment
Owner

Parent

Split from #229 (Ben's 2026-08-06 scope ruling).

What to build

ADR 0116 rests on kanidm minting per-app passwords for mail clients (IMAP/SMTP auth without the primary credential). That capability has never been exercised against the pinned kanidm build. Run it live in the lab: mint an app password via kanidm self-service (MAIL-M4's external door), authenticate a mail client through Stalwart's LDAP directory path, and post the evidence. If the pinned kanidm cannot do it, that is an ADR 0116 amendment — surface it, don't work around it.

Acceptance

  • Given the lab kanidm at the pinned rev, When an app password is minted and used for IMAP + SMTP auth, Then both succeed and the evidence (versions, transcript) is posted here.
## Parent Split from #229 (Ben's 2026-08-06 scope ruling). ## What to build ADR 0116 rests on kanidm minting per-app passwords for mail clients (IMAP/SMTP auth without the primary credential). That capability has never been exercised against the **pinned** kanidm build. Run it live in the lab: mint an app password via kanidm self-service (MAIL-M4's external door), authenticate a mail client through Stalwart's LDAP directory path, and post the evidence. If the pinned kanidm cannot do it, that is an ADR 0116 amendment — surface it, don't work around it. ## Acceptance - Given the lab kanidm at the pinned rev, When an app password is minted and used for IMAP + SMTP auth, Then both succeed and the evidence (versions, transcript) is posted here.
Author
Owner

ADR 0116 app-password capability: CONFIRMED against the pinned kanidm. No amendment needed.

Exercised live end to end against the pinned build (kanidm 1.10.3 kanidmWithSecretProvisioning_1_10, nixpkgs 173d0ad7) with a real Stalwart 0.15.5 front, all from the pinned store on one host (a single-binary capability question — no clan-lab droplet required).

Acceptance met, literally. A member minted an app password via kanidm self-service (SCIM POST /scim/v1/Person/<id>/Application/_create_password) and it authenticated IMAP LOGIN + SMTP AUTH — both succeed through Stalwart's kanidm LDAP directory:

IMAPS a1 LOGIN ruruhi <app-password>  -> a1 OK Authentication successful; SELECT INBOX READ-WRITE
SMTPS AUTH PLAIN <\0ruruhi\0app-password> -> 235 Authentication succeeded; MAIL/RCPT 250 OK
kanidm: ✅ LDAP Bind success for name=ruruhi,app=mail -> Application("mail")

The credential is scoped — it fails as a plain (non-app=) bind and on a wrong secret (LDAP 49).

Findings the mail backend (#229 / #318) must honour (full report: docs/spike-findings/mail-apppw-320.md):

  1. Applications are SCIM-only — the kanidm CLI has no application verb in 1.10.3. Founding must create the mail application over the adapter's REST path (POST /scim/v1/Application), not the provision CLI. The member-facing door stays kanidm's own self-service web UI (ADR 0116's "no custom OurCloud screen").
  2. Stalwart must load attributes over its SERVICE bind — set directory.<id>.bind.auth.search = false. An app-password bind yields an anonymous-level session that can't read the user's own mail/memberof; this was the exact difference between 535 invalid and success.
  3. The Stalwart bind identity must join the builtin idm_mail_servers group (idm_acp_mail_servers grants read of name/spn/mail/memberof) — bound via dn=token it otherwise sees only itself.
  4. Working Stalwart LDAP shape (informs internal/clan/mail.go, which sets bind.dn/bind.secret but not the app-context template or base-dn): base-dn=dc=<domain>, bind.dn="dn=token"+bind.secret=<mail-app api-token>, bind.auth.method="template", bind.auth.template="name=?,app=mail", bind.auth.search=false.
  5. Minting needs a privileged (reauth) SELF session — a fresh login is read-only (403 on _create_password until reauth); an admin cannot mint on the member's behalf (idm_acp_self_write, target=self), matching ADR 0116's self-service ruling.
  6. kanidm LDAP is LDAPS-only (no StartTLS) — Stalwart must trust the community CA.

Landed on origin/main as ebb9bc4; STATUS.md lead + header updated.

**ADR 0116 app-password capability: CONFIRMED against the pinned kanidm. No amendment needed.** Exercised live end to end against the pinned build (kanidm **1.10.3** `kanidmWithSecretProvisioning_1_10`, nixpkgs `173d0ad7`) with a real **Stalwart 0.15.5** front, all from the pinned store on one host (a single-binary capability question — no clan-lab droplet required). **Acceptance met, literally.** A member minted an app password via kanidm self-service (SCIM `POST /scim/v1/Person/<id>/Application/_create_password`) and it authenticated **IMAP LOGIN + SMTP AUTH — both succeed** through Stalwart's kanidm LDAP directory: ``` IMAPS a1 LOGIN ruruhi <app-password> -> a1 OK Authentication successful; SELECT INBOX READ-WRITE SMTPS AUTH PLAIN <\0ruruhi\0app-password> -> 235 Authentication succeeded; MAIL/RCPT 250 OK kanidm: ✅ LDAP Bind success for name=ruruhi,app=mail -> Application("mail") ``` The credential is **scoped** — it fails as a plain (non-`app=`) bind and on a wrong secret (LDAP 49). **Findings the mail backend (#229 / #318) must honour** (full report: `docs/spike-findings/mail-apppw-320.md`): 1. **Applications are SCIM-only** — the `kanidm` CLI has no `application` verb in 1.10.3. Founding must create the `mail` application over the adapter's REST path (`POST /scim/v1/Application`), not the provision CLI. The member-facing door stays kanidm's own self-service web UI (ADR 0116's "no custom OurCloud screen"). 2. **Stalwart must load attributes over its SERVICE bind** — set `directory.<id>.bind.auth.search = false`. An app-password bind yields an anonymous-level session that can't read the user's own `mail`/`memberof`; this was the exact difference between `535 invalid` and success. 3. **The Stalwart bind identity must join the builtin `idm_mail_servers` group** (`idm_acp_mail_servers` grants read of `name/spn/mail/memberof`) — bound via `dn=token` it otherwise sees only itself. 4. **Working Stalwart LDAP shape** (informs `internal/clan/mail.go`, which sets `bind.dn`/`bind.secret` but not the app-context template or base-dn): `base-dn=dc=<domain>`, `bind.dn="dn=token"`+`bind.secret=<mail-app api-token>`, `bind.auth.method="template"`, `bind.auth.template="name=?,app=mail"`, `bind.auth.search=false`. 5. **Minting needs a privileged (reauth) SELF session** — a fresh login is read-only (403 on `_create_password` until `reauth`); an admin **cannot** mint on the member's behalf (`idm_acp_self_write`, target=self), matching ADR 0116's self-service ruling. 6. **kanidm LDAP is LDAPS-only** (no StartTLS) — Stalwart must trust the community CA. Landed on `origin/main` as `ebb9bc4`; STATUS.md lead + header updated.
ben closed this issue 2026-08-06 22:29:07 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/idss#320
No description provided.