Skip to content

Commit cf44ad7

Browse files
asm0deuzguits
authored andcommitted
Turn off SELinux separation for containers MON and RGW
Initially MONs and RGW binded /etc/pki/ca-trust/extracted using the :z flag (introduced to solve an OSP TripleO issue on RHEL - #3638) but using this flag prevents local services (like sssd) running on the host from accessing the certificates/files in that folder. Signed-off-by: Teoman ONAY <tonay@redhat.com> (cherry picked from commit 7e8ce25)
1 parent ae53ca1 commit cf44ad7

File tree

3 files changed

+25
-15
lines changed

3 files changed

+25
-15
lines changed

roles/ceph-container-common/tasks/prerequisites.yml

+8
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,11 @@
3434
mode: 0644
3535
state: present
3636
create: yes
37+
38+
- name: restore certificates selinux context
39+
when:
40+
- ansible_facts['os_family'] == 'RedHat'
41+
- inventory_hostname in groups.get(mon_group_name, [])
42+
or inventory_hostname in groups.get(rgw_group_name, [])
43+
command: /usr/sbin/restorecon -RF /etc/pki/ca-trust/extracted
44+
changed_when: false

roles/ceph-mon/templates/ceph-mon.service.j2

+8-7
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,14 @@ ExecStart=/usr/bin/{{ container_binary }} run --rm --name ceph-mon-%i \
2727
--pids-limit={{ 0 if container_binary == 'podman' else -1 }} \
2828
--memory={{ ceph_mon_docker_memory_limit }} \
2929
--cpus={{ ceph_mon_docker_cpu_limit }} \
30-
-v /var/lib/ceph:/var/lib/ceph:z,rshared \
31-
-v /etc/ceph:/etc/ceph:z \
32-
-v /var/run/ceph:/var/run/ceph:z \
33-
-v /etc/localtime:/etc/localtime:ro \
34-
-v /var/log/ceph:/var/log/ceph:z \
35-
{% if ansible_facts['distribution'] == 'RedHat' -%}
36-
-v /etc/pki/ca-trust/extracted:/etc/pki/ca-trust/extracted:z \
30+
--security-opt label=disable \
31+
-v /var/lib/ceph:/var/lib/ceph:rshared \
32+
-v /etc/ceph:/etc/ceph \
33+
-v /var/run/ceph:/var/run/ceph \
34+
-v /etc/localtime:/etc/localtime \
35+
-v /var/log/ceph:/var/log/ceph \
36+
{% if ansible_facts['os_family'] == 'RedHat' -%}
37+
-v /etc/pki/ca-trust/extracted:/etc/pki/ca-trust/extracted \
3738
{% endif -%}
3839
{% if mon_docker_privileged -%}
3940
--privileged \

roles/ceph-rgw/templates/ceph-radosgw.service.j2

+9-8
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,23 @@ ExecStart=/usr/bin/{{ container_binary }} run --rm --net=host \
2727
--pids-limit={{ 0 if container_binary == 'podman' else -1 }} \
2828
--memory={{ ceph_rgw_docker_memory_limit }} \
2929
--cpus={{ cpu_limit }} \
30+
--security-opt label=disable \
3031
{% if ceph_rgw_docker_cpuset_cpus is defined -%}
3132
--cpuset-cpus="{{ ceph_rgw_docker_cpuset_cpus }}" \
3233
{% endif -%}
3334
{% if ceph_rgw_docker_cpuset_mems is defined -%}
3435
--cpuset-mems="{{ ceph_rgw_docker_cpuset_mems }}" \
3536
{% endif -%}
36-
-v /var/lib/ceph:/var/lib/ceph:z \
37-
-v /etc/ceph:/etc/ceph:z \
38-
-v /var/run/ceph:/var/run/ceph:z \
39-
-v /etc/localtime:/etc/localtime:ro \
40-
-v /var/log/ceph:/var/log/ceph:z \
41-
{% if ansible_facts['distribution'] == 'RedHat' -%}
42-
-v /etc/pki/ca-trust/extracted:/etc/pki/ca-trust/extracted:z \
37+
-v /var/lib/ceph:/var/lib/ceph \
38+
-v /etc/ceph:/etc/ceph \
39+
-v /var/run/ceph:/var/run/ceph \
40+
-v /etc/localtime:/etc/localtime \
41+
-v /var/log/ceph:/var/log/ceph \
42+
{% if ansible_facts['os_family'] == 'RedHat' -%}
43+
-v /etc/pki/ca-trust/extracted:/etc/pki/ca-trust/extracted \
4344
{% endif -%}
4445
{% if radosgw_frontend_ssl_certificate -%}
45-
-v {{ radosgw_frontend_ssl_certificate }}:{{ radosgw_frontend_ssl_certificate }}:ro \
46+
-v {{ radosgw_frontend_ssl_certificate }}:{{ radosgw_frontend_ssl_certificate }} \
4647
{% endif -%}
4748
-e CEPH_DAEMON=RGW \
4849
-e CLUSTER={{ cluster }} \

0 commit comments

Comments
 (0)