Skip to content

Commit

Permalink
Integrate SELinux policy into build system
Browse files Browse the repository at this point in the history
Hook up the new policy to autoconf and automake.

Signed-off-by: Christian Heimes <[email protected]>
Reviewed-By: Christian Heimes <[email protected]>
  • Loading branch information
tiran committed Mar 5, 2020
1 parent 5b573bb commit 9288901
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 7 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,7 @@ ipatests/i18n.py
ipatests/ipa-run-tests
ipatests/ipa-test-config
ipatests/ipa-test-task

selinux/tmp
selinux/*.pp
selinux/*.pp.bz2
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ACLOCAL_AMFLAGS = -I m4

if ENABLE_SERVER
IPASERVER_SUBDIRS = ipaserver
SERVER_SUBDIRS = daemons init install
SERVER_SUBDIRS = daemons init install selinux
endif

if WITH_IPATESTS
Expand Down
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,7 @@ AC_CONFIG_FILES([
pypi/ipatests/Makefile
po/Makefile.in
po/Makefile.hack
selinux/Makefile
util/Makefile
])

Expand Down
7 changes: 1 addition & 6 deletions freeipa.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ Requires: sssd-dbus >= %{sssd_version}
# This ensures that the *-selinux package and all it’s dependencies are not pulled
# into containers and other systems that do not use SELinux
Requires: (%{name}-selinux if selinux-policy-%{selinuxtype})
%endif # if with_selinux
%endif

Provides: %{alt_name}-server = %{version}
Conflicts: %{alt_name}-server
Expand Down Expand Up @@ -870,11 +870,6 @@ mkdir -p %{buildroot}%{_sysconfdir}/cron.d
# ONLY_CLIENT
%endif

%if 0%{?with_selinux}
install -D -m 0644 selinux/%{modulename}.pp.bz2 %{buildroot}%{_datadir}/selinux/packages/%{selinuxtype}/%{modulename}.pp.bz2
# with_selinux
%endif

%clean
rm -rf %{buildroot}

Expand Down
35 changes: 35 additions & 0 deletions selinux/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
SELINUXTYPE = targeted
NULL =

if BUILD_SELINUX_POLICY
MODULE = ipa.pp.bz2
MODULE_IF = ipa.if
else
MODULE =
MODULE_IF =
endif

dist_noinst_DATA = \
ipa.fc \
ipa.if \
ipa.te \
$(NULL)

# selinuxincludedir = $(datarootdir)/selinux/devel/include/contrib
# nodist_selinuxinclude_DATA = \
# $(MODULE_IF) \
# $(NULL)

selinuxpolicydir = $(datarootdir)/selinux/packages/$(SELINUXTYPE)
nodist_selinuxpolicy_DATA = \
$(MODULE) \
$(NULL)

%.pp.bz2: %.pp
bzip2 -f -9 $^

%.pp: %.te %.fc %.if
make -f $(selinux_makefile) $@

clean-local:
rm -f *~ *.tc *.pp *.pp.bz2
12 changes: 12 additions & 0 deletions server.m4
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,15 @@ AC_ARG_WITH([systemdtmpfilesdir],
[systemdtmpfilesdir=$($PKG_CONFIG --define-variable=prefix='${prefix}' --variable=tmpfilesdir systemd)])
AC_SUBST([systemdtmpfilesdir])

dnl ---------------------------------------------------------------------------
dnl - Check for SELinux policy devel
dnl ---------------------------------------------------------------------------

selinux_makefile=/usr/share/selinux/devel/Makefile
AC_SUBST([selinux_makefile])

AC_CHECK_FILE([$selinux_makefile],
[build_selinux=yes],
[build_selinux=no])

AM_CONDITIONAL(BUILD_SELINUX_POLICY, test x$build_selinux = xyes)

0 comments on commit 9288901

Please sign in to comment.