diff --git a/machines/akhaten/default.nix b/machines/akhaten/default.nix index 51b4386..7668263 100644 --- a/machines/akhaten/default.nix +++ b/machines/akhaten/default.nix @@ -113,11 +113,6 @@ }; - services.roundcube = { - enable = true; - hostName = "webmail.luj.fr"; - }; - networking.firewall.allowedUDPPorts = [ 51821 ]; diff --git a/machines/akhaten/stalwart.nix b/machines/akhaten/stalwart.nix index b1572a5..6d2edfd 100644 --- a/machines/akhaten/stalwart.nix +++ b/machines/akhaten/stalwart.nix @@ -1,7 +1,17 @@ -{ config, lib, ... }: +{ + config, + lib, + pkgs, + ... +}: { services.stalwart-mail = { enable = true; + package = pkgs.stalwart-mail.overrideAttrs ( + _: _: { + patches = [ ./stalwart.patch ]; + } + ); settings = { authentication.fallback-admin = { user = "admin"; diff --git a/machines/akhaten/stalwart.patch b/machines/akhaten/stalwart.patch new file mode 100644 index 0000000..acc7882 --- /dev/null +++ b/machines/akhaten/stalwart.patch @@ -0,0 +1,46 @@ +From 1282e77ea96e5154011b3d4607c15140003ee2e6 Mon Sep 17 00:00:00 2001 +From: mdecimus +Date: Sun, 9 Mar 2025 17:47:40 +0100 +Subject: [PATCH] Do not panic when mailboxId is not found (closes #1293) + +--- + crates/imap/src/op/list.rs | 18 +++++++++++++++++- + 1 file changed, 17 insertions(+), 1 deletion(-) + +diff --git a/crates/imap/src/op/list.rs b/crates/imap/src/op/list.rs +index 250db4be..4231ec1b 100644 +--- a/crates/imap/src/op/list.rs ++++ b/crates/imap/src/op/list.rs +@@ -22,6 +22,7 @@ use imap_proto::{ + }, + receiver::Request, + }; ++use trc::StoreEvent; + + use super::ImapContext; + +@@ -202,7 +203,22 @@ impl SessionData { + + for (mailbox_name, mailbox_id) in &account.mailbox_names { + if matches_pattern(&patterns, mailbox_name) { +- let mailbox = account.mailbox_state.get(mailbox_id).unwrap(); ++ let mailbox = if let Some(mailbox) = account.mailbox_state.get(mailbox_id) { ++ mailbox ++ } else { ++ trc::event!( ++ Store(StoreEvent::UnexpectedError), ++ Details = "IMAP mailbox no longer present in account state", ++ Id = *mailbox_id, ++ Details = account ++ .mailbox_state ++ .keys() ++ .copied() ++ .map(trc::Value::from) ++ .collect::>() ++ ); ++ continue; ++ }; + let mut has_recursive_match = false; + if recursive_match { + let prefix = format!("{}/", mailbox_name); + diff --git a/machines/gustave/default.nix b/machines/gustave/default.nix index 29e2c5b..1884ab3 100644 --- a/machines/gustave/default.nix +++ b/machines/gustave/default.nix @@ -161,5 +161,21 @@ networking.firewall.allowedTCPPorts = [ 51820 ]; networking.firewall.allowedUDPPorts = [ 51820 ]; + services.roundcube = { + enable = true; + plugins = [ + "managesieve" + ]; + hostName = "webmail.luj.fr"; + extraConfig = '' + # starttls needed for authentication, so the fqdn required to match + # the certificate + $config['smtp_server'] = "tls://mail.luj.fr"; + $config['smtp_user'] = "%u"; + $config['smtp_pass'] = "%p"; + $config['imap_host'] = 'ssl://mail.luj.fr'; + ''; + }; + system.stateVersion = "23.11"; }