From 136904f7affcbe9228db55ded32de993817471a3 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Mon, 13 Sep 2021 17:22:27 +0200 Subject: [PATCH 1/3] Fix the postorius template URL. --- defaults/main.yml | 2 ++ templates/postorius_settings.py.j2 | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index b55661e..7119cb4 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -133,6 +133,8 @@ mailman_postorius_log_dest_dir: mailmansuite mailman_postorius_log_dir: '/{{ mailman_postorius_var_dir }}/{{ mailman_postorius_log_base_dir }}/{{ mailman_postorius_log_dest_dir }}' mailman_postorius_dir: '{{ mailman_home }}/mailman-suite/mailman-suite_project' mailman_postorius_http_port: 8000 +mailman_postorius_templates_url: '{{ mailman_site_url }}' + mailman_postorius_uwsgi_servicename: 'mailmansuite-uwsgi' mailman_postorius_uwsgi_config_file: /etc/mailmansuite-uwsgi.ini mailman_postorius_uwsgi_rundir: /run/mailmansuite diff --git a/templates/postorius_settings.py.j2 b/templates/postorius_settings.py.j2 index 9dafed4..1345c5a 100644 --- a/templates/postorius_settings.py.j2 +++ b/templates/postorius_settings.py.j2 @@ -484,8 +484,8 @@ if DEBUG == True: # Only display mailing-lists from the same virtual host as the webserver FILTER_VHOST = False - -POSTORIUS_TEMPLATE_BASE_URL = 'http://localhost:8000' +# Use a public URL and set http/https correctly +POSTORIUS_TEMPLATE_BASE_URL = '{{ mailman_postorius_templates_url }}' try: from settings_local import * From 39bf5db940d9dd312341a6a1b6ec497af6f2281f Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Wed, 9 Aug 2023 12:13:50 +0200 Subject: [PATCH 2/3] Fix the cron jobs. jump chain configurable. --- defaults/main.yml | 8 +++++--- meta/main.yml | 8 +++++--- tasks/mailman.yml | 4 ++-- templates/mailman.cfg.j2 | 2 +- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 7119cb4..5381062 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -118,12 +118,14 @@ mailman_dmarc_enabled: 'yes' mailman_dkim_enabled: 'yes' mailman_antispam_header_checks: - - 'X-Spam: (yes|maybe)' - - 'X-Spam: (YES)' - - 'X-Spam-Flag: (yes|maybe)' - 'X-Spam-Flag: (YES)' #- 'Authentication-Results: mail.example.com; dmarc=(fail|quarantine)' +# The chain to jump to if any of the header patterns matches. This must be +# the name of an existing chain such as 'discard', 'reject', 'hold', or +# 'accept', otherwise 'hold' will be used. +mailman_antispam_chain_behaviour: "hold" + mailman_start_nntp_runner: 'no' mailman_repository: 'https://gitlab.com/mailman/mailman-suite.git' diff --git a/meta/main.yml b/meta/main.yml index 4acbe0a..50ceb27 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -1,14 +1,16 @@ --- galaxy_info: - author: adellam + author: Andrea Dell'Amico + namespace: adellam + role_name: mailman description: Mailman 3 installation, configuration, and management for Linux using pip company: ISTI-CNR license: license (EUPL) - min_ansible_version: 2.7 + min_ansible_version: "2.7" platforms: - name: EL versions: - - 7 + - "7" galaxy_tags: - mail - mailing diff --git a/tasks/mailman.yml b/tasks/mailman.yml index 1cdc55a..f92e9d1 100644 --- a/tasks/mailman.yml +++ b/tasks/mailman.yml @@ -114,7 +114,7 @@ block: - name: Add a daily cron job that sends digests cron: - job: "{{ mailman_bindir }}/mailman digests --periodic > {{ mailman_log_dir }}/mailman_cron_digest.log 2>&1" + job: "{{ mailman_bindir }}/mailman -C {{ mailman_conf_dir }}/mailman.cfg digests --periodic > {{ mailman_log_dir }}/mailman_cron_digest.log 2>&1" special_time: daily user: '{{ mailman_user }}' name: "Mailman digests" @@ -123,7 +123,7 @@ - name: Add a daily cron job that sends notifications to the list administrators and list owners cron: - job: "{{ mailman_bindir }}/mailman notify > {{ mailman_log_dir }}/mailman_cron_notifications.log 2>&1" + job: "{{ mailman_bindir }}/mailman -C {{ mailman_conf_dir }}/mailman.cfg notify > {{ mailman_log_dir }}/mailman_cron_notifications.log 2>&1" minute: '0' hour: '7' user: '{{ mailman_user }}' diff --git a/templates/mailman.cfg.j2 b/templates/mailman.cfg.j2 index 8853dac..5ccfb33 100644 --- a/templates/mailman.cfg.j2 +++ b/templates/mailman.cfg.j2 @@ -242,7 +242,7 @@ header_checks: # The chain to jump to if any of the header patterns matches. This must be # the name of an existing chain such as 'discard', 'reject', 'hold', or # 'accept', otherwise 'hold' will be used. -jump_chain: hold +jump_chain: "{{ mailman_antispam_chain_behaviour }}" [runner.nntp] class: mailman.runners.nntp.NNTPRunner From 8320fdac8358a0fbfab05cd0444ed48ce991a596 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Wed, 9 Aug 2023 12:17:53 +0200 Subject: [PATCH 3/3] The notifications cron job can be disabled. --- defaults/main.yml | 3 ++- tasks/mailman.yml | 29 ++++++++++++++--------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 5381062..1e6b413 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -34,7 +34,8 @@ mailman_custom_templates: - 'it/list:user:notice:probe.txt' - 'it/list:user:notice:welcome.txt' -# Documentation that must be followed to configure the social auth providers +mailman_enable_daily_notifications: true + # Documentation that must be followed to configure the social auth providers # https://django-allauth.readthedocs.io/en/latest/installation.html mailman_use_social_account_providers: False mailman_postorius_social_auth_providers: diff --git a/tasks/mailman.yml b/tasks/mailman.yml index f92e9d1..5915e25 100644 --- a/tasks/mailman.yml +++ b/tasks/mailman.yml @@ -111,27 +111,26 @@ - name: Add the maintenance cron jobs + tags: ['mailman', 'mailman_conf', 'mailman_cron'] block: - name: Add a daily cron job that sends digests cron: - job: "{{ mailman_bindir }}/mailman -C {{ mailman_conf_dir }}/mailman.cfg digests --periodic > {{ mailman_log_dir }}/mailman_cron_digest.log 2>&1" - special_time: daily - user: '{{ mailman_user }}' - name: "Mailman digests" - cron_file: 'mailman-digests' - state: present + job: "{{ mailman_bindir }}/mailman -C {{ mailman_conf_dir }}/mailman.cfg digests --periodic > {{ mailman_log_dir }}/mailman_cron_digest.log 2>&1" + special_time: daily + user: '{{ mailman_user }}' + name: "Mailman digests" + cron_file: 'mailman-digests' + state: present - name: Add a daily cron job that sends notifications to the list administrators and list owners cron: - job: "{{ mailman_bindir }}/mailman -C {{ mailman_conf_dir }}/mailman.cfg notify > {{ mailman_log_dir }}/mailman_cron_notifications.log 2>&1" - minute: '0' - hour: '7' - user: '{{ mailman_user }}' - name: "Mailman notifications" - cron_file: 'mailman-notifications' - state: present - - tags: [ 'mailman', 'mailman_conf', 'mailman_cron' ] + job: "{{ mailman_bindir }}/mailman -C {{ mailman_conf_dir }}/mailman.cfg notify > {{ mailman_log_dir }}/mailman_cron_notifications.log 2>&1" + minute: '0' + hour: '7' + user: '{{ mailman_user }}' + name: "Mailman notifications" + cron_file: 'mailman-notifications' + state: "{% if mailman_enable_daily_notifications %}present{% else %}absent{% endif %}" - name: Install some default templates block: