1
0
Fork 0

Improve mail config

This commit is contained in:
Malte Brandy 2020-09-23 15:33:10 +02:00
parent 1572fd0b19
commit d1a406a8d3
No known key found for this signature in database
GPG key ID: 226A2D41EF5378C9

View file

@ -1,5 +1,19 @@
{ config, ... }:
let certPath = "/var/lib/acme/hera.m-0.eu";
{ config, lib, ... }:
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 {
networking.firewall = { allowedTCPPorts = [ 25 143 587 993 ]; };
@ -66,6 +80,12 @@ in {
postfix = {
networks = [ "[${config.m-0.prefix}::]/64" "10.0.0.0/24" ];
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";
};
@ -79,21 +99,12 @@ in {
certificateScheme = 1;
certificateFile = "${certPath}/fullchain.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
'';
};
};
}