summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYi Zhao <yi.zhao@windriver.com>2023-07-27 14:07:46 -0400
committerJoe MacDonald <joe@deserted.net>2023-07-31 15:05:21 -0400
commit7bb93ef630fdf21cbc7fc9dc87e7aa917af649bb (patch)
tree05e010503f0dc8fba9aece956b53d1d8b9ddc628
parenta7732beacdf212a33cc3c3527a0727a7427efa9a (diff)
downloadmeta-selinux-7bb93ef630fdf21cbc7fc9dc87e7aa917af649bb.tar.gz
audit: set correct security context for /var/log/audit
By default /var/log is a symbolic link of /var/volatile/log. But restorecon does not follow symbolic links then we will encounter the following error when set /var/log/audit directory: $ /sbin/restorecon -F /var/log/audit /sbin/restorecon: SELinux: Could not get canonical path for /var/log/audit restorecon: Permission denied. Use readlink to find the real path before set security context. Signed-off-by: Yi Zhao <yi.zhao@windriver.com> (cherry picked from commit 8b79480663bc9de2343e0146ed8d3d0e59ab48be) Signed-off-by: Armin Kuster <akuster@mvista.com> Signed-off-by: Joe MacDonald <joe@deserted.net>
-rw-r--r--[-rwxr-xr-x]recipes-security/audit/audit/auditd2
1 files changed, 1 insertions, 1 deletions
diff --git a/recipes-security/audit/audit/auditd b/recipes-security/audit/audit/auditd
index cda2e43..6aa7f94 100755..100644
--- a/recipes-security/audit/audit/auditd
+++ b/recipes-security/audit/audit/auditd
@@ -86,7 +86,7 @@ do_reload() {
86 86
87if [ ! -e /var/log/audit ]; then 87if [ ! -e /var/log/audit ]; then
88 mkdir -p /var/log/audit 88 mkdir -p /var/log/audit
89 [ -x /sbin/restorecon ] && /sbin/restorecon -F /var/log/audit 89 [ -x /sbin/restorecon ] && /sbin/restorecon -F $(readlink -f /var/log/audit)
90fi 90fi
91 91
92case "$1" in 92case "$1" in