cead9d
From 36180d21dc4b16619b75d65d51eaf37df4e0e2d3 Mon Sep 17 00:00:00 2001
cead9d
From: Sunny Kumar <sunkumar@redhat.com>
cead9d
Date: Mon, 20 Apr 2020 12:15:42 +0100
cead9d
Subject: [PATCH 365/367] build: geo-rep requires relevant selinux permission
cead9d
 for rsync
cead9d
cead9d
If selinux is set in enforcing mode geo-rep goes into faulty state.
cead9d
cead9d
To avoid this from happening some relevant selinux booleans need to be set
cead9d
in 'on' state to allow rsync operation.
cead9d
cead9d
Backport of:
cead9d
   >Upstream Patch: https://review.gluster.org/#/c/glusterfs/+/24348.
cead9d
   >Change-Id: Ia8ce530d6548c2a545f4c99c600f5aac2bbb3363
cead9d
   >Fixes: #1182
cead9d
   >Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
cead9d
cead9d
BUG: 1813917
cead9d
Change-Id: Ia8ce530d6548c2a545f4c99c600f5aac2bbb3363
cead9d
Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
cead9d
Reviewed-on: https://code.engineering.redhat.com/gerrit/198599
cead9d
Tested-by: RHGS Build Bot <nigelb@redhat.com>
cead9d
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
cead9d
---
cead9d
 glusterfs.spec.in | 15 +++++++++++++++
cead9d
 1 file changed, 15 insertions(+)
cead9d
cead9d
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
cead9d
index 7c8a751..5ed07e7 100644
cead9d
--- a/glusterfs.spec.in
cead9d
+++ b/glusterfs.spec.in
cead9d
@@ -130,6 +130,12 @@
cead9d
 ## All %%global definitions should be placed here and keep them sorted
cead9d
 ##
cead9d
 
cead9d
+# selinux booleans whose defalut value needs modification
cead9d
+# these booleans will be consumed by "%%selinux_set_booleans" macro.
cead9d
+%if ( 0%{?rhel} && 0%{?rhel} >= 8 )
cead9d
+%global selinuxbooleans rsync_full_access=1 rsync_client=1
cead9d
+%endif
cead9d
+
cead9d
 %if ( 0%{?fedora} ) || ( 0%{?rhel} && 0%{?rhel} > 6 )
cead9d
 %global _with_systemd true
cead9d
 %endif
cead9d
@@ -515,6 +521,12 @@ Requires:         python%{_pythonver}-gluster = %{version}-%{release}
cead9d
 Requires:         rsync
cead9d
 Requires:         util-linux
cead9d
 Requires:         %{name}-libs%{?_isa} = %{version}-%{release}
cead9d
+# required for setting selinux bools
cead9d
+%if ( 0%{?rhel} && 0%{?rhel} >= 8 )
cead9d
+Requires:            selinux-policy-targeted
cead9d
+Requires(post):      selinux-policy-targeted
cead9d
+BuildRequires:       selinux-policy-devel
cead9d
+%endif
cead9d
 
cead9d
 %description geo-replication
cead9d
 GlusterFS is a distributed file-system capable of scaling to several
cead9d
@@ -941,6 +953,9 @@ exit 0
cead9d
 
cead9d
 %if ( 0%{!?_without_georeplication:1} )
cead9d
 %post geo-replication
cead9d
+%if ( 0%{?rhel} && 0%{?rhel} >= 8 )
cead9d
+%selinux_set_booleans %{selinuxbooleans}
cead9d
+%endif
cead9d
 if [ $1 -ge 1 ]; then
cead9d
     %systemd_postun_with_restart glusterd
cead9d
 fi
cead9d
-- 
cead9d
1.8.3.1
cead9d