summaryrefslogtreecommitdiff
path: root/hosts
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2025-06-07 10:35:50 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2025-06-07 10:35:50 +0200
commitdb535fc5efc4da170a2ee8bb74018ac042e7c186 (patch)
tree63e0352122414d2825b30aa799f508a0a1781747 /hosts
parentf02c96d3a5bf42b1ee6328a2674d430783f853d5 (diff)
downloadnixos-db535fc5efc4da170a2ee8bb74018ac042e7c186.tar
nixos-db535fc5efc4da170a2ee8bb74018ac042e7c186.tar.gz
nixos-db535fc5efc4da170a2ee8bb74018ac042e7c186.tar.bz2
nixos-db535fc5efc4da170a2ee8bb74018ac042e7c186.tar.xz
nixos-db535fc5efc4da170a2ee8bb74018ac042e7c186.zip
...
Diffstat (limited to 'hosts')
-rw-r--r--hosts/surtr/email/ccert-policy-server/ccert_policy_server/__main__.py2
-rw-r--r--hosts/surtr/postgresql/default.nix8
2 files changed, 8 insertions, 2 deletions
diff --git a/hosts/surtr/email/ccert-policy-server/ccert_policy_server/__main__.py b/hosts/surtr/email/ccert-policy-server/ccert_policy_server/__main__.py
index e87ae141..dfe98a76 100644
--- a/hosts/surtr/email/ccert-policy-server/ccert_policy_server/__main__.py
+++ b/hosts/surtr/email/ccert-policy-server/ccert_policy_server/__main__.py
@@ -48,7 +48,7 @@ class PolicyHandler(StreamRequestHandler):
48 cur.row_factory = namedtuple_row 48 cur.row_factory = namedtuple_row
49 49
50 if relay_eligible: 50 if relay_eligible:
51 cur.execute('SELECT EXISTS(SELECT true FROM "mailbox" INNER JOIN "relay_access" ON "mailbox".id = "relay_access"."mailbox" WHERE "mailbox"."mailbox" = %(user)s AND ("domain" = %(domain)s OR "domain" ilike CONCAT("%_.", %(domain)s)) as "exists"', params = {'user': user, 'domain': domain}) 51 cur.execute('SELECT EXISTS(SELECT true FROM "mailbox" INNER JOIN "relay_access" ON "mailbox".id = "relay_access"."mailbox" WHERE "mailbox"."mailbox" = %(user)s AND ("domain" = %(domain)s OR "domain" ilike CONCAT("%%_.", %(domain)s)) as "exists"', params = {'user': user, 'domain': domain})
52 if (row := cur.fetchone()) is not None: 52 if (row := cur.fetchone()) is not None:
53 allowed = row.exists 53 allowed = row.exists
54 54
diff --git a/hosts/surtr/postgresql/default.nix b/hosts/surtr/postgresql/default.nix
index 3640ff12..e29da0b8 100644
--- a/hosts/surtr/postgresql/default.nix
+++ b/hosts/surtr/postgresql/default.nix
@@ -297,7 +297,6 @@ in {
297 297
298 COMMIT; 298 COMMIT;
299 299
300
301 BEGIN; 300 BEGIN;
302 SELECT _v.register_patch('014-relay', ARRAY['000-base'], null); 301 SELECT _v.register_patch('014-relay', ARRAY['000-base'], null);
303 302
@@ -308,6 +307,13 @@ in {
308 ); 307 );
309 308
310 COMMIT; 309 COMMIT;
310
311 BEGIN;
312 SELECT _v.register_patch('015-relay-unique', ARRAY['000-base', '014-relay'], null);
313
314 CREATE UNIQUE INDEX relay_unique ON relay_access (mailbox, domain);
315
316 COMMIT;
311 ''} 317 ''}
312 318
313 psql etebase postgres -eXf ${pkgs.writeText "etebase.sql" '' 319 psql etebase postgres -eXf ${pkgs.writeText "etebase.sql" ''