I was trying to deploy Nagios on a VM running CentOS 7, and as most, ran into "Could not stat() nagios.cmd" problem. I did set permissions for users apache and nagios to acccess the file, and now am fighting with SELinux to both allow apache and nagios to modify the command file. The apparent problem is, Nagios got installed to /usr/local/nagios
instead of /usr/lib/nagios
which seems to be the predefined location for Nagios, based on /etc/selinux/targeted/contexts/files/file_contexts
content. Currently, Apache process already running as httpd_t
, while Nagios processes are running under initrc_t
(default started by init) context. Current folder settings are all files under system_u:object_r:usr_t:s0
context, starting from /usr/local/nagios
and below.
So, I wonder, what context (user, role, type) I should set and where, regarding Nagios files, so I can safely enable SELinux and not run into either Nagios not starting, or Apache not able to modify the command file?