In my sentinel master-slave mode; redis slave fails to write the dumps in /var/lib/redis/ with error:
Failed opening the RDB file dump.rdb (in server root dir /var/lib/redis) for saving: Permission denied
while the permissions is indeed correct:
# ls -la /var/lib/redis/
total 68
drwxr-xr-x. 2 redis redis 22 Apr 20 11:39 .
drwxr-xr-x. 28 root root 4096 Apr 17 12:15 ..
-rw-r--r--. 1 redis redis 62460 Apr 20 11:37 dump.rdb
I looked at the selinux audit and could find some rejections and only in permissive mode I can see that redis process can write into the dir. like:
type=AVC msg=audit(1555741351.680:2719): avc: denied { getattr } for pid=8638 comm="redis-server" path="/var/lib/redis/dump.rdb" dev="vdb1" ino=68 scontext=system_u:system_r:redis_t:s0 tcontext=system_u:object_r:unlabeled_t:s0 tclass=file permissive=1
I tried various selinux permission grants like this one and can confirm that the semanage applied the rule:
# cat /var/log/audit/audit.log |grep redis |audit2allow redis-server
#semodule -i redis-server.pp
I did search here and there and could not get it done while enforcing selinux in a CentOS Linux release 7.6.1810 build with redis-3.2.12-2.el7.x86_64