Page 1 of 2
monitoring HTTPS URL with authentication
Posted: Tue Dec 26, 2017 4:06 pm
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..
Re: monitoring HTTPS URL with authentication
Posted: Wed Dec 27, 2017 9:08 am
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.
Re: monitoring HTTPS URL with authentication
Posted: Wed Dec 27, 2017 10:27 am
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!
Re: monitoring HTTPS URL with authentication
Posted: Wed Dec 27, 2017 12:12 pm
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.
Re: monitoring HTTPS URL with authentication
Posted: Wed Dec 27, 2017 12:43 pm
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.
Re: monitoring HTTPS URL with authentication
Posted: Wed Dec 27, 2017 1:24 pm
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?
Re: monitoring HTTPS URL with authentication
Posted: Wed Dec 27, 2017 1:34 pm
by kyang
Re: monitoring HTTPS URL with authentication
Posted: Fri Dec 29, 2017 12:47 pm
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..
Re: monitoring HTTPS URL with authentication
Posted: Fri Dec 29, 2017 12:57 pm
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).
Re: monitoring HTTPS URL with authentication
Posted: Tue Jan 09, 2018 3:06 pm
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