Nagios Initial Setup with reverse proxy

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Post Reply
Easily3227
Posts: 2
Joined: Sun Jul 14, 2024 4:37 am

Nagios Initial Setup with reverse proxy

Post by Easily3227 »

Hi all,
I am very new to Nagios. I am trying to set it up to monitor some services I am self-hosting.
I have followed the official setup https://support.nagios.com/kb/article/n ... ml#Ubuntul (Ubuntu 22.04).
I can access Nagios at

Code: Select all

http://<publicIP>/nagios
However, I use Gravitational Teleport as my security gateway/reverse proxy. And as soon as I put teleport in front of nagios, I cannot access nagios.

Teleport works by having an agent installed on the same vm/vps that is running Nagios and any traffic coming from teleport looks to the machine/vm to be coming from localhost. From the same VM/VPS that is running nagios, I can run

Code: Select all

curl http://localhost/nagios/
and that works.

However, Teleport, cannot access localhost/nagios. (localhost) works though and shows the apache default page.

I assume it has something to do with the apache config (I don't know apache at all).
ScriptAlias /nagios/cgi-bin "/usr/local/nagios/sbin"

<Directory "/usr/local/nagios/sbin">
# SSLRequireSSL
Options ExecCGI
AllowOverride None
<IfVersion >= 2.3>
<RequireAll>
Require all granted
# Require host 127.0.0.1

#AuthName Nagios Access
#AuthType Basic
#AuthUserFile /usr/local/nagios/etc/htpasswd.users
#Require valid-user
</RequireAll>
</IfVersion>
<IfVersion < 2.3>
Order allow,deny
Allow from all
# Order deny,allow
# Deny from all
# Allow from 127.0.0.1

#AuthName Nagios Access
#AuthType Basic
#AuthUserFile /usr/local/nagios/etc/htpasswd.users
#Require valid-user
</IfVersion>
</Directory>

Alias /nagios "/usr/local/nagios/share"

<Directory "/usr/local/nagios/share">
# SSLRequireSSL
Options None
AllowOverride None
<IfVersion >= 2.3>
<RequireAll>
Require all granted
# Require host 127.0.0.1

#AuthName Nagios Access
#AuthType Basic
#AuthUserFile /usr/local/nagios/etc/htpasswd.users
#Require valid-user
</RequireAll>
</IfVersion>
<IfVersion < 2.3>
Order allow,deny
Allow from all
# Order deny,allow
# Deny from all
# Allow from 127.0.0.1

#AuthName Nagios Access
#AuthType Basic
#AuthUserFile /usr/local/nagios/etc/htpasswd.users
#Require valid-user
</IfVersion>
</Directory>
I am hoping someone can point me in the right direction.
Here is the apache config. It is the default one created from the default install of Nagios, however I have disabled all authentication as that will be handled by teleport.

I have also posted this on the Teleport forums. Thank you very much for any help.
bbahn
Posts: 189
Joined: Thu Jan 12, 2023 5:42 pm

Re: Nagios Initial Setup with reverse proxy

Post by bbahn »

Hello @Easily3227,

I'm not familiar with Gravitational Teleport, but your Apache configuration looks good to me.

Since this isn't working for you and your apache configuration is what's listed in your post, my guess is that Gravitational Teleport isn't routing to Apache properly (assuming you restarted apache to apply the configuration).

You can also check if it's the firewall with

Code: Select all

sudo ufw allow 'Apache Full'
Actively advancing awesome answers with ardent alliteration, aptly addressing all ambiguities. Amplify your acumen and avail our amicable assistance. Eagerly awaiting your astute assessments of our advice.
Easily3227
Posts: 2
Joined: Sun Jul 14, 2024 4:37 am

Re: Nagios Initial Setup with reverse proxy

Post by Easily3227 »

Thanks,

I had previously tried all that. I have no idea what is going on. But thanks for validating the Apache config:)
Post Reply