From 81a72b678b7ae5e68f6952082c75b3d7ce7536cd Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Thu, 5 May 2022 22:36:53 +0200 Subject: surtr: ... --- hosts/surtr/email/default.nix | 6 +++++- hosts/surtr/postgresql.nix | 4 ++-- 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 { dovecotSqlConf = pkgs.writeText "dovecot-sql.conf" '' driver = pgsql connect = dbname=email - password_query = SELECT user, quota_rule FROM imap_user WHERE user = '%u' + password_query = SELECT NULL as password, user as user, quota_rule FROM imap_user WHERE user = '%u' user_query = SELECT user, quota_rule FROM imap_user WHERE user = '%u' + iterate_query = SELECT user FROM imap_user ''; in '' mail_home = /var/lib/mail/%u @@ -325,6 +326,9 @@ in { user = dovecot2 } + userdb { + driver = prefetch + } userdb { driver = sql args = ${dovecotSqlConf} 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 { CREATE DATABASE "email" WITH TEMPLATE "template0" ENCODING "UTF8" LOCALE "C"; CREATE USER "postfix"; GRANT CONNECT ON DATABASE "email" TO "postfix"; - GRANT SELECT ON ALL TABLES IN SCHEMA public TO "postfix"; + ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO "postfix"; CREATE USER "dovecot2"; GRANT CONNECT ON DATABASE "email" TO "dovecot2"; - GRANT SELECT ON ALL TABLES IN SCHEMA public TO "dovecot2"; + ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO "dovecot2"; ''; }; -- cgit v1.2.3