Friday, May 29, 2009

Tips on nagios installation to bypass selinux

I installed a nagios3 monitoring on a centos 5 server, forgot to disable SELinux and I encountered some issue related to cgi and running external command. so here are some commands that can help without the need to restart the server.

Instead of disabling SELinux or setting it to permissive mode, you can use the following command to run the CGIs under SELinux enforcing/targeted mode:

chcon -R -t httpd_sys_content_t /usr/local/nagios/sbin/
chcon -R -t httpd_sys_content_t /usr/local/nagios/share/

ref: nagios documentation - specific to fedora



chcon -R -t httpd_sys_script_rw_t /usr/local/nagios/var/rw/

ref: http://www.mail-archive.com/nagios-users@lists.sourceforge.net/msg14819.html

This allows the running of external command.

Btw, I installed nagios from source that is why the path referred to /usr/local/nagios.

hope it can help me next time. :D