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