Bug 692655

Summary: SELinux is preventing /sbin/agetty from 'write' accesses on the file utmp.
Product: [Fedora] Fedora Reporter: Giovanni Campagna <scampa.giovanni>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 15CC: dwalsh, mgrepl
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard: setroubleshoot_trace_hash:ef807bef6cb1741dffd06aed24aac2d966ccd31e68a0ae5e82eb48470c09c300
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-03-31 21:22:30 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Giovanni Campagna 2011-03-31 19:18:23 UTC
SELinux is preventing /sbin/agetty from 'write' accesses on the file utmp.

*****  Plugin catchall_labels (83.8 confidence) suggests  ********************

If you want to allow agetty to have write access on the utmp file
Then you need to change the label on utmp
Do
# semanage fcontext -a -t FILE_TYPE 'utmp'
where FILE_TYPE is one of the following: var_run_t, initrc_var_run_t, getty_var_run_t, afs_cache_t, user_cron_spool_t, wtmp_t, getty_t, getty_log_t, getty_tmp_t, getty_lock_t. 
Then execute: 
restorecon -v 'utmp'


*****  Plugin catchall (17.1 confidence) suggests  ***************************

If you believe that agetty should be allowed write access on the utmp 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 agetty /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:getty_t:s0
Target Context                system_u:object_r:default_t:s0
Target Objects                utmp [ file ]
Source                        agetty
Source Path                   /sbin/agetty
Port                          <Sconosciuto>
Host                          (removed)
Source RPM Packages           util-linux-2.19-3.fc15
Target RPM Packages           
Policy RPM                    selinux-policy-3.9.16-6.fc15
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Permissive
Host Name                     (removed)
Platform                      Linux (removed) 2.6.38.2-9.fc15.x86_64
                              #1 SMP Wed Mar 30 16:55:57 UTC 2011 x86_64 x86_64
Alert Count                   2
First Seen                    gio 31 mar 2011 21:13:02 CEST
Last Seen                     gio 31 mar 2011 21:14:44 CEST
Local ID                      0e5b9e99-bad1-4b92-a0ee-c73f40a32a65

Raw Audit Messages
type=AVC msg=audit(1301598884.616:212): avc:  denied  { write } for  pid=2192 comm="agetty" name="utmp" dev=tmpfs ino=12074 scontext=system_u:system_r:getty_t:s0 tcontext=system_u:object_r:default_t:s0 tclass=file


type=SYSCALL msg=audit(1301598884.616:212): arch=x86_64 syscall=open success=yes exit=EINTR a0=3c3955b792 a1=80002 a2=3c3955b792 a3=8 items=0 ppid=1 pid=2192 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=agetty exe=/sbin/agetty subj=system_u:system_r:getty_t:s0 key=(null)

Hash: agetty,getty_t,default_t,file,write

audit2allow

#============= getty_t ==============
allow getty_t default_t:file write;

audit2allow -R

#============= getty_t ==============
allow getty_t default_t:file write;

Comment 1 Daniel Walsh 2011-03-31 21:22:30 UTC

*** This bug has been marked as a duplicate of bug 692459 ***