formatting

This commit is contained in:
Rouven Seifert 2022-12-17 21:33:45 +01:00
parent fb8b55b2c9
commit e569bdec50
Signed by: rouven.seifert
GPG key ID: B95E8FE6B11C4D09

View file

@ -1,82 +1,90 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
let let
hostname = "mail.test.stramke.com"; hostname = "mail.test.stramke.com";
domain = "test.stramke.com"; domain = "test.stramke.com";
in { in
networking.firewall.allowedTCPPorts = [ 25 587 143 11334]; {
users.users.postfix.extraGroups = ["rspamd"]; # doesn't seem to work networking.firewall.allowedTCPPorts = [ 25 587 143 ];
services = { services = {
postfix = { postfix = {
enable = true; enable = true;
hostname = "${hostname}"; hostname = "${hostname}";
domain = "${domain}"; domain = "${domain}";
relayHost = ""; relayHost = "";
origin = "${domain}"; origin = "${domain}";
destination = ["${hostname}" "${domain}" "localhost"]; destination = [ "${hostname}" "${domain}" "localhost" ];
config = { config = {
smtpd_recipient_restrictions = [ smtpd_recipient_restrictions = [
"reject_unauth_destination" "reject_unauth_destination"
"permit_sasl_authenticated" "permit_sasl_authenticated"
"permit_mynetworks" "permit_mynetworks"
]; ];
smtpd_sasl_auth_enable = true; smtpd_sasl_auth_enable = true;
smtpd_sasl_path = "/var/lib/postfix/auth"; smtpd_sasl_path = "/var/lib/postfix/auth";
# put in opendkim (port 8891) and rspamd (port 11334) as mail filter # put in opendkim (port 8891) and rspamd (port 11333) as mail filter
smtpd_milters = ["inet:localhost:8891" "/run/rspamd/rspamd.sock"]; smtpd_milters = [ "inet:localhost:8891" "inet:localhost:11333" ];
non_smtpd_milters = "$smtpd_milters"; non_smtpd_milters = "$smtpd_milters";
milter_default_action = "accept"; milter_default_action = "accept";
}; };
}; };
dovecot2 = { dovecot2 = {
enable = true; enable = true;
enableImap = true; enableImap = true;
enableQuota = false; enableQuota = false;
mailboxes = { mailboxes = {
Spam = { Spam = {
auto = "create"; auto = "create";
specialUse = "Junk"; specialUse = "Junk";
};
Sent = {
auto = "create";
specialUse = "Sent";
};
Drafts = {
auto = "create";
specialUse = "Drafts";
};
Trash = {
auto = "create";
specialUse = "Trash";
};
};
extraConfig = ''
mail_location = maildir:/var/spool/mail/%u
auth_mechanisms = plain login
disable_plaintext_auth = no
userdb {
driver = passwd
args = blocking=no
}
service auth {
unix_listener /var/lib/postfix/auth {
group = postfix
mode = 0660
user = postfix
}
}
'';
};
rspamd = {
enable = true;
};
opendkim = {
enable = true;
selector = "default";
domains = "csl:${domain}";
socket = "inet:8891";
};
}; };
} Sent = {
auto = "create";
specialUse = "Sent";
};
Drafts = {
auto = "create";
specialUse = "Drafts";
};
Trash = {
auto = "create";
specialUse = "Trash";
};
};
extraConfig = ''
mail_location = maildir:/var/spool/mail/%u
auth_mechanisms = plain login
disable_plaintext_auth = no
userdb {
driver = passwd
args = blocking=no
}
service auth {
unix_listener /var/lib/postfix/auth {
group = postfix
mode = 0660
user = postfix
}
}
'';
};
rspamd = {
enable = true;
workers = {
normal = {
bindSockets = [ "*:11333" ]; # interface for the mailfilter
};
controller = {
bindSockets = [ "*:11334" ]; # webinterface
};
};
};
opendkim = {
enable = true;
selector = "default";
domains = "csl:${domain}";
socket = "inet:8891";
};
};
}