From 448be4bd314440ac9d2b6adde037e58e4d9cb3d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Tue, 22 Mar 2022 18:21:23 +0100 Subject: [PATCH] Rules.modular: add pure-load target MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a target for modular polices to load all built modules while simultaneously removing all non Reference Policy ones. This will remove dropped Reference Policy modules and user installed ones. Signed-off-by: Christian Göttsche --- Rules.modular | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Rules.modular b/Rules.modular index 63a10e7ff..f7ee2c11f 100644 --- a/Rules.modular +++ b/Rules.modular @@ -58,6 +58,17 @@ load: $(instpkg) $(appfiles) @$(INSTALL) -d -m 0755 $(policypath) $(dir $(fcpath)) $(verbose) $(SEMODULE) -s $(NAME) -i $(modpkgdir)/$(notdir $(base_pkg)) $(foreach mod,$(mod_pkgs),-i $(modpkgdir)/$(mod)) +######################################## +# +# Load all configured modules and remove foreign ones +# +pure-load: $(instpkg) $(appfiles) +# make sure two directories exist since they are not +# created by semanage + @echo "Loading configured modules." + @$(INSTALL) -d -m 0755 $(policypath) $(dir $(fcpath)) + $(verbose) $(SEMODULE) -s $(NAME) -i $(modpkgdir)/$(notdir $(base_pkg)) $(foreach mod,$(mod_pkgs),-i $(modpkgdir)/$(mod)) $(foreach omod,$(filter-out base $(notdir $(mod_mods:.te=)),$(shell $(SEMODULE) -l)),-r $(omod)) + ######################################## # # Install policy packages @@ -226,4 +237,4 @@ clean: $(verbose) rm -f $(net_contexts) $(net_contexts_nft) $(verbose) rm -fR $(tmpdir) -.PHONY: default all policy base modules install load clean validate +.PHONY: default all policy base modules install load pure-load clean validate