Skip to contentSkip to conversation

audit daemon can halt system, allow this to happen.

PATCH In review Sugar, David 2 participants 3 messages Jan 22, 2020 – Feb 8, 2020

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 audit daemon can halt system, allow this to happen.

auditd can halt the system for several reasons based on configuration. These mostly revovle around audit partition full issues. I am seeing the following denials when attempting to halt the system.

Jan 12 03:38:48 localhost audispd: node=localhost type=USER_AVC msg=audit(1578800328.122:1943): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='avc:  denied  { start } for auid=n/a uid=0 gid=0 path="/usr/lib/systemd/system/poweroff.target" cmdline="/sbin/init 0" scontext=system_u:system_r:auditd_t:s0 tcontext=system_u:object_r:power_unit_t:s0 tclass=service exe="/usr/lib/systemd/systemd" sauid=0 hostname=? addr=? terminal=?'
Jan 12 03:38:48 localhost audispd: node=localhost type=USER_AVC msg=audit(1578800328.147:1944): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='avc:  denied  { status } for auid=n/a uid=0 gid=0 path="/usr/lib/systemd/system/poweroff.target" cmdline="/sbin/init 0" scontext=system_u:system_r:auditd_t:s0 tcontext=system_u:object_r:power_unit_t:s0 tclass=service exe="/usr/lib/systemd/systemd" sauid=0 hostname=? addr=? terminal=?'
Jan 12 04:44:54 localhost audispd: node=localhost type=AVC msg=audit(1578804294.103:1923): avc:  denied  { getattr } for  pid=6936 comm="systemctl" path="/run/systemd/system" dev="tmpfs" ino=45 scontext=system_u:system_r:auditd_t:s0 tcontext=system_u:object_r:systemd_unit_t:s0 tclass=dir permissive=1

v2 - use optional rather than ifdef
v3 - fix order

---
 policy/modules/system/logging.te |  6 ++++++
 policy/modules/system/systemd.if | 20 ++++++++++++++++++++
 2 files changed, 26 insertions(+)
policy/modules/system/logging.te +6 -0
index 4c11d061..bce6b4d8 100644
@@ -231,6 +231,12 @@ optional_policy(`
 	seutil_sigchld_newrole(auditd_t)
 ')
 
+optional_policy(`
+	init_list_unit_dirs(auditd_t)
+	systemd_start_power_units(auditd_t)
+	systemd_status_power_units(auditd_t)
+')
+
 optional_policy(`
 	udev_read_db(auditd_t)
 ')
policy/modules/system/systemd.if +20 -0
index a49b0f77..8e46f443 100644
@@ -791,6 +791,26 @@ interface(`systemd_start_power_units',`
 	allow $1 power_unit_t:service start;
 ')
 
+########################################
+## <summary>
+##	Get the system status information about power units
+## </summary>
+## <param name="domain">
+##	<summary>
+##	Domain allowed access.
+##	</summary>
+## </param>
+#
+interface(`systemd_status_power_units',`
+	gen_require(`
+		type power_unit_t;
+		class service status;
+	')
+
+	allow $1 power_unit_t:service status;
+')
+
+
 ########################################
 ## <summary>
 ##	Make the specified type usable for
Signature · 1 line
2.24.1
#1 lore raw

Can this get merged? I have not seen any comments. Would you prefer that I use a github pull request?

Quoted 65 lines · David

auditd can halt the system for several reasons based on configuration. These mostly revovle around audit partition full issues. I am seeing the following denials when attempting to halt the system.

Jan 12 03:38:48 localhost audispd: node=localhost type=USER_AVC msg=audit(1578800328.122:1943): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='avc:  denied  { start } for auid=n/a uid=0 gid=0 path="/usr/lib/systemd/system/poweroff.target" cmdline="/sbin/init 0" scontext=system_u:system_r:auditd_t:s0 tcontext=system_u:object_r:power_unit_t:s0 tclass=service exe="/usr/lib/systemd/systemd" sauid=0 hostname=? addr=? terminal=?'
Jan 12 03:38:48 localhost audispd: node=localhost type=USER_AVC msg=audit(1578800328.147:1944): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='avc:  denied  { status } for auid=n/a uid=0 gid=0 path="/usr/lib/systemd/system/poweroff.target" cmdline="/sbin/init 0" scontext=system_u:system_r:auditd_t:s0 tcontext=system_u:object_r:power_unit_t:s0 tclass=service exe="/usr/lib/systemd/systemd" sauid=0 hostname=? addr=? terminal=?'
Jan 12 04:44:54 localhost audispd: node=localhost type=AVC msg=audit(1578804294.103:1923): avc:  denied  { getattr } for  pid=6936 comm="systemctl" path="/run/systemd/system" dev="tmpfs" ino=45 scontext=system_u:system_r:auditd_t:s0 tcontext=system_u:object_r:systemd_unit_t:s0 tclass=dir permissive=1

v2 - use optional rather than ifdef
v3 - fix order

Quoted 1 line
---
  policy/modules/system/logging.te |  6 ++++++
  policy/modules/system/systemd.if | 20 ++++++++++++++++++++
  2 files changed, 26 insertions(+)
policy/modules/system/logging.te +6 -0
index 4c11d061..bce6b4d8 100644
@@ -231,6 +231,12 @@ optional_policy(`
  	seutil_sigchld_newrole(auditd_t)
  ')
 
+optional_policy(`
+	init_list_unit_dirs(auditd_t)
+	systemd_start_power_units(auditd_t)
+	systemd_status_power_units(auditd_t)
+')
+
  optional_policy(`
  	udev_read_db(auditd_t)
  ')
policy/modules/system/systemd.if +20 -0
index a49b0f77..8e46f443 100644
@@ -791,6 +791,26 @@ interface(`systemd_start_power_units',`
  	allow $1 power_unit_t:service start;
  ')
 
+########################################
+## <summary>
+##	Get the system status information about power units
+## </summary>
+## <param name="domain">
+##	<summary>
+##	Domain allowed access.
+##	</summary>
+## </param>
+#
+interface(`systemd_status_power_units',`
+	gen_require(`
+		type power_unit_t;
+		class service status;
+	')
+
+	allow $1 power_unit_t:service status;
+')
+
+
  ########################################
  ## <summary>
  ##	Make the specified type usable for
#2 lore raw
In reply to Sugar, David
Quoted 55 lines · David

auditd can halt the system for several reasons based on configuration. These mostly revovle around audit partition full issues. I am seeing the following denials when attempting to halt the system.

Jan 12 03:38:48 localhost audispd: node=localhost type=USER_AVC msg=audit(1578800328.122:1943): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='avc:  denied  { start } for auid=n/a uid=0 gid=0 path="/usr/lib/systemd/system/poweroff.target" cmdline="/sbin/init 0" scontext=system_u:system_r:auditd_t:s0 tcontext=system_u:object_r:power_unit_t:s0 tclass=service exe="/usr/lib/systemd/systemd" sauid=0 hostname=? addr=? terminal=?'
Jan 12 03:38:48 localhost audispd: node=localhost type=USER_AVC msg=audit(1578800328.147:1944): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='avc:  denied  { status } for auid=n/a uid=0 gid=0 path="/usr/lib/systemd/system/poweroff.target" cmdline="/sbin/init 0" scontext=system_u:system_r:auditd_t:s0 tcontext=system_u:object_r:power_unit_t:s0 tclass=service exe="/usr/lib/systemd/systemd" sauid=0 hostname=? addr=? terminal=?'
Jan 12 04:44:54 localhost audispd: node=localhost type=AVC msg=audit(1578804294.103:1923): avc:  denied  { getattr } for  pid=6936 comm="systemctl" path="/run/systemd/system" dev="tmpfs" ino=45 scontext=system_u:system_r:auditd_t:s0 tcontext=system_u:object_r:systemd_unit_t:s0 tclass=dir permissive=1

v2 - use optional rather than ifdef
v3 - fix order

---
  policy/modules/system/logging.te |  6 ++++++
  policy/modules/system/systemd.if | 20 ++++++++++++++++++++
  2 files changed, 26 insertions(+)
policy/modules/system/logging.te +6 -0
index 4c11d061..bce6b4d8 100644
@@ -231,6 +231,12 @@ optional_policy(`
  	seutil_sigchld_newrole(auditd_t)
  ')
 
+optional_policy(`
+	init_list_unit_dirs(auditd_t)
+	systemd_start_power_units(auditd_t)
+	systemd_status_power_units(auditd_t)
+')
+
  optional_policy(`
  	udev_read_db(auditd_t)
  ')
policy/modules/system/systemd.if +13 -0
index a49b0f77..8e46f443 100644
@@ -791,6 +791,26 @@ interface(`systemd_start_power_units',`
  	allow $1 power_unit_t:service start;
  ')
 
+########################################
+## <summary>
+##	Get the system status information about power units
+## </summary>
+## <param name="domain">
+##	<summary>
+##	Domain allowed access.
+##	</summary>
+## </param>
+#
+interface(`systemd_status_power_units',`
+	gen_require(`
+		type power_unit_t;

policy/modules/system/systemd.if interface(`systemd_start_power_units',` · line 816

Quoted 10 lines
policy/modules/system/systemd.if +7 -0
+		class service status;
+	')
+
+	allow $1 power_unit_t:service status;
+')
+
+
  ########################################
  ## <summary>
  ##	Make the specified type usable for

Sorry for the delay. Merged.

Signature · 1 line
Chris PeBenito