Dovecot quota-warning executable can not log to stdout

I'm running dovecot with DB based userdb and passdb inside a docker container using the s6-overlay.

Everything runs very well. Now I tried to add quota warnings and run into a problem with logging to /dev/stdout.

Error message

Whenever the warning mail should be sent I see this message getting logged:

Oct 28 10:27:01 quota-warning: Error: Can't open log file /dev/stdout: No such device or address
Oct 28 10:27:01 quota-warning: Fatal: master: service(quota-warning): child 460 returned error 75

Relevant dovecot config

I've set log path to /dev/stdout to let S6 capture the logs for me. And I added a quota warning script following the manual. Here's the relevant config:

log_path = /dev/stdout
first_valid_uid = 100
mail_uid = vmail
mail_gid = dovecot
mail_privileged_group = dovecot
mail_home = /var/mail/domains/%d/%n
mail_location = maildir:/var/mail/domains/%d/%n**
plugin {
  quota = maildir:User quota
  quota_exceeded_message = Storage quota for user %u exceeded
  quota_rule2 = Trash:storage=+100M
  quota_grace = 10%%
  quota_status_success = DUNNO
  quota_status_nouser = DUNNO
  quota_status_overquota = "552 5.2.2 Mailbox is full"
  quota_warning = storage=85%% quota-warning 85 %u %d
}
service quota-warning {
  executable = script /usr/local/bin/quota-warning.sh
  user = vmail
  group = dovecot
  unix_listener quota-warning {
    user = dovecot
    mode = 0666
  }
}

Quota warning script

#!/bin/sh
PERCENT=$1
USER=$2
DOMAIN=$3
cat << EOF | /usr/libexec/dovecot/dovecot-lda -d $USER -o "plugin/quota=maildir:User quota:noenforcing"
From: no-reply@$DOMAIN
Subject: Qutoa warning

Your mailbox quota is at $PERCENT%.
EOF

S6 dovecot service

The S6 run script to start dovecot is very simple:

#!/bin/sh
exec /usr/sbin/dovecot -F -c /etc/dovecot/dovecot.conf

Log output from /dev/stdout is captured via a logs/run script:

#!/bin/sh
exec logutil-service /logs/dovecot

What I've tried

Everything works as soon as I change log_path to a static file like /tmp/dovecot.log. But that's not what I want.

So as I see it there's no /dev/stdout created for the quota-warning script and I have no idea how to fix this.

For the record: Everything else from dovecot is logged just fine via /dev/stdout.

UPDATE: I can also run the quota-warning.sh script manually from a shell inside the container without a problem. It drops a warning message into the users mailbox.

0
задан 28 October 2017 в 16:49
1 ответ

Et funktionnéiert wann Dir déi folgend Saache maacht:

Ännert de Benotzer deen de Quota-Warnscript ausféiert op root :

Service Quota-Warnung { ausführbar = Skript /usr/local/bin/quota-warning.sh Benotzer = root }

Och wann Dir de Skript als Root leeft (wat net aus Sécherheetsperspektiv ideal ass) funktionnéiert et awer net.

Also hunn ech déi folgend Optiounen un de dovecot-lda Kommando bäigefüügt. Zeil:

/ usr / libexec / dovecot / dovecot-lda -d $ USER -o "log_path = / proc / 1 / fd / 2" -o "info_log_path = / proc / 1 / fd / 1" -o " Plugin / Quota = Maildir: Benotzerquote:noenforcing "

Wann Dir dëst maacht, gëtt d'Umeldung op de STDOUT an de STDERR vum Prozess mat PID = 1 weidergeleet, wat de Prozess ass, deem seng Ausgang normalerweis vum Docker protokolléiert gëtt.

Ech weess net firwat / dev / stdout an / dev / stderr sinn net zum Quotewarnscript verfügbar, och wann et vun root ...

Fannt Dir eng besser Léisung an der Tëschenzäit?

Bescht Gréiss, Stefan

0
ответ дан 5 December 2019 в 07:17

Теги

Похожие вопросы