diff --git a/bin/hardening/8.2.4_set_logfile_perm.sh b/bin/hardening/8.2.4_set_logfile_perm.sh index 72257e5..b7c6de6 100755 --- a/bin/hardening/8.2.4_set_logfile_perm.sh +++ b/bin/hardening/8.2.4_set_logfile_perm.sh @@ -70,6 +70,12 @@ apply () { does_file_exist "$FILE" if [ "$FNRET" != 0 ]; then info "$FILE does not exist" + filedir=$(dirname "${FILE#/var/log/}") + if [ ! "$filedir" = "." ] && [ ! -d /var/log/"$filedir" ]; then + debug "Creating /var/log/$filedir for $FILE" + debug "mkdir -p /var/log/"$filedir"" + mkdir -p /var/log/"$filedir" + fi touch "$FILE" fi FOUND_EXC=0