summary refs log tree commit diff
path: root/nixos/modules/services/mail/postfix.nix
diff options
context:
space:
mode:
authorMatt McHenry <github@matt.mchenryfamily.org>2015-12-24 14:34:43 -0500
committerMatt McHenry <github@matt.mchenryfamily.org>2017-09-21 21:44:55 -0400
commit0ece5fc50933ff7bd4d57c3d56b96540262674d4 (patch)
treee6cf988a423fb3aa3343f2f4e224528ebe13f12f /nixos/modules/services/mail/postfix.nix
parent6a7066eb53685438564dc50362666d0e7f150110 (diff)
downloadnixlib-0ece5fc50933ff7bd4d57c3d56b96540262674d4.tar
nixlib-0ece5fc50933ff7bd4d57c3d56b96540262674d4.tar.gz
nixlib-0ece5fc50933ff7bd4d57c3d56b96540262674d4.tar.bz2
nixlib-0ece5fc50933ff7bd4d57c3d56b96540262674d4.tar.lz
nixlib-0ece5fc50933ff7bd4d57c3d56b96540262674d4.tar.xz
nixlib-0ece5fc50933ff7bd4d57c3d56b96540262674d4.tar.zst
nixlib-0ece5fc50933ff7bd4d57c3d56b96540262674d4.zip
nixos/pfix-srsd: add module
Diffstat (limited to 'nixos/modules/services/mail/postfix.nix')
-rw-r--r--nixos/modules/services/mail/postfix.nix14
1 files changed, 14 insertions, 0 deletions
diff --git a/nixos/modules/services/mail/postfix.nix b/nixos/modules/services/mail/postfix.nix
index 01ae49d49090..461d4a621381 100644
--- a/nixos/modules/services/mail/postfix.nix
+++ b/nixos/modules/services/mail/postfix.nix
@@ -79,6 +79,12 @@ let
   // optionalAttrs haveTransport { transport_maps = "hash:/etc/postfix/transport"; }
   // optionalAttrs haveVirtual { virtual_alias_maps = "${cfg.virtualMapType}:/etc/postfix/virtual"; }
   // optionalAttrs (cfg.dnsBlacklists != []) { smtpd_client_restrictions = clientRestrictions; }
+  // optionalAttrs cfg.useSrs {
+    sender_canonical_maps = "tcp:127.0.0.1:10001";
+    sender_canonical_classes = "envelope_sender";
+    recipient_canonical_maps = "tcp:127.0.0.1:10002";
+    recipient_canonical_classes= "envelope_recipient";
+  }
   // optionalAttrs cfg.enableHeaderChecks { header_checks = "regexp:/etc/postfix/header_checks"; }
   // optionalAttrs (cfg.sslCert != "") {
     smtp_tls_CAfile = cfg.sslCACert;
@@ -626,6 +632,12 @@ in
         description = "Maps to be compiled and placed into /var/lib/postfix/conf.";
       };
 
+      useSrs = mkOption {
+        type = types.bool;
+        default = false;
+        description = "Whether to enable sender rewriting scheme";
+      };
+
     };
 
   };
@@ -646,6 +658,8 @@ in
         systemPackages = [ pkgs.postfix ];
       };
 
+      services.pfix-srsd.enable = config.services.postfix.useSrs;
+
       services.mail.sendmailSetuidWrapper = mkIf config.services.postfix.setSendmail {
         program = "sendmail";
         source = "${pkgs.postfix}/bin/sendmail";