From a57096e6131e281a01f40f036c83f40f32438d1e Mon Sep 17 00:00:00 2001 From: kaiyou Date: Sun, 24 Sep 2017 17:49:39 +0200 Subject: [PATCH] Support specifyin multiple hostnames --- .env.dist | 4 +--- admin/mailu/ui/templates/domain/details.html | 5 +++-- dovecot/conf/dovecot.conf | 2 +- postfix/conf/main.cf | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.env.dist b/.env.dist index 1c46082a..17bfaaad 100644 --- a/.env.dist +++ b/.env.dist @@ -23,9 +23,7 @@ BIND_ADDRESS=127.0.0.1 # Main mail domain DOMAIN=mailu.io -# Main hostname for announces, and list of all available hostnames, separated -# by comas -HOSTNAME=mail.mailu.io +# Hostnames for this server, separated with comas HOSTNAMES=mail.mailu.io,alternative.mailu.io,yetanother.mailu.io # Postmaster local part (will append the main mail domain) diff --git a/admin/mailu/ui/templates/domain/details.html b/admin/mailu/ui/templates/domain/details.html index 1ae45e16..5b3655de 100644 --- a/admin/mailu/ui/templates/domain/details.html +++ b/admin/mailu/ui/templates/domain/details.html @@ -15,6 +15,7 @@ {% endblock %} {% block box %} +{% let hostname = config["HOSTNAMES"].split(",")[0] %} @@ -28,8 +29,8 @@ +{{ domain.name }}. 600 IN TXT "v=spf1 mx a:{{ hostname }} -all" +{{ domain.name }}. 600 IN SPF "v=spf1 mx a:{{ hostname }} -all" {% if domain.dkim_publickey %} diff --git a/dovecot/conf/dovecot.conf b/dovecot/conf/dovecot.conf index a1ec72fd..98cff4bc 100644 --- a/dovecot/conf/dovecot.conf +++ b/dovecot/conf/dovecot.conf @@ -4,7 +4,7 @@ log_path = /dev/stderr protocols = imap pop3 lmtp sieve postmaster_address = {{ POSTMASTER }}@{{ DOMAIN }} -hostname = {{ HOSTNAME }} +hostname = {{ HOSTNAMES.split(",")[0] }} mail_plugins = $mail_plugins quota submission_host = smtp diff --git a/postfix/conf/main.cf b/postfix/conf/main.cf index 04b67553..afe48813 100644 --- a/postfix/conf/main.cf +++ b/postfix/conf/main.cf @@ -4,7 +4,7 @@ # Main domain and hostname mydomain = {{ DOMAIN }} -myhostname = {{ HOSTNAME }} +myhostname = {{ HOSTNAMES.split(",")[0] }} myorigin = $mydomain # Queue location
{% trans %}DNS SPF entries{% endtrans %}
-{{ domain.name }}. 600 IN TXT "v=spf1 mx a:{{ config["HOSTNAME"] }} -all"
-{{ domain.name }}. 600 IN SPF "v=spf1 mx a:{{ config["HOSTNAME"] }} -all"