All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2] package/refpolicy: Add option to disable "dontaudit" rules
@ 2021-01-28 12:52 Maxime Chevallier
  2021-01-28 14:24 ` Antoine Tenart
  2022-01-19 22:23 ` [Buildroot] [PATCH v3] " Giulio Benetti
  0 siblings, 2 replies; 14+ messages in thread
From: Maxime Chevallier @ 2021-01-28 12:52 UTC (permalink / raw)
  To: buildroot

Some rules in the refpolicy are declared with "dontaudit", effectively
suppressing any AVC violation log, while still denying the actions.

This is useful in some cases, where denied actions are to be expected
but won't prevent the system from operating.

However in some other cases, the suppressed logs are important to
troubleshoot some issues.

Disabling the "dontaudit" rules can be done either from the running
system by rebuilding the policy with "semodules -DB", or when initialy
building the policy by using the "enableaudit" make target.

This commit allows building the refpolicy with the "enableaudit" target
prior to installing it, thanks to a dedicated config option.

Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
---
v1 -> v2: Use POST_BUILD_HOOKS to summon make enableaudit, as per
Antoine Tenart adnd Thomas petazzoni's reviews

 package/refpolicy/Config.in    | 14 ++++++++++++++
 package/refpolicy/refpolicy.mk |  8 ++++++++
 2 files changed, 22 insertions(+)

diff --git a/package/refpolicy/Config.in b/package/refpolicy/Config.in
index c529b85e1d..d6e195e8f8 100644
--- a/package/refpolicy/Config.in
+++ b/package/refpolicy/Config.in
@@ -111,6 +111,20 @@ config BR2_REFPOLICY_EXTRA_MODULES
 
 endif
 
+config BR2_REFPOLICY_DISABLE_DONTAUDIT
+	bool "Disable dontaudit"
+	help
+	  Builds the refpolicy with the "dontaudit" rules disabled.
+	  This will trigger unseen, and probably unharmful audit logs that are
+	  explicitely silenced otherwise. This option can be helpful for
+	  debugging purposes, should a silenced message cause a real issue
+	  that would otherwise be hard to troubleshoot.
+
+	  This option should be used for debugging purposes only, due to
+	  the amount of avc logs it generates.
+
+	  If unsure, select n.
+
 endif
 
 comment "refpolicy needs a toolchain w/ threads"
diff --git a/package/refpolicy/refpolicy.mk b/package/refpolicy/refpolicy.mk
index 0194708b37..4dfa9e914a 100644
--- a/package/refpolicy/refpolicy.mk
+++ b/package/refpolicy/refpolicy.mk
@@ -116,6 +116,14 @@ define REFPOLICY_BUILD_CMDS
 	$(REFPOLICY_MAKE) -C $(@D) policy
 endef
 
+ifeq ($(BR2_REFPOLICY_DISABLE_DONTAUDIT),y)
+define REFPOLICY_DISABLE_DONTAUDIT_CMDS
+	$(REFPOLICY_MAKE) -C $(@D) enableaudit
+endef
+endif
+
+REFPOLICY_POST_BUILD_HOOKS += REFPOLICY_DISABLE_DONTAUDIT_CMDS
+
 define REFPOLICY_INSTALL_STAGING_CMDS
 	$(REFPOLICY_MAKE) -C $(@D) DESTDIR=$(STAGING_DIR) \
 		install-src install-headers
-- 
2.25.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2022-01-24  9:32 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-28 12:52 [Buildroot] [PATCH v2] package/refpolicy: Add option to disable "dontaudit" rules Maxime Chevallier
2021-01-28 14:24 ` Antoine Tenart
2022-01-19 22:23 ` [Buildroot] [PATCH v3] " Giulio Benetti
2022-01-19 22:39   ` Thomas Petazzoni
2022-01-19 23:56     ` Giulio Benetti
2022-01-20  7:48     ` Maxime Chevallier
2022-01-20  9:29       ` Antoine Tenart
2022-01-23 22:21         ` Giulio Benetti
2022-01-24  8:44           ` Antoine Tenart
2022-01-24  8:59             ` Giulio Benetti
2022-01-24  9:06               ` Antoine Tenart
2022-01-24  9:20                 ` Giulio Benetti
2022-01-24  9:29                   ` Antoine Tenart
2022-01-24  9:32                     ` Giulio Benetti

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.