From a4095a7d48082fe0dbfd2146cf9be4ed743736d1 Mon Sep 17 00:00:00 2001 From: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com> Date: Sun, 12 Dec 2021 12:08:34 +0100 Subject: [PATCH] Disable `service stats` for Dovecot explicitly (#2292) Co-authored-by: Casper Co-authored-by: Casper --- target/dovecot/60-stats.conf | 25 +++++++++++++++++++++++++ target/scripts/startup/setup-stack.sh | 5 +++++ 2 files changed, 30 insertions(+) create mode 100644 target/dovecot/60-stats.conf diff --git a/target/dovecot/60-stats.conf b/target/dovecot/60-stats.conf new file mode 100644 index 00000000..1bddd6b6 --- /dev/null +++ b/target/dovecot/60-stats.conf @@ -0,0 +1,25 @@ +# Disable Dovecot's stats feature +# +# According to https://doc.dovecot.org/configuration_manual/service_configuration/ +# setting mode to 0 disables the socket entirely. + +service stats { + unix_listener stats-reader { + mode = 0 + } + unix_listener stats-writer { + mode = 0 + } +} + +service old-stats { + fifo_listener old-stats-mail { + mode = 0 + } + fifo_listener old-stats-user { + mode = 0 + } + unix_listener old-stats { + mode = 0 + } +} diff --git a/target/scripts/startup/setup-stack.sh b/target/scripts/startup/setup-stack.sh index 397d8e3e..870bd733 100644 --- a/target/scripts/startup/setup-stack.sh +++ b/target/scripts/startup/setup-stack.sh @@ -186,6 +186,11 @@ function _setup_dovecot sed -i -e 's|#ssl = yes|ssl = required|g' /etc/dovecot/conf.d/10-ssl.conf sed -i 's|^postmaster_address = .*$|postmaster_address = '"${POSTMASTER_ADDRESS}"'|g' /etc/dovecot/conf.d/15-lda.conf + if ! grep -q -E '^stats_writer_socket_path=' /etc/dovecot/dovecot.conf + then + printf '\nstats_writer_socket_path=\n' >>/etc/dovecot/dovecot.conf + fi + # set mail_location according to mailbox format case "${DOVECOT_MAILBOX_FORMAT}" in "sdbox" | "mdbox" )