monitoring HTTPS URL with authentication

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
naranant
Posts: 90
Joined: Tue Oct 24, 2017 10:50 am

monitoring HTTPS URL with authentication

Post by naranant »

Hello,

I am trying to monitor https URL with authentication. The URL check is coming Ok even after putting the wrong password. Below is the result after running the command.

[[email protected] ~]$ /usr/local/nagios/libexec/check_http -H lxxxxx-test.xxxxy.com -f ok -I 1xx.1xx.1Xx.x -u '/' -S -p 443 -a 'XXXXXXXMIN:SXXXXXy_123456'
HTTP OK: HTTP/1.1 200 OK - 4053 bytes in 0.083 second response time |time=0.083421s;;;0.000000 size=4053B;;;0

Screenshot is also attached. Please advise on this..
You do not have the required permissions to view the files attached to this post.
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: monitoring HTTPS URL with authentication

Post by mcapra »

What type of authentication is used with the destination URL? Is it basic authentication?

You might try running that command from the CLI of your Nagios XI machine and passing in the -v argument to get the full-page output for additional troubleshooting. The web page is returning a 200, which leads me to believe something other than basic authentication is being used or the HTTP server isn't correctly configured.
Former Nagios employee
https://www.mcapra.com/
kyang

Re: monitoring HTTPS URL with authentication

Post by kyang »

Thanks for the help @mcapra!

He's right, is this basic authentication?

naranant, please show us the ouput when using -v. Otherwise, you should be able to find out what's going on.

Let us know!
naranant
Posts: 90
Joined: Tue Oct 24, 2017 10:50 am

Re: monitoring HTTPS URL with authentication

Post by naranant »

@mcapra thank you for your response. Yes its using basic authentication.

I am uploading the output by using -v arguemnt. i have masked few values hope that is fine.

Let me know how we can make the authentication as mandatory.
You do not have the required permissions to view the files attached to this post.
kyang

Re: monitoring HTTPS URL with authentication

Post by kyang »

Wait, is this when you are using the correct password or the wrong password?

You are using an older version of the plugin.

I don't know if it will make a difference, but maybe try updating the check_http plugin to the 2.2.1 version. To rule that out.

I did a test with on my Nagios Core, which uses basic auth. Providing a wrong password and a correct password.

Here are my outputs.

Code: Select all

[root@localhost libexec]# ./check_http -H 192.168.4.174 -u'/nagios' -a 'nagiosadmin:welcome' -v
GET /nagios HTTP/1.1
User-Agent: check_http/v2.2.1.git (nagios-plugins 2.2.1)
Connection: close
Host: 192.168.4.174
Accept: */*
Authorization: Basic bmFnaW9zYWRtaW46d2VsY29tZQ==


http://192.168.4.174:80/nagios is 448 characters
STATUS: HTTP/1.1 301 Moved Permanently
**** HEADER ****
Date: Wed, 27 Dec 2017 17:41:06 GMT
Server: Apache
Location: http://192.168.4.174/nagios/
Content-Length: 236
Connection: close
Content-Type: text/html; charset=iso-8859-1
**** CONTENT ****
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="http://192.168.4.174/nagios/">here</a>.</p>
</body></html>

HTTP OK: HTTP/1.1 301 Moved Permanently - 448 bytes in 0.001 second response time |time=0.001355s;;;0.000000 size=448B;;;0
Correct PW.

Code: Select all

[root@localhost libexec]# ./check_http -H 192.168.4.174 -u'/nagios' -a 'nagiosadmin:welc' -v
GET /nagios HTTP/1.1
User-Agent: check_http/v2.2.1.git (nagios-plugins 2.2.1)
Connection: close
Host: 192.168.4.174
Accept: */*
Authorization: Basic bmFnaW9zYWRtaW46d2VsYw==


http://192.168.4.174:80/nagios is 595 characters
STATUS: HTTP/1.1 401 Unauthorized
**** HEADER ****
Date: Wed, 27 Dec 2017 17:41:48 GMT
Server: Apache
WWW-Authenticate: Basic realm="Nagios Access"
Content-Length: 381
Connection: close
Content-Type: text/html; charset=iso-8859-1
**** CONTENT ****
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>401 Unauthorized</title>
</head><body>
<h1>Unauthorized</h1>
<p>This server could not verify that you
are authorized to access the document
requested.  Either you supplied the wrong
credentials (e.g., bad password), or your
browser doesn't understand how to supply
the credentials required.</p>
</body></html>

HTTP WARNING: HTTP/1.1 401 Unauthorized - 595 bytes in 0.001 second response time |time=0.001174s;;;0.000000 size=595B;;;0
Wrong PW.
naranant
Posts: 90
Joined: Tue Oct 24, 2017 10:50 am

Re: monitoring HTTPS URL with authentication

Post by naranant »

@Kyang: I have tried with both correct and wrong password but the output remains the same.

Can you provide me the link for the new version of HTTP plugin I can give a try with that?
kyang

Re: monitoring HTTPS URL with authentication

Post by kyang »

Here's the link to our kb article and our Github for installing/updating the nagios plugins.

https://support.nagios.com/kb/article.php?id=569#CentOS

https://github.com/nagios-plugins/nagios-plugins
naranant
Posts: 90
Joined: Tue Oct 24, 2017 10:50 am

Re: monitoring HTTPS URL with authentication

Post by naranant »

@Kynag: I have tried same after updating the http plugin. but it didnt made any difference. the URL Status is OK even after entering the wrong password.
Please advise..
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: monitoring HTTPS URL with authentication

Post by npolovenko »

@naranant, Can you remove the redirect -f ok flag and try your command one more time?
I have also noticed that you're using both -H lXXXX-test.sXXXXy.com and -I 1XX.1XX.1XX.12. Please leave only -H 1XX.1XX.1XX.12 (with the IP address).
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
naranant
Posts: 90
Joined: Tue Oct 24, 2017 10:50 am

Re: monitoring HTTPS URL with authentication

Post by naranant »

@npolovenko : I tried with this option but the results seem to be same.

[root@lxxxxxxx4-xx nagios-plugins-2.1.1]# /usr/local/nagios/libexec/check_http -H 1Xx.1Xx.1xx.XX -u '/' -S -p 443 -a 'SXXXN:SXXX'
HTTP OK: HTTP/1.1 200 OK - 4053 bytes in 0.087 second response time |time=0.086586s;;;0.000000 size=4053B;;;0
Locked