9 cfg = config.services.postfix;
12 setgidGroup = cfg.setgidGroup;
14 haveAliases = cfg.postmasterAlias != "" || cfg.rootAlias != "" || cfg.extraAliases != "";
15 haveCanonical = cfg.canonical != "";
16 haveTransport = cfg.transport != "";
17 haveVirtual = cfg.virtual != "";
18 haveLocalRecipients = cfg.localRecipients != null;
20 clientAccess = lib.optional (
21 cfg.dnsBlacklistOverrides != ""
22 ) "check_client_access hash:/etc/postfix/client_access";
24 dnsBl = lib.optionals (cfg.dnsBlacklists != [ ]) (
25 map (s: "reject_rbl_client " + s) cfg.dnsBlacklists
28 clientRestrictions = lib.concatStringsSep ", " (clientAccess ++ dnsBl);
32 escape = lib.replaceStrings [ "$" ] [ "$$" ];
33 mkList = items: "\n " + lib.concatStringsSep ",\n " items;
36 if lib.isList value then
43 else if value == false then
48 mkEntry = name: value: "${escape name} =${mkVal value}";
50 lib.concatStringsSep "\n" (lib.mapAttrsToList mkEntry cfg.config) + "\n" + cfg.extraConfig;
66 The name of the service to run. Defaults to the attribute set key.
71 type = lib.types.enum [
80 description = "The type of the service";
83 private = lib.mkOption {
84 type = lib.types.bool;
87 Whether the service's sockets and storage directory is restricted to
88 be only available via the mail system. If `null` is
89 given it uses the postfix default `true`.
93 privileged = lib.mkOption {
94 type = lib.types.bool;
99 chroot = lib.mkOption {
100 type = lib.types.bool;
103 Whether the service is chrooted to have only access to the
104 {option}`services.postfix.queueDir` and the closure of
105 store paths specified by the {option}`program` option.
109 wakeup = lib.mkOption {
110 type = lib.types.int;
113 Automatically wake up the service after the specified number of
114 seconds. If `0` is given, never wake the service
119 wakeupUnusedComponent = lib.mkOption {
120 type = lib.types.bool;
123 If set to `false` the component will only be woken
124 up if it is used. This is equivalent to postfix' notion of adding a
125 question mark behind the wakeup time in
130 maxproc = lib.mkOption {
131 type = lib.types.int;
134 The maximum number of processes to spawn for this service. If the
135 value is `0` it doesn't have any limit. If
136 `null` is given it uses the postfix default of
141 command = lib.mkOption {
142 type = lib.types.str;
146 A program name specifying a Postfix service/daemon process.
147 By default it's the attribute {option}`name`.
151 args = lib.mkOption {
152 type = lib.types.listOf lib.types.str;
156 "smtp_helo_timeout=5"
159 Arguments to pass to the {option}`command`. There is no shell
160 processing involved and shell syntax is passed verbatim to the
165 rawEntry = lib.mkOption {
166 type = lib.types.listOf lib.types.str;
170 The raw configuration line for the {file}`master.cf`.
177 mkBool = bool: if bool then "y" else "n";
178 mkArg = arg: "${lib.optionalString (lib.hasPrefix "-" arg) "\n "}${arg}";
180 maybeOption = fun: option: if options.${option}.isDefined then fun config.${option} else "-";
182 # This is special, because we have two options for this value.
185 wakeupDefined = options.wakeup.isDefined;
186 wakeupUCDefined = options.wakeupUnusedComponent.isDefined;
188 toString config.wakeup + lib.optionalString (wakeupUCDefined && !config.wakeupUnusedComponent) "?";
190 if wakeupDefined then finalValue else "-";
196 (maybeOption mkBool "private")
197 (maybeOption (b: mkBool (!b)) "privileged")
198 (maybeOption mkBool "chroot")
200 (maybeOption toString "maxproc")
201 (config.command + " " + lib.concatMapStringsSep " " mkArg config.args)
231 masterCf = lib.mapAttrsToList (lib.const (lib.getAttr "rawEntry")) cfg.masterConfig;
233 # A list of the maximum width of the columns across all lines and labels
239 columnLengths = map lib.stringLength line;
241 lib.zipListsWith lib.max acc columnLengths;
242 # We need to handle the last column specially here, because it's
243 # open-ended (command + args).
247 ] ++ (map (l: lib.init l ++ [ "" ]) masterCf);
249 lib.foldr foldLine (lib.genList (lib.const 0) (lib.length labels)) lines;
251 # Pad a string with spaces from the right (opposite of fixedWidthString).
255 padWidth = width - lib.stringLength str;
256 padding = lib.concatStrings (lib.genList (lib.const " ") padWidth);
258 str + lib.optionalString (padWidth > 0) padding;
260 # It's + 2 here, because that's the amount of spacing between columns.
261 fullWidth = lib.foldr (width: acc: acc + width + 2) 0 maxWidths;
263 formatLine = line: lib.concatStringsSep " " (lib.zipListsWith pad maxWidths line);
267 sep = "# " + lib.concatStrings (lib.genList (lib.const "=") (fullWidth + 5));
271 (formatLine labelDefaults)
275 lib.concatStringsSep "\n" lines;
280 + lib.concatMapStringsSep "\n" formatLine masterCf
282 + cfg.extraMasterConf;
288 pattern = lib.mkOption {
289 type = lib.types.str;
291 example = "/^X-Mailer:/";
292 description = "A regexp pattern matching the header";
294 action = lib.mkOption {
295 type = lib.types.str;
297 example = "BCC mail@example.com";
298 description = "The action to be executed when the pattern is matched";
304 lib.concatStringsSep "\n" (map (x: "${x.pattern} ${x.action}") cfg.headerChecks)
305 + cfg.extraHeaderChecks;
309 separator = lib.optionalString (cfg.aliasMapType == "hash") ":";
311 lib.optionalString (cfg.postmasterAlias != "") ''
312 postmaster${separator} ${cfg.postmasterAlias}
314 + lib.optionalString (cfg.rootAlias != "") ''
315 root${separator} ${cfg.rootAlias}
319 aliasesFile = pkgs.writeText "postfix-aliases" aliases;
320 canonicalFile = pkgs.writeText "postfix-canonical" cfg.canonical;
321 virtualFile = pkgs.writeText "postfix-virtual" cfg.virtual;
322 localRecipientMapFile = pkgs.writeText "postfix-local-recipient-map" (
323 lib.concatMapStrings (x: x + " ACCEPT\n") cfg.localRecipients
325 checkClientAccessFile = pkgs.writeText "postfix-check-client-access" cfg.dnsBlacklistOverrides;
326 mainCfFile = pkgs.writeText "postfix-main.cf" mainCf;
327 masterCfFile = pkgs.writeText "postfix-master.cf" masterCfContent;
328 transportFile = pkgs.writeText "postfix-transport" cfg.transport;
329 headerChecksFile = pkgs.writeText "postfix-header-checks" headerChecks;
341 enable = lib.mkOption {
342 type = lib.types.bool;
344 description = "Whether to run the Postfix mail server.";
347 enableSmtp = lib.mkOption {
348 type = lib.types.bool;
350 description = "Whether to enable smtp in master.cf.";
353 enableSubmission = lib.mkOption {
354 type = lib.types.bool;
356 description = "Whether to enable smtp submission.";
359 enableSubmissions = lib.mkOption {
360 type = lib.types.bool;
363 Whether to enable smtp submission via smtps.
365 According to RFC 8314 this should be preferred
366 over STARTTLS for submission of messages by end user clients.
370 submissionOptions = lib.mkOption {
371 type = with lib.types; attrsOf str;
373 smtpd_tls_security_level = "encrypt";
374 smtpd_sasl_auth_enable = "yes";
375 smtpd_client_restrictions = "permit_sasl_authenticated,reject";
376 milter_macro_daemon_name = "ORIGINATING";
379 smtpd_tls_security_level = "encrypt";
380 smtpd_sasl_auth_enable = "yes";
381 smtpd_sasl_type = "dovecot";
382 smtpd_client_restrictions = "permit_sasl_authenticated,reject";
383 milter_macro_daemon_name = "ORIGINATING";
385 description = "Options for the submission config in master.cf";
388 submissionsOptions = lib.mkOption {
389 type = with lib.types; attrsOf str;
391 smtpd_sasl_auth_enable = "yes";
392 smtpd_client_restrictions = "permit_sasl_authenticated,reject";
393 milter_macro_daemon_name = "ORIGINATING";
396 smtpd_sasl_auth_enable = "yes";
397 smtpd_sasl_type = "dovecot";
398 smtpd_client_restrictions = "permit_sasl_authenticated,reject";
399 milter_macro_daemon_name = "ORIGINATING";
402 Options for the submission config via smtps in master.cf.
404 smtpd_tls_security_level will be set to encrypt, if it is missing
405 or has one of the values "may" or "none".
407 smtpd_tls_wrappermode with value "yes" will be added automatically.
411 setSendmail = lib.mkOption {
412 type = lib.types.bool;
414 description = "Whether to set the system sendmail to postfix's.";
417 user = lib.mkOption {
418 type = lib.types.str;
420 description = "What to call the Postfix user (must be used only for postfix).";
423 group = lib.mkOption {
424 type = lib.types.str;
426 description = "What to call the Postfix group (must be used only for postfix).";
429 setgidGroup = lib.mkOption {
430 type = lib.types.str;
431 default = "postdrop";
433 How to call postfix setgid group (for postdrop). Should
434 be uniquely used group.
438 networks = lib.mkOption {
439 type = lib.types.nullOr (lib.types.listOf lib.types.str);
441 example = [ "192.168.0.1/24" ];
443 Net masks for trusted - allowed to relay mail to third parties -
444 hosts. Leave empty to use mynetworks_style configuration or use
445 default (localhost-only).
449 networksStyle = lib.mkOption {
450 type = lib.types.str;
453 Name of standard way of trusted network specification to use,
454 leave blank if you specify it explicitly or if you want to use
455 default (localhost-only).
459 hostname = lib.mkOption {
460 type = lib.types.str;
463 Hostname to use. Leave blank to use just the hostname of machine.
468 domain = lib.mkOption {
469 type = lib.types.str;
472 Domain to use. Leave blank to use hostname minus first component.
476 origin = lib.mkOption {
477 type = lib.types.str;
480 Origin to use in outgoing e-mail. Leave blank to use hostname.
484 destination = lib.mkOption {
485 type = lib.types.nullOr (lib.types.listOf lib.types.str);
487 example = [ "localhost" ];
489 Full (!) list of domains we deliver locally. Leave blank for
490 acceptable Postfix default.
494 relayDomains = lib.mkOption {
495 type = lib.types.nullOr (lib.types.listOf lib.types.str);
497 example = [ "localdomain" ];
499 List of domains we agree to relay to. Default is empty.
503 relayHost = lib.mkOption {
504 type = lib.types.str;
507 Mail relay for outbound mail.
511 relayPort = lib.mkOption {
512 type = lib.types.int;
515 SMTP port for relay mail relay.
519 lookupMX = lib.mkOption {
520 type = lib.types.bool;
523 Whether relay specified is just domain whose MX must be used.
527 postmasterAlias = lib.mkOption {
528 type = lib.types.str;
531 Who should receive postmaster e-mail. Multiple values can be added by
532 separating values with comma.
536 rootAlias = lib.mkOption {
537 type = lib.types.str;
540 Who should receive root e-mail. Blank for no redirection.
541 Multiple values can be added by separating values with comma.
545 extraAliases = lib.mkOption {
546 type = lib.types.lines;
549 Additional entries to put verbatim into aliases file, cf. man-page aliases(8).
553 aliasMapType = lib.mkOption {
563 description = "The format the alias map should have. Use regexp if you want to use regular expressions.";
566 config = lib.mkOption {
576 The main.cf configuration file as key value set.
579 mail_owner = "postfix";
580 smtp_tls_security_level = "may";
584 extraConfig = lib.mkOption {
585 type = lib.types.lines;
588 Extra lines to be added verbatim to the main.cf configuration file.
592 tlsTrustedAuthorities = lib.mkOption {
593 type = lib.types.str;
594 default = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt";
595 defaultText = lib.literalExpression ''"''${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"'';
597 File containing trusted certification authorities (CA) to verify certificates of mailservers contacted for mail delivery. This basically sets smtp_tls_CAfile and enables opportunistic tls. Defaults to NixOS trusted certification authorities.
601 sslCert = lib.mkOption {
602 type = lib.types.str;
604 description = "SSL certificate to use.";
607 sslKey = lib.mkOption {
608 type = lib.types.str;
610 description = "SSL key to use.";
613 recipientDelimiter = lib.mkOption {
614 type = lib.types.str;
618 Delimiter for address extension: so mail to user+test can be handled by ~user/.forward+test
622 canonical = lib.mkOption {
623 type = lib.types.lines;
626 Entries for the {manpage}`canonical(5)` table.
630 virtual = lib.mkOption {
631 type = lib.types.lines;
634 Entries for the virtual alias map, cf. man-page virtual(5).
638 virtualMapType = lib.mkOption {
639 type = lib.types.enum [
646 What type of virtual alias map file to use. Use `"regexp"` for regular expressions.
650 localRecipients = lib.mkOption {
651 type = with lib.types; nullOr (listOf str);
654 List of accepted local users. Specify a bare username, an
655 `"@domain.tld"` wild-card, or a complete
656 `"user@domain.tld"` address. If set, these names end
657 up in the local recipient map -- see the local(8) man-page -- and
658 effectively replace the system user database lookup that's otherwise
663 transport = lib.mkOption {
665 type = lib.types.lines;
667 Entries for the transport map, cf. man-page transport(8).
671 dnsBlacklists = lib.mkOption {
673 type = with lib.types; listOf str;
674 description = "dns blacklist servers to use with smtpd_client_restrictions";
677 dnsBlacklistOverrides = lib.mkOption {
679 type = lib.types.lines;
680 description = "contents of check_client_access for overriding dnsBlacklists";
683 masterConfig = lib.mkOption {
684 type = lib.types.attrsOf (lib.types.submodule masterCfOptions);
691 "smtpd_tls_security_level=encrypt"
696 An attribute set of service options, which correspond to the service
697 definitions usually done within the Postfix
698 {file}`master.cf` file.
702 extraMasterConf = lib.mkOption {
703 type = lib.types.lines;
705 example = "submission inet n - n - - smtpd";
706 description = "Extra lines to append to the generated master.cf file.";
709 enableHeaderChecks = lib.mkOption {
710 type = lib.types.bool;
713 description = "Whether to enable postfix header checks";
716 headerChecks = lib.mkOption {
717 type = lib.types.listOf (lib.types.submodule headerCheckOptions);
721 pattern = "/^X-Spam-Flag:/";
722 action = "REDIRECT spam@example.com";
725 description = "Postfix header checks.";
728 extraHeaderChecks = lib.mkOption {
729 type = lib.types.lines;
731 example = "/^X-Spam-Flag:/ REDIRECT spam@example.com";
732 description = "Extra lines to /etc/postfix/header_checks file.";
735 aliasFiles = lib.mkOption {
736 type = lib.types.attrsOf lib.types.path;
738 description = "Aliases' tables to be compiled and placed into /var/lib/postfix/conf.";
741 mapFiles = lib.mkOption {
742 type = lib.types.attrsOf lib.types.path;
744 description = "Maps to be compiled and placed into /var/lib/postfix/conf.";
747 useSrs = lib.mkOption {
748 type = lib.types.bool;
750 description = "Whether to enable sender rewriting scheme";
757 ###### implementation
759 config = lib.mkIf config.services.postfix.enable (
764 etc.postfix.source = "/var/lib/postfix/conf";
766 # This makes it comfortable to run 'postqueue/postdrop' for example.
767 systemPackages = [ pkgs.postfix ];
770 services.pfix-srsd.enable = config.services.postfix.useSrs;
772 services.mail.sendmailSetuidWrapper = lib.mkIf config.services.postfix.setSendmail {
773 program = "sendmail";
774 source = "${pkgs.postfix}/bin/sendmail";
781 security.wrappers.mailq = {
783 source = "${pkgs.postfix}/bin/mailq";
790 security.wrappers.postqueue = {
791 program = "postqueue";
792 source = "${pkgs.postfix}/bin/postqueue";
799 security.wrappers.postdrop = {
800 program = "postdrop";
801 source = "${pkgs.postfix}/bin/postdrop";
808 users.users = lib.optionalAttrs (user == "postfix") {
810 description = "Postfix mail server user";
811 uid = config.ids.uids.postfix;
817 lib.optionalAttrs (group == "postfix") {
818 ${group}.gid = config.ids.gids.postfix;
820 // lib.optionalAttrs (setgidGroup == "postdrop") {
821 ${setgidGroup}.gid = config.ids.gids.postdrop;
824 systemd.services.postfix-setup = {
825 description = "Setup for Postfix mail server";
826 serviceConfig.RemainAfterExit = true;
827 serviceConfig.Type = "oneshot";
829 # Backwards compatibility
830 if [ ! -d /var/lib/postfix ] && [ -d /var/postfix ]; then
832 mv /var/postfix /var/lib/postfix
835 # All permissions set according ${pkgs.postfix}/etc/postfix/postfix-files script
836 mkdir -p /var/lib/postfix /var/lib/postfix/queue/{pid,public,maildrop}
837 chmod 0755 /var/lib/postfix
838 chown root:root /var/lib/postfix
840 rm -rf /var/lib/postfix/conf
841 mkdir -p /var/lib/postfix/conf
842 chmod 0755 /var/lib/postfix/conf
843 ln -sf ${pkgs.postfix}/etc/postfix/postfix-files /var/lib/postfix/conf/postfix-files
844 ln -sf ${mainCfFile} /var/lib/postfix/conf/main.cf
845 ln -sf ${masterCfFile} /var/lib/postfix/conf/master.cf
847 ${lib.concatStringsSep "\n" (
848 lib.mapAttrsToList (to: from: ''
849 ln -sf ${from} /var/lib/postfix/conf/${to}
850 ${pkgs.postfix}/bin/postalias -o -p /var/lib/postfix/conf/${to}
853 ${lib.concatStringsSep "\n" (
854 lib.mapAttrsToList (to: from: ''
855 ln -sf ${from} /var/lib/postfix/conf/${to}
856 ${pkgs.postfix}/bin/postmap /var/lib/postfix/conf/${to}
860 mkdir -p /var/spool/mail
861 chown root:root /var/spool/mail
862 chmod a+rwxt /var/spool/mail
863 ln -sf /var/spool/mail /var/
865 #Finally delegate to postfix checking remain directories in /var/lib/postfix and set permissions on them
866 ${pkgs.postfix}/bin/postfix set-permissions config_directory=/var/lib/postfix/conf
870 systemd.services.postfix = {
871 description = "Postfix mail server";
873 wantedBy = [ "multi-user.target" ];
876 "postfix-setup.service"
878 requires = [ "postfix-setup.service" ];
879 path = [ pkgs.postfix ];
884 PIDFile = "/var/lib/postfix/queue/pid/master.pid";
885 ExecStart = "${pkgs.postfix}/bin/postfix start";
886 ExecStop = "${pkgs.postfix}/bin/postfix stop";
887 ExecReload = "${pkgs.postfix}/bin/postfix reload";
891 PrivateDevices = true;
892 ProtectSystem = "full";
893 CapabilityBoundingSet = [ "~CAP_NET_ADMIN CAP_SYS_ADMIN CAP_SYS_BOOT CAP_SYS_MODULE" ];
894 MemoryDenyWriteExecute = true;
895 ProtectKernelModules = true;
896 ProtectKernelTunables = true;
897 ProtectControlGroups = true;
898 RestrictAddressFamilies = [
904 RestrictNamespaces = true;
905 RestrictRealtime = true;
909 services.postfix.config =
910 (lib.mapAttrs (_: v: lib.mkDefault v) {
911 compatibility_level = pkgs.postfix.version;
912 mail_owner = cfg.user;
913 default_privs = "nobody";
915 # NixOS specific locations
916 data_directory = "/var/lib/postfix/data";
917 queue_directory = "/var/lib/postfix/queue";
919 # Default location of everything in package
920 meta_directory = "${pkgs.postfix}/etc/postfix";
921 command_directory = "${pkgs.postfix}/bin";
922 sample_directory = "/etc/postfix";
923 newaliases_path = "${pkgs.postfix}/bin/newaliases";
924 mailq_path = "${pkgs.postfix}/bin/mailq";
925 readme_directory = false;
926 sendmail_path = "${pkgs.postfix}/bin/sendmail";
927 daemon_directory = "${pkgs.postfix}/libexec/postfix";
928 manpage_directory = "${pkgs.postfix}/share/man";
929 html_directory = "${pkgs.postfix}/share/postfix/doc/html";
930 shlib_directory = false;
931 mail_spool_directory = "/var/spool/mail/";
932 setgid_group = cfg.setgidGroup;
934 // lib.optionalAttrs (cfg.relayHost != "") {
937 "${cfg.relayHost}:${toString cfg.relayPort}"
939 "[${cfg.relayHost}]:${toString cfg.relayPort}";
941 // lib.optionalAttrs (!config.networking.enableIPv6) { inet_protocols = lib.mkDefault "ipv4"; }
942 // lib.optionalAttrs (cfg.networks != null) { mynetworks = cfg.networks; }
943 // lib.optionalAttrs (cfg.networksStyle != "") { mynetworks_style = cfg.networksStyle; }
944 // lib.optionalAttrs (cfg.hostname != "") { myhostname = cfg.hostname; }
945 // lib.optionalAttrs (cfg.domain != "") { mydomain = cfg.domain; }
946 // lib.optionalAttrs (cfg.origin != "") { myorigin = cfg.origin; }
947 // lib.optionalAttrs (cfg.destination != null) { mydestination = cfg.destination; }
948 // lib.optionalAttrs (cfg.relayDomains != null) { relay_domains = cfg.relayDomains; }
949 // lib.optionalAttrs (cfg.recipientDelimiter != "") {
950 recipient_delimiter = cfg.recipientDelimiter;
952 // lib.optionalAttrs haveAliases { alias_maps = [ "${cfg.aliasMapType}:/etc/postfix/aliases" ]; }
953 // lib.optionalAttrs haveTransport { transport_maps = [ "hash:/etc/postfix/transport" ]; }
954 // lib.optionalAttrs haveVirtual {
955 virtual_alias_maps = [ "${cfg.virtualMapType}:/etc/postfix/virtual" ];
957 // lib.optionalAttrs haveLocalRecipients {
958 local_recipient_maps = [
959 "hash:/etc/postfix/local_recipients"
960 ] ++ lib.optional haveAliases "$alias_maps";
962 // lib.optionalAttrs (cfg.dnsBlacklists != [ ]) { smtpd_client_restrictions = clientRestrictions; }
963 // lib.optionalAttrs cfg.useSrs {
964 sender_canonical_maps = [ "tcp:127.0.0.1:10001" ];
965 sender_canonical_classes = [ "envelope_sender" ];
966 recipient_canonical_maps = [ "tcp:127.0.0.1:10002" ];
967 recipient_canonical_classes = [ "envelope_recipient" ];
969 // lib.optionalAttrs cfg.enableHeaderChecks {
970 header_checks = [ "regexp:/etc/postfix/header_checks" ];
972 // lib.optionalAttrs (cfg.tlsTrustedAuthorities != "") {
973 smtp_tls_CAfile = cfg.tlsTrustedAuthorities;
974 smtp_tls_security_level = lib.mkDefault "may";
976 // lib.optionalAttrs (cfg.sslCert != "") {
977 smtp_tls_cert_file = cfg.sslCert;
978 smtp_tls_key_file = cfg.sslKey;
980 smtp_tls_security_level = lib.mkDefault "may";
982 smtpd_tls_cert_file = cfg.sslCert;
983 smtpd_tls_key_file = cfg.sslKey;
985 smtpd_tls_security_level = lib.mkDefault "may";
989 services.postfix.masterConfig =
1007 wakeupUnusedComponent = false;
1011 command = "trivial-rewrite";
1030 wakeupUnusedComponent = false;
1034 command = "proxymap";
1038 command = "proxymap";
1063 // lib.optionalAttrs cfg.enableSubmission {
1070 mkKeyVal = opt: val: [
1075 lib.concatLists (lib.mapAttrsToList mkKeyVal cfg.submissionOptions);
1078 // lib.optionalAttrs cfg.enableSmtp {
1090 "smtp_fallback_relay="
1094 // lib.optionalAttrs cfg.enableSubmissions {
1101 mkKeyVal = opt: val: [
1105 adjustSmtpTlsSecurityLevel =
1106 !(cfg.submissionsOptions ? smtpd_tls_security_level)
1107 || cfg.submissionsOptions.smtpd_tls_security_level == "none"
1108 || cfg.submissionsOptions.smtpd_tls_security_level == "may";
1109 submissionsOptions =
1110 cfg.submissionsOptions
1112 smtpd_tls_wrappermode = "yes";
1114 // lib.optionalAttrs adjustSmtpTlsSecurityLevel {
1115 smtpd_tls_security_level = "encrypt";
1118 lib.concatLists (lib.mapAttrsToList mkKeyVal submissionsOptions);
1123 (lib.mkIf haveAliases {
1124 services.postfix.aliasFiles.aliases = aliasesFile;
1126 (lib.mkIf haveCanonical {
1127 services.postfix.mapFiles.canonical = canonicalFile;
1129 (lib.mkIf haveTransport {
1130 services.postfix.mapFiles.transport = transportFile;
1132 (lib.mkIf haveVirtual {
1133 services.postfix.mapFiles.virtual = virtualFile;
1135 (lib.mkIf haveLocalRecipients {
1136 services.postfix.mapFiles.local_recipients = localRecipientMapFile;
1138 (lib.mkIf cfg.enableHeaderChecks {
1139 services.postfix.mapFiles.header_checks = headerChecksFile;
1141 (lib.mkIf (cfg.dnsBlacklists != [ ]) {
1142 services.postfix.mapFiles.client_access = checkClientAccessFile;
1148 (lib.mkRemovedOptionModule [ "services" "postfix" "sslCACert" ]
1149 "services.postfix.sslCACert was replaced by services.postfix.tlsTrustedAuthorities. In case you intend that your server should validate requested client certificates use services.postfix.extraConfig."
1152 (lib.mkChangedOptionModule
1153 [ "services" "postfix" "useDane" ]
1154 [ "services" "postfix" "config" "smtp_tls_security_level" ]
1155 (config: lib.mkIf config.services.postfix.useDane "dane")