Page 1 of 1

CGI Error on Centos 7

Posted: Thu Sep 21, 2017 5:15 pm
by klingsor
I have installed nagios core 4.3.2-8.el7 from epel and done the SELinux config suggested by the startup script. Subsequently the nagios daemon started and looks ok:

Code: Select all

nagios.service - Nagios Network Monitoring
   Loaded: loaded (/usr/lib/systemd/system/nagios.service; disabled)
   Active: active (running) since Thu 2017-09-21 22:56:33 CEST; 1h 11min ago
     Docs: https://www.nagios.org/documentation/
  Process: 11601 ExecStopPost=/bin/rm -f /var/spool/nagios/cmd/nagios.cmd (code=exited, status=0/SUCCESS)
  Process: 11599 ExecStopPost=/bin/rm -f /var/spool/nagios/status.dat (code=exited, status=0/SUCCESS)
  Process: 11596 ExecStopPost=/bin/rm -f /var/run/nagios/nagios.pid (code=exited, status=0/SUCCESS)
  Process: 11595 ExecStopPost=/usr/bin/rm -f /var/spool/nagios/cmd/nagios.cmd (code=exited, status=0/SUCCESS)
  Process: 11605 ExecStart=/usr/sbin/nagios -d /etc/nagios/nagios.cfg (code=exited, status=0/SUCCESS)
  Process: 11603 ExecStartPre=/usr/sbin/nagios -v /etc/nagios/nagios.cfg (code=exited, status=0/SUCCESS)
 Main PID: 11606 (nagios)
   CGroup: /system.slice/nagios.service
           ├─11606 /usr/sbin/nagios -d /etc/nagios/nagios.cfg
           ├─11607 /usr/sbin/nagios --worker /var/spool/nagios/cmd/nagios.qh
           ├─11608 /usr/sbin/nagios --worker /var/spool/nagios/cmd/nagios.qh
           ├─11609 /usr/sbin/nagios --worker /var/spool/nagios/cmd/nagios.qh
           ├─11610 /usr/sbin/nagios --worker /var/spool/nagios/cmd/nagios.qh
           ├─11611 /usr/sbin/nagios --worker /var/spool/nagios/cmd/nagios.qh
           ├─11612 /usr/sbin/nagios --worker /var/spool/nagios/cmd/nagios.qh
           └─11613 /usr/sbin/nagios -d /etc/nagios/nagios.cfg
Still the nagios home page shows "Unable to get process status" and "End of script output before headers" is written to the apache error log. Setting SELinux to permissive does not help and the permissions seem ok, as installed by RPM.
Any suggestions where to start looking?

Re: CGI Error on Centos 7

Posted: Fri Sep 22, 2017 9:51 am
by scottwilkerson
Does the rest of the UI work correctly? It is possible that the RPM packagers missed something when creating the SELinux context that is required for the pid check on the landing page.

Re: CGI Error on Centos 7

Posted: Fri Sep 22, 2017 11:44 pm
by klingsor
Actually all CGI calls out of Apache fail and "Internal Server Error" being displayed.

Re: CGI Error on Centos 7

Posted: Mon Sep 25, 2017 3:30 am
by klingsor
Calling the Scripts from the sidebar links results in HTTP 500, i.e. nothing in the GUI works. Calling the scripts directly from command line works fine, though.

Re: CGI Error on Centos 7

Posted: Mon Sep 25, 2017 10:36 am
by scottwilkerson
If you run the following is there any clue in the httpd logs?

Code: Select all

tail -100 /var/log/httpd/error_log
If not could you zip up and post the contents of the /etc/httpd/conf.d

Re: CGI Error on Centos 7

Posted: Mon Sep 25, 2017 2:38 pm
by klingsor
Thanks for pointing me to the httpd config, the problem was setting SuexecUserGroup for another application on server level.
Now it will work, but only when setting SELinux to permissive. Did I miss something on installation?

Re: CGI Error on Centos 7

Posted: Mon Sep 25, 2017 4:10 pm
by scottwilkerson
klingsor wrote:Now it will work, but only when setting SELinux to permissive. Did I miss something on installation?
This is going to be required for the apache user to be able to access some required files

Re: CGI Error on Centos 7

Posted: Wed Sep 27, 2017 5:26 am
by klingsor
Obviously, guess I will then have to either grep through the audit logs until everything works, or look for a policy package to install. Thanks for helping out anyway, much appreciated.