From 6bc097f96f94b6ed7492dfb242d06bf64be22e89 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Tue, 30 Dec 2025 00:41:46 +0100 Subject: [PATCH] refactor(email,domain): unify primary domain and TLS handling - replace localhost special-casing with valid FQDN (infinito.localhost) - derive system email DOMAIN and HOST directly from DOMAIN_PRIMARY - align Mailu TLS_FLAVOR with SYSTEM_EMAIL.TLS (mail vs notls) - tie OIDC_VERIFY_SSL to TLS_ENABLED for consistent test/CI behavior - update CI deploy script to use new primary domain https://chatgpt.com/share/695311c0-fbe8-800f-8058-9d40a06b189a --- group_vars/all/00_general.yml | 2 +- group_vars/all/02_email.yml | 9 ++------- roles/web-app-mailu/templates/env.j2 | 4 ++-- scripts/tests/deploy.sh | 2 +- 4 files changed, 6 insertions(+), 11 deletions(-) diff --git a/group_vars/all/00_general.yml b/group_vars/all/00_general.yml index 5b0a7f1056..3574a7628d 100644 --- a/group_vars/all/00_general.yml +++ b/group_vars/all/00_general.yml @@ -38,7 +38,7 @@ WWW_REDIRECT_ENABLED: "{{ ('web-opt-rdr-www' in group_names) | bool }}" AUTO_BUILD_ALIASES: False # If enabled it creates an alias domain for each web application by the entity name, recommended to set to false to safe domain space # Domain -DOMAIN_PRIMARY: "localhost" # Primary Domain of the server +DOMAIN_PRIMARY: "infinito.localhost" # Primary Domain of the server DOMAIN_TEST: "test.{{ DOMAIN_PRIMARY }}" DNS_PROVIDER: "localhost" # The DNS Provider\Registrar for the domain -> Legit values: cloudflare diff --git a/group_vars/all/02_email.yml b/group_vars/all/02_email.yml index 6f71d03542..ff5b8ee5d1 100644 --- a/group_vars/all/02_email.yml +++ b/group_vars/all/02_email.yml @@ -1,12 +1,7 @@ -# Internal email domain: -# - append .localdomain when DOMAIN_PRIMARY == localhost -# - avoids invalid email domains like user@localhost -_SYSTEM_EMAIL_DOMAIN: "{{ 'secondlevel.' if DOMAIN_PRIMARY == 'localhost' else '' }}{{ DOMAIN_PRIMARY }}" - # Email Configuration DEFAULT_SYSTEM_EMAIL: - DOMAIN: "{{ _SYSTEM_EMAIL_DOMAIN }}" - HOST: "mail.{{ _SYSTEM_EMAIL_DOMAIN }}" + DOMAIN: "{{ DOMAIN_PRIMARY }}" + HOST: "mail.{{ DOMAIN_PRIMARY }}" PORT: "{{ TLS_ENABLED | ternary(465,25) }}" TLS: "{{ TLS_ENABLED }}" # true for TLS and false for SSL START_TLS: false diff --git a/roles/web-app-mailu/templates/env.j2 b/roles/web-app-mailu/templates/env.j2 index 83bc789c2c..63341ffeea 100644 --- a/roles/web-app-mailu/templates/env.j2 +++ b/roles/web-app-mailu/templates/env.j2 @@ -26,7 +26,7 @@ HOSTNAMES={{ MAILU_HOSTNAMES | join(',') }} POSTMASTER=admin # Choose how secure connections will behave (value: letsencrypt, cert, notls, mail, mail-letsencrypt) -TLS_FLAVOR=mail +TLS_FLAVOR={{ SYSTEM_EMAIL.TLS | ternary('mail','notls') }} # Authentication rate limit (per source IP address) AUTH_RATELIMIT=10/minute;1000/hour @@ -181,7 +181,7 @@ OIDC_CLIENT_SECRET={{ OIDC.CLIENT.SECRET }} OIDC_BUTTON_NAME={{ OIDC.BUTTON_TEXT }} # Disable TLS certificate verification for the OIDC client. Possible values: True, False -OIDC_VERIFY_SSL=True +OIDC_VERIFY_SSL={{ TLS_ENABLED | ternary('True','False') }} # Enable redirect to OIDC provider for password change. Possible values: True, False OIDC_CHANGE_PASSWORD_REDIRECT_ENABLED=True diff --git a/scripts/tests/deploy.sh b/scripts/tests/deploy.sh index d02df32ab2..24a1fa4e22 100755 --- a/scripts/tests/deploy.sh +++ b/scripts/tests/deploy.sh @@ -307,7 +307,7 @@ infinito_exec sh -lc ' /etc/inventories/github-ci \ --host localhost \ --ssl-disabled \ - --primary-domain localhost \ + --primary-domain infinito.localhost \ --exclude "'"${EXCLUDE_CSV}"'" \ --vars-file inventory.sample.yml \ --authorized-keys "'"${AUTHORIZED_KEYS}"'"