From 4e337b308f56345138a6c0ebf3b7bb1f9f9c046e Mon Sep 17 00:00:00 2001 From: andryyy Date: Fri, 6 Nov 2020 12:23:02 +0100 Subject: [PATCH] [Dovecot] Select action in quarantine script, use nobody to run imapsync cron --- data/Dockerfiles/dovecot/Dockerfile | 2 ++ data/Dockerfiles/dovecot/docker-entrypoint.sh | 2 +- data/Dockerfiles/dovecot/quarantine_notify.py | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/data/Dockerfiles/dovecot/Dockerfile b/data/Dockerfiles/dovecot/Dockerfile index 2c683c31..691f9a7a 100644 --- a/data/Dockerfiles/dovecot/Dockerfile +++ b/data/Dockerfiles/dovecot/Dockerfile @@ -9,6 +9,8 @@ ENV LC_ALL C RUN groupadd -g 5000 vmail \ && groupadd -g 401 dovecot \ && groupadd -g 402 dovenull \ + && groupadd -g 999 sogo \ + && usermod -a -G sogo nobody \ && useradd -g vmail -u 5000 vmail -d /var/vmail \ && useradd -c "Dovecot unprivileged user" -d /dev/null -u 401 -g dovecot -s /bin/false dovecot \ && useradd -c "Dovecot login user" -d /dev/null -u 402 -g dovenull -s /bin/false dovenull \ diff --git a/data/Dockerfiles/dovecot/docker-entrypoint.sh b/data/Dockerfiles/dovecot/docker-entrypoint.sh index e16f95df..63c63220 100755 --- a/data/Dockerfiles/dovecot/docker-entrypoint.sh +++ b/data/Dockerfiles/dovecot/docker-entrypoint.sh @@ -321,7 +321,7 @@ chmod +x /usr/lib/dovecot/sieve/rspamd-pipe-ham \ if [[ "${MASTER}" =~ ^([yY][eE][sS]|[yY])+$ ]]; then # Setup cronjobs -echo '* * * * * root /usr/local/bin/imapsync_cron.pl 2>&1 | /usr/bin/logger' > /etc/cron.d/imapsync +echo '* * * * * nobody /usr/local/bin/imapsync_cron.pl 2>&1 | /usr/bin/logger' > /etc/cron.d/imapsync #echo '30 3 * * * vmail /usr/local/bin/doveadm quota recalc -A' > /etc/cron.d/dovecot-sync echo '* * * * * vmail /usr/local/bin/trim_logs.sh >> /dev/console 2>&1' > /etc/cron.d/trim_logs echo '25 * * * * vmail /usr/local/bin/maildir_gc.sh >> /dev/console 2>&1' > /etc/cron.d/maildir_gc diff --git a/data/Dockerfiles/dovecot/quarantine_notify.py b/data/Dockerfiles/dovecot/quarantine_notify.py index 07f14682..b0ed29b9 100755 --- a/data/Dockerfiles/dovecot/quarantine_notify.py +++ b/data/Dockerfiles/dovecot/quarantine_notify.py @@ -59,7 +59,7 @@ def query_mysql(query, headers = True, update = False): cnx.close() def notify_rcpt(rcpt, msg_count, quarantine_acl): - meta_query = query_mysql('SELECT SHA2(CONCAT(id, qid), 256) AS qhash, id, subject, score, sender, created FROM quarantine WHERE notified = 0 AND rcpt = "%s" AND score < %f' % (rcpt, max_score)) + meta_query = query_mysql('SELECT SHA2(CONCAT(id, qid), 256) AS qhash, id, subject, score, sender, created, action FROM quarantine WHERE notified = 0 AND rcpt = "%s" AND score < %f' % (rcpt, max_score)) if r.get('Q_HTML'): try: template = Template(r.get('Q_HTML'))