1 |
commit: 3f7c372e6212f0ab402c6bbd833dd80d1fb50e22 |
2 |
Author: Christian Göttsche <cgzones <AT> googlemail <DOT> com> |
3 |
AuthorDate: Tue Mar 22 17:10:11 2022 +0000 |
4 |
Commit: Jason Zaman <perfinion <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Mar 31 02:40:53 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/hardened-refpolicy.git/commit/?id=3f7c372e |
7 |
|
8 |
Rules.monolithic: add target to generate CIL policy |
9 |
|
10 |
Add a Makefile target to generate a CIL policy, useful for debugging, |
11 |
introspection or testing. |
12 |
|
13 |
Signed-off-by: Christian Göttsche <cgzones <AT> googlemail.com> |
14 |
Signed-off-by: Jason Zaman <perfinion <AT> gentoo.org> |
15 |
|
16 |
Rules.monolithic | 15 +++++++++++++++ |
17 |
1 file changed, 15 insertions(+) |
18 |
|
19 |
diff --git a/Rules.monolithic b/Rules.monolithic |
20 |
index e369f8f3..d6d0e6f2 100644 |
21 |
--- a/Rules.monolithic |
22 |
+++ b/Rules.monolithic |
23 |
@@ -25,6 +25,7 @@ endif |
24 |
polbinpath := $(shell $(binary_policy_path)) |
25 |
|
26 |
policy_conf = $(builddir)policy.conf |
27 |
+policy_cil = $(builddir)policy.cil |
28 |
fc = $(builddir)file_contexts |
29 |
polver = $(builddir)policy.$(pv) |
30 |
homedir_template = $(builddir)homedir_template |
31 |
@@ -83,6 +84,19 @@ ifneq ($(pv),$(kv)) |
32 |
endif |
33 |
$(verbose) $(CHECKPOLICY) -U $(UNK_PERMS) -S -O -E $^ -o $@ |
34 |
|
35 |
+######################################## |
36 |
+# |
37 |
+# Build a CIL policy locally |
38 |
+# |
39 |
+$(policy_cil): $(policy_conf) |
40 |
+ @echo "Compiling $(NAME) $(policy_cil)" |
41 |
+ifneq ($(pv),$(kv)) |
42 |
+ @echo |
43 |
+ @echo "WARNING: Policy version mismatch (policy:$(pv) kernel:$(kv))! Is your OUTPUT_POLICY set correctly?" |
44 |
+ @echo |
45 |
+endif |
46 |
+ $(verbose) $(CHECKPOLICY) -C -U $(UNK_PERMS) -S -O -E $^ -o $@ |
47 |
+ |
48 |
######################################## |
49 |
# |
50 |
# Install a binary policy |
51 |
@@ -261,6 +275,7 @@ $(installdir)/seusers: $(seusers) |
52 |
clean: |
53 |
$(verbose) rm -f $(policy_conf) |
54 |
$(verbose) rm -f $(polver) |
55 |
+ $(verbose) rm -f $(policy_cil) |
56 |
$(verbose) rm -f $(fc) |
57 |
$(verbose) rm -f $(homedir_template) |
58 |
$(verbose) rm -f $(net_contexts) $(net_contexts_nft) |