2015-10-18 12:25:54 +00:00
|
|
|
{ config, pkgs, ... }:
|
|
|
|
|
|
|
|
{
|
|
|
|
# services.opensmtpd = {
|
|
|
|
# enable = true;
|
|
|
|
# serverConfiguration = ''
|
|
|
|
# listen on 0.0.0.0
|
|
|
|
# filter sa spamassassin "-s accept"
|
|
|
|
# accept for any deliver to lmtp localhost:24
|
|
|
|
# '';
|
|
|
|
# procPackages = [ pkgs.opensmtpd-extras ];
|
|
|
|
# };
|
|
|
|
|
|
|
|
services.postfix = {
|
|
|
|
enable = true;
|
|
|
|
postmasterAlias = "gebner";
|
|
|
|
rootAlias = "gebner";
|
|
|
|
extraAliases = ''
|
|
|
|
ge: gebner
|
|
|
|
cutintro: gebner
|
|
|
|
'';
|
2015-10-18 13:17:38 +00:00
|
|
|
hostname = "mastus.gebner.org";
|
2015-10-18 12:25:54 +00:00
|
|
|
sslCACert = "/etc/sslcerts/startssl.cert";
|
|
|
|
sslCert = "/etc/sslcerts/mail.cert";
|
2015-10-18 12:43:41 +00:00
|
|
|
sslKey = "/etc/sslcerts/mail.key";
|
2015-10-18 12:25:54 +00:00
|
|
|
|
2015-10-18 13:17:38 +00:00
|
|
|
destination = [ "gebner.org" "gabrielebner.at" "2b7e.org"
|
|
|
|
"mastus.gebner.org" "mail.gebner.org" "localhost" ];
|
|
|
|
|
2015-10-18 12:25:54 +00:00
|
|
|
extraConfig = ''
|
|
|
|
mailbox_command = ${pkgs.procmail}/bin/procmail
|
2015-10-25 08:29:49 +00:00
|
|
|
|
|
|
|
smtpd_tls_mandatory_protocols=!SSLv2,!SSLv3
|
|
|
|
smtp_tls_mandatory_protocols=!SSLv2,!SSLv3
|
|
|
|
smtpd_tls_protocols=!SSLv2,!SSLv3
|
|
|
|
smtp_tls_protocols=!SSLv2,!SSLv3
|
2015-10-25 12:56:35 +00:00
|
|
|
|
|
|
|
smtpd_sasl_type = dovecot
|
|
|
|
smtpd_sasl_path = private/auth
|
|
|
|
smtpd_sasl_auth_enable = yes
|
|
|
|
smtpd_tls_auth_only = yes
|
2015-10-18 12:25:54 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
services.dovecot2 = {
|
|
|
|
enable = true;
|
|
|
|
enablePop3 = false;
|
|
|
|
mailLocation = "maildir:~/mail";
|
|
|
|
sslCACert = "/etc/sslcerts/startssl.cert";
|
|
|
|
sslServerCert = "/etc/sslcerts/mail.cert";
|
2015-10-18 20:46:54 +00:00
|
|
|
sslServerKey = "/etc/sslcerts/mail-dovecot.key";
|
2015-10-25 08:29:49 +00:00
|
|
|
extraConfig = ''
|
|
|
|
ssl_protocols = !SSLv2 !SSLv3
|
2015-10-25 12:56:35 +00:00
|
|
|
|
|
|
|
service auth {
|
|
|
|
unix_listener /var/postfix/queue/private/auth {
|
|
|
|
mode = 0660
|
|
|
|
user = postfix
|
|
|
|
group = postfix
|
|
|
|
}
|
|
|
|
}
|
2015-10-25 08:29:49 +00:00
|
|
|
'';
|
2015-10-18 12:25:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
services.spamassassin.enable = true;
|
|
|
|
systemd.services.setupSpamassassin = {
|
|
|
|
wantedBy = [ "spamd.service" ];
|
|
|
|
after = [ "network.target" ];
|
|
|
|
path = [ pkgs.spamassassin ];
|
|
|
|
serviceConfig = {
|
|
|
|
Type = "oneshot";
|
|
|
|
RemainAfterExit = "yes";
|
|
|
|
};
|
|
|
|
script = ''
|
|
|
|
if [ ! -d /etc/spamassassin ]; then
|
|
|
|
cp -rv ${pkgs.spamassassin}/share/spamassassin /etc/
|
|
|
|
sa-update
|
|
|
|
fi
|
|
|
|
'';
|
|
|
|
};
|
2015-10-18 20:17:56 +00:00
|
|
|
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
spamassassin
|
|
|
|
procmail
|
2015-10-19 05:57:22 +00:00
|
|
|
mailutils
|
2015-10-18 20:17:56 +00:00
|
|
|
];
|
2015-10-18 12:25:54 +00:00
|
|
|
}
|