summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hosts/surtr/email/default.nix6
-rw-r--r--hosts/surtr/postgresql.nix4
2 files changed, 7 insertions, 3 deletions
diff --git a/hosts/surtr/email/default.nix b/hosts/surtr/email/default.nix
index fb8573ce..e2f71c21 100644
--- a/hosts/surtr/email/default.nix
+++ b/hosts/surtr/email/default.nix
@@ -287,8 +287,9 @@ in {
287 dovecotSqlConf = pkgs.writeText "dovecot-sql.conf" '' 287 dovecotSqlConf = pkgs.writeText "dovecot-sql.conf" ''
288 driver = pgsql 288 driver = pgsql
289 connect = dbname=email 289 connect = dbname=email
290 password_query = SELECT user, quota_rule FROM imap_user WHERE user = '%u' 290 password_query = SELECT NULL as password, user as user, quota_rule FROM imap_user WHERE user = '%u'
291 user_query = SELECT user, quota_rule FROM imap_user WHERE user = '%u' 291 user_query = SELECT user, quota_rule FROM imap_user WHERE user = '%u'
292 iterate_query = SELECT user FROM imap_user
292 ''; 293 '';
293 in '' 294 in ''
294 mail_home = /var/lib/mail/%u 295 mail_home = /var/lib/mail/%u
@@ -326,6 +327,9 @@ in {
326 } 327 }
327 328
328 userdb { 329 userdb {
330 driver = prefetch
331 }
332 userdb {
329 driver = sql 333 driver = sql
330 args = ${dovecotSqlConf} 334 args = ${dovecotSqlConf}
331 default_fields = uid=dovecot2 gid=dovecot2 nopassword 335 default_fields = uid=dovecot2 gid=dovecot2 nopassword
diff --git a/hosts/surtr/postgresql.nix b/hosts/surtr/postgresql.nix
index 71fd6463..c1993431 100644
--- a/hosts/surtr/postgresql.nix
+++ b/hosts/surtr/postgresql.nix
@@ -15,10 +15,10 @@ in {
15 CREATE DATABASE "email" WITH TEMPLATE "template0" ENCODING "UTF8" LOCALE "C"; 15 CREATE DATABASE "email" WITH TEMPLATE "template0" ENCODING "UTF8" LOCALE "C";
16 CREATE USER "postfix"; 16 CREATE USER "postfix";
17 GRANT CONNECT ON DATABASE "email" TO "postfix"; 17 GRANT CONNECT ON DATABASE "email" TO "postfix";
18 GRANT SELECT ON ALL TABLES IN SCHEMA public TO "postfix"; 18 ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO "postfix";
19 CREATE USER "dovecot2"; 19 CREATE USER "dovecot2";
20 GRANT CONNECT ON DATABASE "email" TO "dovecot2"; 20 GRANT CONNECT ON DATABASE "email" TO "dovecot2";
21 GRANT SELECT ON ALL TABLES IN SCHEMA public TO "dovecot2"; 21 ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO "dovecot2";
22 ''; 22 '';
23 }; 23 };
24 24