Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow containers to access files labeled as cert_t #7061

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions roles/ceph-container-common/tasks/prerequisites.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
---
- name: Install selinux modules
when:
- ansible_facts['distribution'] == 'RedHat'
- inventory_hostname in groups.get(mon_group_name, [])
or inventory_hostname in groups.get(rgw_group_name, [])
block:
- import_role:
name: ceph-common
tasks_from: configure_repository.yml

- name: install ceph-selinux package
package:
name: ceph-selinux
state: present

- name: restore certificates selinux context
command: /usr/sbin/restorecon -RF /etc/pki/ca-trust/extracted
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you please say more about the problem?

What file in /etc/pki/ca-trust/extracted is mis-labeled?

What is the thing that's mis-labeling it in the first place?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the mon and rgw containers need to get access to the local folder /etc/pki/ca-trust/extracted and its content, this line https://github.com/ceph/ceph-ansible/blob/c491e67486d8ed2717b5b9eda96544eb4f7eae2d/roles/ceph-rgw/templates/ceph-radosgw.service.j2#L42 relabels the whole folder content with container_t at container startup. While it gives access to the container(s) it prevents local processes like sssd to access the files. Unfortunately just changing the flag from z to ro does not put back the cert_t label on the files, this is why that restorecon is necessary.

I hope having answered your question.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


- name: lvmetad tasks related
when:
- inventory_hostname in groups.get(osd_group_name, [])
Expand Down
2 changes: 1 addition & 1 deletion roles/ceph-mon/templates/ceph-mon.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ ExecStart=/usr/bin/{{ container_binary }} run --rm --name ceph-mon-%i \
-v /etc/localtime:/etc/localtime:ro \
-v /var/log/ceph:/var/log/ceph:z \
{% 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:ro \
{% endif -%}
{% if mon_docker_privileged | bool -%}
--privileged \
Expand Down
2 changes: 1 addition & 1 deletion roles/ceph-rgw/templates/ceph-radosgw.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ ExecStart=/usr/bin/{{ container_binary }} run --rm --net=host \
-v /etc/localtime:/etc/localtime:ro \
-v /var/log/ceph:/var/log/ceph:z \
{% 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:ro \
{% endif -%}
{% if radosgw_frontend_ssl_certificate -%}
-v {{ radosgw_frontend_ssl_certificate }}:{{ radosgw_frontend_ssl_certificate }}:ro \
Expand Down