From 1addce7dbca3da8cb9de4b9a73272122bd5c323b Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Wed, 15 Dec 2021 22:02:36 +0000 Subject: [PATCH] Add a domain aliases mechanism to lists.o.o In order to be able to redirect list addresses which have moved from one domain to another, we need a solution to alias the old addresses to the new ones. We have simple aliases but they only match on the local part. Add a new /etc/aliases.domain which matches full local_part@domain addresses instead. Also collect this file in the Mailman deployment test for ease of inspection. Change-Id: I16f871e96792545e1a8cc8eb3834fa4eb82e31c8 --- inventory/service/host_vars/lists.openstack.org.yaml | 8 ++++++++ playbooks/roles/mailman/tasks/main.yaml | 5 +++++ playbooks/roles/mailman/templates/domain_aliases.j2 | 6 ++++++ zuul.d/system-config-run.yaml | 1 + 4 files changed, 20 insertions(+) create mode 100644 playbooks/roles/mailman/templates/domain_aliases.j2 diff --git a/inventory/service/host_vars/lists.openstack.org.yaml b/inventory/service/host_vars/lists.openstack.org.yaml index d690836762..a937cb6c7d 100644 --- a/inventory/service/host_vars/lists.openstack.org.yaml +++ b/inventory/service/host_vars/lists.openstack.org.yaml @@ -34,6 +34,7 @@ exim_aliases: superuser-owner: spam user-committee-owner: spam spam: ':fail: delivery temporarily disabled due to ongoing spam flood' +exim_domain_aliases: {} exim_routers: - mailman_verp_router: | {% raw -%} @@ -51,6 +52,13 @@ exim_routers: transport = mailman_verp_smtp - dnslookup: '{{ exim_dnslookup_router }}' - system_aliases: '{{ exim_system_aliases_router }}' + - domain_aliases: | + driver = redirect + allow_fail + allow_defer + data = ${lookup{$local_part@$domain}lsearch{/etc/aliases.domain}} + file_transport = address_file + pipe_transport = address_pipe - localuser: '{{ exim_localuser_router }}' - mailman_copy: | driver = accept diff --git a/playbooks/roles/mailman/tasks/main.yaml b/playbooks/roles/mailman/tasks/main.yaml index 706f7e6e66..f2db3d8683 100644 --- a/playbooks/roles/mailman/tasks/main.yaml +++ b/playbooks/roles/mailman/tasks/main.yaml @@ -91,6 +91,11 @@ loop: "{{ mailman_sites }}" loop_control: loop_var: site + - name: Write /etc/aliases.domain + template: + src: "domain_aliases.j2" + dest: "/etc/aliases.domain" + mode: 0444 when: mailman_multihost - name: normal mailman configs diff --git a/playbooks/roles/mailman/templates/domain_aliases.j2 b/playbooks/roles/mailman/templates/domain_aliases.j2 new file mode 100644 index 0000000000..05e531b03f --- /dev/null +++ b/playbooks/roles/mailman/templates/domain_aliases.j2 @@ -0,0 +1,6 @@ +# /etc/aliases.domain +{% for k, v in exim_domain_aliases|dictsort %} +{% if v %} +{{ k }}: {{ v }} +{% endif %} +{% endfor %} diff --git a/zuul.d/system-config-run.yaml b/zuul.d/system-config-run.yaml index c2c2e55deb..8efbeddd69 100644 --- a/zuul.d/system-config-run.yaml +++ b/zuul.d/system-config-run.yaml @@ -270,6 +270,7 @@ '/var/log/mailman': logs lists.openstack.org: host_copy_output: + '/etc/aliases.domain': logs_txt '/var/log/mailman': logs - job: