Bug 1310464 - SELinux is preventing dbus-daemon from read, write access on the chr_file /dev/pts/ptmx.
SELinux is preventing dbus-daemon from read, write access on the chr_file /de...
Status: CLOSED EOL
Product: Fedora
Classification: Fedora
Component: selinux-policy (Show other bugs)
23
x86_64 Unspecified
medium Severity medium
: ---
: ---
Assigned To: Lukas Vrabec
Fedora Extras Quality Assurance
abrt_hash:8a10a9dd000bb1c7e22a72474a9...
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2016-02-21 17:09 EST by Aaron Sowry
Modified: 2016-12-20 14:23 EST (History)
12 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-12-20 13:55:15 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
machined strace (2.81 KB, application/x-gzip)
2016-05-24 11:44 EDT, Vincent Batts
no flags Details
machinectl strace (5.62 KB, application/x-gzip)
2016-05-24 11:44 EDT, Vincent Batts
no flags Details
journalctl on machinectl login with SELinux set to Permissive (19.67 KB, text/x-vhdl)
2016-10-18 15:10 EDT, srakitnican
no flags Details

  None (edit)
Description Aaron Sowry 2016-02-21 17:09:53 EST
Description of problem:
Running "machinectl login <machine_name>" on a running nspawn machine fails with the following message:

Failed to get machine PTY: Message recipient disconnected from message bus without replying
SELinux is preventing dbus-daemon from read, write access on the chr_file /dev/pts/ptmx.

*****  Plugin catchall (100. confidence) suggests   **************************

If you believe that dbus-daemon should be allowed read write access on the ptmx chr_file by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# grep dbus-daemon /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:system_dbusd_t:s0-s0:c0.c1023
Target Context                system_u:object_r:devpts_t:s0
Target Objects                /dev/pts/ptmx [ chr_file ]
Source                        dbus-daemon
Source Path                   dbus-daemon
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           
Target RPM Packages           
Policy RPM                    selinux-policy-3.13.1-158.6.fc23.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 4.3.5-300.fc23.x86_64 #1 SMP Mon
                              Feb 1 03:18:41 UTC 2016 x86_64 x86_64
Alert Count                   1
First Seen                    2016-02-22 11:03:45 NZDT
Last Seen                     2016-02-22 11:03:45 NZDT
Local ID                      1131986a-d0b4-4408-a3bd-5c3e8957a2f4

Raw Audit Messages
type=AVC msg=audit(1456092225.153:660): avc:  denied  { read write } for  pid=874 comm="dbus-daemon" path="/dev/pts/ptmx" dev="devpts" ino=2 scontext=system_u:system_r:system_dbusd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:devpts_t:s0 tclass=chr_file permissive=0


Hash: dbus-daemon,system_dbusd_t,devpts_t,chr_file,read,write

Version-Release number of selected component:
selinux-policy-3.13.1-158.6.fc23.noarch

Additional info:
reporter:       libreport-2.6.4
hashmarkername: setroubleshoot
kernel:         4.3.5-300.fc23.x86_64
type:           libreport
Comment 1 Aaron Sowry 2016-02-21 17:15:42 EST
Probably still exists as RH #1257990 too.
Comment 2 Francisco de la Peña 2016-03-27 18:52:42 EDT
I guess this is a duplicate of rhbz#1219729, where there is a policy proposal to fix this issues which works for me. However, it still fails to login with the same error when tried with a machine with the --private-users=nnnn parameter, also reveals multiple service issues when booting in the journal.
Comment 3 Vincent Batts 2016-05-24 11:44 EDT
Created attachment 1161084 [details]
machined strace
Comment 4 Vincent Batts 2016-05-24 11:44 EDT
Created attachment 1161085 [details]
machinectl strace
Comment 5 Vincent Batts 2016-05-24 11:46:22 EDT
This is still an issue on f23 and f24. 
[fedora@a sysconfig]$ rpm -q selinux-policy systemd
selinux-policy-3.13.1-185.fc24.noarch
systemd-229-7.fc24.x86_64

I've attached strace output from machined and machinectl where you can see machined getting kicked off of dbus when writing back to the client.

The work around is `setenforce 0`. :-\
Comment 6 Fedora Admin XMLRPC Client 2016-09-27 10:55:39 EDT
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.
Comment 7 Daniel Walsh 2016-10-10 12:53:24 EDT
Vincent if you put the machine in permissive mode, does it generate additional AVCs?
Comment 8 srakitnican 2016-10-18 15:10 EDT
Created attachment 1211830 [details]
journalctl on machinectl login with SELinux set to Permissive

Same or similar issue, SELinux blocking a try to login to a container using "machinectl login <name>":

$ sudo machinectl login fedora-mock 
Failed to get login PTY: Message recipient disconnected from message bus without replying

After which machinectl command no longer works with a dbus timeout until restart of systemd-machined.service

$ sudo machinectl status fedora-mock 
Could not get path to machine: Failed to activate service 'org.freedesktop.machine1': timed out (service_start_timeout=25000ms)

