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