From 11a8e49f059c4eb71a8f931edcbfa238d90873a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20M=C3=B6hlmann?= Date: Tue, 16 Oct 2018 11:09:42 +0300 Subject: [PATCH 01/19] Compose file upgrade and define more variables for setup --- setup/flavors/compose/docker-compose.yml | 38 ++++++++++++------------ setup/flavors/compose/mailu.env | 16 +++++----- 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/setup/flavors/compose/docker-compose.yml b/setup/flavors/compose/docker-compose.yml index fcf0c092..a82817af 100644 --- a/setup/flavors/compose/docker-compose.yml +++ b/setup/flavors/compose/docker-compose.yml @@ -2,7 +2,7 @@ # This file is auto-generated by the Mailu configuration wizard. # Please read the documentation before attempting any change. -version: '2' +version: '3.7' services: @@ -11,7 +11,7 @@ services: image: redis:alpine restart: always volumes: - - "$ROOT/redis:/data" + - "{{ root }}/redis:/data" # Core services front: @@ -24,15 +24,15 @@ services: ports: {% for port in (80, 443, 25, 465, 587, 110, 995, 143, 993) %} {% if bind4 %} - - "$PUBLIC_IPV4:{{ port }}:{{ port }}" + - "{{ bind4}}:{{ port }}:{{ port }}" {% endif %} {% if bind6 %} - - "$PUBLIC_IPV6:{{ port }}:{{ port }}" + - "{{ bind6 }}:{{ port }}:{{ port }}" {% endif %} {% endfor %} {% if flavor in ('cert', 'mail') %} volumes: - - "$ROOT/certs:/certs" + - "{{ root }}/certs:/certs" {% endif %} admin: @@ -44,8 +44,8 @@ services: - 127.0.0.1:8080:80 {% endif %} volumes: - - "$ROOT/data:/data" - - "$ROOT/dkim:/dkim" + - "{{ root }}/data:/data" + - "{{ root }}/dkim:/dkim" depends_on: - redis @@ -54,9 +54,9 @@ services: restart: always env_file: {{ env }} volumes: - - "$ROOT/data:/data" - - "$ROOT/mail:/mail" - - "$ROOT/overrides:/overrides" + - "{{ root }}/data:/data" + - "{{ root }}/mail:/mail" + - "{{ root }}/overrides:/overrides" depends_on: - front @@ -65,8 +65,8 @@ services: restart: always env_file: {{ env }} volumes: - - "$ROOT/data:/data" - - "$ROOT/overrides:/overrides" + - "{{ root }}/data:/data" + - "{{ root }}/overrides:/overrides" depends_on: - front @@ -77,9 +77,9 @@ services: restart: always env_file: {{ env }} volumes: - - "$ROOT/filter:/var/lib/rspamd" - - "$ROOT/dkim:/dkim" - - "$ROOT/overrides/rspamd:/etc/rspamd/override.d" + - "{{ root }}/filter:/var/lib/rspamd" + - "{{ root }}/dkim:/dkim" + - "{{ root }}/overrides/rspamd:/etc/rspamd/override.d" depends_on: - front {% endif %} @@ -90,7 +90,7 @@ services: restart: always env_file: {{ env }} volumes: - - "$ROOT/filter:/data" + - "{{ root }}/filter:/data" {% endif %} {% if enable_webdav %} @@ -99,7 +99,7 @@ services: restart: always env_file: {{ env }} volumes: - - "$ROOT/dav:/data" + - "{{ root }}/dav:/data" {% endif %} {% if enable_fetchmail %} @@ -108,7 +108,7 @@ services: restart: always env_file: {{ env }} volumes: - - "$ROOT/data:/data" + - "{{ root }}/data:/data" {% endif %} # Webmail @@ -118,7 +118,7 @@ services: restart: always env_file: {{ env }} volumes: - - "$ROOT/webmail:/data" + - "{{ root }}/webmail:/data" depends_on: - imap {% endif %} diff --git a/setup/flavors/compose/mailu.env b/setup/flavors/compose/mailu.env index 24d7b247..2de771f3 100644 --- a/setup/flavors/compose/mailu.env +++ b/setup/flavors/compose/mailu.env @@ -9,14 +9,16 @@ ################################### # Set this to the path where Mailu data and configuration is stored -ROOT=/mailu +# This variable is now set directly in `docker-compose.yml by the setup utility +# ROOT=/mailu # Set to a randomly generated 16 bytes string SECRET_KEY={{ secret(16) }} # Address where listening ports should bind -{% if bind4 %}PUBLIC_IPV4={{ bind4 }}{% endif %} -{% if bind6 %}PUBLIC_IPV6={{ bind6 }}{% endif %} +# This variables are now set directly in `docker-compose.yml by the setup utility +# PUBLIC_IPV4=127.0.0.1 +# PUBLIC_IPV6=::1 # Mail address of the postmaster POSTMASTER={{ postmaster }} @@ -75,16 +77,16 @@ DOMAIN_REGISTRATION=true ################################### # Path to the admin interface if enabled -WEB_ADMIN=/admin +WEB_ADMIN={{ admin_path }} # Path to the webmail if enabled -WEB_WEBMAIL=/webmail +WEB_WEBMAIL={{ webmail_path }} # Website name -SITENAME=Mailu +SITENAME={{ site_name }{ # Linked Website URL -WEBSITE=https://mailu.io +WEBSITE={{ website }} {% if recaptcha_public_key and recaptcha_private_key %} # Registration reCaptcha settings (warning, this has some privacy impact) From 0d164486b45b194de81905089b37a4557a828a8f Mon Sep 17 00:00:00 2001 From: Ionut Filip Date: Tue, 16 Oct 2018 12:34:55 +0300 Subject: [PATCH 02/19] docker-compose variables and setup --- setup/Dockerfile | 4 +++- setup/docker-compose.yml | 1 + setup/flavors/compose/docker-compose.yml | 2 +- setup/flavors/compose/mailu.env | 8 ++++---- setup/flavors/compose/setup.html | 6 +++--- setup/server.py | 6 ++++-- setup/templates/steps/expose.html | 4 ++-- setup/templates/steps/root.html | 8 ++++++++ setup/templates/wizard.html | 1 + 9 files changed, 27 insertions(+), 13 deletions(-) create mode 100644 setup/templates/steps/root.html diff --git a/setup/Dockerfile b/setup/Dockerfile index 1fc808f1..c970e57d 100644 --- a/setup/Dockerfile +++ b/setup/Dockerfile @@ -10,8 +10,10 @@ RUN apk add --no-cache git \ COPY server.py ./server.py COPY setup.py ./setup.py COPY main.py ./main.py +COPY flavors /data/master/flavors +COPY templates /data/master/templates -RUN python setup.py https://github.com/mailu/mailu /data +#RUN python setup.py https://github.com/mailu/mailu /data EXPOSE 80/tcp diff --git a/setup/docker-compose.yml b/setup/docker-compose.yml index 9288bb7e..30966167 100644 --- a/setup/docker-compose.yml +++ b/setup/docker-compose.yml @@ -10,4 +10,5 @@ services: image: mailu/setup ports: - "80:80" + build: . diff --git a/setup/flavors/compose/docker-compose.yml b/setup/flavors/compose/docker-compose.yml index a82817af..3dcfa5a2 100644 --- a/setup/flavors/compose/docker-compose.yml +++ b/setup/flavors/compose/docker-compose.yml @@ -24,7 +24,7 @@ services: ports: {% for port in (80, 443, 25, 465, 587, 110, 995, 143, 993) %} {% if bind4 %} - - "{{ bind4}}:{{ port }}:{{ port }}" + - "{{ bind4 }}:{{ port }}:{{ port }}" {% endif %} {% if bind6 %} - "{{ bind6 }}:{{ port }}:{{ port }}" diff --git a/setup/flavors/compose/mailu.env b/setup/flavors/compose/mailu.env index 2de771f3..1512e75b 100644 --- a/setup/flavors/compose/mailu.env +++ b/setup/flavors/compose/mailu.env @@ -10,15 +10,15 @@ # Set this to the path where Mailu data and configuration is stored # This variable is now set directly in `docker-compose.yml by the setup utility -# ROOT=/mailu +# ROOT= {{ root }} # Set to a randomly generated 16 bytes string SECRET_KEY={{ secret(16) }} # Address where listening ports should bind # This variables are now set directly in `docker-compose.yml by the setup utility -# PUBLIC_IPV4=127.0.0.1 -# PUBLIC_IPV6=::1 +# PUBLIC_IPV4= {{ bind4 }} (default: 127.0.0.1) +# PUBLIC_IPV6= {{ bind6 }} (default: ::1) # Mail address of the postmaster POSTMASTER={{ postmaster }} @@ -83,7 +83,7 @@ WEB_ADMIN={{ admin_path }} WEB_WEBMAIL={{ webmail_path }} # Website name -SITENAME={{ site_name }{ +SITENAME={{ site_name }} # Linked Website URL WEBSITE={{ website }} diff --git a/setup/flavors/compose/setup.html b/setup/flavors/compose/setup.html index e4506e6d..3c190c9c 100644 --- a/setup/flavors/compose/setup.html +++ b/setup/flavors/compose/setup.html @@ -4,13 +4,13 @@

