From ca1514a6bb9204eb013091d94478085155c60218 Mon Sep 17 00:00:00 2001 From: Sebastian Hugentobler Date: Tue, 21 Dec 2021 18:19:11 +0100 Subject: [PATCH] add virtual-mailbox-maps configuration --- rootfs/etc/confd/conf.d/pgsql-virtual-mailbox-maps.cf.toml | 3 +++ rootfs/etc/confd/templates/main.cf.tmpl | 1 + .../etc/confd/templates/pgsql-virtual-mailbox-maps.cf.tmpl | 5 +++++ 3 files changed, 9 insertions(+) create mode 100644 rootfs/etc/confd/conf.d/pgsql-virtual-mailbox-maps.cf.toml create mode 100644 rootfs/etc/confd/templates/pgsql-virtual-mailbox-maps.cf.tmpl diff --git a/rootfs/etc/confd/conf.d/pgsql-virtual-mailbox-maps.cf.toml b/rootfs/etc/confd/conf.d/pgsql-virtual-mailbox-maps.cf.toml new file mode 100644 index 0000000..19fb044 --- /dev/null +++ b/rootfs/etc/confd/conf.d/pgsql-virtual-mailbox-maps.cf.toml @@ -0,0 +1,3 @@ +[template] +src = "pgsql-virtual-mailbox-maps.cf.tmpl" +dest = "/etc/postfix/pgsql-virtual-mailbox-maps.cf" diff --git a/rootfs/etc/confd/templates/main.cf.tmpl b/rootfs/etc/confd/templates/main.cf.tmpl index 6cbc15a..336d1e8 100644 --- a/rootfs/etc/confd/templates/main.cf.tmpl +++ b/rootfs/etc/confd/templates/main.cf.tmpl @@ -17,6 +17,7 @@ mailbox_transport = lmtp:{{getenv "LMTP_HOST"}} mailbox_size_limit = {{getenv "MAILBOX_SIZELIMIT" "0"}} smtpd_banner = {{getenv "SMTP_BANNER"}} $myhostname ESMTP $mail_name +virtual_mailbox_maps = pgsql:/etc/postfix/pgsql-virtual-mailbox-maps.cf virtual_mailbox_domains = pgsql:/etc/postfix/pgsql-virtual-mailbox-domains.cf virtual_alias_maps = pgsql:/etc/postfix/pgsql-virtual-alias-maps.cf virtual_transport = lmtp:inet:{{getenv "LMTP_HOST"}}:{{getenv "LMTP_PORT"}} diff --git a/rootfs/etc/confd/templates/pgsql-virtual-mailbox-maps.cf.tmpl b/rootfs/etc/confd/templates/pgsql-virtual-mailbox-maps.cf.tmpl new file mode 100644 index 0000000..ad86a75 --- /dev/null +++ b/rootfs/etc/confd/templates/pgsql-virtual-mailbox-maps.cf.tmpl @@ -0,0 +1,5 @@ +hosts = {{ getenv "DB_HOST" }} +user = {{ getenv "DB_USER" "email" }} +password = {{ getenv "DB_PASSWORD" }} +dbname = {{ getenv "DB_NAME" "email" }} +query = SELECT 1 FROM virtual_users WHERE email ='%s'