问题原文
原帖链接 · dghodgson · CC BY-SA 3.0
I have a folder shared out via Samba, and a Docker container which I would like to give access to said folder by adding it as a volume to the Docker container (yes, I know that's not portable).
SELinux blocks the container from accessing the folder since the folder and its contents are labeled as samba_share_t, not svirt_sandbox_file_t
I know that the smbd_t domain has access to a number of SELinux labels (e.g. httpd_sys_content_t, though sesearch -s smbd_t --allow provides a full list), but svirt_sandbox_file_t is not one of them.
I see a few ways around this problem:
Access the samba share from the container over the network (not desirable as that requires samba to be installed in the container, and there's network overhead)
Relabel the folder and its contents as
svirt_sandbox_file_t(which prevents Samba from accessing the folder)Relabel the folder and its contents as
public_content_rw_t(but that also gives access to a number of other services which I don't want to have access to this folder)Create a policy to give
svirt_lxc_net_taccess to thesamba_share_tlabel (generated by audit2allow, but that gives any container access to any file/folder labeled as samba_share_t)
The other option I can think of is to create my own SELinux role with its own label that gives access only to Samba and svirt (which I haven't done before, but am willing to try).
Am I missing something here? Is there an easier way to do this?
已采纳解答
原帖链接 · rhatdan · CC BY-SA 3.0
I would go the route of adding the rule to allow samba to write to svirt_sandbox_file_t. Since you want samba to be allowed to upload content to the container. Is samba only needs to read the content, then just add the allow rules to make this happen.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
