aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/by-name/co/constants/module.nix1
-rw-r--r--modules/by-name/st/stalwart-mail/module.nix56
2 files changed, 28 insertions, 29 deletions
diff --git a/modules/by-name/co/constants/module.nix b/modules/by-name/co/constants/module.nix
index 946776b..743ac65 100644
--- a/modules/by-name/co/constants/module.nix
+++ b/modules/by-name/co/constants/module.nix
@@ -85,6 +85,7 @@
# Keep this sorted with `!sort --numeric-sort --key=2 --field-separator="="`
systemd-coredump = 151; # matches systemd-coredump user
resolvconf = 333; # This group is not matched to an user?
+ stalwart-mail-certificates = 338; # This group is used to connect nginx and stalwart-mail
# The gid should match the uid. Thus should not be >= 400;
};
diff --git a/modules/by-name/st/stalwart-mail/module.nix b/modules/by-name/st/stalwart-mail/module.nix
index ec10188..ed1821a 100644
--- a/modules/by-name/st/stalwart-mail/module.nix
+++ b/modules/by-name/st/stalwart-mail/module.nix
@@ -188,22 +188,9 @@ in {
# dataDir = cfg.dataDirectory;
};
- # FIXME(@bpeetz): This is currently needed for a successful acme http-01 challenge.
- # We could also use the DNS challenge. <2025-03-01>
nginx.virtualHosts."${cfg.fqdn}" = {
- enableACME = false;
- extraConfig =
- # This is copied directly from the nixos nginx module.
- # Rule for legitimate ACME Challenge requests (like /.well-known/acme-challenge/xxxxxxxxx)
- # We use ^~ here, so that we don't check any regexes (which could
- # otherwise easily override this intended match accidentally).
- ''
- location ^~ /.well-known/acme-challenge/ {
- root ${config.security.acme.certs.${cfg.fqdn}.webroot};
- auth_basic off;
- auth_request off;
- }
- '';
+ useACMEHost = "${cfg.fqdn}";
+ forceSSL = true;
};
redis = {
@@ -234,7 +221,7 @@ in {
security.acme.certs = {
"${cfg.fqdn}" = {
domain = cfg.fqdn;
- group = "stalwart-mail";
+ group = "stalwart-mail-certificates";
};
};
@@ -274,20 +261,31 @@ in {
# service is restarted on a potentially large number of files.
# That would cause unnecessary and unwanted delays.
users = {
- groups.stalwart-mail = {
- gid = config.vhack.constants.ids.gids.stalwart-mail;
- };
- users.stalwart-mail = {
- isSystemUser = true;
- group = "stalwart-mail";
- uid = config.vhack.constants.ids.uids.stalwart-mail;
- };
- groups.redis-stalwart-mail = {
- gid = config.vhack.constants.ids.gids.redis-stalwart-mail;
+ groups = {
+ stalwart-mail = {
+ gid = config.vhack.constants.ids.gids.stalwart-mail;
+ };
+ stalwart-mail-certificates = {
+ gid = config.vhack.constants.ids.gids.stalwart-mail-certificates;
+ };
+ redis-stalwart-mail = {
+ gid = config.vhack.constants.ids.gids.redis-stalwart-mail;
+ };
};
- users.redis-stalwart-mail = {
- group = "redis-stalwart-mail";
- uid = config.vhack.constants.ids.uids.redis-stalwart-mail;
+ users = {
+ nginx = {
+ extraGroups = ["stalwart-mail-certificates"];
+ };
+ stalwart-mail = {
+ isSystemUser = true;
+ group = "stalwart-mail";
+ uid = config.vhack.constants.ids.uids.stalwart-mail;
+ extraGroups = ["stalwart-mail-certificates"];
+ };
+ redis-stalwart-mail = {
+ group = "redis-stalwart-mail";
+ uid = config.vhack.constants.ids.uids.redis-stalwart-mail;
+ };
};
};