2020-04-27 05:41:54 +04:00
|
|
|
{ pkgs, config, lib, inputs, ... }:
|
2020-02-17 17:00:59 +04:00
|
|
|
let
|
2020-04-27 05:41:54 +04:00
|
|
|
module = toString inputs.simple-nixos-mailserver;
|
2020-02-17 17:00:59 +04:00
|
|
|
readCommandResult = command:
|
|
|
|
builtins.readFile (pkgs.runCommand "cmd" { preferLocalBuild = true; }
|
|
|
|
"echo -n $(${command}) > $out");
|
|
|
|
hashedPassword = readCommandResult
|
|
|
|
"${pkgs.mkpasswd}/bin/mkpasswd -m sha-512 '${config.secrets.mail.password}'";
|
|
|
|
in {
|
|
|
|
imports = [ module ];
|
2020-03-02 17:30:34 +04:00
|
|
|
services.postfix = {
|
2020-03-04 20:17:43 +04:00
|
|
|
dnsBlacklists = [
|
|
|
|
"all.s5h.net"
|
|
|
|
"b.barracudacentral.org"
|
|
|
|
"bl.spamcop.net"
|
|
|
|
"blacklist.woody.ch"
|
2020-03-04 20:18:38 +04:00
|
|
|
# "bogons.cymru.com"
|
2020-03-10 13:18:28 +04:00
|
|
|
# "cbl.abuseat.org"
|
|
|
|
# "combined.abuse.ch"
|
|
|
|
# "db.wpbl.info"
|
|
|
|
# "dnsbl-1.uceprotect.net"
|
|
|
|
# "dnsbl-2.uceprotect.net"
|
|
|
|
# "dnsbl-3.uceprotect.net"
|
2020-03-04 20:31:34 +04:00
|
|
|
# "dnsbl.anticaptcha.net"
|
2020-03-10 13:18:28 +04:00
|
|
|
# "dnsbl.dronebl.org"
|
|
|
|
# "dnsbl.inps.de"
|
|
|
|
# "dnsbl.sorbs.net"
|
|
|
|
# "dnsbl.spfbl.net"
|
|
|
|
# "drone.abuse.ch"
|
|
|
|
# "duinv.aupads.org"
|
|
|
|
# "dul.dnsbl.sorbs.net"
|
|
|
|
# "dyna.spamrats.com"
|
|
|
|
# "dynip.rothen.com"
|
|
|
|
# "http.dnsbl.sorbs.net"
|
|
|
|
# "ips.backscatterer.org"
|
|
|
|
# "ix.dnsbl.manitu.net"
|
|
|
|
# "korea.services.net"
|
|
|
|
# "misc.dnsbl.sorbs.net"
|
|
|
|
# "noptr.spamrats.com"
|
|
|
|
# "orvedb.aupads.org"
|
|
|
|
# "pbl.spamhaus.org"
|
|
|
|
# "proxy.bl.gweep.ca"
|
|
|
|
# "psbl.surriel.com"
|
|
|
|
# "relays.bl.gweep.ca"
|
|
|
|
# "relays.nether.net"
|
|
|
|
# "sbl.spamhaus.org"
|
|
|
|
# "singular.ttk.pte.hu"
|
|
|
|
# "smtp.dnsbl.sorbs.net"
|
|
|
|
# "socks.dnsbl.sorbs.net"
|
|
|
|
# "spam.abuse.ch"
|
|
|
|
# "spam.dnsbl.anonmails.de"
|
|
|
|
# "spam.dnsbl.sorbs.net"
|
|
|
|
# "spam.spamrats.com"
|
|
|
|
# "spambot.bls.digibase.ca"
|
|
|
|
# "spamrbl.imp.ch"
|
|
|
|
# "spamsources.fabel.dk"
|
|
|
|
# "ubl.lashback.com"
|
|
|
|
# "ubl.unsubscore.com"
|
|
|
|
# "virus.rbl.jp"
|
|
|
|
# "web.dnsbl.sorbs.net"
|
|
|
|
# "wormrbl.imp.ch"
|
|
|
|
# "xbl.spamhaus.org"
|
|
|
|
# "z.mailspike.net"
|
|
|
|
# "zen.spamhaus.org"
|
|
|
|
# "zombie.dnsbl.sorbs.net"
|
2020-03-04 20:17:43 +04:00
|
|
|
];
|
2020-03-04 20:40:40 +04:00
|
|
|
dnsBlacklistOverrides = ''
|
2020-03-04 20:41:16 +04:00
|
|
|
balsoft.ru OK
|
2020-03-10 13:21:13 +04:00
|
|
|
${builtins.concatStringsSep " OK \n" (builtins.attrNames config.devices)} OK
|
2020-03-04 20:41:16 +04:00
|
|
|
192.168.0.0/16 OK
|
2020-03-04 20:40:40 +04:00
|
|
|
'';
|
2020-03-02 17:30:34 +04:00
|
|
|
};
|
2020-02-17 17:00:59 +04:00
|
|
|
mailserver = {
|
2020-04-29 02:56:35 +04:00
|
|
|
enable = ! isNull config.secrets.mail.host;
|
2020-02-17 17:00:59 +04:00
|
|
|
fqdn = config.secrets.mail.host;
|
|
|
|
domains = [ config.secrets.mail.host ];
|
|
|
|
loginAccounts = {
|
|
|
|
"balsoft@balsoft.ru" = {
|
2020-03-02 17:30:34 +04:00
|
|
|
aliases =
|
|
|
|
[ "balsoft" "admin@balsoft.ru" "admin" "root@balsoft.ru" "root" ];
|
2020-02-17 17:00:59 +04:00
|
|
|
inherit hashedPassword;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
localDnsResolver = false;
|
|
|
|
certificateScheme = 1;
|
|
|
|
certificateFile = builtins.toFile "balsoft.crt" config.secrets.ssl.cert;
|
|
|
|
keyFile = builtins.toFile "balsoft.key" config.secrets.ssl.priv;
|
|
|
|
enableImap = true;
|
|
|
|
enableImapSsl = true;
|
|
|
|
virusScanning = false;
|
|
|
|
};
|
|
|
|
}
|