Skip to content

Commit 7d1dc1f

Browse files
committed
systemd: allow tmpfiles to handle auditd_log_t
audit installs a tmpfiles.d file for /var/log/audit [0]: ``` AVC avc: denied { relabelfrom } for pid=1439 comm="systemd-tmpfile" name="audit" dev="dm-0" ino=1246029 scontext=system_u:system_r:systemd_tmpfiles_t:s0 tcontext=system_u:object_r:auditd_log_t:s0 tclass=dir AVC avc: denied { relabelto } for pid=1439 comm="systemd-tmpfile" name="audit" dev="dm-0" ino=1246029 scontext=system_u:system_r:systemd_tmpfiles_t:s0 tcontext=system_u:object_r:auditd_log_t:s0 tclass=dir ``` An explicit allow is needed because auditd_log_t is a security_file. [0] linux-audit/audit-userspace@eb3a9a6 Signed-off-by: Sam James <sam@gentoo.org>
1 parent d305828 commit 7d1dc1f

2 files changed

Lines changed: 38 additions & 0 deletions

File tree

policy/modules/system/logging.if

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1458,6 +1458,42 @@ interface(`logging_admin',`
14581458
logging_admin_syslog($1, $2)
14591459
')
14601460

1461+
#######################################
1462+
## <summary>
1463+
## Allow creating auditd_log_t directories.
1464+
## </summary>
1465+
## <param name="domain">
1466+
## <summary>
1467+
## Domain allowed access.
1468+
## </summary>
1469+
## </param>
1470+
#
1471+
interface(`logging_create_audit_log_dirs',`
1472+
gen_require(`
1473+
type auditd_log_t;
1474+
')
1475+
1476+
allow $1 auditd_log_t:dir create_dir_perms;
1477+
')
1478+
1479+
#######################################
1480+
## <summary>
1481+
## Allow relabeling auditd_log_t directories.
1482+
## </summary>
1483+
## <param name="domain">
1484+
## <summary>
1485+
## Domain allowed access.
1486+
## </summary>
1487+
## </param>
1488+
#
1489+
interface(`logging_relabel_audit_log_dirs',`
1490+
gen_require(`
1491+
type auditd_log_t;
1492+
')
1493+
1494+
allow $1 auditd_log_t:dir relabel_dir_perms;
1495+
')
1496+
14611497
#######################################
14621498
## <summary>
14631499
## Map files in /run/log/journal/ directory.

policy/modules/system/systemd.te

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2242,6 +2242,8 @@ kernel_relabelfrom_unlabeled_sockets(systemd_tmpfiles_t)
22422242
kernel_relabelfrom_unlabeled_blk_devs(systemd_tmpfiles_t)
22432243
kernel_relabelfrom_unlabeled_chr_devs(systemd_tmpfiles_t)
22442244

2245+
logging_create_audit_log_dirs(systemd_tmpfiles_t)
2246+
logging_relabel_audit_log_dirs(systemd_tmpfiles_t)
22452247
logging_relabel_generic_log_dirs(systemd_tmpfiles_t)
22462248
logging_relabel_syslogd_tmp_files(systemd_tmpfiles_t)
22472249
logging_relabel_syslogd_tmp_dirs(systemd_tmpfiles_t)

0 commit comments

Comments
 (0)