From fba756d7ac3471f6469959a851a9a79e8f4c3200 Mon Sep 17 00:00:00 2001 From: Sebastian Hugentobler Date: Mon, 31 Oct 2022 13:38:08 +0100 Subject: [PATCH] readd wildcard sending functionality --- Dockerfile | 3 ++- README.md | 2 +- rootfs/etc/confd/templates/main.cf.tmpl | 13 ++++++------- rootfs/etc/confd/templates/pgsql-login-maps.cf.tmpl | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index d8f8e55..a058c3c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,8 @@ RUN apk add --no-cache \ postfix-pgsql \ openssl \ libstdc++ \ - libmilter + libmilter \ + icu-data-full RUN addgroup -g 2222 access RUN addgroup postfix access diff --git a/README.md b/README.md index bdc8ebc..57cc753 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ create table if not exists virtual_domains ( create table if not exists virtual_users ( email text primary key, domain_name text not null references virtual_domains(name), - wildcard_sender bool default false + wildcard_sender bool default false ); create table if not exists virtual_aliases ( diff --git a/rootfs/etc/confd/templates/main.cf.tmpl b/rootfs/etc/confd/templates/main.cf.tmpl index 2f7fd06..deb7b03 100644 --- a/rootfs/etc/confd/templates/main.cf.tmpl +++ b/rootfs/etc/confd/templates/main.cf.tmpl @@ -1,15 +1,11 @@ -compatibility_level = 2 +compatibility_level = 3.7 mail_owner = postfix myhostname = {{getenv "MYHOSTNAME"}} mydomain = {{getenv "MYDOMAIN"}} myorigin = $mydomain -mydestination = $myhostname, localhost - -proxy_interfaces = {{getenv "EXTERNAL_IP"}} unknown_local_recipient_reject_code = 550 -mynetworks_style = host relay_domains = $mydestination recipient_delimiter = + @@ -59,8 +55,11 @@ smtpd_sasl_auth_enable = yes smtpd_tls_auth_only = yes smtpd_sasl_tls_security_options = noanonymous -smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, defer_unauth_destination -smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, defer_unauth_destination, reject_unverified_recipient +smtpd_relay_restrictions = + permit_mynetworks + permit_sasl_authenticated + defer_unauth_destination + reject_sender_login_mismatch smtpd_sender_restrictions = reject_sender_login_mismatch smtpd_sender_login_maps = pgsql:/etc/postfix/pgsql-login-maps.cf diff --git a/rootfs/etc/confd/templates/pgsql-login-maps.cf.tmpl b/rootfs/etc/confd/templates/pgsql-login-maps.cf.tmpl index 4460f1c..29ce91c 100644 --- a/rootfs/etc/confd/templates/pgsql-login-maps.cf.tmpl +++ b/rootfs/etc/confd/templates/pgsql-login-maps.cf.tmpl @@ -2,4 +2,4 @@ hosts = {{ getenv "DB_HOST" }} user = {{ getenv "DB_USER" "email" }} password = {{ getenv "DB_PASSWORD" }} dbname = {{ getenv "DB_NAME" "email" }} -query = SELECT email FROM virtual_users WHERE email='%u' UNION SELECT destination FROM virtual_aliases WHERE source='%u' +query = SELECT email FROM virtual_users WHERE email='%u' UNION SELECT destination FROM virtual_aliases WHERE source='%u' UNION SELECT email FROM virtual_users WHERE wildcard_sender = true AND domain_name = '%d'