Skip to content

Commit

Permalink
Disable selinux on containers MON and RGW
Browse files Browse the repository at this point in the history
Initially MONs and RGW binded /etc/pki/ca-trust/extracted using the :z flag
(introduced to solve an OSP TripleO issue on RHEL - ceph#3638) but using
this flag on that specific folder brought other issues like
https://bugzilla.redhat.com/show_bug.cgi?id=2026953
The z flag prevents local services (like sssd) running on the host accessing
the certificates/files in that folder.

Signed-off-by: Teoman ONAY <tonay@redhat.com>
  • Loading branch information
asm0deuz committed Mar 7, 2022
1 parent 266b6e7 commit 2599686
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
3 changes: 3 additions & 0 deletions roles/ceph-container-common/tasks/prerequisites.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@
mode: 0644
state: present
create: yes

- name: restore certificates selinux context
command: /usr/sbin/restorecon -RF /etc/pki/ca-trust/extracted
13 changes: 7 additions & 6 deletions roles/ceph-mon/templates/ceph-mon.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@ ExecStart=/usr/bin/{{ container_binary }} run --rm --name ceph-mon-%i \
--pids-limit={{ 0 if container_binary == 'podman' else -1 }} \
--memory={{ ceph_mon_docker_memory_limit }} \
--cpus={{ ceph_mon_docker_cpu_limit }} \
-v /var/lib/ceph:/var/lib/ceph:z,rshared \
-v /etc/ceph:/etc/ceph:z \
-v /var/run/ceph:/var/run/ceph:z \
-v /etc/localtime:/etc/localtime:ro \
-v /var/log/ceph:/var/log/ceph:z \
--security-opt label:disable
-v /var/lib/ceph:/var/lib/ceph:rshared \
-v /etc/ceph:/etc/ceph \
-v /var/run/ceph:/var/run/ceph \
-v /etc/localtime:/etc/localtime \
-v /var/log/ceph:/var/log/ceph \
{% if ansible_facts['distribution'] == 'RedHat' -%}
-v /etc/pki/ca-trust/extracted:/etc/pki/ca-trust/extracted:z \
-v /etc/pki/ca-trust/extracted:/etc/pki/ca-trust/extracted \
{% endif -%}
{% if mon_docker_privileged | bool -%}
--privileged \
Expand Down
15 changes: 8 additions & 7 deletions roles/ceph-rgw/templates/ceph-radosgw.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,23 @@ ExecStart=/usr/bin/{{ container_binary }} run --rm --net=host \
--pids-limit={{ 0 if container_binary == 'podman' else -1 }} \
--memory={{ ceph_rgw_docker_memory_limit }} \
--cpus={{ cpu_limit }} \
--security-opt label:disable
{% if ceph_rgw_docker_cpuset_cpus is defined -%}
--cpuset-cpus="{{ ceph_rgw_docker_cpuset_cpus }}" \
{% endif -%}
{% if ceph_rgw_docker_cpuset_mems is defined -%}
--cpuset-mems="{{ ceph_rgw_docker_cpuset_mems }}" \
{% endif -%}
-v /var/lib/ceph:/var/lib/ceph:z \
-v /etc/ceph:/etc/ceph:z \
-v /var/run/ceph:/var/run/ceph:z \
-v /etc/localtime:/etc/localtime:ro \
-v /var/log/ceph:/var/log/ceph:z \
-v /var/lib/ceph:/var/lib/ceph \
-v /etc/ceph:/etc/ceph \
-v /var/run/ceph:/var/run/ceph \
-v /etc/localtime:/etc/localtime \
-v /var/log/ceph:/var/log/ceph \
{% if ansible_facts['distribution'] == 'RedHat' -%}
-v /etc/pki/ca-trust/extracted:/etc/pki/ca-trust/extracted:z \
-v /etc/pki/ca-trust/extracted:/etc/pki/ca-trust/extracted \
{% endif -%}
{% if radosgw_frontend_ssl_certificate -%}
-v {{ radosgw_frontend_ssl_certificate }}:{{ radosgw_frontend_ssl_certificate }}:ro \
-v {{ radosgw_frontend_ssl_certificate }}:{{ radosgw_frontend_ssl_certificate }} \
{% endif -%}
-e CEPH_DAEMON=RGW \
-e CLUSTER={{ cluster }} \
Expand Down

0 comments on commit 2599686

Please sign in to comment.