From 71c9a0cc4023408be4389aa5a42903c562d7d27d Mon Sep 17 00:00:00 2001
From: Lars Beckers <lars.beckers@rwth-aachen.de>
Date: Mon, 17 Jun 2019 17:14:10 +0200
Subject: [PATCH] postfix: allow DNS-based config of postscreen filter

---
 postfix/templates/postscreen_access.cidr.j2 | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/postfix/templates/postscreen_access.cidr.j2 b/postfix/templates/postscreen_access.cidr.j2
index 8a829fb..fda2bec 100644
--- a/postfix/templates/postscreen_access.cidr.j2
+++ b/postfix/templates/postscreen_access.cidr.j2
@@ -12,5 +12,22 @@
 #
 
 {% for net in postfix_network_access %}
+{% if 'comment' in net %}
+{{ net.comment|comment('plain', prefix='', postfix='') }}
+{% endif %}
+{% if 'cidr' in net %}
 {{ net.cidr }}	{{ net.action|default('dunno') }}
+{% endif %}
+{% if 'mx' in net %}
+{{ net.mx|comment('plain', prefix='', postfix='') }}
+{% for mx in q('dig', net.mx, 'qtype=MX') %}
+{% for addr in q('dig', mx.split(' ', maxsplit=1)[-1], 'qtype=A') %}
+{{ addr }}	{{ net.action|default('dunno') }}
+{% endfor %}
+{% for addr in q('dig', mx.split(' ', maxsplit=1)[-1], 'qtype=AAAA') %}
+{{ addr }}	{{ net.action|default('dunno') }}
+{% endfor %}
+{% endfor %}
+{% endif %}
+
 {% endfor %}
-- 
GitLab