Solved bug existed due to difference between mailu domain and hostname difference. also refactored during this to find the bug

This commit is contained in:
2025-08-16 14:29:07 +02:00
parent 1bed83078e
commit 0de26fa6c7
76 changed files with 543 additions and 487 deletions

View File

@@ -2,29 +2,29 @@
# Core services
resolver:
image: {{docker_source}}/unbound:{{ mailu_version }}
container_name: {{mailu_name}}_resolver
image: {{ MAILU_DOCKER_FLAVOR }}/unbound:{{ MAILU_VERSION }}
container_name: {{ MAILU_CONTAINER }}_resolver
{% include 'roles/docker-container/templates/base.yml.j2' %}
{% include 'roles/docker-container/templates/networks.yml.j2' %}
ipv4_address: {{networks.local['web-app-mailu'].dns}}
ipv4_address: {{ MAILU_DNS_RESOLVER }}
front:
container_name: {{mailu_name}}_front
image: {{docker_source}}/nginx:{{ mailu_version }}
container_name: {{ MAILU_CONTAINER }}_front
image: {{ MAILU_DOCKER_FLAVOR }}/nginx:{{ MAILU_VERSION }}
{% include 'roles/docker-container/templates/base.yml.j2' %}
ports:
- "127.0.0.1:{{ports.localhost.http[application_id]}}:80"
- "{{ networks.internet.ip4 }}:25:25"
- "{{ networks.internet.ip4 }}:465:465"
- "{{ networks.internet.ip4 }}:587:587"
- "{{ networks.internet.ip4 }}:110:110"
- "{{ networks.internet.ip4 }}:995:995"
- "{{ networks.internet.ip4 }}:143:143"
- "{{ networks.internet.ip4 }}:993:993"
- "{{ networks.internet.ip4 }}:4190:4190"
- "{{ MAILU_IP4_PUBLIC }}:25:25"
- "{{ MAILU_IP4_PUBLIC }}:465:465"
- "{{ MAILU_IP4_PUBLIC }}:587:587"
- "{{ MAILU_IP4_PUBLIC }}:110:110"
- "{{ MAILU_IP4_PUBLIC }}:995:995"
- "{{ MAILU_IP4_PUBLIC }}:143:143"
- "{{ MAILU_IP4_PUBLIC }}:993:993"
- "{{ MAILU_IP4_PUBLIC }}:4190:4190"
volumes:
- "{{docker_compose.directories.volumes}}overrides/nginx:/overrides:ro"
- "{{cert_mount_directory}}:/certs:ro"
- "{{ cert_mount_directory }}:/certs:ro"
{% include 'roles/docker-container/templates/depends_on/dmbs_incl.yml.j2' %}
resolver:
condition: service_started
@@ -32,11 +32,11 @@
webmail:
radicale:
dns:
- {{networks.local['web-app-mailu'].dns}}
- {{ MAILU_DNS_RESOLVER }}
admin:
container_name: {{mailu_name}}_admin
image: {{docker_source}}/admin:{{ mailu_version }}
container_name: {{ MAILU_CONTAINER }}_admin
image: {{ MAILU_DOCKER_FLAVOR }}/admin:{{ MAILU_VERSION }}
{% include 'roles/docker-container/templates/base.yml.j2' %}
volumes:
- "admin_data:/data"
@@ -47,12 +47,12 @@
front:
condition: service_started
dns:
- {{networks.local['web-app-mailu'].dns}}
- {{ MAILU_DNS_RESOLVER }}
{% include 'roles/docker-container/templates/networks.yml.j2' %}
imap:
container_name: {{mailu_name}}_imap
image: {{docker_source}}/dovecot:{{ mailu_version }}
container_name: {{ MAILU_CONTAINER }}_imap
image: {{ MAILU_DOCKER_FLAVOR }}/dovecot:{{ MAILU_VERSION }}
{% include 'roles/docker-container/templates/base.yml.j2' %}
volumes:
- "dovecot_mail:/mail"
@@ -61,12 +61,12 @@
- front
- resolver
dns:
- {{networks.local['web-app-mailu'].dns}}
- {{ MAILU_DNS_RESOLVER }}
{% include 'roles/docker-container/templates/networks.yml.j2' %}
smtp:
container_name: {{mailu_name}}_smtp
image: {{docker_source}}/postfix:{{ mailu_version }}
container_name: {{ MAILU_CONTAINER }}_smtp
image: {{ MAILU_DOCKER_FLAVOR }}/postfix:{{ MAILU_VERSION }}
{% include 'roles/docker-container/templates/base.yml.j2' %}
volumes:
- "{{docker_compose.directories.volumes}}overrides:/overrides:ro"
@@ -75,24 +75,24 @@
- front
- resolver
dns:
- {{networks.local['web-app-mailu'].dns}}
- {{ MAILU_DNS_RESOLVER }}
{% include 'roles/docker-container/templates/networks.yml.j2' %}
oletools:
container_name: {{mailu_name}}_oletools
image: {{docker_source}}/oletools:{{ mailu_version }}
container_name: {{ MAILU_CONTAINER }}_oletools
image: {{ MAILU_DOCKER_FLAVOR }}/oletools:{{ MAILU_VERSION }}
hostname: oletools
restart: {{ DOCKER_RESTART_POLICY }}
depends_on:
- resolver
dns:
- {{networks.local['web-app-mailu'].dns}}
- {{ MAILU_DNS_RESOLVER }}
{% include 'roles/docker-container/templates/networks.yml.j2' %}
noinet:
antispam:
container_name: {{mailu_name}}_antispam
image: {{docker_source}}/rspamd:{{ mailu_version }}
container_name: {{ MAILU_CONTAINER }}_antispam
image: {{ MAILU_DOCKER_FLAVOR }}/rspamd:{{ MAILU_VERSION }}
{% include 'roles/docker-container/templates/base.yml.j2' %}
volumes:
- "filter:/var/lib/rspamd"
@@ -104,14 +104,14 @@
- antivirus
- resolver
dns:
- {{networks.local['web-app-mailu'].dns}}
- {{ MAILU_DNS_RESOLVER }}
{% include 'roles/docker-container/templates/networks.yml.j2' %}
noinet:
# Optional services
antivirus:
container_name: {{mailu_name}}_antivirus
container_name: {{ MAILU_CONTAINER }}_antivirus
image: clamav/clamav-debian:latest
{% include 'roles/docker-container/templates/base.yml.j2' %}
volumes:
@@ -119,25 +119,25 @@
depends_on:
- resolver
dns:
- {{networks.local['web-app-mailu'].dns}}
- {{ MAILU_DNS_RESOLVER }}
{% include 'roles/docker-container/templates/networks.yml.j2' %}
webdav:
container_name: {{mailu_name}}_webdav
image: {{docker_source}}/radicale:{{ mailu_version }}
container_name: {{ MAILU_CONTAINER }}_webdav
image: {{ MAILU_DOCKER_FLAVOR }}/radicale:{{ MAILU_VERSION }}
{% include 'roles/docker-container/templates/base.yml.j2' %}
volumes:
- "webdav_data:/data"
depends_on:
- resolver
dns:
- {{networks.local['web-app-mailu'].dns}}
- {{ MAILU_DNS_RESOLVER }}
{% include 'roles/docker-container/templates/networks.yml.j2' %}
radicale:
fetchmail:
container_name: {{mailu_name}}_fetchmail
image: {{docker_source}}/fetchmail:{{ mailu_version }}
container_name: {{ MAILU_CONTAINER }}_fetchmail
image: {{ MAILU_DOCKER_FLAVOR }}/fetchmail:{{ MAILU_VERSION }}
volumes:
- "admin_data:/data"
{% include 'roles/docker-container/templates/base.yml.j2' %}
@@ -147,12 +147,12 @@
- imap
- resolver
dns:
- {{networks.local['web-app-mailu'].dns}}
- {{ MAILU_DNS_RESOLVER }}
{% include 'roles/docker-container/templates/networks.yml.j2' %}
webmail:
container_name: {{mailu_name}}_webmail
image: {{docker_source}}/webmail:{{ mailu_version }}
container_name: {{ MAILU_CONTAINER }}_webmail
image: {{ MAILU_DOCKER_FLAVOR }}/webmail:{{ MAILU_VERSION }}
{% include 'roles/docker-container/templates/base.yml.j2' %}
volumes:
- "webmail_data:/data"
@@ -162,25 +162,25 @@
- front
- resolver
dns:
- {{networks.local['web-app-mailu'].dns}}
- {{ MAILU_DNS_RESOLVER }}
{% include 'roles/docker-container/templates/networks.yml.j2' %}
webmail:
{% include 'roles/docker-compose/templates/volumes.yml.j2' %}
smtp_queue:
name: {{ mailu_smtp_queue }}
name: {{ MAILU_SMTP_QUEUE_VOLUME }}
admin_data:
name: {{ mailu_admin_data }}
name: {{ MAILU_ADMIN_DATA_VOLUME }}
webdav_data:
name: {{ mailu_webdav_data }}
name: {{ MAILU_WEBDAV_DATA }}
webmail_data:
name: {{ mailu_webmail_data }}
name: {{ MAILU_WEBMAIL_DATA }}
filter:
name: {{ mailu_filter }}
name: {{ MAILU_FILTER_VOLUME }}
dkim:
name: {{ mailu_dkim }}
name: {{ MAILU_DKIM_VOLUME }}
dovecot_mail:
name: {{ mailu_dovecot_mail }}
name: {{ MAILU_DOVECOT_MAIL_VOLUME }}
{% include 'roles/docker-compose/templates/networks.yml.j2' %}
radicale:

