From 37e0082cd7998924564c542cc24e5ac72c7ef6c2 Mon Sep 17 00:00:00 2001 From: Erik Wramner Date: Sun, 27 Oct 2019 09:22:16 +0100 Subject: [PATCH] Set expected permissions in log #1300 --- target/start-mailserver.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/target/start-mailserver.sh b/target/start-mailserver.sh index 0260002f..26e98e56 100644 --- a/target/start-mailserver.sh +++ b/target/start-mailserver.sh @@ -90,6 +90,7 @@ function register_functions() { ################### >> setup funcs _register_setup_function "_setup_default_vars" + _register_setup_function "_setup_file_permissions" if [ "$ENABLE_ELK_FORWARDER" = 1 ]; then _register_setup_function "_setup_elk_forwarder" @@ -472,6 +473,26 @@ function _setup_default_vars() { done } +# File/folder permissions are fine when using docker volumes, but may be wrong +# when file system folders are mounted into the container. +# Set the expected values and create missing folders/files just in case. +function _setup_file_permissions() { + notify 'task' "Setting file/folder permissions" + + mkdir -p /var/log/supervisor + + mkdir -p /var/log/mail + chown syslog:root /var/log/mail + + touch /var/log/mail/clamav.log + chown clamav:adm /var/log/mail/clamav.log + chmod 640 /var/log/mail/clamav.log + + touch /var/log/mail/freshclam.log + chown clamav:adm /var/log/mail/freshclam.log + chmod 640 /var/log/mail/freshclam.log +} + function _setup_chksum_file() { notify 'task' "Setting up configuration checksum file"