Docker Compose expects a project file, named docker-compose.yml in a project directory. First create your project directory.

-
mkdir /mailu
+
mkdir {{ root }}
 

Then download the project file. A side configuration file makes it easier to read and check the configuration variables generated by the wizard.

-
cd /mailu
+
cd {{ root }}
 wget {{ url_for('.file', uid=uid, filepath='docker-compose.yml', _external=True) }}
 wget {{ url_for('.file', uid=uid, filepath='mailu.env', _external=True) }}
 
@@ -30,7 +30,7 @@ files before going any further.

To start your compose project, simply run the Docker Compose up command.

-
cd /mailu
+
cd {{ root }}
 docker-compose up -d
 
{% endcall %} diff --git a/setup/server.py b/setup/server.py index 108f5043..ddeafd90 100644 --- a/setup/server.py +++ b/setup/server.py @@ -32,9 +32,11 @@ def secret(length=16): def build_app(path): + #Hardcoded master as the only version for test purposes versions = [ - version for version in os.listdir(path) - if os.path.isdir(os.path.join(path, version)) + # version for version in os.listdir(path) + # if os.path.isdir(os.path.join(path, version)) + "master" ] app.jinja_env.trim_blocks = True diff --git a/setup/templates/steps/expose.html b/setup/templates/steps/expose.html index 665b08a2..372ebddc 100644 --- a/setup/templates/steps/expose.html +++ b/setup/templates/steps/expose.html @@ -14,12 +14,12 @@ avoid generic all-interfaces addresses like 0.0.0.0 or :: - +
- +

You server will be available under a main hostname but may expose multiple public diff --git a/setup/templates/steps/root.html b/setup/templates/steps/root.html new file mode 100644 index 00000000..f32c2250 --- /dev/null +++ b/setup/templates/steps/root.html @@ -0,0 +1,8 @@ +{% call macros.panel("info", "Step 0 - Set root path") %} +

Before starting root path must be set

+ +
+ + +
+{% endcall %} diff --git a/setup/templates/wizard.html b/setup/templates/wizard.html index da9d5134..bbebe569 100644 --- a/setup/templates/wizard.html +++ b/setup/templates/wizard.html @@ -9,6 +9,7 @@ {% endcall %}
+ {% include "steps/root.html" %} {% include "steps/flavor.html" %} {% include "steps/expose.html" %} {% include "steps/services.html" %} From e8dee22ecfc8836f7d0a9ec56b3d68fba582b718 Mon Sep 17 00:00:00 2001 From: Ionut Filip Date: Tue, 16 Oct 2018 16:12:42 +0300 Subject: [PATCH 03/19] Added vars and fixed naming use --- setup/flavors/compose/docker-compose.yml | 10 ++-- setup/flavors/compose/mailu.env | 32 +++++++++++-- setup/templates/steps/initial-config.html | 58 +++++++++++++++++++++++ setup/templates/steps/root.html | 8 ---- setup/templates/steps/services.html | 15 ++++-- setup/templates/wizard.html | 4 +- 6 files changed, 105 insertions(+), 22 deletions(-) create mode 100644 setup/templates/steps/initial-config.html delete mode 100644 setup/templates/steps/root.html diff --git a/setup/flavors/compose/docker-compose.yml b/setup/flavors/compose/docker-compose.yml index 3dcfa5a2..bf6c2db8 100644 --- a/setup/flavors/compose/docker-compose.yml +++ b/setup/flavors/compose/docker-compose.yml @@ -71,7 +71,7 @@ services: - front # Optional services - {% if enable_antispam %} + {% if antispam_enabled %} antispam: image: mailu/rspamd:{{ version }} restart: always @@ -84,7 +84,7 @@ services: - front {% endif %} - {% if enable_antivirus %} + {% if antivirus_enabled %} antivirus: image: mailu/clamav:{{ version }} restart: always @@ -93,9 +93,9 @@ services: - "{{ root }}/filter:/data" {% endif %} - {% if enable_webdav %} + {% if webdav_enabled %} webdav: - image: mailu/radivale:{{ version }} + image: mailu/radicale:{{ version }} restart: always env_file: {{ env }} volumes: @@ -112,7 +112,7 @@ services: {% endif %} # Webmail - {% if enable_webmail %} + {% if webmail_enabled %} webmail: image: mailu/{{ webmail }}:{{ version }} restart: always diff --git a/setup/flavors/compose/mailu.env b/setup/flavors/compose/mailu.env index 1512e75b..4f470533 100644 --- a/setup/flavors/compose/mailu.env +++ b/setup/flavors/compose/mailu.env @@ -10,7 +10,7 @@ # Set this to the path where Mailu data and configuration is stored # This variable is now set directly in `docker-compose.yml by the setup utility -# ROOT= {{ root }} +# ROOT={{ root }} # Set to a randomly generated 16 bytes string SECRET_KEY={{ secret(16) }} @@ -20,8 +20,14 @@ SECRET_KEY={{ secret(16) }} # PUBLIC_IPV4= {{ bind4 }} (default: 127.0.0.1) # PUBLIC_IPV6= {{ bind6 }} (default: ::1) +# Main mail domain +# DOMAIN={{ domain }} + # Mail address of the postmaster -POSTMASTER={{ postmaster }} +POSTMASTER={{ postmaster or 'admin'}} + +#Chose how secure connections will behave: +#TLS_FLAVOR={{ tls_flavor }} # Hostnames for this server, separated with comas HOSTNAMES={{ hostnames }} @@ -30,7 +36,27 @@ HOSTNAMES={{ hostnames }} AUTH_RATELIMIT={{ auth_ratelimit }} # Opt-out of statistics, replace with "True" to opt out -DISABLE_STATISTICS={{ disable_statistics }} +DISABLE_STATISTICS={{ disable_statistics or 'False' }} + +################################### +# Optional features +################################### + +#Expose the admin interface +ADMIN={{ admin_enabled or 'false' }} + +#Chose which webmail to run if any +#WEBMAIL_ENABLED={{ webmail_enabled or 'false' }} +WEBMAIL={{ webmail_type or 'none' }} + +#Antivirus solution +ANTIVIRUS={{ antivirus_enabled or 'none' }} + +#Antispam solution +#ANTISPAM={{ antispam_enabled or 'none'}} + +#Dav server implementation +WEBDAV={{ webdav_enabled or 'none' }} ################################### # Server behavior diff --git a/setup/templates/steps/initial-config.html b/setup/templates/steps/initial-config.html new file mode 100644 index 00000000..d71d2971 --- /dev/null +++ b/setup/templates/steps/initial-config.html @@ -0,0 +1,58 @@ +{% call macros.panel("info", "Step 0 - Initial configuration") %} +

Before starting some variables must be st

+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ +
+ +
+ +
+ + +
+ +
+ +
+ +
+ + +
+ +
+ + +
+ +
+ +
+ +{% endcall %} diff --git a/setup/templates/steps/root.html b/setup/templates/steps/root.html deleted file mode 100644 index f32c2250..00000000 --- a/setup/templates/steps/root.html +++ /dev/null @@ -1,8 +0,0 @@ -{% call macros.panel("info", "Step 0 - Set root path") %} -

Before starting root path must be set

- -
- - -
-{% endcall %} diff --git a/setup/templates/steps/services.html b/setup/templates/steps/services.html index e80b4ff4..e6ee88aa 100644 --- a/setup/templates/steps/services.html +++ b/setup/templates/steps/services.html @@ -9,7 +9,7 @@ manage your email domains, users, etc.

-
+
@@ -21,7 +21,7 @@ accessing messages for beginner users.

-
+

@@ -38,15 +38,22 @@ also disable the antivirus if required (it does use aroung 1GB of ram).

+
+ +
+ {% endcall %} diff --git a/setup/templates/wizard.html b/setup/templates/wizard.html index bbebe569..5a15af6f 100644 --- a/setup/templates/wizard.html +++ b/setup/templates/wizard.html @@ -9,11 +9,11 @@ {% endcall %} - {% include "steps/root.html" %} + {% include "steps/initial-config.html" %} {% include "steps/flavor.html" %} {% include "steps/expose.html" %} {% include "steps/services.html" %} - {% include "steps/optional.html" %} + From b9ecc0ccc6380c51dfd032397524e8c0d9ab4073 Mon Sep 17 00:00:00 2001 From: Ionut Filip Date: Tue, 16 Oct 2018 18:03:59 +0300 Subject: [PATCH 04/19] Added minor changes --- setup/flavors/compose/docker-compose.yml | 10 ++++----- setup/flavors/compose/mailu.env | 11 +++++----- setup/templates/steps/initial-config.html | 25 ++++++++++++----------- setup/templates/steps/services.html | 11 ++++++++-- 4 files changed, 33 insertions(+), 24 deletions(-) diff --git a/setup/flavors/compose/docker-compose.yml b/setup/flavors/compose/docker-compose.yml index bf6c2db8..83a46169 100644 --- a/setup/flavors/compose/docker-compose.yml +++ b/setup/flavors/compose/docker-compose.yml @@ -19,8 +19,8 @@ services: restart: always env_file: {{ env }} env: - - TLS_FLAVOR={{ tls_flavor or 'letsencrypt' }} - - ADMIN={{ expose_admin or 'no' }} + - TLS_FLAVOR={{ tls_flavor }} + - ADMIN={{ admin_enabled or 'no' }} ports: {% for port in (80, 443, 25, 465, 587, 110, 995, 143, 993) %} {% if bind4 %} @@ -39,7 +39,7 @@ services: image: mailu/admin:{{ version }} restart: always env_file: {{ env }} - {% if not expose_admin %} + {% if not admin_enabled %} ports: - 127.0.0.1:8080:80 {% endif %} @@ -102,7 +102,7 @@ services: - "{{ root }}/dav:/data" {% endif %} - {% if enable_fetchmail %} + {% if fetchmail_enabled %} fetchmail: image: mailu/fetchmail:{{ version }} restart: always @@ -114,7 +114,7 @@ services: # Webmail {% if webmail_enabled %} webmail: - image: mailu/{{ webmail }}:{{ version }} + image: mailu/{{ webmail_type }}:{{ version }} restart: always env_file: {{ env }} volumes: diff --git a/setup/flavors/compose/mailu.env b/setup/flavors/compose/mailu.env index 4f470533..b1cded1c 100644 --- a/setup/flavors/compose/mailu.env +++ b/setup/flavors/compose/mailu.env @@ -33,7 +33,8 @@ POSTMASTER={{ postmaster or 'admin'}} HOSTNAMES={{ hostnames }} # Authentication rate limit (per source IP address) -AUTH_RATELIMIT={{ auth_ratelimit }} +AUTH_RATELIMIT={% if auth_ratelimit_pm %}{{ auth_ratelimit_pm }}/minute;{% endif %} +{% if auth_ratelimit_ph %}{{ auth_ratelimit_ph }}/hour{% endif %} # Opt-out of statistics, replace with "True" to opt out DISABLE_STATISTICS={{ disable_statistics or 'False' }} @@ -43,20 +44,20 @@ DISABLE_STATISTICS={{ disable_statistics or 'False' }} ################################### #Expose the admin interface -ADMIN={{ admin_enabled or 'false' }} +#ADMIN={{ admin_enabled or 'false' }} #Chose which webmail to run if any #WEBMAIL_ENABLED={{ webmail_enabled or 'false' }} -WEBMAIL={{ webmail_type or 'none' }} +#WEBMAIL={{ webmail_type or 'none' }} #Antivirus solution -ANTIVIRUS={{ antivirus_enabled or 'none' }} +#ANTIVIRUS={{ antivirus_enabled or 'none' }} #Antispam solution #ANTISPAM={{ antispam_enabled or 'none'}} #Dav server implementation -WEBDAV={{ webdav_enabled or 'none' }} +#WEBDAV={{ webdav_enabled or 'none' }} ################################### # Server behavior diff --git a/setup/templates/steps/initial-config.html b/setup/templates/steps/initial-config.html index d71d2971..c16d4c13 100644 --- a/setup/templates/steps/initial-config.html +++ b/setup/templates/steps/initial-config.html @@ -3,7 +3,7 @@
- +
@@ -11,9 +11,16 @@
+
+ +
+
- +
@@ -28,7 +35,8 @@
- +

/minute; + /hour

@@ -40,19 +48,12 @@
- +
- -
- -
- +
{% endcall %} diff --git a/setup/templates/steps/services.html b/setup/templates/steps/services.html index e6ee88aa..ed529c83 100644 --- a/setup/templates/steps/services.html +++ b/setup/templates/steps/services.html @@ -38,8 +38,8 @@ also disable the antivirus if required (it does use aroung 1GB of ram).

@@ -56,4 +56,11 @@ also disable the antivirus if required (it does use aroung 1GB of ram).

+
+ +
+ {% endcall %} From b3c7c45140f4c8d1e019ecff9db5c5f623b6f8ff Mon Sep 17 00:00:00 2001 From: Ionut Filip Date: Wed, 17 Oct 2018 15:11:55 +0300 Subject: [PATCH 05/19] Added input form constraints --- setup/flavors/compose/docker-compose.yml | 4 ++-- setup/flavors/compose/mailu.env | 6 ++--- .../config.html} | 22 +++++++++++++------ .../templates/steps/{ => compose}/expose.html | 12 +++++++--- .../templates/steps/{ => compose}/flavor.html | 0 .../steps/{ => compose}/optional.html | 0 .../steps/{ => compose}/services.html | 21 ++++++++++++------ setup/templates/wizard.html | 10 ++++----- 8 files changed, 48 insertions(+), 27 deletions(-) rename setup/templates/steps/{initial-config.html => compose/config.html} (71%) rename setup/templates/steps/{ => compose}/expose.html (67%) rename setup/templates/steps/{ => compose}/flavor.html (100%) rename setup/templates/steps/{ => compose}/optional.html (100%) rename setup/templates/steps/{ => compose}/services.html (77%) diff --git a/setup/flavors/compose/docker-compose.yml b/setup/flavors/compose/docker-compose.yml index 83a46169..8316e681 100644 --- a/setup/flavors/compose/docker-compose.yml +++ b/setup/flavors/compose/docker-compose.yml @@ -20,7 +20,7 @@ services: env_file: {{ env }} env: - TLS_FLAVOR={{ tls_flavor }} - - ADMIN={{ admin_enabled or 'no' }} + - ADMIN={{ admin_enabled or 'false' }} ports: {% for port in (80, 443, 25, 465, 587, 110, 995, 143, 993) %} {% if bind4 %} @@ -112,7 +112,7 @@ services: {% endif %} # Webmail - {% if webmail_enabled %} + {% if webmail_type != 'none' %} webmail: image: mailu/{{ webmail_type }}:{{ version }} restart: always diff --git a/setup/flavors/compose/mailu.env b/setup/flavors/compose/mailu.env index b1cded1c..77da5670 100644 --- a/setup/flavors/compose/mailu.env +++ b/setup/flavors/compose/mailu.env @@ -33,8 +33,9 @@ POSTMASTER={{ postmaster or 'admin'}} HOSTNAMES={{ hostnames }} # Authentication rate limit (per source IP address) -AUTH_RATELIMIT={% if auth_ratelimit_pm %}{{ auth_ratelimit_pm }}/minute;{% endif %} -{% if auth_ratelimit_ph %}{{ auth_ratelimit_ph }}/hour{% endif %} +{% if auth_ratelimit_pm > '0' and auth_ratelimit_ph > '0' %} +AUTH_RATELIMIT={{ auth_ratelimit_pm }}/minute;{{ auth_ratelimit_ph }}/hour +{% endif %} # Opt-out of statistics, replace with "True" to opt out DISABLE_STATISTICS={{ disable_statistics or 'False' }} @@ -47,7 +48,6 @@ DISABLE_STATISTICS={{ disable_statistics or 'False' }} #ADMIN={{ admin_enabled or 'false' }} #Chose which webmail to run if any -#WEBMAIL_ENABLED={{ webmail_enabled or 'false' }} #WEBMAIL={{ webmail_type or 'none' }} #Antivirus solution diff --git a/setup/templates/steps/initial-config.html b/setup/templates/steps/compose/config.html similarity index 71% rename from setup/templates/steps/initial-config.html rename to setup/templates/steps/compose/config.html index c16d4c13..f5a39a5a 100644 --- a/setup/templates/steps/initial-config.html +++ b/setup/templates/steps/compose/config.html @@ -3,12 +3,15 @@
- + +
- + +
@@ -20,7 +23,7 @@
- +
@@ -35,8 +38,11 @@
-

/minute; - /hour

+ +

/minute; + /hour

@@ -48,12 +54,14 @@
- +
- + +
{% endcall %} diff --git a/setup/templates/steps/expose.html b/setup/templates/steps/compose/expose.html similarity index 67% rename from setup/templates/steps/expose.html rename to setup/templates/steps/compose/expose.html index 372ebddc..e0aa8fee 100644 --- a/setup/templates/steps/expose.html +++ b/setup/templates/steps/compose/expose.html @@ -14,12 +14,16 @@ avoid generic all-interfaces addresses like 0.0.0.0 or :: - + +
- + +

You server will be available under a main hostname but may expose multiple public @@ -28,6 +32,8 @@ hostnames in its MX record. Hostnames must be coma-separated.

- + +
{% endcall %} diff --git a/setup/templates/steps/flavor.html b/setup/templates/steps/compose/flavor.html similarity index 100% rename from setup/templates/steps/flavor.html rename to setup/templates/steps/compose/flavor.html diff --git a/setup/templates/steps/optional.html b/setup/templates/steps/compose/optional.html similarity index 100% rename from setup/templates/steps/optional.html rename to setup/templates/steps/compose/optional.html diff --git a/setup/templates/steps/services.html b/setup/templates/steps/compose/services.html similarity index 77% rename from setup/templates/steps/services.html rename to setup/templates/steps/compose/services.html index ed529c83..d8ec8106 100644 --- a/setup/templates/steps/services.html +++ b/setup/templates/steps/compose/services.html @@ -18,16 +18,23 @@ manage your email domains, users, etc.

email client. These do add some complexity but provide an easier way of accessing messages for beginner users.

+
-
-
- -
+ + + + +
+

-
- {{ macros.radio("webmail_type", "roundcube", "RoundCube", "popular Webmail running on top of PHP") }} - {{ macros.radio("webmail_type", "rainloop", "Rainloop", "lightweight Webmail based on PHP, no database") }} +
+ +
diff --git a/setup/templates/wizard.html b/setup/templates/wizard.html index 5a15af6f..1c85a0ad 100644 --- a/setup/templates/wizard.html +++ b/setup/templates/wizard.html @@ -9,11 +9,11 @@ {% endcall %}
- {% include "steps/initial-config.html" %} - {% include "steps/flavor.html" %} - {% include "steps/expose.html" %} - {% include "steps/services.html" %} - + {% include "steps/compose/flavor.html" %} + {% include "steps/compose/config.html" %} + {% include "steps/compose/services.html" %} + {% include "steps/compose/expose.html" %} +
From 6b6cbcf977002f768827389f035ab45fde1c4c15 Mon Sep 17 00:00:00 2001 From: Ionut Filip Date: Wed, 17 Oct 2018 15:38:51 +0300 Subject: [PATCH 06/19] Modified variables in .env file --- setup/flavors/compose/mailu.env | 27 ++++++++++++++--------- setup/templates/steps/compose/config.html | 2 +- setup/templates/steps/compose/expose.html | 2 +- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/setup/flavors/compose/mailu.env b/setup/flavors/compose/mailu.env index 77da5670..a577f979 100644 --- a/setup/flavors/compose/mailu.env +++ b/setup/flavors/compose/mailu.env @@ -65,26 +65,24 @@ DISABLE_STATISTICS={{ disable_statistics or 'False' }} # Message size limit in bytes # Default: accept messages up to 50MB -MESSAGE_SIZE_LIMIT={{ message_size_limit }} +MESSAGE_SIZE_LIMIT={{ message_size_limit or '50000000' }} # Networks granted relay permissions, make sure that you include your Docker # internal network (default to 172.17.0.0/16) -RELAYNETS={{ relaynets }} +RELAYNETS={{ relaynets or '172.17.0.0/16'}} # Will relay all outgoing mails if configured RELAYHOST={{ relayhost }} # Fetchmail delay -FETCHMAIL_DELAY={{ fetchmail_delay }} +FETCHMAIL_DELAY={{ fetchmail_delay or '600' }} # Recipient delimiter, character used to delimiter localpart from custom address part -RECIPIENT_DELIMITER={{ recipient_delimiter }} +RECIPIENT_DELIMITER={{ recipient_delimiter or '+' }} -{% if dmarc_rua or dmarc_ruf %} # DMARC rua and ruf email -{% if dmarc_rua %}DMARC_RUA={{ dmarc_rua }}{% endif %} -{% if dmarc_ruf %}DMARC_RUF={{ dmarc_ruf }}{% endif %} -{% endif %} +DMARC_RUA={{ dmarc_rua or 'admin' }} +DMARC_RUF={{ dmarc_ruf or 'admin' }} {% if welcome_enabled %} # Welcome email, enable and set a topic and body if you wish to send welcome @@ -94,6 +92,12 @@ WELCOME_SUBJECT={{ welcome_subject }} WELCOME_BODY={{ welcome_body }} {% endif %} +# Maildir Compression +# choose compression-method, default: none (value: bz2, gz) +COMPRESSION={{ compression }} +# change compression-level, default: 6 (value: 1-9) +COMPRESSION_LEVEL={{ compression_level }} + {% if domain_registration %} # Domain registration (remove to disable) DOMAIN_REGISTRATION=true @@ -125,13 +129,14 @@ WEBSITE={{ website }} # Advanced settings ################################### -{% if password_scheme %} # Specific password storage scheme -PASSWORD_SCHEME={{ password_scheme }} -{% endif %} +PASSWORD_SCHEME={{ password_scheme or 'SHA512-CRYPT'}} # Header to take the real ip from REAL_IP_HEADER={{ real_ip_header }} # IPs for nginx set_real_ip_from (CIDR list separated by commas) REAL_IP_FROM={{ real_ip_from }} + +# choose wether mailu bounces (no) or rejects (yes) mail when recipient is unknown (value: yes, no) +REJECT_UNLISTED_RECIPIENT={{ reject_unlisted_recipient }} diff --git a/setup/templates/steps/compose/config.html b/setup/templates/steps/compose/config.html index f5a39a5a..8d613d08 100644 --- a/setup/templates/steps/compose/config.html +++ b/setup/templates/steps/compose/config.html @@ -1,4 +1,4 @@ -{% call macros.panel("info", "Step 0 - Initial configuration") %} +{% call macros.panel("info", "Step 2 - Initial configuration") %}

Before starting some variables must be st

diff --git a/setup/templates/steps/compose/expose.html b/setup/templates/steps/compose/expose.html index e0aa8fee..6bc2f528 100644 --- a/setup/templates/steps/compose/expose.html +++ b/setup/templates/steps/compose/expose.html @@ -1,4 +1,4 @@ -{% call macros.panel("info", "Step 2 - expose Mailu to the world") %} +{% call macros.panel("info", "Step 4 - expose Mailu to the world") %}

A mail server must be exposed to the world to receive emails, send emails, and let users access their mailboxes. Mailu has some flexibility in the way you expose it to the world.

From cb1ed349bf15f13690416583816ff0f6a8b8c117 Mon Sep 17 00:00:00 2001 From: Ionut Filip Date: Wed, 17 Oct 2018 16:46:20 +0300 Subject: [PATCH 07/19] Bug fixes --- setup/flavors/compose/docker-compose.yml | 10 ++-------- setup/flavors/compose/mailu.env | 8 ++++---- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/setup/flavors/compose/docker-compose.yml b/setup/flavors/compose/docker-compose.yml index 8316e681..3d84e595 100644 --- a/setup/flavors/compose/docker-compose.yml +++ b/setup/flavors/compose/docker-compose.yml @@ -2,7 +2,7 @@ # This file is auto-generated by the Mailu configuration wizard. # Please read the documentation before attempting any change. -version: '3.7' +version: '3.6' services: @@ -18,7 +18,7 @@ services: image: mailu/nginx:{{ version }} restart: always env_file: {{ env }} - env: + environment: - TLS_FLAVOR={{ tls_flavor }} - ADMIN={{ admin_enabled or 'false' }} ports: @@ -30,10 +30,8 @@ services: - "{{ bind6 }}:{{ port }}:{{ port }}" {% endif %} {% endfor %} - {% if flavor in ('cert', 'mail') %} volumes: - "{{ root }}/certs:/certs" - {% endif %} admin: image: mailu/admin:{{ version }} @@ -54,7 +52,6 @@ services: restart: always env_file: {{ env }} volumes: - - "{{ root }}/data:/data" - "{{ root }}/mail:/mail" - "{{ root }}/overrides:/overrides" depends_on: @@ -65,7 +62,6 @@ services: restart: always env_file: {{ env }} volumes: - - "{{ root }}/data:/data" - "{{ root }}/overrides:/overrides" depends_on: - front @@ -107,8 +103,6 @@ services: image: mailu/fetchmail:{{ version }} restart: always env_file: {{ env }} - volumes: - - "{{ root }}/data:/data" {% endif %} # Webmail diff --git a/setup/flavors/compose/mailu.env b/setup/flavors/compose/mailu.env index a577f979..55def163 100644 --- a/setup/flavors/compose/mailu.env +++ b/setup/flavors/compose/mailu.env @@ -21,7 +21,7 @@ SECRET_KEY={{ secret(16) }} # PUBLIC_IPV6= {{ bind6 }} (default: ::1) # Main mail domain -# DOMAIN={{ domain }} +DOMAIN={{ domain }} # Mail address of the postmaster POSTMASTER={{ postmaster or 'admin'}} @@ -48,16 +48,16 @@ DISABLE_STATISTICS={{ disable_statistics or 'False' }} #ADMIN={{ admin_enabled or 'false' }} #Chose which webmail to run if any -#WEBMAIL={{ webmail_type or 'none' }} +WEBMAIL={{ webmail_type }} #Antivirus solution #ANTIVIRUS={{ antivirus_enabled or 'none' }} #Antispam solution -#ANTISPAM={{ antispam_enabled or 'none'}} +ANTISPAM={{ antispam_enabled or 'none'}} #Dav server implementation -#WEBDAV={{ webdav_enabled or 'none' }} +WEBDAV={{ webdav_enabled or 'none' }} ################################### # Server behavior From 7c0f5b20d6e196f71cda5d4d38773810a15cdaf1 Mon Sep 17 00:00:00 2001 From: Ionut Filip Date: Wed, 17 Oct 2018 17:54:37 +0300 Subject: [PATCH 08/19] Bug fixes --- setup/templates/steps/compose/expose.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup/templates/steps/compose/expose.html b/setup/templates/steps/compose/expose.html index 6bc2f528..df121c7d 100644 --- a/setup/templates/steps/compose/expose.html +++ b/setup/templates/steps/compose/expose.html @@ -15,7 +15,7 @@ avoid generic all-interfaces addresses like 0.0.0.0 or :: -
@@ -23,7 +23,7 @@ avoid generic all-interfaces addresses like 0.0.0.0 or ::IPv6 listen address + pattern="^s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:)))(%.+)?s*(\/([0-9]|[1-9][0-9]|1[0-1][0-9]|12[0-8]))?$">

