diff options
Diffstat (limited to 'modules/private/mail/postfix.nix')
-rw-r--r-- | modules/private/mail/postfix.nix | 42 |
1 files changed, 17 insertions, 25 deletions
diff --git a/modules/private/mail/postfix.nix b/modules/private/mail/postfix.nix index de5e59d..054b93e 100644 --- a/modules/private/mail/postfix.nix +++ b/modules/private/mail/postfix.nix | |||
@@ -4,9 +4,8 @@ | |||
4 | services.duplyBackup.profiles.mail.excludeFile = '' | 4 | services.duplyBackup.profiles.mail.excludeFile = '' |
5 | + /var/lib/postfix | 5 | + /var/lib/postfix |
6 | ''; | 6 | ''; |
7 | secrets.keys = [ | 7 | secrets.keys = { |
8 | { | 8 | "postfix/mysql_alias_maps" = { |
9 | dest = "postfix/mysql_alias_maps"; | ||
10 | user = config.services.postfix.user; | 9 | user = config.services.postfix.user; |
11 | group = config.services.postfix.group; | 10 | group = config.services.postfix.group; |
12 | permissions = "0440"; | 11 | permissions = "0440"; |
@@ -32,9 +31,8 @@ | |||
32 | FROM forwardings_blacklisted | 31 | FROM forwardings_blacklisted |
33 | WHERE source = '%s' | 32 | WHERE source = '%s' |
34 | ''; | 33 | ''; |
35 | } | 34 | }; |
36 | { | 35 | "postfix/ldap_mailboxes" = { |
37 | dest = "postfix/ldap_mailboxes"; | ||
38 | user = config.services.postfix.user; | 36 | user = config.services.postfix.user; |
39 | group = config.services.postfix.group; | 37 | group = config.services.postfix.group; |
40 | permissions = "0440"; | 38 | permissions = "0440"; |
@@ -48,9 +46,8 @@ | |||
48 | result_format = dummy | 46 | result_format = dummy |
49 | version = 3 | 47 | version = 3 |
50 | ''; | 48 | ''; |
51 | } | 49 | }; |
52 | { | 50 | "postfix/mysql_sender_login_maps" = { |
53 | dest = "postfix/mysql_sender_login_maps"; | ||
54 | user = config.services.postfix.user; | 51 | user = config.services.postfix.user; |
55 | group = config.services.postfix.group; | 52 | group = config.services.postfix.group; |
56 | permissions = "0440"; | 53 | permissions = "0440"; |
@@ -72,9 +69,8 @@ | |||
72 | AND active = 1 | 69 | AND active = 1 |
73 | UNION SELECT CONCAT(SUBSTRING_INDEX('%u', '+', 1), '@%d') AS destination | 70 | UNION SELECT CONCAT(SUBSTRING_INDEX('%u', '+', 1), '@%d') AS destination |
74 | ''; | 71 | ''; |
75 | } | 72 | }; |
76 | { | 73 | "postfix/mysql_sender_relays_maps" = { |
77 | dest = "postfix/mysql_sender_relays_maps"; | ||
78 | user = config.services.postfix.user; | 74 | user = config.services.postfix.user; |
79 | group = config.services.postfix.group; | 75 | group = config.services.postfix.group; |
80 | permissions = "0440"; | 76 | permissions = "0440"; |
@@ -102,9 +98,8 @@ | |||
102 | ((regex = 1 AND '%s' REGEXP CONCAT('^',`from`,'$') ) OR (regex = 0 AND `from` = '%s')) | 98 | ((regex = 1 AND '%s' REGEXP CONCAT('^',`from`,'$') ) OR (regex = 0 AND `from` = '%s')) |
103 | AND active = 1 | 99 | AND active = 1 |
104 | ''; | 100 | ''; |
105 | } | 101 | }; |
106 | { | 102 | "postfix/mysql_sender_relays_hosts" = { |
107 | dest = "postfix/mysql_sender_relays_hosts"; | ||
108 | user = config.services.postfix.user; | 103 | user = config.services.postfix.user; |
109 | group = config.services.postfix.group; | 104 | group = config.services.postfix.group; |
110 | permissions = "0440"; | 105 | permissions = "0440"; |
@@ -122,9 +117,8 @@ | |||
122 | ((regex = 1 AND '%s' REGEXP CONCAT('^',`from`,'$') ) OR (regex = 0 AND `from` = '%s')) | 117 | ((regex = 1 AND '%s' REGEXP CONCAT('^',`from`,'$') ) OR (regex = 0 AND `from` = '%s')) |
123 | AND active = 1 | 118 | AND active = 1 |
124 | ''; | 119 | ''; |
125 | } | 120 | }; |
126 | { | 121 | "postfix/mysql_sender_relays_creds" = { |
127 | dest = "postfix/mysql_sender_relays_creds"; | ||
128 | user = config.services.postfix.user; | 122 | user = config.services.postfix.user; |
129 | group = config.services.postfix.group; | 123 | group = config.services.postfix.group; |
130 | permissions = "0440"; | 124 | permissions = "0440"; |
@@ -142,9 +136,8 @@ | |||
142 | ((regex = 1 AND '%s' REGEXP CONCAT('^',`from`,'$') ) OR (regex = 0 AND `from` = '%s')) | 136 | ((regex = 1 AND '%s' REGEXP CONCAT('^',`from`,'$') ) OR (regex = 0 AND `from` = '%s')) |
143 | AND active = 1 | 137 | AND active = 1 |
144 | ''; | 138 | ''; |
145 | } | 139 | }; |
146 | { | 140 | "postfix/ldap_ejabberd_users_immae_fr" = { |
147 | dest = "postfix/ldap_ejabberd_users_immae_fr"; | ||
148 | user = config.services.postfix.user; | 141 | user = config.services.postfix.user; |
149 | group = config.services.postfix.group; | 142 | group = config.services.postfix.group; |
150 | permissions = "0440"; | 143 | permissions = "0440"; |
@@ -159,14 +152,13 @@ | |||
159 | result_format = ejabberd@localhost | 152 | result_format = ejabberd@localhost |
160 | version = 3 | 153 | version = 3 |
161 | ''; | 154 | ''; |
162 | } | 155 | }; |
163 | ] ++ (lib.mapAttrsToList (name: v: { | 156 | } // lib.mapAttrs' (name: v: lib.nameValuePair "postfix/scripts/${name}-env" { |
164 | dest = "postfix/scripts/${name}-env"; | ||
165 | user = "postfixscripts"; | 157 | user = "postfixscripts"; |
166 | group = "root"; | 158 | group = "root"; |
167 | permissions = "0400"; | 159 | permissions = "0400"; |
168 | text = builtins.toJSON v.env; | 160 | text = builtins.toJSON v.env; |
169 | }) config.myEnv.mail.scripts); | 161 | }) config.myEnv.mail.scripts; |
170 | 162 | ||
171 | networking.firewall.allowedTCPPorts = [ 25 465 587 ]; | 163 | networking.firewall.allowedTCPPorts = [ 25 465 587 ]; |
172 | 164 | ||