1 { lib, pkgs, config, name, ... }:
3 config = lib.mkIf config.myServices.mailRelay.enable {
6 dest = "opensmtpd/creds";
11 eldiron ${name}:${config.hostEnv.ldap.password}
15 users.users.smtpd.extraGroups = [ "keys" ];
16 services.opensmtpd = {
18 serverConfiguration = ''
20 "${config.secrets.fullPaths."opensmtpd/creds"}"
21 # FIXME: filtering requires 6.6
23 # proc-exec "${pkgs.procmail}/bin/formail -i 'From: ${name}@immae.eu'"
24 action "relay-rewrite-from" relay \
25 helo ${config.hostEnv.fqdn} \
26 host smtp+tls://eldiron@eldiron.immae.eu:587 \
28 mail-from ${name}@immae.eu
29 action "relay" relay \
30 helo ${config.hostEnv.fqdn} \
31 host smtp+tls://eldiron@eldiron.immae.eu:587 \
33 match for any !mail-from "@immae.eu" action "relay-rewrite-from"
34 match for any mail-from "@immae.eu" action "relay"
37 environment.systemPackages = [ config.services.opensmtpd.package ];
38 services.mail.sendmailSetuidWrapper = {
40 source = "${config.services.opensmtpd.package}/bin/smtpctl";
44 security.wrappers.mailq = {
46 source = "${config.services.opensmtpd.package}/bin/smtpctl";