Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions misc/selinux/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ selinuxdir = $(prefix)/selinux
selinux_DATA = cfengine-enterprise.pp
selinux_DATA += cfengine-enterprise.te
selinux_DATA += cfengine-enterprise.fc
selinux_DATA += label-binaries-unconfined.sh

clean-local:
rm -rf tmp
Expand All @@ -18,5 +19,6 @@ endif
# tarball even without running './configure --with-selinux-policy'
DISTFILES = Makefile.in Makefile.am cfengine-enterprise.fc cfengine-enterprise.te.all
DISTFILES += cfengine-enterprise.te.el9
DISTFILES += label-binaries-unconfined.sh

CLEANFILES = cfengine-enterprise.pp cfengine-enterprise.if cfengine-enterprise.te
10 changes: 10 additions & 0 deletions misc/selinux/label-binaries-unconfined.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -ex # for visibility
# This script is intended to be used by the package scriptlets in case the selinux module fails to install
_prefix=${1:-/var/cfengine}
# find all executables in prefix(/var/cfengine default) which do not include a period(.) as that happens to work for us, catching cf-* in bin and things like apachectl.
find "$_prefix" -type f -executable -not -name '*.*' | while IFS='' read -r binary
do
semanage fcontext -a -t bin_t "$binary"
done
restorecon -iR "$_prefix"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also provide a script to revert this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmm... right. I was thinking there might need to be a few layers of undo/fixup. I will address these as soon as I have an initial "good test" manually with the current bits in the 3.24 PRs.

Loading