Bug 1485363

Summary: Unable to start a getty on ttyUSB0 with SELinux enabled
Product: [Fedora] Fedora Reporter: Ondřej Lysoněk <olysonek>
Component: selinux-policyAssignee: Lukas Vrabec <lvrabec>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 25CC: dwalsh, lsm5, lvrabec, mgrepl, plautrba, pmoore
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: 2017-12-12 10:12:44 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 Flags
audit.log none

Description Ondřej Lysoněk 2017-08-25 13:29:13 UTC
Created attachment 1318211 [details]
audit.log

Description of problem:
SELinux is preventing getty from starting on /dev/ttyUSB0 (a USB-serial converter, context system_u:object_r:usbtty_device_t:s0).

Version-Release number of selected component (if applicable):
selinux-policy-3.13.1-225.19.fc25.noarch

How reproducible:
always

Steps to Reproduce:
1. Plug in a USB-serial converter
2. systemctl start serial-getty
3. See the audit log and output of 'systemctl status serial-getty'

Actual results:
agetty, systemd, login and unix_chkpwd are denied access to the tty.

Expected results:
The getty should work.

Additional info:
It seems to work with the following policy, generated by audit2allow, applied:

module local 1.0;

require {
	type getty_t;
	type local_login_t;
	type usbtty_device_t;
	type init_t;
	class chr_file { getattr ioctl open read relabelfrom relabelto setattr write };
}

#============= getty_t ==============
allow getty_t usbtty_device_t:chr_file { getattr ioctl open read write };

#============= init_t ==============
allow init_t usbtty_device_t:chr_file { ioctl open read write };

#============= local_login_t ==============
allow local_login_t usbtty_device_t:chr_file { getattr ioctl open read relabelfrom relabelto setattr write };


Note that it doesn't contain any rules for unix_chkpwd - after the above policy is applied, I still get the AVCs related to unix_chkpwd in the logs, but the getty seems to work and I'm able to log in. I don't know why. The policy might be incomplete anyway though. I think the policy should be the same as for other tty devices, such as /dev/tty1.

I'm attaching the full audit log since attempting to start the getty for the first time. grep for usbtty to get the relevant lines.

Comment 1 Fedora End Of Life 2017-11-16 19:21:43 UTC
This message is a reminder that Fedora 25 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 25. 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 '25'.

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 25 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 2 Fedora End Of Life 2017-12-12 10:12:44 UTC
Fedora 25 changed to end-of-life (EOL) status on 2017-12-12. Fedora 25 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.