Skip to content

Commit 26fb24c

Browse files
committed
Use redis-ce.fc file to install selinux file contexts
1 parent e40e59e commit 26fb24c

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

configs/redis-ce.fc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/etc/redis/sentinel -d system_u:object_r:redis_conf_t:s0
2+
/etc/redis/sentinel.conf -- system_u:object_r:redis_conf_t:s0

scripts/postinstall.sh

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,15 @@
44
if command -v checkmodule &> /dev/null && command -v semodule_package &> /dev/null; then
55
# Compile policy module
66
checkmodule -M -m /usr/share/selinux/packages/redis-ce.te -o /usr/share/selinux/packages/redis-ce.mod
7-
semodule_package -m /usr/share/selinux/packages/redis-ce.mod -o /usr/share/selinux/packages/redis-ce.pp
7+
semodule_package -m /usr/share/selinux/packages/redis-ce.mod -o /usr/share/selinux/packages/redis-ce.pp -f /usr/share/selinux/packages/redis-ce.fc
88

99
# Install or update the policy module
1010
semodule -i /usr/share/selinux/packages/redis-ce.pp
1111
fi
1212

1313
# Allow writing to /etc/redis/sentinel/ for redis-sentinel
14-
if command -v semanage &> /dev/null && command -v restorecon &> /dev/null; then
15-
semanage fcontext -a -t redis_conf_t '/etc/redis/sentinel'
16-
semanage fcontext -a -t redis_conf_t '/etc/redis/sentinel/sentinel.conf'
17-
restorecon '/etc/redis/sentinel' '/etc/redis/sentinel/sentinel.conf'
14+
if command -v chcon &> /dev/null; then
15+
chcon -t redis_conf_t '/etc/redis/sentinel' '/etc/redis/sentinel/sentinel.conf'
1816
fi
1917

2018
#

templates/nfpm.yaml.tpl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,12 @@ contents:
114114
mode: 0644
115115
owner: root
116116
group: root
117+
- src: ./configs/redis-ce.fc
118+
dst: /usr/share/selinux/packages/redis-ce.fc
119+
file_info:
120+
mode: 0644
121+
owner: root
122+
group: root
117123

118124
# Systemd service file for redis-server
119125
- src: ./configs/redis.service

0 commit comments

Comments
 (0)