Improve mail config
This commit is contained in:
parent
1572fd0b19
commit
d1a406a8d3
1 changed files with 27 additions and 16 deletions
|
@ -1,5 +1,19 @@
|
||||||
{ config, ... }:
|
{ config, lib, ... }:
|
||||||
let certPath = "/var/lib/acme/hera.m-0.eu";
|
let
|
||||||
|
certPath = "/var/lib/acme/hera.m-0.eu";
|
||||||
|
# attrsToAliasList :: attrsOf (either str (listOf str)) -> str
|
||||||
|
attrsToAliasList = aliases:
|
||||||
|
lib.concatStringsSep "\n" (map (from:
|
||||||
|
let
|
||||||
|
to = aliases.${from};
|
||||||
|
aliasList = (l:
|
||||||
|
let aliasStr = builtins.foldl' (x: y: x + y + ", ") "" l;
|
||||||
|
in builtins.substring 0 (builtins.stringLength aliasStr - 2)
|
||||||
|
aliasStr);
|
||||||
|
in if (builtins.isList to) then
|
||||||
|
"${from} " + (aliasList to)
|
||||||
|
else
|
||||||
|
"${from} ${to}") (builtins.attrNames aliases));
|
||||||
in {
|
in {
|
||||||
networking.firewall = { allowedTCPPorts = [ 25 143 587 993 ]; };
|
networking.firewall = { allowedTCPPorts = [ 25 143 587 993 ]; };
|
||||||
|
|
||||||
|
@ -66,6 +80,12 @@ in {
|
||||||
postfix = {
|
postfix = {
|
||||||
networks = [ "[${config.m-0.prefix}::]/64" "10.0.0.0/24" ];
|
networks = [ "[${config.m-0.prefix}::]/64" "10.0.0.0/24" ];
|
||||||
transport = "email2matrix.maralorn.de smtp:[::1]:2525";
|
transport = "email2matrix.maralorn.de smtp:[::1]:2525";
|
||||||
|
virtual = attrsToAliasList (config.m-0.private.lists // {
|
||||||
|
"weather-channel@maralorn.de" = "weather@email2matrix.maralorn.de";
|
||||||
|
"subjects-channel@maralorn.de" =
|
||||||
|
"subjects@email2matrix.maralorn.de";
|
||||||
|
"notify-channel@maralorn.de" = "notify@email2matrix.maralorn.de";
|
||||||
|
});
|
||||||
};
|
};
|
||||||
opendkim.keyPath = "/var/dkim";
|
opendkim.keyPath = "/var/dkim";
|
||||||
};
|
};
|
||||||
|
@ -79,21 +99,12 @@ in {
|
||||||
certificateScheme = 1;
|
certificateScheme = 1;
|
||||||
certificateFile = "${certPath}/fullchain.pem";
|
certificateFile = "${certPath}/fullchain.pem";
|
||||||
keyFile = "${certPath}/key.pem";
|
keyFile = "${certPath}/key.pem";
|
||||||
extraVirtualAliases = config.m-0.private.lists // {
|
|
||||||
"weather-channel@maralorn.de" =
|
|
||||||
[ "weather@email2matrix.maralorn.de" ];
|
|
||||||
"subjects-channel@maralorn.de" =
|
|
||||||
[ "subjects@email2matrix.maralorn.de" ];
|
|
||||||
"notify-channel@maralorn.de" = [ "notify@email2matrix.maralorn.de" ];
|
|
||||||
"monitoring-channel@maralorn.de" =
|
|
||||||
[ "monitoring@email2matrix.maralorn.de" ];
|
|
||||||
};
|
|
||||||
policydSPFExtraConfig = ''
|
|
||||||
Mail_From_reject = False
|
|
||||||
HELO_Whitelist = hosteurope.de
|
|
||||||
skip_addresses = 127.0.0.0/8,::ffff:127.0.0.0/104,::1,130.83.0.0/16
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
policydSPFExtraConfig = ''
|
||||||
|
Mail_From_reject = False
|
||||||
|
HELO_Whitelist = hosteurope.de
|
||||||
|
skip_addresses = 127.0.0.0/8,::ffff:127.0.0.0/104,::1,130.83.0.0/16
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue