From 7dcb2eb006fd2309a91dea9229551ba661af2b3d Mon Sep 17 00:00:00 2001 From: Daniel Huber Date: Mon, 4 Mar 2019 18:52:04 +0100 Subject: [PATCH 1/8] Add authentication for email relays --- core/postfix/conf/main.cf | 5 +++++ core/postfix/start.py | 7 +++++++ docs/configuration.rst | 3 ++- towncrier/newsfragments/958.feature | 1 + 4 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 towncrier/newsfragments/958.feature diff --git a/core/postfix/conf/main.cf b/core/postfix/conf/main.cf index d5d47d19..ddabe32c 100644 --- a/core/postfix/conf/main.cf +++ b/core/postfix/conf/main.cf @@ -27,6 +27,11 @@ mydestination = # Relayhost if any is configured relayhost = {{ RELAYHOST }} +{% if RELAYUSER %} +smtp_sasl_auth_enable = yes +smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd +smtp_sasl_security_options = noanonymous +{% endif %} # Recipient delimiter for extended addresses recipient_delimiter = {{ RECIPIENT_DELIMITER }} diff --git a/core/postfix/start.py b/core/postfix/start.py index 95c97fde..b7a3a853 100755 --- a/core/postfix/start.py +++ b/core/postfix/start.py @@ -48,6 +48,13 @@ for map_file in glob.glob("/overrides/*.map"): os.system("postmap {}".format(destination)) os.remove(destination) +if "RELAYUSER" in os.environ: + path = "/etc/postfix/sasl_passwd" + fileContent = "{} {}:{}".format(os.environ["RELAYHOST"], os.environ["RELAYUSER"], os.environ["RELAYPASSWORD"]) + with open(path, "w") as f: + f.write(fileContent) + os.system("postmap {}".format(path)) + convert("/conf/rsyslog.conf", "/etc/rsyslog.conf") # Run Podop and Postfix diff --git a/docs/configuration.rst b/docs/configuration.rst index e7dfa2af..7b84d6fc 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -57,7 +57,8 @@ Docker services' outbound mail to be relayed, you can set this to ``172.16.0.0/1 to include **all** Docker networks. The default is to leave this empty. The ``RELAYHOST`` is an optional address of a mail server relaying all outgoing -mail. +mail in following format: ``[HOST]:PORT``. +``RELAYUSER`` and ``RELAYPASSWORD`` can be used when authentication is needed. The ``FETCHMAIL_DELAY`` is a delay (in seconds) for the fetchmail service to go and fetch new email if available. Do not use too short delays if you do not diff --git a/towncrier/newsfragments/958.feature b/towncrier/newsfragments/958.feature new file mode 100644 index 00000000..ac02dec4 --- /dev/null +++ b/towncrier/newsfragments/958.feature @@ -0,0 +1 @@ +Relays with authentication From ae290482c0e0b2401a180f4fd48fe9915acd98a6 Mon Sep 17 00:00:00 2001 From: Daniel Huber Date: Wed, 26 Jun 2019 20:22:02 +0200 Subject: [PATCH 2/8] Format relay credentials file with jinja --- core/postfix/conf/sasl_passwd | 1 + core/postfix/start.py | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) create mode 100644 core/postfix/conf/sasl_passwd diff --git a/core/postfix/conf/sasl_passwd b/core/postfix/conf/sasl_passwd new file mode 100644 index 00000000..e19d0657 --- /dev/null +++ b/core/postfix/conf/sasl_passwd @@ -0,0 +1 @@ +{{ RELAYHOST }} {{ RELAYUSER }}:{{ RELAYPASSWORD }} \ No newline at end of file diff --git a/core/postfix/start.py b/core/postfix/start.py index b7a3a853..81849c5b 100755 --- a/core/postfix/start.py +++ b/core/postfix/start.py @@ -50,9 +50,7 @@ for map_file in glob.glob("/overrides/*.map"): if "RELAYUSER" in os.environ: path = "/etc/postfix/sasl_passwd" - fileContent = "{} {}:{}".format(os.environ["RELAYHOST"], os.environ["RELAYUSER"], os.environ["RELAYPASSWORD"]) - with open(path, "w") as f: - f.write(fileContent) + convert("/conf/sasl_passwd", path) os.system("postmap {}".format(path)) convert("/conf/rsyslog.conf", "/etc/rsyslog.conf") From 616d40d225d10b7f6f6da882bbe65c9fe2befcf9 Mon Sep 17 00:00:00 2001 From: hoellen Date: Mon, 8 Jul 2019 10:35:59 +0200 Subject: [PATCH 3/8] Update password in commandline --- core/admin/mailu/manage.py | 20 ++++++++++++++++++++ docs/cli.rst | 9 +++++++++ towncrier/newsfragments/1066.feature | 1 + 3 files changed, 30 insertions(+) create mode 100644 towncrier/newsfragments/1066.feature diff --git a/core/admin/mailu/manage.py b/core/admin/mailu/manage.py index c39fc1b6..e113abfe 100644 --- a/core/admin/mailu/manage.py +++ b/core/admin/mailu/manage.py @@ -85,6 +85,26 @@ def user(localpart, domain_name, password, hash_scheme=None): db.session.commit() +@mailu.command() +@click.argument('localpart') +@click.argument('domain_name') +@click.argument('password') +@click.argument('hash_scheme', required=False) +@flask_cli.with_appcontext +def password(localpart, domain_name, password, hash_scheme=None): + """ Change the password of an user + """ + email = '{0}@{1}'.format(localpart, domain_name) + user = models.User.query.get(email) + if hash_scheme is None: + hash_scheme = app.config['PASSWORD_SCHEME'] + if user: + user.set_password(password, hash_scheme=hash_scheme) + else: + print("User " + email + " not found.") + db.session.commit() + + @mailu.command() @click.argument('domain_name') @click.option('-u', '--max-users') diff --git a/docs/cli.rst b/docs/cli.rst index bdd030f9..24ba22dd 100644 --- a/docs/cli.rst +++ b/docs/cli.rst @@ -6,6 +6,7 @@ Managing users and aliases can be done from CLI using commands: * alias * alias-delete * domain +* password * user * user-import * user-delete @@ -35,6 +36,14 @@ domain docker-compose exec admin flask mailu domain example.net +password +-------- + +.. code-block:: bash + + docker-compose exec admin flask mailu password myuser example.net 'password123' + + user ---- diff --git a/towncrier/newsfragments/1066.feature b/towncrier/newsfragments/1066.feature new file mode 100644 index 00000000..b9f5ea13 --- /dev/null +++ b/towncrier/newsfragments/1066.feature @@ -0,0 +1 @@ +Update user password in commandline From 589f524a58adc772ce6b7af7a5839d9fabe442e5 Mon Sep 17 00:00:00 2001 From: hoellen Date: Mon, 8 Jul 2019 15:53:57 +0200 Subject: [PATCH 4/8] fix destination of changelog file (#1010) --- towncrier/{newsframents => newsfragments}/916.doc | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename towncrier/{newsframents => newsfragments}/916.doc (100%) diff --git a/towncrier/newsframents/916.doc b/towncrier/newsfragments/916.doc similarity index 100% rename from towncrier/newsframents/916.doc rename to towncrier/newsfragments/916.doc From 2c7d1d2f71ebfa04209ed64b291357a52d3d6418 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20S=C3=A4nger?= Date: Thu, 11 Jul 2019 22:38:34 +0200 Subject: [PATCH 5/8] use HTTP/1.1 for proxyied connections --- core/nginx/conf/proxy.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/core/nginx/conf/proxy.conf b/core/nginx/conf/proxy.conf index 3e3710b9..5a182ea8 100644 --- a/core/nginx/conf/proxy.conf +++ b/core/nginx/conf/proxy.conf @@ -3,3 +3,4 @@ proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $proxy_x_forwarded_proto; +proxy_http_version 1.1; From c064f58f4d958321f7cef8f64193b548210c3023 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20S=C3=A4nger?= Date: Thu, 11 Jul 2019 22:46:05 +0200 Subject: [PATCH 6/8] update changelog --- towncrier/newsfragments/1070.feature | 1 + 1 file changed, 1 insertion(+) create mode 100644 towncrier/newsfragments/1070.feature diff --git a/towncrier/newsfragments/1070.feature b/towncrier/newsfragments/1070.feature new file mode 100644 index 00000000..d6c08425 --- /dev/null +++ b/towncrier/newsfragments/1070.feature @@ -0,0 +1 @@ +use HTTP/1.1 for proxyied connections From 5038438efba065b31d2f74d2e2518b709a82a126 Mon Sep 17 00:00:00 2001 From: hoellen Date: Fri, 12 Jul 2019 09:16:51 +0200 Subject: [PATCH 7/8] update rainloop to 1.13.0 --- webmails/rainloop/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webmails/rainloop/Dockerfile b/webmails/rainloop/Dockerfile index 975227b0..728664f2 100644 --- a/webmails/rainloop/Dockerfile +++ b/webmails/rainloop/Dockerfile @@ -5,7 +5,7 @@ RUN apt-get update && apt-get install -y \ && rm -rf /var/lib/apt/lists \ && echo "ServerSignature Off" >> /etc/apache2/apache2.conf -ENV RAINLOOP_URL https://github.com/RainLoop/rainloop-webmail/releases/download/v1.12.1/rainloop-community-1.12.1.zip +ENV RAINLOOP_URL https://github.com/RainLoop/rainloop-webmail/releases/download/v1.13.0/rainloop-community-1.13.0.zip RUN apt-get update && apt-get install -y \ unzip python3-jinja2 \ @@ -21,7 +21,7 @@ RUN apt-get update && apt-get install -y \ && chown -R www-data: * \ && apt-get purge -y unzip \ && rm -rf /var/lib/apt/lists - + RUN pip3 install git+https://github.com/usrpro/MailuStart.git#egg=mailustart COPY include.php /var/www/html/include.php From 37d4db514f164a6b8fa9a0bd0d44b4a7b31ea9bc Mon Sep 17 00:00:00 2001 From: hoellen Date: Fri, 12 Jul 2019 09:22:07 +0200 Subject: [PATCH 8/8] update changelog --- towncrier/newsfragments/1071.feature | 1 + 1 file changed, 1 insertion(+) create mode 100644 towncrier/newsfragments/1071.feature diff --git a/towncrier/newsfragments/1071.feature b/towncrier/newsfragments/1071.feature new file mode 100644 index 00000000..c5186cb8 --- /dev/null +++ b/towncrier/newsfragments/1071.feature @@ -0,0 +1 @@ +Update Rainloop to 1.13.0