Skip to content

Commit e6a7e95

Browse files
committed
CI: Add a semodule load test to verify modules insert to store.
There have been some discrepancies between semodule_link/_expand and semodule -i, see SELinuxProject#829. Add an extra CI test of installing the modules using semodule -i. Signed-off-by: Chris PeBenito <pebenito@ieee.org>
1 parent 7718b32 commit e6a7e95

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

.github/workflows/build-policy.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ jobs:
9090
echo "DIRECT_INITRC=${{ matrix.direct_initrc }}" >> $GITHUB_ENV
9191
echo "WERROR=y" >> $GITHUB_ENV
9292
echo "TEST_TOOLCHAIN=\"${{ steps.dl-userspace.outputs.download-path }}\"" >> $GITHUB_ENV
93+
sed -i -e '/^module-store/a compiler-directory = ${{ steps.dl-userspace.outputs.download-path }}/usr/libexec/selinux/hll' ${{ steps.dl-userspace.outputs.download-path }}/etc/selinux/semanage.conf
94+
echo -e '[sefcontext_compile]\npath = ${{ steps.dl-userspace.outputs.download-path }}/usr/sbin/sefcontext_compile\nargs = $@\n[end]' >> ${{ steps.dl-userspace.outputs.download-path }}/etc/selinux/semanage.conf
95+
sudo cp ${{ steps.dl-userspace.outputs.download-path }}/etc/selinux/semanage.conf /etc/selinux/semanage.conf
96+
cat /etc/selinux/semanage.conf
9397
9498
- name: Build refpolicy
9599
shell: bash
@@ -125,6 +129,10 @@ jobs:
125129
make install-docs
126130
make install-udica-templates
127131
make install-appconfig
132+
if [[ $MONOLITHIC == "n" ]]; then
133+
# test modules insertion
134+
make load
135+
fi
128136
env:
129137
DESTDIR: /tmp/refpolicy-install
130138

Rules.modular

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
# Rules and Targets for building modular policies
44
#
55

6+
module_store_root := $(DESTDIR)/var/lib/selinux
7+
8+
ifneq ($(DESTDIR),)
9+
SEMODULE += -p $(DESTDIR) -n
10+
endif
11+
612
all_modules := $(base_mods) $(mod_mods) $(off_mods)
713
all_interfaces := $(all_modules:.te=.if)
814
enabled_mod_fc := $(addprefix $(tmpdir)/,$(notdir $(base_mods:.te=.mod.fc) $(mod_mods:.te=.mod.fc)))
@@ -57,7 +63,7 @@ load: $(instpkg) $(appfiles)
5763
# make sure two directories exist since they are not
5864
# created by semanage
5965
@echo "Loading configured modules."
60-
@$(INSTALL) -d -m 0755 $(policypath) $(dir $(fcpath))
66+
@$(INSTALL) -d -m 0755 $(policypath) $(dir $(fcpath)) $(module_store_root)
6167
$(verbose) $(SEMODULE) -s $(NAME) -i $(modpkgdir)/$(notdir $(base_pkg)) $(foreach mod,$(mod_pkgs),-i $(modpkgdir)/$(mod))
6268

6369
########################################
@@ -68,7 +74,7 @@ pure-load: $(instpkg) $(appfiles)
6874
# make sure two directories exist since they are not
6975
# created by semanage
7076
@echo "Loading configured modules."
71-
@$(INSTALL) -d -m 0755 $(policypath) $(dir $(fcpath))
77+
@$(INSTALL) -d -m 0755 $(policypath) $(dir $(fcpath)) $(module_store_root)
7278
$(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))
7379

7480
########################################

0 commit comments

Comments
 (0)