View File

@@ -11,16 +11,16 @@
LD_PRELOAD=/usr/lib/libhardened_malloc.so
# Set to a randomly generated 16 bytes string
SECRET_KEY={{applications | get_app_conf(application_id,'credentials.secret_key')}}
SECRET_KEY={{ MAILU_SECRET_KEY }}
# Subnet of the docker network. This should not conflict with any networks to which your system is connected. (Internal and external!)
SUBNET={{networks.local['web-app-mailu'].subnet}}
SUBNET={{ MAILU_SUBNET }}
# Main mail domain
DOMAIN={{ applications | get_app_conf(application_id,'domain') }}
DOMAIN={{ MAILU_DOMAIN }}
# Hostnames for this server, separated with comas
HOSTNAMES={{ domains[application_id] | join(',') }}
HOSTNAMES={{ MAILU_HOSTNAMES | join(',') }}
# Postmaster local part (will append the main mail domain)
POSTMASTER=admin
@@ -105,7 +105,7 @@ WEB_WEBMAIL=/webmail
SITENAME=Mailservices
# Linked Website URL
WEBSITE={{ domains | get_url(application_id, WEB_PROTOCOL) }}
WEBSITE={{ MAILU_WEBSITE }}
@@ -151,34 +151,34 @@ SQLALCHEMY_DATABASE_URI=mysql+mysqlconnector://{{ database_username }}:{{ databa
API=true
WEB_API=/api
# Configures the authentication token. The minimum length is 3 characters. This token must be passed as request header to the API as authentication token. This is a mandatory setting for using the RESTful API.
API_TOKEN={{ applications | get_app_conf(application_id, 'credentials.api_token')}}
API_TOKEN={{ MAILU_API_TOKEN}}
# Activated https://mailu.io/master/configuration.html#advanced-settings
AUTH_REQUIRE_TOKENS=True
{% if applications | get_app_conf(application_id, 'features.oidc', False) %}
{% if MAILU_OIDC_ENABLED | bool %}
###################################
# OpenID Connect settings
###################################
# @see https://github.com/heviat/Mailu-OIDC/tree/master
# Enable OpenID Connect. Possible values: True, False
OIDC_ENABLED={{ applications | get_app_conf(application_id, 'features.oidc', False) | string | capitalize }}
OIDC_ENABLED={{ MAILU_OIDC_ENABLED | string | capitalize }}
# OpenID Connect provider configuration URL
OIDC_PROVIDER_INFO_URL={{ oidc.client.issuer_url }}
OIDC_PROVIDER_INFO_URL={{ OIDC.CLIENT.ISSUER_URL }}
# OpenID Connect Client ID for Mailu
OIDC_CLIENT_ID={{ oidc.client.id }}
OIDC_CLIENT_ID={{ OIDC.CLIENT.ID }}
# OpenID Connect Client secret for Mailu
OIDC_CLIENT_SECRET={{ oidc.client.secret }}
OIDC_CLIENT_SECRET={{ OIDC.CLIENT.SECRET }}
# Label text for OpenID Connect login button. Default: OpenID Connect
OIDC_BUTTON_NAME={{ oidc.button_text }}
OIDC_BUTTON_NAME={{ OIDC.BUTTON_TEXT }}
# Disable TLS certificate verification for the OIDC client. Possible values: True, False
OIDC_VERIFY_SSL=True
@@ -187,17 +187,17 @@ OIDC_VERIFY_SSL=True
OIDC_CHANGE_PASSWORD_REDIRECT_ENABLED=True
# Redirect URL for password change. Defaults to provider issuer url appended by /.well-known/change-password
OIDC_CHANGE_PASSWORD_REDIRECT_URL={{oidc.client.change_credentials}}
OIDC_CHANGE_PASSWORD_REDIRECT_URL={{ OIDC.CLIENT.CHANGE_CREDENTIALS }}
{% if applications | get_app_conf(application_id, 'oidc.email_by_username', True) | bool %}
{% if MAILU_OIDC_EMAIL_BY_USERNAME_ENABLED | bool %}
# The OIDC claim used as the username. If the selected claim contains an email address, it will be used as is. If it is not an email (e.g., sub), the email address will be constructed as <OIDC_USERNAME_CLAIM>@<OIDC_USER_DOMAIN>. Defaults to email.
OIDC_USERNAME_CLAIM={{oidc.attributes.username}}
OIDC_USERNAME_CLAIM={{ OIDC.ATTRIBUTES.USERNAME }}
# The domain used when constructing an email from a non-email username (e.g., when OIDC_USERNAME_CLAIM=sub). Ignored if OIDC_USERNAME_CLAIM is already an email. Defaults to the value of DOMAIN.
OIDC_USER_DOMAIN={{ PRIMARY_DOMAIN }}
OIDC_USER_DOMAIN={{ MAILU_DOMAIN }}
{% endif %}
# If enabled, users who authenticate successfully but do not yet have an account will have one created for them. If disabled, only existing users can log in, and authentication will fail for users without a pre-existing account. Defaults to True.
OIDC_ENABLE_USER_CREATION={{ applications | get_app_conf(application_id, 'oidc.enable_user_creation', True) | string | capitalize }}
OIDC_ENABLE_USER_CREATION={{ MAILU_OIDC_ENABLE_USER_CREATION }}
{% endif %}