nixos-config/mastus/mail.nix

91 lines
2.1 KiB
Nix
Raw Normal View History

2015-10-18 14:25:54 +02: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 15:17:38 +02:00
hostname = "mastus.gebner.org";
sslCert = "/etc/sslcerts/fullchain.pem";
sslKey = "/etc/sslcerts/key.pem";
2015-10-18 14:25:54 +02:00
2015-10-18 15:17:38 +02:00
destination = [ "gebner.org" "gabrielebner.at" "2b7e.org"
2015-11-06 08:28:19 +01:00
"mastus.gebner.org" "localhost" ];
2015-10-18 15:17:38 +02:00
2015-10-18 14:25:54 +02:00
extraConfig = ''
mailbox_command = ${pkgs.procmail}/bin/procmail
2015-10-25 09:29:49 +01: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 13:56:35 +01:00
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_tls_auth_only = yes
2015-10-18 14:25:54 +02:00
'';
2015-10-27 09:08:29 +01:00
extraMasterConf = ''
submission inet n - n - - smtpd
'';
2015-10-18 14:25:54 +02:00
};
services.dovecot2 = {
enable = true;
enablePop3 = false;
mailLocation = "maildir:~/mail";
sslCACert = "/etc/sslcerts/fullchain.pem";
sslServerCert = "/etc/sslcerts/fullchain.pem";
sslServerKey = "/etc/sslcerts/key-dovecot.pem";
2015-10-25 09:29:49 +01:00
extraConfig = ''
ssl_protocols = !SSLv2 !SSLv3
2015-10-25 13:56:35 +01:00
service auth {
unix_listener /var/postfix/queue/private/auth {
mode = 0660
user = postfix
group = postfix
}
}
2015-10-25 09:29:49 +01:00
'';
2015-10-18 14:25:54 +02: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
'';
};
environment.systemPackages = with pkgs; [
spamassassin
procmail
2015-10-19 07:57:22 +02:00
mailutils
];
2015-10-18 14:25:54 +02:00
}