Blame SOURCES/bz1390974-redis-fix-selinux-permissions.patch

4c01c1
From 70b13e3c27944292cfe658284878de5cb3a4918c Mon Sep 17 00:00:00 2001
4c01c1
From: Gabriele Cerami <gcerami@redhat.com>
4c01c1
Date: Wed, 2 Nov 2016 00:44:37 +0100
4c01c1
Subject: [PATCH] Redis: restore rundir security context
4c01c1
4c01c1
When selinux rules packages are installed, rundir does not yet exist,
4c01c1
and security context for it cannot be applied. Calling restorecon after
4c01c1
dir creation ensures that the proper context is applied to the rundir.
4c01c1
If the context is not applied, selinux denies write permission, the unix
4c01c1
socket cannot be created, and redis does not start
4c01c1
---
4c01c1
 heartbeat/redis | 4 ++++
4c01c1
 1 file changed, 4 insertions(+)
4c01c1
4c01c1
diff --git a/heartbeat/redis b/heartbeat/redis
4c01c1
index f85b2f7..1fe8906 100755
4c01c1
--- a/heartbeat/redis
4c01c1
+++ b/heartbeat/redis
4c01c1
@@ -324,6 +324,10 @@ function start() {
4c01c1
 
4c01c1
 	[[ ! -d "$REDIS_RUNDIR" ]] && mkdir -p "$REDIS_RUNDIR"
4c01c1
 	chown -R "$REDIS_USER" "$REDIS_RUNDIR"
4c01c1
+	if have_binary "restorecon"; then
4c01c1
+		restorecon -Rv "$REDIS_RUNDIR"
4c01c1
+	fi
4c01c1
+
4c01c1
 
4c01c1
 	# check for 0 byte database dump file. This is an unrecoverable start
4c01c1
 	# condition that we can avoid by deleting the 0 byte database file.