1 |
Just when I thought I was getting near to switching on strict and all of |
2 |
a sudden my cron jobs are throwing AVCs all over. |
3 |
|
4 |
|
5 |
The gist of it is all the same, for example: |
6 |
scontext=user_u:user_r:cronjob_t tcontext=system_u:object_r:crond_tmp_t. |
7 |
This is from /etc/crontab and has USER=root, so it should be run as a |
8 |
system crontab and therefore be system_cronjob_t? Here are a couple of |
9 |
specific AVCs that show this but there are many more similar or |
10 |
otherwise to do with cron jobs that worked alright until recently: |
11 |
|
12 |
---- |
13 |
time->Mon Jan 30 13:00:01 2017 |
14 |
type=AVC msg=audit(1485781201.744:14756): avc: denied { write open } |
15 |
for pid=26263 comm="touch" path="/var/spool/cron/lastrun/cron.hourly" |
16 |
dev="dm-0" ino=787203 scontext=user_u:user_r:cronjob_t |
17 |
tcontext=user_u:object_r:crond_tmp_t tclass=file permissive=1 |
18 |
type=AVC msg=audit(1485781201.744:14756): avc: denied { create } for |
19 |
pid=26263 comm="touch" name="cron.hourly" |
20 |
scontext=user_u:user_r:cronjob_t tcontext=user_u:object_r:crond_tmp_t |
21 |
tclass=file permissive=1 |
22 |
type=AVC msg=audit(1485781201.744:14756): avc: denied { add_name } |
23 |
for pid=26263 comm="touch" name="cron.hourly" |
24 |
scontext=user_u:user_r:cronjob_t tcontext=system_u:object_r:crond_tmp_t |
25 |
tclass=dir permissive=1 |
26 |
---- |
27 |
time->Mon Jan 30 15:40:01 2017 |
28 |
type=PROCTITLE msg=audit(1485790801.293:14758): |
29 |
proctitle=2F62696E2F7368002F7573722F7362696E2F72756E2D63726F6E73 |
30 |
type=PATH msg=audit(1485790801.293:14758): item=0 |
31 |
name="/var/lock/cron.hourly" inode=5592510 dev=00:11 mode=0120777 ouid=0 |
32 |
ogid=0 rdev=00:00 obj=user_u:object_r:var_lock_t nametype=NORMAL |
33 |
type=CWD msg=audit(1485790801.293:14758): cwd="/" |
34 |
type=SYSCALL msg=audit(1485790801.293:14758): arch=c000003e syscall=6 |
35 |
success=yes exit=0 a0=1626565d30 a1=3b84123bb70 a2=3b84123bb70 a3=40 |
36 |
items=1 ppid=26697 pid=26698 auid=4294967295 uid=0 gid=0 euid=0 suid=0 |
37 |
fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="run-crons" |
38 |
exe="/bin/bash" subj=user_u:user_r:cronjob_t key=(null) |
39 |
type=AVC msg=audit(1485790801.293:14758): avc: denied { getattr } for |
40 |
pid=26698 comm="run-crons" path="/run/lock/cron.hourly" dev="tmpfs" |
41 |
ino=5592510 scontext=user_u:user_r:cronjob_t |
42 |
tcontext=user_u:object_r:var_lock_t tclass=lnk_file permissive=1 |
43 |
|
44 |
Also, I noticed that the files in /var/spool/cron/lastrun/ have the |
45 |
following contexts: |
46 |
|
47 |
-rw-r--r--. 1 root root user_u:object_r:crond_tmp_t 0 Jan 30 |
48 |
03:10 cron.daily |
49 |
-rw-r--r--. 1 root root user_u:object_r:crond_tmp_t 0 Jan 30 |
50 |
15:00 cron.hourly |
51 |
-rw-r--r--. 1 root root system_u:object_r:system_cronjob_tmp_t 0 Jan 1 |
52 |
05:30 cron.monthly |
53 |
-rw-r--r--. 1 root root user_u:object_r:crond_tmp_t 0 Jan 28 |
54 |
04:20 cron.weekly |
55 |
|
56 |
the cron.monthly looks like I would expect (system_cronjob_t) but the |
57 |
rest have been changed since then. |
58 |
|
59 |
I have just checked the logs and it confirms that this behaviour started |
60 |
on 11th Jan, when I updated sec-policy/selinux-base-policy to |
61 |
2.20161023-r3. So either something got reset that I need to change, I |
62 |
haven't restarted something or there is some sort of error in the cron |
63 |
policy that is causing this? |
64 |
|
65 |
Any ideas? |
66 |
|
67 |
Thanks - Robert Sharp |