Saturday, August 4, 2018

Centos 7 - SELinux and Crontab


Updated my Centos 7 and noticed a few days later, the root crontab not working.

Looking at the cron logs showed:

Unauthorized SELinux context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 file_context=system_u:object_r:unlabeled_t:s0 (/var/spool/cron/root)

Doing a ls -Z on that directory showed:

ls -Z /var/spool/cron/root

-rw-------. root root system_u:object_r:unlabeled_t:s0 /var/spool/cron/root

Well, there is the problem, unlabeled_t. I eventually fixed it by simply editing the crontab with crontab -e, and saving the changes, it was then fixed:

ls -Z /var/spool/cron/root

-rw-------. root root unconfined_u:object_r:user_cron_spool_t:s0 /var/spool/cron/root

Certainly and annoying bug, at least it had an easy fix.