From 08cb5828e814bf6f5b1e82c36fe0feb77ad725d3 Mon Sep 17 00:00:00 2001 From: Jack O'Sullivan Date: Fri, 27 Nov 2026 14:35:43 +0000 Subject: [PATCH] middleman: Add a Pocket ID client for mailcow mailcow's Generic-OIDC identity provider can sign mailboxes in to its UI and SOGo with Pocket ID. mailcow isn't NixOS, so its side is set up by hand in the admin UI with the secret from `mailcow/oidc-secret.txt`. Co-Authored-By: Claude Opus 5.5 --- docs/sites/colony/mail.md | 12 ++++++++++++ .../colony/vms/shill/containers/middleman/auth.nix | 10 ++++++++++ secrets/mailcow/oidc-secret.txt.age | 13 +++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 secrets/mailcow/oidc-secret.txt.age diff --git a/docs/sites/colony/mail.md b/docs/sites/colony/mail.md index 8d2ba0b..cbc3afd 100644 --- a/docs/sites/colony/mail.md +++ b/docs/sites/colony/mail.md @@ -33,6 +33,18 @@ The VM attaches to a dedicated, unbridged TAP (`vm-mail`). `colony` puts the poi estuary's reverse zone). `estuary` accepts traffic to the customer prefixes without per-port filtering; `colony` forwards it on ("trust for now"). +## Sign-in with Pocket ID + +mailcow's Generic-OIDC identity provider signs mailboxes in to the mailcow UI and SOGo with +Pocket ID on [`middleman`](shill/containers/middleman.md#pocket-id). + +- The `mailcow` client is declared in `middleman`'s `auth.nix`; its secret + `mailcow/oidc-secret.txt` is only deployed there. On the mailcow side the provider is set up + by hand under System → Configuration → Access → Identity Provider, with that secret pasted in. +- Only mailboxes whose auth source is the identity provider use it. IMAP, SMTP and the DAV and + ActiveSync clients can't follow a redirect, so those mailboxes use mailcow app passwords there. +- Admin and domain-admin logins are unaffected. + ## Notes - ACME certificates are issued on `middleman` and pushed to the VM over SSH diff --git a/nixos/boxes/colony/vms/shill/containers/middleman/auth.nix b/nixos/boxes/colony/vms/shill/containers/middleman/auth.nix index 527ccf0..f6c0b2d 100644 --- a/nixos/boxes/colony/vms/shill/containers/middleman/auth.nix +++ b/nixos/boxes/colony/vms/shill/containers/middleman/auth.nix @@ -17,6 +17,8 @@ in "middleman/oauth2-proxy.env" = { }; # Client secrets shared with the boxes that run the apps "gitea/oidc-secret.txt" = { }; + # Not deployed anywhere else: mailcow isn't NixOS, so it's pasted into its admin UI + "mailcow/oidc-secret.txt" = { }; }; pocket-id = { @@ -48,6 +50,14 @@ in launchURL = "https://git.${pubDomain}/"; secret.file = config.age.secrets."gitea/oidc-secret.txt".path; }; + + # mailcow's Generic-OIDC identity provider (`mail` VM), for mailbox sign-in + mailcow = { + name = "mailcow"; + callbackURLs = [ "https://mail.${pubDomain}" "https://mail.${pubDomain}/" ]; + launchURL = "https://mail.${pubDomain}/"; + secret.file = config.age.secrets."mailcow/oidc-secret.txt".path; + }; }; }; }; diff --git a/secrets/mailcow/oidc-secret.txt.age b/secrets/mailcow/oidc-secret.txt.age new file mode 100644 index 0000000..c4ef08b --- /dev/null +++ b/secrets/mailcow/oidc-secret.txt.age @@ -0,0 +1,13 @@ +-----BEGIN AGE ENCRYPTED FILE----- +YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IHNzaC1lZDI1NTE5IFZGY3c1ZyByOEdE +dStNQUxBS2I4OFBNdjc1ek5VQ1d3UnIxMldmQllTVlhXdjFWdkZNClRQeVNxajBO +bjBJRHRKTTJBOG1yZlV3VHFKRjVvN2ZoZjhmM3daQWQ2SjgKLT4gWDI1NTE5IDdJ +OTQ1NlNIbUJHWE9wN0J4Qi82ZVhXZTUvbE14SDR5TlErYnRyRHNPeU0KaGJIZVE1 +WGt6N0NnZ0Q2TXBZRm9hOXJMSVY2Vis4TExBQnVETk1zZE53YwotPiBYMjU1MTkg +RHVZS2VKUUxSdkk4aEQ5cGV4WkFQNDFZTnBlMmRrMjdCcHRPbDlYRzFIdwpVNG5R +eHRsSGIyQnVKNE5qenlEa0cwcmw4NUpERHlnRlFYck9kckVTMVp3Ci0+IDNIKil9 +cSUtZ3JlYXNlIHMpK15qdwpnMkI3MzhjMHFkUlh0QWFvUWdJR1lsSFNuVFo5QVg1 +MWRXM3M5Q1hEWlAyOEoxVFR2dwotLS0gUTRlTTBuSG5vbm5Cc2wwa0JZajZoZXBP +b0tPdjFEWHh2WHN5QVFxQStVYwqJgKKXVzhl1hAzrjCjL9Ms50Opvs0OEp9K0ncS +hBKY7L8jR0mPVdZrTSlA249HW22nAYXxt419WMt9wITs3lDwiA== +-----END AGE ENCRYPTED FILE----- -- 2.56.0