From 79ae6fa60a01dfe07152550e4d418950a4192014 Mon Sep 17 00:00:00 2001
From: Yohann D'ANELLO <ynerant@crans.org>
Date: Mon, 1 Mar 2021 14:55:55 +0100
Subject: [PATCH] [mailman3] Update postfix configuration of Redisdead

Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
---
 roles/postfix/templates/postfix/main.cf.j2   | 15 +++------------
 roles/postfix/templates/postfix/master.cf.j2 |  5 -----
 roles/postfix/templates/postfix/transport.j2 |  6 ++----
 3 files changed, 5 insertions(+), 21 deletions(-)

diff --git a/roles/postfix/templates/postfix/main.cf.j2 b/roles/postfix/templates/postfix/main.cf.j2
index fabff795..8605c235 100644
--- a/roles/postfix/templates/postfix/main.cf.j2
+++ b/roles/postfix/templates/postfix/main.cf.j2
@@ -20,21 +20,12 @@ mynetworks = 127.0.0.0/8, [::1]/128
 # Destinations acceptees
 mydestination = {{ ansible_hostname }}, $myhostname, localhost, localhost.$mydomain
 {% if postfix.primary or not postfix.secondary %}
-                $mydomain, crans.ens-cachan.fr, clubs.ens-cachan.fr, install-party.ens-cachan.fr, crans.fr, crans.eu
+                $mydomain, crans.ens-cachan.fr, clubs.ens-cachan.fr, install-party.ens-cachan.fr, crans.fr, crans.eu, lists.crans.org
 {% endif %}
 # Domaine relaye par ce MX
 relay_domains = $mydestination
-{% if postfix.mailman or postfix.public %}
-                lists.$mydomain
-{% endif %}
 {% if postfix.secondary %}
-                $mydomain, crans.ens-cachan.fr, clubs.ens-cachan.fr, install-party.ens-cachan.fr, crans.fr, crans.eu
-{% endif %}
-{% if postfix.mailman %}
-relay_recipient_maps =
-    hash:/var/local/re2o-services/mail-server/generated/virtual
-    hash:/var/lib/mailman/data/virtual-mailman
-mailman_destination_recipient_limit = 1
+                $mydomain, crans.ens-cachan.fr, clubs.ens-cachan.fr, install-party.ens-cachan.fr, crans.fr, crans.eu, lists.crans.org
 {% endif %}
 # Etre notifie ou non de l'arrive de nouveaux mails
 {% if postfix.primary or postfix.secondary %}
@@ -48,7 +39,6 @@ biff = yes
 # il faut enlever ca.
 soft_bounce = no
 
-smtpd_reject_unlisted_sender = yes
 {% if not postfix.primary and not postfix.secondary %}
 # On delivre dans des maildir
 mail_spool_directory = /home/mail/
@@ -151,6 +141,7 @@ smtpd_sender_restrictions = permit_mynetworks
 {% endif %}
                             reject_non_fqdn_sender
                             reject_unknown_sender_domain
+                            reject_unlisted_sender
 
 ## Dit à postfix de jeter toute socket vers un serveur de policy après une
 ## utilisation. Il en recrée donc une nouvelle, ce qui permet d'éviter
diff --git a/roles/postfix/templates/postfix/master.cf.j2 b/roles/postfix/templates/postfix/master.cf.j2
index 909bbee8..04ddafd7 100644
--- a/roles/postfix/templates/postfix/master.cf.j2
+++ b/roles/postfix/templates/postfix/master.cf.j2
@@ -140,8 +140,3 @@ scalemail-backend unix -   n   n   -   2   pipe
   flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store $${nexthop} $${user} $${extension}
 # only used by postfix-tls
 tlsmgr    unix  -       -       n       300     1       tlsmgr
-{% if postfix.mailman %}
-mailman   unix  -       n       n       -       -       pipe
-      flags=FR user=list
-      argv=/var/lib/mailman/bin/postfix-to-mailman.py ${nexthop} ${user}
-{% endif %}
diff --git a/roles/postfix/templates/postfix/transport.j2 b/roles/postfix/templates/postfix/transport.j2
index 77e92b2b..954c3b01 100644
--- a/roles/postfix/templates/postfix/transport.j2
+++ b/roles/postfix/templates/postfix/transport.j2
@@ -2,10 +2,8 @@
 # Transport des mails
 
 {% if postfix.mailman %}
-# Les mailing-listes sont delivrees localement
-lists.crans.org              mailman:
-{% else %}
-lists.crans.org              smtp:[lists.adm.crans.org]
+# Les mailing-listes sont delivrees sur un serveur à part
+lists.crans.org              smtp:[{{ query('ldap', 'ip', 'mailman', 'adm') | ipv4 | first }}]
 {% endif %}
 {% if postfix.primary or postfix.secondary %}
 # C'est le serveur des adherents qui fait les livraisons des
-- 
GitLab