File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ Documentation=http://redis.io/documentation
55
66[Service]
77Type =notify
8+ # Try to restore context for sentinel.conf* as sentinel needs to write into these files
9+ ExecStartPre =-/bin/sh -c "[ -x /sbin/restorecon ] && /sbin/restorecon '/etc/redis/sentinel.conf*'"
810ExecStart =/usr/bin/redis-sentinel /etc/redis/sentinel.conf
911TimeoutStopSec =0
1012Restart =always
@@ -22,6 +24,8 @@ ReadOnlyDirectories=/
2224ReadWriteDirectories =-/var/lib/redis
2325ReadWriteDirectories =-/var/log/redis
2426ReadWriteDirectories =-/run/sentinel
27+ # To run restorecon in ExecStartPre
28+ PermissionsStartOnly =yes
2529
2630NoNewPrivileges =true
2731CapabilityBoundingSet =CAP_SYS_RESOURCE
Original file line number Diff line number Diff line change @@ -10,6 +10,11 @@ if command -v checkmodule &> /dev/null && command -v semodule_package &> /dev/nu
1010 semodule -i /usr/share/selinux/packages/redis-ce.pp
1111fi
1212
13+ # Allow writing to /etc/redis/sentinel.conf* for redis-sentinel
14+ if command -v semanage & > /dev/null; then
15+ semanage fcontext -a -t redis_conf_t ' /etc/redis/sentinel.conf*'
16+ fi
17+
1318#
1419# Handle service setup
1520# $1 will be 1 for initial install and 2 for upgrade
You can’t perform that action at this time.
0 commit comments