Rules.monolithic: add target to generate CIL policy

Add a Makefile target to generate a CIL policy, useful for debugging,
introspection or testing.

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
This commit is contained in:
Christian Göttsche 2022-03-22 18:10:11 +01:00
parent 37257e241d
commit a00910742b
1 changed files with 15 additions and 0 deletions

View File

@ -25,6 +25,7 @@ endif
polbinpath := $(shell $(binary_policy_path))
policy_conf = $(builddir)policy.conf
policy_cil = $(builddir)policy.cil
fc = $(builddir)file_contexts
polver = $(builddir)policy.$(pv)
homedir_template = $(builddir)homedir_template
@ -83,6 +84,19 @@ ifneq ($(pv),$(kv))
endif
$(verbose) $(CHECKPOLICY) -U $(UNK_PERMS) -S -O -E $^ -o $@
########################################
#
# Build a CIL policy locally
#
$(policy_cil): $(policy_conf)
@echo "Compiling $(NAME) $(policy_cil)"
ifneq ($(pv),$(kv))
@echo
@echo "WARNING: Policy version mismatch (policy:$(pv) kernel:$(kv))! Is your OUTPUT_POLICY set correctly?"
@echo
endif
$(verbose) $(CHECKPOLICY) -C -U $(UNK_PERMS) -S -O -E $^ -o $@
########################################
#
# Install a binary policy
@ -261,6 +275,7 @@ $(installdir)/seusers: $(seusers)
clean:
$(verbose) rm -f $(policy_conf)
$(verbose) rm -f $(polver)
$(verbose) rm -f $(policy_cil)
$(verbose) rm -f $(fc)
$(verbose) rm -f $(homedir_template)
$(verbose) rm -f $(net_contexts) $(net_contexts_nft)