[Dovecot] Replace hostname for quarantine notifications with mailcow hostname (broke after Docker 20.10 fix)

master
andryyy 2020-12-11 10:05:05 +01:00
parent 2086927bb8
commit 16f87f07fa
No known key found for this signature in database
GPG Key ID: 8EC34FF2794E25EF
2 changed files with 3 additions and 1 deletions

View File

@ -271,6 +271,7 @@ fi
sed -i "s/__DBUSER__/${DBUSER}/g" /usr/local/bin/imapsync_cron.pl /usr/local/bin/quarantine_notify.py /usr/local/bin/clean_q_aged.sh /etc/dovecot/lua/app-passdb.lua
sed -i "s/__DBPASS__/${DBPASS}/g" /usr/local/bin/imapsync_cron.pl /usr/local/bin/quarantine_notify.py /usr/local/bin/clean_q_aged.sh /etc/dovecot/lua/app-passdb.lua
sed -i "s/__DBNAME__/${DBNAME}/g" /usr/local/bin/imapsync_cron.pl /usr/local/bin/quarantine_notify.py /usr/local/bin/clean_q_aged.sh /etc/dovecot/lua/app-passdb.lua
sed -i "s/__MAILCOW_HOSTNAME__/${MAILCOW_HOSTNAME}/g" /usr/local/bin/quarantine_notify.py
sed -i "s/__LOG_LINES__/${LOG_LINES}/g" /usr/local/bin/trim_logs.sh
if [[ "${MASTER}" =~ ^([nN][oO]|[nN])+$ ]]; then
# Toggling MASTER will result in a rebuild of containers, so the quota script will be recreated

View File

@ -26,6 +26,7 @@ while True:
break
time_now = int(time.time())
mailcow_hostname = '__MAILCOW_HOSTNAME__'
max_score = float(r.get('Q_MAX_SCORE') or "9999.0")
if max_score == "":
@ -75,7 +76,7 @@ def notify_rcpt(rcpt, msg_count, quarantine_acl, category):
else:
with open('/templates/quarantine.tpl') as file_:
template = Template(file_.read())
html = template.render(meta=meta_query, username=rcpt, counter=msg_count, hostname=socket.gethostname(), quarantine_acl=quarantine_acl)
html = template.render(meta=meta_query, username=rcpt, counter=msg_count, hostname=mailcow_hostname, quarantine_acl=quarantine_acl)
text = html2text.html2text(html)
count = 0
while count < 15: