about summary refs log tree commit diff
path: root/modules/server/spectrum/postfix
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2021-02-27 16:29:33 +0000
committerAlyssa Ross <hi@alyssa.is>2021-02-27 16:41:41 +0000
commite7c24f90e6092bff156600c4a056bdaef5a55de4 (patch)
tree4464673ef1eccf777960351823ccfacc074b6000 /modules/server/spectrum/postfix
parent4325970ffdb6f4cbb58240fbbe224460d242a9f9 (diff)
downloadnixlib-e7c24f90e6092bff156600c4a056bdaef5a55de4.tar
nixlib-e7c24f90e6092bff156600c4a056bdaef5a55de4.tar.gz
nixlib-e7c24f90e6092bff156600c4a056bdaef5a55de4.tar.bz2
nixlib-e7c24f90e6092bff156600c4a056bdaef5a55de4.tar.lz
nixlib-e7c24f90e6092bff156600c4a056bdaef5a55de4.tar.xz
nixlib-e7c24f90e6092bff156600c4a056bdaef5a55de4.tar.zst
nixlib-e7c24f90e6092bff156600c4a056bdaef5a55de4.zip
modules/spectrum/postfix: init
Diffstat (limited to 'modules/server/spectrum/postfix')
-rw-r--r--modules/server/spectrum/postfix/default.nix60
1 files changed, 60 insertions, 0 deletions
diff --git a/modules/server/spectrum/postfix/default.nix b/modules/server/spectrum/postfix/default.nix
new file mode 100644
index 000000000000..eef4bc36c79e
--- /dev/null
+++ b/modules/server/spectrum/postfix/default.nix
@@ -0,0 +1,60 @@
+{ pkgs, ... }:
+
+{
+  services.postfix.enable = true;
+  services.postfix.enableSubmission = true;
+  services.postfix.hostname = "atuin.qyliss.net";
+  services.postfix.config.smtp_tls_loglevel = "1";
+  services.postfix.sslCert = "/var/lib/acme/spectrum-os.org/fullchain.pem";
+  services.postfix.sslKey = "/var/lib/acme/spectrum-os.org/key.pem";
+  services.postfix.rootAlias = "hi@alyssa.is";
+  services.postfix.relayDomains = [ "hash:/var/lib/mailman/data/postfix_domains" ];
+  services.postfix.config.transport_maps = [ "hash:/var/lib/mailman/data/postfix_lmtp" ];
+  services.postfix.localRecipients = []; # empty array causes NixOS to add $alias_maps
+  services.postfix.config.mailbox_command = "${pkgs.coreutils}/bin/false";
+  services.postfix.config.local_recipient_maps =
+    [ "proxy:unix:passwd.byname" "hash:/var/lib/mailman/data/postfix_lmtp" ];
+
+  services.postfix.destination =
+    [ "atuin.qyliss.net" "qyliss.net" "spectrumos.org" "spectrum-os.org" ];
+  services.postfix.extraAliases = ''
+    abuse: root
+    noc: root
+    security: root
+    hostmaster: root
+    usenet: root
+    news: root
+    webmaster: root
+    www: root
+    uucp: root
+    ftp: root
+  '';
+
+  services.postfix.enableHeaderChecks = true;
+  services.postfix.headerChecks = [
+    { pattern = ''/^Content-Type:\s*text\/html/'';
+      action = "REJECT HTML mail is not supported.  See https://useplaintext.email for instructions."; }
+  ];
+
+  services.postfix.masterConfig.smtp_inet.args =
+    [ "-o" "content_filter=spamassassin" ];
+
+  services.postfix.masterConfig.spamassassin = {
+    privileged = true;
+    chroot = false;
+    command = "pipe";
+    args = [
+      "user=public-inbox" # FIXME: this is a hack because public-inbox has ~/.spamassassin
+      "argv=${pkgs.spamassassin}/bin/spamc"
+      "-f"
+      "-e"
+      "/run/wrappers/bin/sendmail"
+      "-oi"
+      "-f"
+      "\${sender}"
+      "\${recipient}"
+    ];
+  };
+
+  networking.firewall.allowedTCPPorts = [ 25 ];
+}