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