manios / docker-nagios

Docker image for Nagios Core in Alpine Linux with basic plugins, available for x86, x64 , ARM v6, ARM v7 and ARM64.
https://www.nagios.org/
Other
60 stars 28 forks source link

[Bug]: NAGIOSADMIN_USER env variable not set in cgi.cfg as authorized username #78

Closed pathia closed 3 months ago

pathia commented 3 months ago

What happened?

I got "It appears as though you do not have permission to view information for any of the services you requested..." whenever accessing the webpages of Nagios.

Image information

Image architecture

x86

Relevant log output

not needed.
This can be fixed by doing something like this in start_nagios.sh
sed -i "s|nagiosadmin|${NAGIOSADMIN_USER}|g" /opt/nagios/etc/cgi.cfg
manios commented 3 months ago

Hi @pathia !

To be honest at the first look I could not understand what is the problem that you describe. I managed to reproduce the issue by executing:

docker run -d --name nagios  \
  -e NAGIOSADMIN_USER="godmode" \
  -e NAGIOSADMIN_PASS="godmode"  \
  -p 0.0.0.0:8080:80  \
   manios/nagios:latest

Then after trying to see the Hosts and Services through the web interface I got the error shown:

It appears as though you do not have permission to view information for any of the hosts you requested...

If you believe this is an error, check the HTTP server authentication requirements for accessing this CGI
and check the authorization options in your CGI configuration file.

Thanks for your suggestion! A fix will come soon.

Best regards, Chris

pathia commented 3 months ago

Thanks!

manios commented 3 months ago

Good morning @pathia !

A new release build-22 is out with the fix. You can download it and test it with docker pull manios/nagios:latest or docker pull manios/nagios:build-22 or docker pull manios/nagios:4.5.4. Please let me know if the problem has been fixed.

Thanks, Chris

pathia commented 3 months ago

Good morning! Watchtower already downloaded it while I was asleep. Even though I already fixed it in my setup here I'll start over tonight and see how it goes. I looked at the code changes you did and it looked promising.

pathia commented 3 months ago

Hi Chris, I tested with a default cgi.cfg and it nicely replaced all the authorized_for entries with my configured username. Thanks for your quick response and action!