diff options
Diffstat (limited to 'modules/private/mail/postfix.nix')
-rw-r--r-- | modules/private/mail/postfix.nix | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/modules/private/mail/postfix.nix b/modules/private/mail/postfix.nix index f8f86f6..9c4b87c 100644 --- a/modules/private/mail/postfix.nix +++ b/modules/private/mail/postfix.nix | |||
@@ -80,6 +80,23 @@ | |||
80 | UNION SELECT '%s' AS destination | 80 | UNION SELECT '%s' AS destination |
81 | ''; | 81 | ''; |
82 | } | 82 | } |
83 | { | ||
84 | dest = "postfix/ldap_ejabberd_users_immae_fr"; | ||
85 | user = config.services.postfix.user; | ||
86 | group = config.services.postfix.group; | ||
87 | permissions = "0440"; | ||
88 | text = '' | ||
89 | server_host = ldaps://${config.myEnv.jabber.ldap.host}:636 | ||
90 | search_base = ${config.myEnv.jabber.ldap.base} | ||
91 | query_filter = ${config.myEnv.jabber.postfix_user_filter} | ||
92 | domain = immae.fr | ||
93 | bind_dn = ${config.myEnv.jabber.ldap.dn} | ||
94 | bind_pw = ${config.myEnv.jabber.ldap.password} | ||
95 | result_attribute = immaeXmppUid | ||
96 | result_format = ejabberd@localhost | ||
97 | version = 3 | ||
98 | ''; | ||
99 | } | ||
83 | ]; | 100 | ]; |
84 | 101 | ||
85 | networking.firewall.allowedTCPPorts = [ 25 465 587 ]; | 102 | networking.firewall.allowedTCPPorts = [ 25 465 587 ]; |
@@ -94,6 +111,7 @@ | |||
94 | config.secrets.fullPaths."postfix/mysql_alias_maps" | 111 | config.secrets.fullPaths."postfix/mysql_alias_maps" |
95 | config.secrets.fullPaths."postfix/mysql_mailbox_maps" | 112 | config.secrets.fullPaths."postfix/mysql_mailbox_maps" |
96 | config.secrets.fullPaths."postfix/mysql_sender_login_maps" | 113 | config.secrets.fullPaths."postfix/mysql_sender_login_maps" |
114 | config.secrets.fullPaths."postfix/ldap_ejabberd_users_immae_fr" | ||
97 | ]; | 115 | ]; |
98 | }; | 116 | }; |
99 | services.postfix = { | 117 | services.postfix = { |
@@ -161,7 +179,7 @@ | |||
161 | virtual = pkgs.writeText "postfix-virtual" ( | 179 | virtual = pkgs.writeText "postfix-virtual" ( |
162 | builtins.concatStringsSep "\n" ( | 180 | builtins.concatStringsSep "\n" ( |
163 | lib.attrsets.mapAttrsToList ( | 181 | lib.attrsets.mapAttrsToList ( |
164 | n: v: '' | 182 | n: v: lib.optionalString v.external '' |
165 | script_${n}@mail.immae.eu ${n}@localhost, scripts@mail.immae.eu | 183 | script_${n}@mail.immae.eu ${n}@localhost, scripts@mail.immae.eu |
166 | '' | 184 | '' |
167 | ) config.myEnv.mail.scripts | 185 | ) config.myEnv.mail.scripts |
@@ -182,7 +200,7 @@ | |||
182 | alias_database = "\$alias_maps"; | 200 | alias_database = "\$alias_maps"; |
183 | 201 | ||
184 | ### Virtual mailboxes config | 202 | ### Virtual mailboxes config |
185 | virtual_alias_maps = "hash:/etc/postfix/virtual mysql:${config.secrets.fullPaths."postfix/mysql_alias_maps"}"; | 203 | virtual_alias_maps = "hash:/etc/postfix/virtual mysql:${config.secrets.fullPaths."postfix/mysql_alias_maps"} ldap:${config.secrets.fullPaths."postfix/ldap_ejabberd_users_immae_fr"}"; |
186 | virtual_mailbox_domains = config.myEnv.mail.postfix.additional_mailbox_domains | 204 | virtual_mailbox_domains = config.myEnv.mail.postfix.additional_mailbox_domains |
187 | ++ lib.remove "localhost.immae.eu" (lib.remove null (lib.flatten (map | 205 | ++ lib.remove "localhost.immae.eu" (lib.remove null (lib.flatten (map |
188 | (zone: map | 206 | (zone: map |