From b3d49599cf802aff2fbb3e51052c98ae658734f6 Mon Sep 17 00:00:00 2001 From: Florent Daigniere Date: Sat, 22 Jun 2024 10:04:10 +0200 Subject: [PATCH] Update autoconfig too --- core/admin/mailu/configuration.py | 1 + core/admin/mailu/models.py | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/core/admin/mailu/configuration.py b/core/admin/mailu/configuration.py index 167d4577..e568deb9 100644 --- a/core/admin/mailu/configuration.py +++ b/core/admin/mailu/configuration.py @@ -87,6 +87,7 @@ DEFAULT_CONFIG = { 'TLS_PERMISSIVE': True, 'TZ': 'Etc/UTC', 'DEFAULT_SPAM_THRESHOLD': 80, + 'PORTS': '25,80,443,465,993,995,4190', 'PROXY_AUTH_WHITELIST': '', 'PROXY_AUTH_HEADER': 'X-Auth-Email', 'PROXY_AUTH_CREATE': False, diff --git a/core/admin/mailu/models.py b/core/admin/mailu/models.py index 7cde30b9..16641d72 100644 --- a/core/admin/mailu/models.py +++ b/core/admin/mailu/models.py @@ -259,16 +259,16 @@ class Domain(Base): """ return list of auto configuration records (RFC6186) """ hostname = app.config['HOSTNAME'] protocols = [ - ('imap', 143, 20), - ('pop3', 110, 20), - ('submission', 587, 20), + ('imap', 143, 20 if 143 in app.config['PORTS'].split(',') else 0), + ('pop3', 110, 20 if 110 in app.config['PORTS'].split(',') else 0), + ('submission', 587, 20 if 587 in app.config['PORTS'].split(',') else 0), ] if app.config['TLS_FLAVOR'] != 'notls': protocols.extend([ - ('autodiscover', 443, 10), - ('submissions', 465, 10), - ('imaps', 993, 10), - ('pop3s', 995, 10), + ('autodiscover', 443, 10 if 443 in app.config['PORTS'].split(',') else 0), + ('submissions', 465, 10 if 465 in app.config['PORTS'].split(',') else 0), + ('imaps', 993, 10 if 993 in app.config['PORTS'].split(',') else 0), + ('pop3s', 995, 10 if 995 in app.config['PORTS'].split(',') else 0), ]) return [