Skip to content

Make company email sign-in, encryption and recovery declarative #5387

Open
7 of 8 issues completed
Open

Description

@devantler

🤖 Generated by the Agentic Engineer

Problem

The maintainer wants company email sign-in integrated with the existing identity provider, mailbox encryption at rest, and a service that can be rebuilt from reviewed configuration after an incident. The Homepage must list Stalwart with its logo under the Email section.

Expected outcome

Use the maintainer's existing mailbox for normal administration when supported, with a tested recovery path before retiring a separate administrator. Manage supported settings declaratively and retain required private keys and recovery material in approved private custody.

Acceptance criteria

  • The Stalwart entry appears with its logo in the declared Email section, with matching dashboard admission rules and observed browser navigation.
  • Dedicated OIDC client and native mail authentication configuration are declarative. Verify issuer, audience, identity mapping and denied identities; observe the maintainer's real sign-in without reading tokens or credentials into chat or logs.
  • The maintainer's mailbox can administer the server. Decide the separate administrator's lifecycle from tested normal and recovery access, preserving automation privileges and the restricted agent account.
  • Encrypt the persistent server storage for company email while ordinary mail clients read messages normally, without requiring per-client S/MIME identities. Manage operational encryption keys through approved private custody and verify safe migration of existing data, new delivery and actual backup restoration. Document the exact protection, limitations and independent bootstrap needed to recover the secrets service.
  • Move the three durable credentials into infrastructure/email/... in OpenBao through reviewed configuration. Copy and compare the current values before switching consumers; retain recovery history and refuse conflicting destination values. Use company email wording in operator documentation without replacing retained mailbox storage.
  • Reapply desired state without duplicating accounts or erasing mailbox history, personal keys, app credentials or unrelated data. Rebuild and restore from the declared configuration plus approved recovery material; verify readback and fail on drift.
  • Pass current-head validation, substantive review, protected merge and deployed checks. No click-based configuration or secrets in public artifacts.

Part of #5030.

References