$ rpm -q selinux-policy
selinux-policy-3.13.1-219.fc25.noarch
Comment 9 Fedora End Of Life 2016-11-24 10:40:58 EST
This message is a reminder that Fedora 23 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 23. 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 '23'.

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 23 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.
Comment 10 Fedora End Of Life 2016-12-20 13:55:15 EST
Fedora 23 changed to end-of-life (EOL) status on 2016-12-20. Fedora 23 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.
Comment 11 srakitnican 2016-12-20 14:23:51 EST
Can someone reopen, since it doesn't seems fixed?

This time I had to set SELinux to Permissive to even start container.

AVCs generated as in permissive mode:

type=AVC msg=audit(1482261577.255:1270): avc:  denied  { search } for  pid=5454 comm="systemd-machine" name="6218" dev="proc" ino=1056775 scontext=system_u:system_r:systemd_machined_t:s0 tcontext=system_u:system_r:unconfined_service_t:s0 tclass=dir permissive=1
type=AVC msg=audit(1482261577.255:1271): avc:  denied  { read } for  pid=5454 comm="systemd-machine" name="cgroup" dev="proc" ino=1056808 scontext=system_u:system_r:systemd_machined_t:s0 tcontext=system_u:system_r:unconfined_service_t:s0 tclass=file permissive=1
type=AVC msg=audit(1482261577.255:1272): avc:  denied  { read open } for  pid=5454 comm="systemd-machine" path="/proc/6218/cgroup" dev="proc" ino=1056808 scontext=system_u:system_r:systemd_machined_t:s0 tcontext=system_u:system_r:unconfined_service_t:s0 tclass=file permissive=1
type=AVC msg=audit(1482261577.256:1273): avc:  denied  { getattr } for  pid=5454 comm="systemd-machine" path="/proc/6218/cgroup" dev="proc" ino=1056808 scontext=system_u:system_r:systemd_machined_t:s0 tcontext=system_u:system_r:unconfined_service_t:s0 tclass=file permissive=1
type=AVC msg=audit(1482261604.169:1306): avc:  denied  { read } for  pid=5454 comm="systemd-machine" name="mnt" dev="proc" ino=1059096 scontext=system_u:system_r:systemd_machined_t:s0 tcontext=system_u:system_r:unconfined_service_t:s0 tclass=lnk_file permissive=1
type=AVC msg=audit(1482261604.169:1307): avc:  denied  { sys_ptrace } for  pid=5454 comm="systemd-machine" capability=19  scontext=system_u:system_r:systemd_machined_t:s0 tcontext=system_u:system_r:systemd_machined_t:s0 tclass=cap_userns permissive=1
type=AVC msg=audit(1482261604.172:1308): avc:  denied  { sys_admin } for  pid=6394 comm="systemd-machine" capability=21  scontext=system_u:system_r:systemd_machined_t:s0 tcontext=system_u:system_r:systemd_machined_t:s0 tclass=cap_userns permissive=1
type=AVC msg=audit(1482261604.172:1309): avc:  denied  { sys_chroot } for  pid=6394 comm="systemd-machine" capability=18  scontext=system_u:system_r:systemd_machined_t:s0 tcontext=system_u:system_r:systemd_machined_t:s0 tclass=cap_userns permissive=1
type=AVC msg=audit(1482261604.172:1310): avc:  denied  { setgid } for  pid=6394 comm="systemd-machine" capability=6  scontext=system_u:system_r:systemd_machined_t:s0 tcontext=system_u:system_r:systemd_machined_t:s0 tclass=cap_userns permissive=1
type=AVC msg=audit(1482261604.172:1311): avc:  denied  { setuid } for  pid=6394 comm="systemd-machine" capability=7  scontext=system_u:system_r:systemd_machined_t:s0 tcontext=system_u:system_r:systemd_machined_t:s0 tclass=cap_userns permissive=1
type=AVC msg=audit(1482261604.172:1312): avc:  denied  { read } for  pid=6394 comm="systemd-machine" name="ptmx" dev="tmpfs" ino=1055706 scontext=system_u:system_r:systemd_machined_t:s0 tcontext=system_u:object_r:tmpfs_t:s0 tclass=lnk_file permissive=1
type=AVC msg=audit(1482261604.172:1313): avc:  denied  { open } for  pid=6394 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:devpts_t:s0 tclass=chr_file permissive=1
type=AVC msg=audit(1482261604.173:1314): avc:  denied  { sys_ptrace } for  pid=5454 comm="systemd-machine" capability=19  scontext=system_u:system_r:systemd_machined_t:s0 tcontext=system_u:system_r:systemd_machined_t:s0 tclass=cap_userns permissive=1
type=AVC msg=audit(1482261604.175:1315): avc:  denied  { write } for  pid=6402 comm="systemd-machine" name="system_bus_socket" dev="tmpfs" ino=1057542 scontext=system_u:system_r:systemd_machined_t:s0 tcontext=system_u:object_r:tmpfs_t:s0 tclass=sock_file permissive=1
type=AVC msg=audit(1482261604.217:1316): avc:  denied  { read write } for  pid=1052 comm="dbus-daemon" path="/dev/pts/ptmx" dev="devpts" ino=2 scontext=system_u:system_r:system_dbusd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:devpts_t:s0 tclass=chr_file permissive=1

Note You need to log in before you can comment on or make changes to this bug.