Bug 1325759 - SELinux is preventing dbus-daemon from 'read, write' accesses on the chr_file /dev/pts/ptmx.
Summary: SELinux is preventing dbus-daemon from 'read, write' accesses on the chr_file...
Keywords:
Status: CLOSED INSUFFICIENT_DATA
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 23
Hardware: All
OS: Linux
unspecified
low
Target Milestone: ---
Assignee: Miroslav Grepl
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-04-11 06:45 UTC by Paul Alesius
Modified: 2016-04-11 07:38 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-04-11 07:38:11 UTC
Type: Bug


Attachments (Terms of Use)

Description Paul Alesius 2016-04-11 06:45:33 UTC
## Description of problem:
Trying to login to a systemd-nspawn container using machinectl login <container>

## Version-Release number of selected component (if applicable):
selinux-policy.noarch                    3.13.1-158.12.fc23        @updates     
selinux-policy-targeted.noarch           3.13.1-158.12.fc23        @updates 

## How reproducible:
always

## Steps to Reproduce:
1.machinectl login <my-nspawn-machine>

## Actual results:
-> Failed to get machine PTY: Message recipient disconnected from message bus without replying

Because "it" (machinectl? systemd? nspawn?) tries to access /dev/pts/ptmx instead of /dev/ptmx

ls -lZ /dev/ptmx /dev/pts/ptmx:
-> root tty  system_u:object_r:ptmx_t:s0 /dev/ptmx
-> root root system_u:object_r:devpts_t:s0 /dev/pts/ptmx

semanage fcontext -l | grep ptmx:
-> /dev/ptmx    character device   system_u:object_r:ptmx_t:s0

## Expected results:
Login prompt to the container to show up.

## Additional info:
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                          <Unknown>
Source RPM Packages           
Target RPM Packages           
Policy RPM                    selinux-policy-3.13.1-158.12.fc23.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     hypervisor.unnsvc.dev
Platform                      Linux hypervisor.unnsvc.dev 4.5.0 #1 SMP Fri Apr 8
                              02:31:15 CEST 2016 x86_64 x86_64
Alert Count                   3
First Seen                    2016-04-11 07:03:15 CEST
Last Seen                     2016-04-11 07:03:33 CEST
Local ID                      bd6e884e-e862-4a9c-b030-4498d7cac5ba

Raw Audit Messages
type=AVC msg=audit(1460351013.405:190): avc:  denied  { read write } for  pid=746 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

## The .te file it generates from the auditd.log:

module dbusd-ptmx 1.0;

require {
	type devpts_t;
	type system_dbusd_t;
	class chr_file { write read };
}

#============= system_dbusd_t ==============
allow system_dbusd_t devpts_t:chr_file { write read };

Comment 1 Paul Alesius 2016-04-11 07:38:11 UTC
For some reason, relabeling /dev/pts/ptmx doesn't work either, it will only work by allowing the above AVC. Closing for further debugging.


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