Set expected permissions in log #1300

This commit is contained in:
Erik Wramner 2019-10-27 09:22:16 +01:00
parent 7ff9764285
commit 37e0082cd7

View file

@ -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"