You server will be available under a main hostname but may expose multiple public From ed53d655d3977c8e7794ec66eeac38881c541cfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20M=C3=B6hlmann?= Date: Wed, 17 Oct 2018 18:38:10 +0300 Subject: [PATCH 09/19] Extend documentation in download page. Small cleanup in env. --- setup/flavors/compose/mailu.env | 2 +- setup/flavors/compose/setup.html | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/setup/flavors/compose/mailu.env b/setup/flavors/compose/mailu.env index 55def163..fba5bee8 100644 --- a/setup/flavors/compose/mailu.env +++ b/setup/flavors/compose/mailu.env @@ -24,7 +24,7 @@ SECRET_KEY={{ secret(16) }} DOMAIN={{ domain }} # Mail address of the postmaster -POSTMASTER={{ postmaster or 'admin'}} +POSTMASTER={{ postmaster }} #Chose how secure connections will behave: #TLS_FLAVOR={{ tls_flavor }} diff --git a/setup/flavors/compose/setup.html b/setup/flavors/compose/setup.html index 3c190c9c..d5f7abc5 100644 --- a/setup/flavors/compose/setup.html +++ b/setup/flavors/compose/setup.html @@ -11,8 +11,8 @@ in a project directory. First create your project directory.

to read and check the configuration variables generated by the wizard.

cd {{ root }}
-wget {{ url_for('.file', uid=uid, filepath='docker-compose.yml', _external=True) }}
-wget {{ url_for('.file', uid=uid, filepath='mailu.env', _external=True) }}
+curl {{ url_for('.file', uid=uid, filepath='docker-compose.yml', _external=True) }} > docker-compose.yml
+curl {{ url_for('.file', uid=uid, filepath='mailu.env', _external=True) }} > mailu.env
 
{% endcall %} @@ -33,4 +33,17 @@ command.

cd {{ root }}
 docker-compose up -d
 
+ +Before you can use Mailu, you must create the primary administrator user account. This should be {{ postmaster }}@{{ domain }}. Use the following command, changing PASSWORD to your liking: + +
docker-compose exec admin python manage.py admin {{ postmaster }} {{ domain }} PASSWORD
+
+ +Login the the admin interface to change the password for a safe one, at +{% if admin_enabled %} +one of the hostnames ({{ hostnames }}){{ admin_path }}. +{% else %} +http://127.0.0.1:8080 (only directly from the host running docker). +{% endif %} +And choose the "Update password" option in the left menu. {% endcall %} From 5679d355aafa14cdce652e5dc50a3e053f1e1a4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20M=C3=B6hlmann?= Date: Wed, 17 Oct 2018 18:45:09 +0300 Subject: [PATCH 10/19] Avoid binding conflicts on production servers --- setup/docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup/docker-compose.yml b/setup/docker-compose.yml index 30966167..e91332e1 100644 --- a/setup/docker-compose.yml +++ b/setup/docker-compose.yml @@ -9,6 +9,6 @@ services: setup: image: mailu/setup ports: - - "80:80" + - "8000:80" build: . From adfadab4cf4d749d6bf95f0b9bd420fa3bc93094 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20M=C3=B6hlmann?= Date: Thu, 18 Oct 2018 12:56:16 +0300 Subject: [PATCH 11/19] Load steps after setting flavor --- setup/server.py | 5 +++++ setup/templates/macros.html | 4 ++-- setup/templates/steps/{compose => }/flavor.html | 8 ++++---- setup/templates/wizard.html | 17 +++++++++++------ 4 files changed, 22 insertions(+), 12 deletions(-) rename setup/templates/steps/{compose => }/flavor.html (81%) diff --git a/setup/server.py b/setup/server.py index ddeafd90..4e29fe9e 100644 --- a/setup/server.py +++ b/setup/server.py @@ -65,6 +65,11 @@ def build_app(path): def wizard(): return flask.render_template('wizard.html') + @bp.route("/submit_flavor", methods=["POST"]) + def submit_flavor(): + data = flask.request.form.copy() + return flask.render_template('wizard.html', flavor=data["flavor"]) + @bp.route("/submit", methods=["POST"]) def submit(): data = flask.request.form.copy() diff --git a/setup/templates/macros.html b/setup/templates/macros.html index 579800d2..4af20c4e 100644 --- a/setup/templates/macros.html +++ b/setup/templates/macros.html @@ -9,10 +9,10 @@
{% endmacro %} -{% macro radio(name, value, emph, text) %} +{% macro radio(name, value, emph, text, current) %}