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;
|
2023-03-23 01:58:10 +03:00
|
|
|
secrets.mailserver-kavita = secrets-default;
|
2023-04-25 17:24:01 +03:00
|
|
|
secrets.mailserver-synapse = secrets-default;
|
2023-07-26 21:20:52 +03:00
|
|
|
secrets.mailserver-outline = 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-06-13 04:24:19 +03:00
|
|
|
aliases = [
|
2023-01-13 04:03:15 +03:00
|
|
|
"ataraxiadev" "admin@ataraxiadev.com" "admin" "root@ataraxiadev.com" "root"
|
2023-06-13 04:24:19 +03:00
|
|
|
"ark@ataraxiadev.com" "ark" "ataraxiadev.hsr@ataraxiadev.com" "ataraxiadev.hsr"
|
|
|
|
"hsr@ataraxiadev.com" "hsr"
|
|
|
|
"hsr1@ataraxiadev.com" "hsr1"
|
|
|
|
"hsr2@ataraxiadev.com" "hsr2"
|
|
|
|
"hsr3@ataraxiadev.com" "hsr3"
|
|
|
|
"hsr4@ataraxiadev.com" "hsr4"
|
|
|
|
"hsr5@ataraxiadev.com" "hsr5"
|
|
|
|
"hsr6@ataraxiadev.com" "hsr6"
|
|
|
|
"hsr7@ataraxiadev.com" "hsr7"
|
|
|
|
"hsr8@ataraxiadev.com" "hsr8"
|
|
|
|
"hsr9@ataraxiadev.com" "hsr9"
|
|
|
|
"hsr10@ataraxiadev.com" "hsr10"
|
|
|
|
"hsr11@ataraxiadev.com" "hsr11"
|
|
|
|
"hsr12@ataraxiadev.com" "hsr12"
|
|
|
|
"hsr13@ataraxiadev.com" "hsr13"
|
|
|
|
"hsr14@ataraxiadev.com" "hsr14"
|
|
|
|
"hsr15@ataraxiadev.com" "hsr15"
|
|
|
|
"hsr16@ataraxiadev.com" "hsr16"
|
2023-01-13 04:03:15 +03:00
|
|
|
# "@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" = {
|
2023-06-13 04:24:19 +03:00
|
|
|
aliases = [
|
|
|
|
"minichka76" "kpoxa@ataraxiadev.com" "kpoxa"
|
|
|
|
"sladkiyson0417@ataraxiadev.com" "sladkiyson0417"
|
|
|
|
];
|
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;
|
|
|
|
};
|
2023-03-23 01:58:10 +03:00
|
|
|
"kavita@ataraxiadev.com" = {
|
|
|
|
aliases = [ "kavita" ];
|
|
|
|
hashedPasswordFile = config.secrets.mailserver-kavita.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;
|
|
|
|
};
|
2023-04-25 17:24:01 +03:00
|
|
|
"matrix@ataraxiadev.com" = {
|
|
|
|
aliases = [ "matrix" ];
|
|
|
|
hashedPasswordFile = config.secrets.mailserver-synapse.decrypted;
|
|
|
|
};
|
2023-07-26 21:20:52 +03:00
|
|
|
"outline@ataraxiadev.com" = {
|
|
|
|
aliases = [ "outline" ];
|
|
|
|
hashedPasswordFile = config.secrets.mailserver-outline.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;
|
2023-06-15 01:54:40 +03:00
|
|
|
certificateScheme = "manual";
|
2022-02-21 02:25:13 +03:00
|
|
|
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
|
|
|
|
|
|
|
persist.state.directories = [
|
2023-04-25 17:32:30 +03:00
|
|
|
"/var/sieve" # FIXME: change ownership to virtualMail:
|
2023-01-13 04:03:15 +03:00
|
|
|
] ++ 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 ];
|
2023-06-13 04:24:19 +03:00
|
|
|
}
|