From 03cb6534f75812f3a33ac768fe83861e0805b0e0 Mon Sep 17 00:00:00 2001 From: Xin Ouyang Date: Thu, 22 Aug 2013 13:37:23 +0800 Subject: [PATCH 2/6] add rules for the symlink of /var/log /var/log is a symlink in poky, so we need allow rules for files to read lnk_file while doing search/list/delete/rw.. in /var/log/ directory. Upstream-Status: Inappropriate [only for Poky] Signed-off-by: Xin Ouyang Signed-off-by: Joe MacDonald --- policy/modules/system/logging.fc | 1 + policy/modules/system/logging.if | 14 +++++++++++++- policy/modules/system/logging.te | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) Index: refpolicy/policy/modules/system/logging.fc =================================================================== --- refpolicy.orig/policy/modules/system/logging.fc +++ refpolicy/policy/modules/system/logging.fc @@ -53,6 +53,7 @@ ifdef(`distro_suse', ` /var/dnscache/log/main(/.*)? gen_context(system_u:object_r:var_log_t,s0) /var/log -d gen_context(system_u:object_r:var_log_t,s0-mls_systemhigh) +/var/log -l gen_context(system_u:object_r:var_log_t,s0-mls_systemhigh) /var/log/.* gen_context(system_u:object_r:var_log_t,s0) /var/log/boot\.log -- gen_context(system_u:object_r:var_log_t,mls_systemhigh) /var/log/messages[^/]* gen_context(system_u:object_r:var_log_t,mls_systemhigh) Index: refpolicy/policy/modules/system/logging.if =================================================================== --- refpolicy.orig/policy/modules/system/logging.if +++ refpolicy/policy/modules/system/logging.if @@ -945,10 +945,12 @@ interface(`logging_append_all_inherited_ interface(`logging_read_all_logs',` gen_require(` attribute logfile; + type var_log_t; ') files_search_var($1) allow $1 logfile:dir list_dir_perms; + allow $1 var_log_t:lnk_file read_lnk_file_perms; read_files_pattern($1, logfile, logfile) ') @@ -967,10 +969,12 @@ interface(`logging_read_all_logs',` interface(`logging_exec_all_logs',` gen_require(` attribute logfile; + type var_log_t; ') files_search_var($1) allow $1 logfile:dir list_dir_perms; + allow $1 var_log_t:lnk_file read_lnk_file_perms; can_exec($1, logfile) ') @@ -1072,6 +1076,7 @@ interface(`logging_read_generic_logs',` files_search_var($1) allow $1 var_log_t:dir list_dir_perms; + allow $1 var_log_t:lnk_file read_lnk_file_perms; read_files_pattern($1, var_log_t, var_log_t) ') @@ -1173,6 +1178,7 @@ interface(`logging_manage_generic_logs', files_search_var($1) manage_files_pattern($1, var_log_t, var_log_t) + allow $1 var_log_t:lnk_file read_lnk_file_perms; ') ######################################## Index: refpolicy/policy/modules/system/logging.te =================================================================== --- refpolicy.orig/policy/modules/system/logging.te +++ refpolicy/policy/modules/system/logging.te @@ -159,6 +159,7 @@ manage_files_pattern(auditd_t, auditd_lo allow auditd_t auditd_log_t:dir setattr; manage_lnk_files_pattern(auditd_t, auditd_log_t, auditd_log_t) allow auditd_t var_log_t:dir search_dir_perms; +allow auditd_t var_log_t:lnk_file read_lnk_file_perms; manage_files_pattern(auditd_t, auditd_var_run_t, auditd_var_run_t) manage_sock_files_pattern(auditd_t, auditd_var_run_t, auditd_var_run_t)