Bug 575560

Summary: SELinux is preventing /usr/sbin/crond "create" access .
Product: [Fedora] Fedora Reporter: Matěj Cepl <mcepl>
Component: selinux-policyAssignee: Daniel Walsh <dwalsh>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: cpebenito, dwalsh, eparis, jmorris, mcepl, mgrepl, sdsmall
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard: setroubleshoot_trace_hash:479e4b6430104d75b009af9b5af6c88b7ed1ddfa5a521c0297d483e38cd52aee
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-07-29 16:35:00 UTC Type: ---
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
output of ausearch -m AVC -ts 14:43 none

Description Matěj Cepl 2010-03-21 13:45:12 UTC
Souhrn:

SELinux is preventing /usr/sbin/crond "create" access .

Podrobný popis:

[crond has a permissive type (crond_t). This access was not denied.]

SELinux denied access requested by crond. It is not expected that this access is
required by crond and this access may signal an intrusion attempt. It is also
possible that the specific version or configuration of the application is
causing it to require additional access.

Povolení přístupu:

You can generate a local policy module to allow this access - see FAQ
(http://docs.fedoraproject.org/selinux-faq-fc5/#id2961385) Please file a bug
report.

Další informace:

Kontext zdroje                system_u:system_r:crond_t:s0-s0:c0.c1023
Kontext cíle                 staff_u:staff_r:cronjob_t:s0-s0:c0.c1023
Objekty cíle                 None [ key ]
Zdroj                         crond
Cesta zdroje                  /usr/sbin/crond
Port                          <Neznámé>
Počítač                    (removed)
RPM balíčky zdroje          cronie-1.4.3-6.el6
RPM balíčky cíle           
RPM politiky                  selinux-policy-3.7.15-2.el6
Selinux povolen               True
Typ politiky                  targeted
Vynucovací režim            Enforcing
Název zásuvného modulu     catchall
Název počítače            (removed)
Platforma                     Linux (removed) 2.6.32-19.el6.x86_64 #1
                              SMP Tue Mar 9 17:48:46 EST 2010 x86_64 x86_64
Počet upozornění           1
Poprvé viděno               Ne 21. březen 2010, 14:45:01 CET
Naposledy viděno             Ne 21. březen 2010, 14:45:01 CET
Místní ID                   1632e197-eddd-45ee-ac34-d53385cff0be
Čísla řádků              

Původní zprávy auditu      

node=(removed) type=AVC msg=audit(1269179101.281:9670): avc:  denied  { create } for  pid=27537 comm="crond" scontext=system_u:system_r:crond_t:s0-s0:c0.c1023 tcontext=staff_u:staff_r:cronjob_t:s0-s0:c0.c1023 tclass=key

node=(removed) type=SYSCALL msg=audit(1269179101.281:9670): arch=c000003e syscall=1 success=yes exit=68719476864 a0=3 a1=7ffa4d25ce50 a2=29 a3=726379656b2f7274 items=0 ppid=1663 pid=27537 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="crond" exe="/usr/sbin/crond" subj=system_u:system_r:crond_t:s0-s0:c0.c1023 key=(null)



Hash String generated from  catchall,crond,crond_t,cronjob_t,key,create
audit2allow suggests:

#============= crond_t ==============
allow crond_t cronjob_t:key create;

Comment 1 Matěj Cepl 2010-03-21 13:49:02 UTC
johanka:rpmbuild$ crontab -l
SHELL=/bin/sh

*/5 * * * *     $HOME/.bin/fortune-thunderbird
johanka:rpmbuild$ cat /home/matej/.bin/fortune-thunderbird 
#!/bin/sh
$HOME/.bin/fortune >~/.signature-thunderbird
johanka:rpmbuild$ cat /home/matej/.bin/fortune
#!/bin/sh
#Insert your constant tagline here.
cat <<EOS
http://www.ceplovi.cz/matej/, Jabber: mcepl<at>ceplovi.cz
GPG Finger: 89EF 4BC6 288A BF43 1BAB  25C3 E09F EF25 D964 84AC
 
EOS
/usr/bin/fortune -s ~/.config/dotfiles/citations
johanka:rpmbuild$

Comment 2 Matěj Cepl 2010-03-21 13:57:41 UTC
After another cycle, I've got to this:

johanka:~# cat /root/myCrontabFileCreate.te
module myCrontabFileCreate 1.2;

require {
	type tmp_t;
	type cronjob_t;
	type crond_t;
	type user_home_dir_t;
	class key create;
	class dir { write add_name };
}

allow crond_t cronjob_t:key create;
allow cronjob_t tmp_t:dir add_name;

allow cronjob_t tmp_t:dir write;

allow cronjob_t user_home_dir_t:dir write;
johanka:~#

Comment 3 Matěj Cepl 2010-03-21 14:00:21 UTC
Created attachment 401561 [details]
output of ausearch -m AVC -ts 14:43

Comment 5 Stephen Smalley 2010-03-25 13:08:37 UTC
:key create is checked upon setkeycreatecon(3), called by pam_selinux, to set up the key creation security context just as it sets up the user cron job security context.

I thought user cron jobs were being run in the user's normal context these days (e.g. user_t, staff_t) rather than in a separate domain?

Comment 6 Daniel Walsh 2010-07-29 16:35:00 UTC
Fixed in selinux-policy-3.8.8-8.fc14