1
0
mirror of https://github.com/Mailu/Mailu.git synced 2025-08-10 22:31:47 +02:00

Add authentication for email relays

This commit is contained in:
Daniel Huber
2019-03-04 18:52:04 +01:00
parent 42953eb70b
commit 7dcb2eb006
4 changed files with 15 additions and 1 deletions

View File

@@ -27,6 +27,11 @@ mydestination =
# Relayhost if any is configured # Relayhost if any is configured
relayhost = {{ RELAYHOST }} 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 for extended addresses
recipient_delimiter = {{ RECIPIENT_DELIMITER }} recipient_delimiter = {{ RECIPIENT_DELIMITER }}

View File

@@ -48,6 +48,13 @@ for map_file in glob.glob("/overrides/*.map"):
os.system("postmap {}".format(destination)) os.system("postmap {}".format(destination))
os.remove(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") convert("/conf/rsyslog.conf", "/etc/rsyslog.conf")
# Run Podop and Postfix # Run Podop and Postfix

View File

@@ -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. 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 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 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 go and fetch new email if available. Do not use too short delays if you do not

View File

@@ -0,0 +1 @@
Relays with authentication