Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 528184 - net-analyzer/nagios-core-3.5.1 - Could not open CGI config file '/etc/nagios/cgi.cfg' for reading
Summary: net-analyzer/nagios-core-3.5.1 - Could not open CGI config file '/etc/nagios/...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Server (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Andrew Hamilton
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-03 22:53 UTC by W. Trevor King
Modified: 2014-11-22 21:52 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description W. Trevor King 2014-11-03 22:53:38 UTC
When installed with lighttpd, CGI-backed pages give 404s with:

  Error: Could not open CGI config file '/etc/nagios/cgi.cfg' for reading!

It seems like this has been going on since 2005 [1].  I'm not sure what the secrets are that the restrictive 0750 mode for /etc/nagios is protecting, but here are some possible solutions:

a. Use 755 (or the default directory mode) for /etc/nagios, and use restrictive modes for any sensitive files instead,
b. Add the webserver user to the nagios group, or
c. Chown /etc/nagios to be nagios:${webserver} (as the ebuild already does for "${D}"/var/nagios/rw).

[1]: http://forums.gentoo.org/viewtopic-t-407334-highlight-nagios.html

Reproducible: Always

Steps to Reproduce:
From a fresh stage3 with Portage:

1. echo 'media-libs/gd jpeg png' >> /etc/portage/package.use
2. echo 'net-analyzer/nagios-core lighttpd' >> /etc/portage/package.use
3. echo 'net-analyzer/nagios-plugins nagios-dns nagios-ntp nagios-ssh' >> /etc/portage/package.use
4. echo 'dev-lang/php cgi' >> /etc/portage/package.use
5. emerge -v net-analyzer/nagios
8. echo 'include "mod_fastcgi.conf"' >> /etc/lighttpd/lighttpd.conf
9. echo 'include "syslog.conf"' >> /etc/lighttpd/lighttpd.conf
10. # drop the auth stuff from /etc/lighttpd/nagios.conf
11. echo 'include "nagios.conf"' >> /etc/lighttpd/lighttpd.conf
12. sed -i 's|\(#use_timezone=Australia/Brisbane\)|\1\nuse_timezone=UTC|' /etc/nagios/nagios.cfg
13. sed -i 's|\(;date.timezone.*\)|\1\ndate.timezone = "UTC"|' /etc/php/*/php.ini
14. rc-update add nagios default
15. rc-update add lighttpd default
16. rc default
17. Browse to http://localhost/nagios/cgi-bin/tac.cgi

Actual Results:  
Error: Could not open CGI config file '/etc/nagios/cgi.cfg' for reading!


Expected Results:  
A tactical monitoring overview.
Comment 1 W. Trevor King 2014-11-03 22:56:52 UTC
Possibly related to [1], although #453626 also talks about .htaccess files.

[1]: https://bugs.gentoo.org/show_bug.cgi?id=453626
Comment 2 Michael Orlitzky gentoo-dev 2014-11-22 21:49:47 UTC
Hello, I have implemented your option (b) in the latest nagios 4.x series. I've tested with the out-of-the-box config using both apache and lighttpd, and they should both start right up.

If the issue isn't fixed for you, please feel free to reopen this.
Comment 3 Michael Orlitzky gentoo-dev 2014-11-22 21:52:35 UTC
Sorry, option *c*.