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