Skip to contentSkip to conversation

libselinux: Add additional log callback details in man page for auditing.

PATCH In review Chris PeBenito 3 participants 6 messages Sep 15, 2020 – Sep 17, 2020 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 libselinux: Add additional log callback details in man page for auditing.

Add additional information about the log callback message types. Indicate which types could be audited and the relevant audit record types for them.

---
 libselinux/man/man3/selinux_set_callback.3 | 9 +++++++++
 1 file changed, 9 insertions(+)
libselinux/man/man3/selinux_set_callback.3 +9 -0
index 6dfe5ff6..75f49b06 100644
@@ -51,6 +51,15 @@ argument indicates the type of message and will be set to one of the following:
 
 .B SELINUX_SETENFORCE
 
+SELINUX_ERROR, SELINUX_WARNING, and SELINUX_INFO indicate standard log severity
+levels and are not auditable messages.
+
+The SELINUX_AVC, SELINUX_POLICYLOAD, and SELINUX_SETENFORCE message types can be
+audited with AUDIT_USER_AVC, AUDIT_USER_MAC_POLICY_LOAD, and AUDIT_USER_MAC_STATUS
+values from libaudit, respectively.  If they are not audited, SELINUX_AVC should be
+considered equivalent to SELINUX_ERROR; similarly, SELINUX_POLICYLOAD and
+SELINUX_SETENFORCE should be considered equivalent to SELINUX_INFO.
+
 .
 .TP
 .B SELINUX_CB_AUDIT
Signature · 1 line
2.26.2
#1 lore raw

PATCH 2/2 libselinux: Change userspace AVC setenforce and policy load messages to audit format.

---
 libselinux/src/avc_internal.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
libselinux/src/avc_internal.c +2 -2
index 572b2159..53a99a1f 100644
@@ -59,7 +59,7 @@ int avc_process_setenforce(int enforcing)
 	int rc = 0;
 
 	avc_log(SELINUX_SETENFORCE,
-		"%s:  received setenforce notice (enforcing=%d)\n",
+		"%s:  op=setenforce lsm=selinux enforcing=%d res=1",
 		avc_prefix, enforcing);
 	if (avc_setenforce)
 		goto out;
@@ -81,7 +81,7 @@ int avc_process_policyload(uint32_t seqno)
 	int rc = 0;
 
 	avc_log(SELINUX_POLICYLOAD,
-		"%s:  received policyload notice (seqno=%u)\n",
+		"%s:  op=load_policy lsm=selinux seqno=%u res=1",
 		avc_prefix, seqno);
 	rc = avc_ss_reset(seqno);
 	if (rc < 0) {
Signature · 1 line
2.26.2
#2 lore raw

Re: [PATCH 2/2] libselinux: Change userspace AVC setenforce and policy load messages to audit format.

Quoted 19 lines · EDT Chris PeBenito
---
 libselinux/src/avc_internal.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
libselinux/src/avc_internal.c +1 -1
index 572b2159..53a99a1f 100644
@@ -59,7 +59,7 @@ int avc_process_setenforce(int enforcing)
 	int rc = 0;
 
 	avc_log(SELINUX_SETENFORCE,
-		"%s:  received setenforce notice (enforcing=%d)\n",
+		"%s:  op=setenforce lsm=selinux enforcing=%d res=1",
 		avc_prefix, enforcing);
 	if (avc_setenforce)
 		goto out;

libselinux/src/avc_internal.c int avc_process_policyload(uint32_t seqno) · line 87

Quoted 8 lines
libselinux/src/avc_internal.c +1 -1
@@ -81,7 +81,7 @@ int avc_process_policyload(uint32_t seqno)
 	int rc = 0;
 
 	avc_log(SELINUX_POLICYLOAD,
-		"%s:  received policyload notice (seqno=%u)\n",
+		"%s:  op=load_policy lsm=selinux seqno=%u res=1",
 		avc_prefix, seqno);
 	rc = avc_ss_reset(seqno);
 	if (rc < 0) {

These look good from an audit perspective.

Thanks,
-Steve