Bug 1416540
Summary: | machinectl user experience is completely broken | ||||||
---|---|---|---|---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Germano Massullo <germano.massullo> | ||||
Component: | selinux-policy-targeted | Assignee: | Lukas Vrabec <lvrabec> | ||||
Status: | CLOSED DUPLICATE | QA Contact: | Ben Levenson <benl> | ||||
Severity: | high | Docs Contact: | |||||
Priority: | unspecified | ||||||
Version: | 29 | CC: | alan.christopher.jenkins, amessina, dustymabe, dwalsh, enrico.tagliavini, fedora, gary.tierney, gujemutu, harald, kay, mathieu-acct, mschmidt, philip, ssahani, systemd-maint, taocrismon | ||||
Target Milestone: | --- | ||||||
Target Release: | --- | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
Whiteboard: | |||||||
Fixed In Version: | Doc Type: | If docs needed, set a value | |||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2019-04-02 16:42:08 UTC | Type: | Bug | ||||
Regression: | --- | Mount Type: | --- | ||||
Documentation: | --- | CRM: | |||||
Verified Versions: | Category: | --- | |||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
Cloudforms Team: | --- | Target Upstream Version: | |||||
Embargoed: | |||||||
Attachments: |
|
Description
Germano Massullo
2017-01-25 18:36:41 UTC
Created attachment 1244512 [details]
audit.log
sfix user helped me doing some tries. At the end of them we managed to use
# machinectl start foo
# machinectl stop foo
but
# machinectl login foo
still does not work.
We inserted
(type nspawn_unit_file_t)
(roletype object_r nspawn_unit_file_t)
(typeattributeset systemd_unit_file_type nspawn_unit_file_t)
(typeattributeset file_type nspawn_unit_file_t)
(context nspawn_unit_file_context (system_u object_r nspawn_unit_file_t ((s0) (s0))))
(filecon "/usr/lib/systemd/system/systemd\-nspawn@\.service" file nspawn_unit_file_context)
(allow systemd_machined_t spc_t (process (signal)))
(allow systemd_machined_t self (cap_userns (all)))
(allow systemd_machined_t nspawn_unit_file_t (service (all))
into machined_patch.cil
then
# semodule -i machined_patch.cil
# restorecon -vF /usr/lib/systemd/system/systemd-nspawn@.service
and tried playing with
# machinectl start foo
# machinectl login foo
# machinectl stop foo
I attach /var/log/audit/audit.log
Based on the above policy that we created after stepping through the previous AVCs in the initial report, it seems to me when machined wants these access vectors:
type=AVC msg=audit(1485387994.833:13154): avc: denied { read } for pid=7456 comm="systemd-machine" name="ptmx" dev="tmpfs" ino=5689160 scontext=system_u:system_r:systemd_machined_t:s0 tcontext=system_u:object_r:container_runtime_tmpfs_t:s0 tclass=lnk_file permissive=1
type=AVC msg=audit(1485387994.833:13155): avc: denied { open } for pid=7456 comm="systemd-machine" path="/dev/pts/ptmx" dev="devpts" ino=2 scontext=system_u:system_r:systemd_machined_t:s0 tcontext=system_u:object_r:container_devpts_t:s0 tclass=chr_file permissive=1
type=AVC msg=audit(1485387994.838:13156): avc: denied { write } for pid=7460 comm="systemd-machine" name="system_bus_socket" dev="tmpfs" ino=5694845 scontext=system_u:system_r:systemd_machined_t:s0 tcontext=system_u:object_r:container_runtime_tmpfs_t:s0 tclass=sock_file permissive=1
That it should be running in the container_runtime_t domain (Or equivalent for nspawn. Currently systemd-nspawn has no private type in Fedora's policy).
container_runtime_t has permissions on these access vectors:
> $ sesearch -ACS -d -s container_runtime_t -t container_runtime_tmpfs_t
Found 6 semantic av rules:
allow container_runtime_t container_runtime_tmpfs_t : dir { ioctl read write create getattr setattr lock relabelfrom unlink link rename add_name remove_name reparent search rmdir open } ;
allow container_runtime_t container_runtime_tmpfs_t : lnk_file { ioctl read write create getattr setattr lock append unlink link rename } ;
allow container_runtime_t container_runtime_tmpfs_t : file { ioctl read write create getattr setattr lock append unlink link rename execute execute_no_trans open } ;
allow container_runtime_t container_runtime_tmpfs_t : chr_file { ioctl read write create getattr setattr lock append unlink link rename mounton open } ;
allow container_runtime_t container_runtime_tmpfs_t : fifo_file { ioctl read write create getattr setattr lock append unlink link rename open } ;
allow container_runtime_t container_runtime_tmpfs_t : blk_file { ioctl read write create getattr setattr lock append unlink link rename open } ;
I have limited experience with machined and user namespaces, so the above is based on an observation of the current container-selinux policy.
Still not fixed in Fedora 26, please change the version to 26. This makes systemd-nspawn completely unusable without disabling selinux. I would too like to voice my support for this bug. It is understandable that something like machinectl trips SELinux, but that makes it all the more important that a fine grained SELinux policy is supplied on installation. In the current situation users must disable SELinux or at best (I don't know) apply some overly broad SELinux policy, potentially leaving them open for rogue containers. This message is a reminder that Fedora 26 is nearing its end of life. Approximately 4 (four) weeks from now Fedora will stop maintaining and issuing updates for Fedora 26. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as EOL if it remains open with a Fedora 'version' of '26'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version. Thank you for reporting this issue and we are sorry that we were not able to fix it before Fedora 26 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged change the 'version' to a later Fedora version prior this bug is closed as described in the policy above. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete. This bug appears to have been reported against 'rawhide' during the Fedora 29 development cycle. Changing version to '29'. *** This bug has been marked as a duplicate of bug 1257990 *** |