2022-02-21 02:25:13 +03:00
|
|
|
{ pkgs, config, lib, inputs, ... }:
|
|
|
|
let
|
2023-01-13 04:03:15 +03:00
|
|
|
secrets-default = {
|
2022-03-22 06:02:13 +03:00
|
|
|
owner = "dovecot2:dovecot2";
|
|
|
|
services = [ "dovecot2" ];
|
|
|
|
};
|
2023-01-13 04:03:15 +03:00
|
|
|
in {
|
|
|
|
imports = [ (toString inputs.simple-nixos-mailserver) ];
|
|
|
|
secrets.mailserver = secrets-default;
|
|
|
|
secrets.mailserver-minichka = secrets-default;
|
|
|
|
secrets.mailserver-mitin = secrets-default;
|
|
|
|
secrets.mailserver-joplin = secrets-default;
|
|
|
|
secrets.mailserver-vaultwarden = secrets-default;
|
|
|
|
secrets.mailserver-seafile = secrets-default;
|
|
|
|
secrets.mailserver-gitea = secrets-default;
|
2023-01-26 04:45:14 +03:00
|
|
|
secrets.mailserver-authentik = secrets-default;
|
2022-02-21 02:25:13 +03:00
|
|
|
|
|
|
|
security.acme.certs."mail.ataraxiadev.com" = {
|
|
|
|
webroot = "/var/lib/acme/acme-challenge";
|
|
|
|
postRun = ''
|
|
|
|
systemctl reload postfix
|
|
|
|
systemctl reload dovecot2
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
services.postfix = {
|
|
|
|
dnsBlacklists = [
|
|
|
|
"all.s5h.net"
|
|
|
|
"b.barracudacentral.org"
|
|
|
|
"bl.spamcop.net"
|
|
|
|
"blacklist.woody.ch"
|
|
|
|
];
|
|
|
|
dnsBlacklistOverrides = ''
|
|
|
|
ataraxiadev.com OK
|
|
|
|
mail.ataraxiadev.com OK
|
|
|
|
127.0.0.0/8 OK
|
|
|
|
192.168.0.0/16 OK
|
|
|
|
'';
|
2022-08-31 11:37:26 +03:00
|
|
|
headerChecks = [
|
|
|
|
{
|
|
|
|
action = "IGNORE";
|
|
|
|
pattern = "/^User-Agent.*Roundcube Webmail/";
|
|
|
|
}
|
|
|
|
];
|
2022-02-21 02:25:13 +03:00
|
|
|
};
|
|
|
|
mailserver = rec {
|
|
|
|
enable = true;
|
|
|
|
openFirewall = true;
|
|
|
|
fqdn = "mail.ataraxiadev.com";
|
|
|
|
domains = [ "ataraxiadev.com" ];
|
2022-03-22 06:02:13 +03:00
|
|
|
# hashedPassword:
|
|
|
|
# nsp apacheHttpd --run 'htpasswd -nbB "" "super secret password"' | cut -d: -f2
|
2022-02-21 02:25:13 +03:00
|
|
|
loginAccounts = {
|
|
|
|
"ataraxiadev@ataraxiadev.com" = {
|
2023-01-13 04:03:15 +03:00
|
|
|
aliases =[
|
|
|
|
"ataraxiadev" "admin@ataraxiadev.com" "admin" "root@ataraxiadev.com" "root"
|
|
|
|
"ark@ataraxiadev.com" "ark"
|
|
|
|
# "@ataraxiadev.com"
|
|
|
|
];
|
2022-02-21 02:25:13 +03:00
|
|
|
hashedPasswordFile = config.secrets.mailserver.decrypted;
|
|
|
|
};
|
2022-03-22 06:04:02 +03:00
|
|
|
"minichka76@ataraxiadev.com" = {
|
2022-08-31 11:37:26 +03:00
|
|
|
aliases =
|
|
|
|
[ "minichka76" "kpoxa@ataraxiadev.com" "kpoxa" ];
|
2022-03-22 06:04:02 +03:00
|
|
|
hashedPasswordFile = config.secrets.mailserver-minichka.decrypted;
|
|
|
|
};
|
2022-12-07 02:39:08 +03:00
|
|
|
"mitin@ataraxiadev.com" = {
|
|
|
|
aliases = [ "mitin" "mitin1@ataraxiadev.com" "mitin1" "mitin2@ataraxiadev.com" "mitin2" ];
|
|
|
|
hashedPasswordFile = config.secrets.mailserver-mitin.decrypted;
|
|
|
|
};
|
2023-01-13 04:03:15 +03:00
|
|
|
|
2023-01-26 04:45:14 +03:00
|
|
|
"authentik@ataraxiadev.com" = {
|
|
|
|
aliases = [ "authentik" ];
|
|
|
|
hashedPasswordFile = config.secrets.mailserver-authentik.decrypted;
|
|
|
|
};
|
2023-01-13 04:03:15 +03:00
|
|
|
"gitea@ataraxiadev.com" = {
|
|
|
|
aliases = [ "gitea" ];
|
|
|
|
hashedPasswordFile = config.secrets.mailserver-gitea.decrypted;
|
|
|
|
};
|
2022-10-09 00:39:52 +03:00
|
|
|
"joplin@ataraxiadev.com" = {
|
|
|
|
aliases = [ "joplin" ];
|
|
|
|
hashedPasswordFile = config.secrets.mailserver-joplin.decrypted;
|
|
|
|
};
|
2022-02-21 02:25:13 +03:00
|
|
|
"vaultwarden@ataraxiadev.com" = {
|
|
|
|
aliases = [ "vaultwarden" ];
|
|
|
|
hashedPasswordFile = config.secrets.mailserver-vaultwarden.decrypted;
|
|
|
|
};
|
2022-03-22 06:02:13 +03:00
|
|
|
"seafile@ataraxiadev.com" = {
|
|
|
|
aliases = [ "seafile" ];
|
|
|
|
hashedPasswordFile = config.secrets.mailserver-seafile.decrypted;
|
|
|
|
};
|
2022-02-21 02:25:13 +03:00
|
|
|
};
|
2022-08-31 11:37:26 +03:00
|
|
|
hierarchySeparator = "/";
|
2023-01-26 02:13:15 +03:00
|
|
|
localDnsResolver = false;
|
2022-02-21 02:25:13 +03:00
|
|
|
certificateScheme = 1;
|
|
|
|
certificateFile = "${config.security.acme.certs.${fqdn}.directory}/fullchain.pem";
|
|
|
|
keyFile = "${config.security.acme.certs.${fqdn}.directory}/key.pem";
|
2022-08-31 11:37:26 +03:00
|
|
|
enableManageSieve = true;
|
2022-02-21 02:25:13 +03:00
|
|
|
enableImap = true;
|
2022-08-31 11:37:26 +03:00
|
|
|
enableImapSsl = true;
|
|
|
|
enablePop3 = false;
|
|
|
|
enablePop3Ssl = false;
|
2022-02-21 02:25:13 +03:00
|
|
|
enableSubmission = true;
|
2022-08-31 11:37:26 +03:00
|
|
|
enableSubmissionSsl = true;
|
2022-02-21 02:25:13 +03:00
|
|
|
virusScanning = false;
|
2023-01-13 04:03:15 +03:00
|
|
|
|
|
|
|
mailDirectory = "/srv/mail/vmail";
|
|
|
|
dkimKeyDirectory = "/srv/mail/dkim";
|
2022-02-21 02:25:13 +03:00
|
|
|
};
|
2022-12-14 23:46:25 +03:00
|
|
|
|
|
|
|
# FIXME: ownership of mail directory
|
|
|
|
persist.state.directories = [
|
2023-01-13 04:03:15 +03:00
|
|
|
# "/var/lib/dovecot"
|
|
|
|
# "/var/lib/postfix"
|
|
|
|
# "/var/lib/dhparams"
|
|
|
|
] ++ lib.optionals (config.deviceSpecific.devInfo.fileSystem != "zfs") [
|
|
|
|
config.mailserver.dkimKeyDirectory
|
2022-12-14 23:46:25 +03:00
|
|
|
config.mailserver.mailDirectory
|
|
|
|
];
|
2023-01-13 04:03:15 +03:00
|
|
|
|
|
|
|
networking.firewall.allowedTCPPorts = [ 80 443 ];
|
2022-02-21 02:25:13 +03:00
|
|
|
}
|