2022-11-25 15:24:05 +01:00
|
|
|
{ config, pkgs, ... }:
|
2022-12-17 12:58:27 +01:00
|
|
|
let
|
|
|
|
hostname = "mail.test.stramke.com";
|
|
|
|
domain = "test.stramke.com";
|
2022-11-25 15:24:05 +01:00
|
|
|
in {
|
2022-12-02 16:13:18 +01:00
|
|
|
networking.firewall.allowedTCPPorts = [ 25 587 143 ];
|
2022-11-25 15:24:05 +01:00
|
|
|
services = {
|
|
|
|
postfix = {
|
|
|
|
enable = true;
|
|
|
|
hostname = "${hostname}";
|
2022-12-17 12:58:27 +01:00
|
|
|
domain = "${domain}";
|
2022-12-02 16:13:18 +01:00
|
|
|
relayHost = "";
|
2022-12-17 12:58:27 +01:00
|
|
|
origin = "${domain}";
|
|
|
|
destination = ["${hostname}" "${domain}" "localhost"];
|
2022-11-25 15:24:05 +01:00
|
|
|
config = {
|
2022-12-02 16:13:18 +01:00
|
|
|
mynetworks = "168.119.135.69/32 10.0.0.0/24 0.0.0.0/0 127.0.0.1";
|
2022-11-25 15:24:05 +01:00
|
|
|
smtpd_recipient_restrictions = [
|
2022-12-02 16:13:18 +01:00
|
|
|
"reject_unauth_destination"
|
|
|
|
"permit_sasl_authenticated"
|
|
|
|
"permit_mynetworks"
|
|
|
|
];
|
2022-11-25 15:24:05 +01:00
|
|
|
smtpd_sasl_auth_enable = true;
|
|
|
|
smtpd_sasl_path = "/var/lib/postfix/auth";
|
2022-12-02 16:13:18 +01:00
|
|
|
# smtpd_sasl_type = "dovecot";
|
2022-11-25 15:24:05 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
dovecot2 = {
|
|
|
|
enable = true;
|
|
|
|
enableImap = true;
|
|
|
|
enableQuota = false;
|
|
|
|
mailboxes = {
|
|
|
|
Spam = {
|
|
|
|
auto = "create";
|
|
|
|
specialUse = "Junk";
|
|
|
|
};
|
|
|
|
Sent = {
|
|
|
|
auto = "create";
|
|
|
|
specialUse = "Sent";
|
|
|
|
};
|
|
|
|
Drafts = {
|
|
|
|
auto = "create";
|
|
|
|
specialUse = "Drafts";
|
|
|
|
};
|
|
|
|
Trash = {
|
|
|
|
auto = "create";
|
|
|
|
specialUse = "Trash";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
extraConfig = ''
|
2022-12-02 16:13:18 +01:00
|
|
|
mail_location = maildir:/var/spool/mail/%u
|
|
|
|
auth_mechanisms = plain login
|
|
|
|
disable_plaintext_auth = no
|
2022-11-25 15:24:05 +01:00
|
|
|
userdb {
|
|
|
|
driver = passwd
|
|
|
|
args = blocking=no
|
|
|
|
}
|
|
|
|
service auth {
|
|
|
|
unix_listener /var/lib/postfix/auth {
|
|
|
|
group = postfix
|
|
|
|
mode = 0660
|
|
|
|
user = postfix
|
|
|
|
}
|
2022-12-02 16:13:18 +01:00
|
|
|
|
2022-11-25 15:24:05 +01:00
|
|
|
}
|
|
|
|
'';
|
|
|
|
};
|
2022-12-17 12:58:27 +01:00
|
|
|
rspamd = {
|
|
|
|
enable = true;
|
|
|
|
};
|
|
|
|
opendkim = {
|
|
|
|
enable = true;
|
|
|
|
selector = "mail";
|
|
|
|
domains = "csl:${domain}";
|
|
|
|
};
|
2022-11-25 15:24:05 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|