Bug 713555

Summary: SELinux is preventing /usr/libexec/dovecot/auth from 'search' accesses on the dossier /sys.
Product: [Fedora] Fedora Reporter: Nicolas Mailhot <nicolas.mailhot>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: dominick.grift, dwalsh, mgrepl, nicolas.mailhot
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard: setroubleshoot_trace_hash:71f1d1bd7b011e8899536ad4843891b47ff1355a57b4c14e713dadccc2474311
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-06-15 20:20:46 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 Nicolas Mailhot 2011-06-15 19:09:44 UTC
SELinux is preventing /usr/libexec/dovecot/auth from 'search' accesses on the dossier /sys.

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

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

Additional Information:
Source Context                system_u:system_r:dovecot_auth_t:s0
Target Context                system_u:object_r:sysfs_t:s0
Target Objects                /sys [ dir ]
Source                        auth
Source Path                   /usr/libexec/dovecot/auth
Port                          <Inconnu>
Host                          (removed)
Source RPM Packages           dovecot-2.0.13-1.fc16
Target RPM Packages           filesystem-2.4.42-1.fc16
Policy RPM                    selinux-policy-3.9.16-28.fc16
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 3.0-0.rc3.git0.3.fc16.x86_64 #1
                              SMP Tue Jun 14 17:13:27 UTC 2011 x86_64 x86_64
Alert Count                   2
First Seen                    mer. 15 juin 2011 21:07:42 CEST
Last Seen                     mer. 15 juin 2011 21:07:42 CEST
Local ID                      3372bf8c-1d45-499d-97ba-64259b0a282d

Raw Audit Messages
type=AVC msg=audit(1308164862.492:94): avc:  denied  { search } for  pid=2624 comm="auth" name="/" dev=sysfs ino=1 scontext=system_u:system_r:dovecot_auth_t:s0 tcontext=system_u:object_r:sysfs_t:s0 tclass=dir


type=SYSCALL msg=audit(1308164862.492:94): arch=x86_64 syscall=statfs success=no exit=EACCES a0=25215fa a1=7fffda969610 a2=5 a3=fffffffffffff61f items=0 ppid=2602 pid=2624 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=auth exe=/usr/libexec/dovecot/auth subj=system_u:system_r:dovecot_auth_t:s0 key=(null)

Hash: auth,dovecot_auth_t,sysfs_t,dir,search

audit2allow

#============= dovecot_auth_t ==============
allow dovecot_auth_t sysfs_t:dir search;

audit2allow -R

#============= dovecot_auth_t ==============
allow dovecot_auth_t sysfs_t:dir search;

Comment 1 Nicolas Mailhot 2011-06-15 19:11:49 UTC
On a rawhide system freshly updated with all the latest stuff and rebooted after relabeling

Comment 2 Dominick Grift 2011-06-15 19:13:20 UTC
I wonder if this is cgroupfs related or selinuxfs related. I guess all programs
using libselinux will want to get attributes of selinuxfs? which is now in
/sys/fs/selinux?

Comment 3 Dominick Grift 2011-06-15 19:18:17 UTC
Can you reproduce this in permissive mode please. We're only seeying the first syscall (since selinux is blocking that we dont see what it wants next)

I suspects it has business in either /sys/fs/cgroup or sys/fs/selinux, would like to see which one it is

Comment 4 Nicolas Mailhot 2011-06-15 20:10:32 UTC
In permissive mode :

SELinux is preventing /usr/libexec/dovecot/auth from search access on the dossier /sys.

*****  Plugin catchall (100. confiance) suggéré*******************************

Siyou believe that auth should be allowed search access on the sys directory by default.
Alorsyou should report this as a bug.
You can generate a local policy module to allow this access.
Faire
allow this access for now by executing:
# grep auth /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Contexte source               system_u:system_r:dovecot_auth_t:s0
Contexte cible                system_u:object_r:sysfs_t:s0
Objets du contexte            /sys [ dir ]
Source                        auth
Chemin de la source           /usr/libexec/dovecot/auth
Port                          <Inconnu>
Hôte                          (removed)
Paquetages RPM source         dovecot-2.0.13-1.fc16
Paquetages RPM cible          filesystem-2.4.42-1.fc16
RPM de la statégie            selinux-policy-3.9.16-28.fc16
Selinux activé                True
Type de stratégie             targeted
Mode strict                   Permissive
Nom de l'hôte                 (removed)
Plateforme                    Linux arekh.okg 3.0-0.rc3.git0.3.fc16.x86_64 #1
                              SMP Tue Jun 14 17:13:27 UTC 2011 x86_64 x86_64
Compteur d'alertes            1
Première alerte               mer. 15 juin 2011 22:06:14 CEST
Dernière alerte               mer. 15 juin 2011 22:06:14 CEST
ID local                      11919086-7e20-4359-8c25-9bbf4fc973a4

Messages d'audit bruts 
type=AVC msg=audit(1308168374.636:264): avc:  denied  { search } for  pid=6044 comm="auth" name="/" dev=sysfs ino=1 scontext=system_u:system_r:dovecot_auth_t:s0 tcontext=system_u:object_r:sysfs_t:s0 tclass=dir


type=SYSCALL msg=audit(1308168374.636:264): arch=x86_64 syscall=statfs success=yes exit=0 a0=36a861665e a1=7fff01d83a60 a2=1000 a3=314f80e0ca items=0 ppid=5464 pid=6044 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=auth exe=/usr/libexec/dovecot/auth subj=system_u:system_r:dovecot_auth_t:s0 key=(null)

Hash: auth,dovecot_auth_t,sysfs_t,dir,search

audit2allow

#============= dovecot_auth_t ==============
allow dovecot_auth_t sysfs_t:dir search;

audit2allow -R

#============= dovecot_auth_t ==============
allow dovecot_auth_t sysfs_t:dir search;

Comment 5 Dominick Grift 2011-06-15 20:17:50 UTC
ok is searching statfs i guess and not cgroupfs or securitfs, i guess we can allow this for now.

http://git.fedorahosted.org/git/?p=selinux-policy.git;a=commitdiff;h=0daf404d1596573ea704981c91d47c2fce26112a

Comment 6 Dominick Grift 2011-06-15 20:19:02 UTC
I meant its statting /sys any ways i added it to master branch

Comment 7 Daniel Walsh 2011-06-15 20:20:46 UTC
This is related I believe to libselinux changes with systemd.  

Fixed in selinux-policy-3.9.16-29.fc16