Skip to content

Commit

Permalink
Add SELinux subpackage for Thales Luna HSM support
Browse files Browse the repository at this point in the history
This is simple, a port needs to be available to certmonger
to communicate during renewals of CA subsystem certificats.

Signed-off-by: Rob Crittenden <rcritten@redhat.com>
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
  • Loading branch information
rcritten committed May 16, 2024
1 parent 87ecca0 commit f8798b3
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 0 deletions.
1 change: 1 addition & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ SUBDIRS = \
pypi \
selinux \
selinux/nfast \
selinux/luna \
$(PYTHON_SUBDIRS) \
$(SERVER_SUBDIRS) \
$(NULL)
Expand Down
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,7 @@ AC_CONFIG_FILES([
po/Makefile.hack
selinux/Makefile
selinux/nfast/Makefile
selinux/luna/Makefile
util/Makefile
])

Expand Down
21 changes: 21 additions & 0 deletions freeipa.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -1006,6 +1006,16 @@ Requires(post): selinux-policy-%{selinuxtype}

%description selinux-nfast
Custom SELinux policy module for nCipher nfast HSMs

%package selinux-luna
Summary: FreeIPA SELinux policy for Thales Luna HSMs
BuildArch: noarch
Requires: selinux-policy-%{selinuxtype}
Requires(post): selinux-policy-%{selinuxtype}
%{?selinux_requires}

%description selinux-luna
Custom SELinux policy module for Thales Luna HSMs
# with selinux
%endif

Expand Down Expand Up @@ -1325,6 +1335,9 @@ semodule -d ipa_custodia &> /dev/null || true;
%post selinux-nfast
%selinux_modules_install -s %{selinuxtype} %{_datadir}/selinux/packages/%{selinuxtype}/%{modulename}-nfast.pp.bz2

%post selinux-luna
%selinux_modules_install -s %{selinuxtype} %{_datadir}/selinux/packages/%{selinuxtype}/%{modulename}-luna.pp.bz2

%postun selinux
if [ $1 -eq 0 ]; then
%selinux_modules_uninstall -s %{selinuxtype} %{modulename}
Expand All @@ -1336,6 +1349,10 @@ if [ $1 -eq 0 ]; then
%selinux_modules_uninstall -s %{selinuxtype} %{modulename}-nfast
fi

%postun selinux-luna
if [ $1 -eq 0 ]; then
%selinux_modules_uninstall -s %{selinuxtype} %{modulename}-luna

%posttrans selinux
%selinux_relabel_post -s %{selinuxtype}
# with_selinux
Expand Down Expand Up @@ -1796,6 +1813,10 @@ fi
%files selinux-nfast
%{_datadir}/selinux/packages/%{selinuxtype}/%{modulename}-nfast.pp.*
%ghost %verify(not md5 size mode mtime) %{_sharedstatedir}/selinux/%{selinuxtype}/active/modules/200/%{modulename}-nfast

%files selinux-luna
%{_datadir}/selinux/packages/%{selinuxtype}/%{modulename}-luna.pp.*
%ghost %verify(not md5 size mode mtime) %{_sharedstatedir}/selinux/%{selinuxtype}/active/modules/200/%{modulename}-luna
# with selinux
%endif

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

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

dist_noinst_DATA = \
ipa-luna.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
make -f $(selinux_makefile) $@

clean-local:
rm -f *~ *.tc *.pp *.pp.bz2
9 changes: 9 additions & 0 deletions selinux/luna/ipa-luna.te
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
policy_module(ipa-luna, 1.0.0)

require {
type certmonger_t;
type ibm_dt_2_port_t;
class tcp_socket name_connect;
}

allow certmonger_t ibm_dt_2_port_t:tcp_socket name_connect;

0 comments on commit f8798b3

Please sign in to comment.