cron sys_admin
I am seeing the cron daemon request capability sys_admin. The below seems to indicate that vfork() is the relevant operation (190 seems to be vfork according to ia32entry.S).
So how does vfork() require sys_admin?
type=AVC msg=audit(1234433821.879:6677): avc: denied { sys_admin } for pid=9598 comm="cron" capability=21 scontext=system_u:system_r:crond_t:s0-s0:c0.c1023 tcontext=system_u:system_r:crond_t:s0-s0:c0.c1023 tclass=capability type=SYSCALL msg=audit(1234433821.879:6677): arch=40000003 syscall=190 success=yes exit=9600 a0=0 a1=804ca00 a2=257e a3=0 items=0 ppid=3701 pid=9598 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="cron" exe="/usr/sbin/cron" subj=system_u:system_r:crond_t:s0-s0:c0.c1023 key=(null)
Signature · 8 lines
[email protected] http://etbe.coker.com.au/ My Main Blog http://doc.coker.com.au/ My Documents Blog -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 6 lines · Russell Coker
I am seeing the cron daemon request capability
sys_admin. The below seems to indicate thatvfork()is the relevant operation (190 seems to be vfork according toia32entry.S).So how does
vfork()requiresys_admin?
Quoted 9 lines
type=AVC msg=audit(1234433821.879:6677): avc: denied {
sys_admin} for pid=9598 comm="cron" capability=21 scontext=system_u:system_r:crond_t:s0-s0:c0.c1023 tcontext=system_u:system_r:crond_t:s0-s0:c0.c1023 tclass=capability type=SYSCALL msg=audit(1234433821.879:6677): arch=40000003 syscall=190 success=yes exit=9600 a0=0 a1=804ca00 a2=257e a3=0 items=0 ppid=3701 pid=9598 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="cron" exe="/usr/sbin/cron" subj=system_u:system_r:crond_t:s0-s0:c0.c1023 key=(null)
Could be this test in kernel/fork.c:
if (atomic_read(&p->real_cred->user->processes) >=
p->signal->rlim[RLIMIT_NPROC].rlim_cur) {
if (!capable(CAP_SYS_ADMIN) && !capable(CAP_SYS_RESOURCE) &&
p->real_cred->user != INIT_USER)
goto bad_fork_free;
}Kernel version?
Signature · 8 lines
Stephen Smalley National Security Agency -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 9 lines · Stephen Smalley
Could be this test in
kernel/fork.c:
if (atomic_read(&p->real_cred->user->processes)>= p->signal->rlim[RLIMIT_NPROC].rlim_cur) { if (!capable(CAP_SYS_ADMIN) && !capable(CAP_SYS_RESOURCE) &&p->real_cred->user!=INIT_USER)
gotobad_fork_free;
}From a casual inspection of the code that seems to be a
vfork()called as root
before setgid() and setuid() are called.
Quoted 1 line
Kernel version?
The Debian packaged version of 2.6.26.
Below is the ulimit output. I restarted cron and received the same message. I have less than 300 processes on the machine in question, nothing near 12283.
# ulimit -a core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 12283 max locked memory (kbytes, -l) 32 max memory size (kbytes, -m) unlimited open files (-n) 1024 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 real-time priority (-r) 0 stack size (kbytes, -s) 8192 cpu time (seconds, -t) unlimited max user processes (-u) 12283 virtual memory (kbytes, -v) unlimited file locks (-x) unlimited # /etc/init.d/cron restart Restarting periodic command scheduler: crond.
Thanks for the pointer to the kernel code, but I'm still stuck trying to work out the real cause of this.
Signature · 9 lines
[email protected] http://etbe.coker.com.au/ My Main Blog http://doc.coker.com.au/ My Documents Blog -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.