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/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; diff --git a/core/postfix/conf/main.cf b/core/postfix/conf/main.cf index 5ad39a3c..18f8f5b8 100644 --- a/core/postfix/conf/main.cf +++ b/core/postfix/conf/main.cf @@ -30,6 +30,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/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 4dcd90ca..79879d01 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" + convert("/conf/sasl_passwd", path) + os.system("postmap {}".format(path)) + +convert("/conf/rsyslog.conf", "/etc/rsyslog.conf") + # Run Podop and Postfix multiprocessing.Process(target=start_podop).start() os.system("/usr/libexec/postfix/post-install meta_directory=/etc/postfix create-missing") 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/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/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 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 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 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 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 diff --git a/webmails/rainloop/Dockerfile b/webmails/rainloop/Dockerfile index a6a1c739..94d8eff5 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 \