Activity

  1. self-assigned this
    on Oct 26, 2026
  2. coderabbitai commented on Oct 26, 2026

    @coderabbitai
    Contributor
    🔗 Related PRs

    #5388 - feat(email): prepare Email credential custody and recovery [merged]
    #5533 - feat(email): move active credentials and recovery to infrastructure [merged]
    #5503 - fix(email): preserve client credentials during configuration replay [merged]
    #5493 - fix(email): verify backups using the declared credential format [merged]
    #5351 - feat(mail): activate Stalwart administration and Homepage entry [merged]
    #5482 - fix(homepage): show Stalwart with its logo under Email [merged]


    📝 Issue Planner

    Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.

    • Create Plan

    🧪 Issue enrichment is currently in open beta.

    You can configure auto-planning by selecting labels in the issue_enrichment configuration.

    To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

    issue_enrichment:
      auto_enrich:
        enabled: false

    💬 Have feedback or questions? Drop into our discord!

  3. added 2 commits that reference this issue on Oct 26, 2026
  4. moved this to 🏃🏻‍♂️ In Progress in 🌊 Project Boardon Oct 26, 2026
  5. changed the title [-]Make mail sign-in, encryption and recovery declarative[/-] [+]Make company email sign-in, encryption and recovery declarative[/+] on Oct 26, 2026
  6. devantler commented on Oct 27, 2026

    @devantler
    ContributorAuthor

    🤖 Generated by the Agentic Engineer

    Recovery acceptance now explicitly includes the maintainer's requirement that Email encryption identities and their unlocking material remain recoverable without the original client computer or cluster. A local keychain alone is insufficient. Preserve the original identity and historical decryption keys; generating a replacement does not prove recovery.

    The original identity's client import and a synthetic encrypted-message decryption have been observed. Independent retrieval of the encrypted package and its unlocking material still needs confirmation before encryption activation or any retirement of existing access. Keep secret values, private storage references and recovery material out of this issue.

  7. devantler commented on Oct 27, 2026

    @devantler
    ContributorAuthor

    🤖 Generated by the Agentic Engineer

    The maintainer clarified the intended behavior: encrypt server storage while ordinary mail clients read messages normally, without installing per-client decryption identities. Recovery records should have their canonical home in OpenBao.

    Stalwart's per-account S/MIME feature does not provide that experience: it stores encrypted messages that require the matching private key in each client. Do not activate that feature as the implementation of this requirement. The completed local identity round-trip is therefore preparation evidence, not acceptance of the requested storage encryption.

    Continue with declarative transparent storage encryption, preserve existing data through migration, and prove restore before retiring the old copies. Operational recovery records belong in OpenBao; the independent bootstrap needed to recover OpenBao itself must remain recoverable outside that service.

  8. removed their assignment
    on Oct 28, 2026
  9. 45 remaining items

  10. self-assigned this
    on Nov 11, 2026
  11. added 3 commits that reference this issue on Nov 11, 2026
  12. devantler commented on Nov 15, 2026

    @devantler
    ContributorAuthor

    Email server settings audit (Stalwart 0.16.27)

    Every security setting was checked against the Stalwart v0.16.27 source. The setup program now declares the settings below, applies them at every start and reads each one back before the server serves (#6261). A read-only drift check (private-mail-bootstrap check) reports a setting changed in the web interface; scheduling it comes with the image adoption.

    Changed

    Setting Old value New value Reason
    DKIM and DMARC verification Intended relaxed on the inbound listener only, but written as a quoted string, which the server ignores. The server fell back to relaxed on every listener, including submission. Relaxed on smtp-inbound, off elsewhere, as bare constants Checks only mail arriving from other servers. A test now refuses quoted values.
    ARC verification Off Relaxed on smtp-inbound DNS-only and cheap.
    Non-FQDN HELO rejection Off on the inbound listener (upstream keys it on port 25; ours is 1025) On for smtp-inbound Cheap bot filter.
    Received and Return-Path headers Off on the inbound listener (same port-25 keying) On for smtp-inbound Trace headers on received mail.
    Authentication-Results header Added on every listener smtp-inbound only Outbound mail no longer carries this server's verdicts.
    VRFY and EXPN Allowed for signed-in sessions Off Address enumeration.
    Ban periods (sign-in, abuse, loiter, scan) Permanent One day A ban blocks an address on every listener. Web clients reach the server with their own address (#5448).
    Ban logging Not logged Logged: bans and blocked addresses They name only an address. Sign-in and mail activity stay out of the log (#5416).
    Pyzor lookups On Off Egress blocks them, so each one only waits for its timeout. They would also send message digests to a third party.
    Spam classifier training samples Kept 180 days Kept 30 days Samples are private message data.
    DMARC, DKIM and SPF failure reports Sent daily Off They carry message content to whoever a sender's domain names. Aggregate DMARC and TLS reports stay on.
    Trash and Junk expunge 30 days (upstream default) 30 days, declared Pins the default.
    Inbound throttles Two seeded by the server only into an empty collection; no limit per account Sender IP 5 per second, sender-to-recipient 25 per hour, submission 100 per hour per account All three declared and read back.

    Kept, and why

    Setting Value Reason
    TLS on listeners STARTTLS on SMTP and submission, implicit TLS on IMAP Already correct. TLS 1.2 stays for mail servers that lack 1.3.
    Plain-text IMAP sign-in Off Already correct.
    SMTP AUTH Offered and required only on submission over TLS; sender must match Already correct.
    Password policy Upstream: 8 characters, strength three, Argon2id Generated passwords are 40 or more random characters. Storing a stricter policy during setup stops the server installing its role defaults on a fresh store.
    ASN lookups Off Declaring the default stores nothing, so it is left to the server.
    HSTS Gateway sends it (two years, preload) Stronger than the server's fixed header.

    Needs a decision or a later step

    • Two-factor sign-in. Stalwart 0.16.27 cannot require it. A TOTP secret for the administrator can be declared from OpenBao once the maintainer enrols one.
    • Web sign-in provider. Anonymous client registration is on. Requiring registration needs a registered client for the web interface first.
    • Before public SMTP and IMAP: SPF and reverse-IP checks, strict DMARC, and bans and the IP throttle on those listeners all need the real client address there.
    • Before MX moves: the spam filter needs a vendored, pinned rules file. Today it has no rules, so every score is zero.

    Full table with source references: docs/operations/email-secure-defaults.md.

    🤖 Generated with Claude Code

  13. devantler commented on Nov 15, 2026

    @devantler
    ContributorAuthor

    Encrypted mail storage: cutover done

    The company mail store is now encrypted at rest. #6257 merged at 03:50 UTC on 2026-11-15, and merge-group run 43672283203 succeeded.

    • Key first. feat(email): bring up the encrypted store's key before any cutover #6283 brought the key up without a stop. Production showed SecretStore/private-mail/email-storage Valid and ExternalSecret/private-mail/email-storage-key synced at 02:20 UTC, before the cutover was queued.
    • Stop. The new private-mail-0 started at 03:44:31 and was Ready at 03:45:10, about one minute down. No manual pod replacement was needed.
    • Copy. The copy step reported: "Email storage copied onto the encrypted volume and verified; the original is untouched." Setup then reported: "Email configuration verified".
    • Volumes. Mail serves from email-data-encrypted. Longhorn reports encrypted=true, and the PV is Retain. The original private-mail-data stays mounted read-only as the rollback.
    • Route. healthz/ready answered 200.

    Follow-up: the encrypted volume has 2 of 3 replicas. Longhorn refuses the third with "insufficient storage" on worker 1, whose disk is fully booked. Removing the two old recovery copies (run 43674222442, recorded on #6041) should free that space; I will confirm the third replica.

    Still open under this issue: two-factor sign-in, the web sign-in provider, the real client address before public SMTP and IMAP, and pinned spam rules before MX moves (see the settings audit above). The restore proof from encrypted storage is #6256.

    🤖 Generated with Claude Code

  14. devantler commented on Nov 15, 2026

    @devantler
    ContributorAuthor

    Follow-up to the cutover: the encrypted mail store's Longhorn volume is now healthy with all three replicas. Removing recovery copy 41561215415 (#6041) freed the space its third replica needed.

    🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Fields

Priority

None yet

Start date

None yet

Target date

None yet

Effort

None yet

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions