Skip to content

Commit 8aa31df

Browse files
committed
Added fallback selinux script to label binaries as unconfined in case the cfengine-enterprise module fails to install
In case the normal cfengine-enterprise policy module fails to install the scripts will run this new scripts to ensure that CFEngine can function even if SELinux is enforcing by labeling them as bin_t aka unconfined. Ticket: ENT-12980 Changelog: title
1 parent b805b28 commit 8aa31df

File tree

5 files changed

+24
-4
lines changed

5 files changed

+24
-4
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,4 +190,7 @@ __pycache__
190190
misc/selinux/cfengine-enterprise.pp
191191
misc/selinux/cfengine-enterprise.if
192192
misc/selinux/cfengine-enterprise.te
193+
misc/selinux/cfengine-enterprise-unconfined.pp
194+
misc/selinux/cfengine-enterprise-unconfined.if
195+
misc/selinux/cfengine-enterprise-unconfined.te
193196
misc/selinux/tmp

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1666,7 +1666,7 @@ AC_ARG_WITH(selinux-policy,
16661666
AS_HELP_STRING([--with-selinux-policy],
16671667
[Whether to build and install SELinux policy (default: no)]),
16681668
[], [with_selinux_policy=no])
1669-
AM_CONDITIONAL([WITH_SELINUX], [test "x$with_selinux_policy" != "xno"])
1669+
AM_CONDITIONAL([WITH_SELINUX_POLICY], [test "x$with_selinux_policy" != "xno"])
16701670

16711671
if test "x$with_selinux_policy" != "xno"; then
16721672
platform_id=$(sed -r -e '/PLATFORM_ID/!d;s/PLATFORM_ID="platform:(@<:@^"@:>@+)"/\1/' < /etc/os-release)

misc/selinux/Makefile.am

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1-
if WITH_SELINUX
1+
if WITH_SELINUX_POLICY
22
cfengine-enterprise.te: cfengine-enterprise.te.all $(PLATFORM_SELINUX_POLICIES)
33
cat cfengine-enterprise.te.all $(PLATFORM_SELINUX_POLICIES) > cfengine-enterprise.te
44

5-
cfengine-enterprise.pp: cfengine-enterprise.te cfengine-enterprise.fc
5+
cfengine-enterprise.pp cfengine-enterprise-unconfined.pp: cfengine-enterprise.te cfengine-enterprise.fc cfengine-enterprise-unconfined.te cfengine-enterprise-unconfined.fc
66
$(MAKE) -f /usr/share/selinux/devel/Makefile -j1
77

88
selinuxdir = $(prefix)/selinux
99
selinux_DATA = cfengine-enterprise.pp
1010
selinux_DATA += cfengine-enterprise.te
1111
selinux_DATA += cfengine-enterprise.fc
12+
selinux_DATA += cfengine-enterprise-unconfined.pp
13+
selinux_DATA += cfengine-enterprise-unconfined.te
14+
selinux_DATA += cfengine-enterprise-unconfined.fc
1215

1316
clean-local:
1417
rm -rf tmp
@@ -18,5 +21,7 @@ endif
1821
# tarball even without running './configure --with-selinux-policy'
1922
DISTFILES = Makefile.in Makefile.am cfengine-enterprise.fc cfengine-enterprise.te.all
2023
DISTFILES += cfengine-enterprise.te.el9
24+
DISTFILES += cfengine-enterprise-unconfined.te
25+
DISTFILES += cfengine-enterprise-unconfined.fc
2126

22-
CLEANFILES = cfengine-enterprise.pp cfengine-enterprise.if cfengine-enterprise.te
27+
CLEANFILES = cfengine-enterprise.pp cfengine-enterprise.if cfengine-enterprise.te cfengine-enterprise-unconfined.pp cfengine-enterprise-unconfined.if
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/var/cfengine/bin/.* -- gen_context(system_u:object_r:cfengine_exec_t,s0)
2+
/var/cfengine/notification_scripts(/.*)? -- gen_context(system_u:object_r:cfengine_exec_t,s0)
3+
/var/cfengine/httpd/bin/.* -- gen_context(system_u:object_r:cfengine_exec_t,s0)
4+
/var/cfengine/httpd/php/bin/.* -- gen_context(system_u:object_r:cfengine_exec_t,s0)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module cfengine-enterprise-unconfined 1.0;
2+
require {
3+
all_kernel_class_perms # required for unconfined_domain()
4+
}
5+
type cfengine_t;
6+
type cfengine_exec_t;
7+
unconfined_domain(cfengine_t)
8+
domain_entry_file(cfengine_t, cfengine_exec_t)

0 commit comments

Comments
 (0)