I am looking to check a site using NTLM auth and was unable to get anything to work. I searched this forum and found this thread but the results are not correct. I am trying to check a URL satmr1t.domain.com/TT/sitestatus.aspx which is reading a database call and to verify things are working will display this on the page:
TT Site Status
SQL Check Fourteen: 14
So I need to use a service account in our AD, _satmr_t, to view the page and if 14 exists all is good with the world. If 14 doesn't appear then I need a critical response and notification should get dispatched. Again, I ran across this thread but the script doesn't appear to be working correctly. See below results.
Code: Select all
[nagios@nagiosserver libexec]$ ./check_ntlm_website.sh -u 'domain\_satmr_t' -p 'sp\!pru6h' -U 'satmr1t.domain.com/TT/sitestatus.aspx' -s '14'
OK - Authenticated Successfully.
Good
[nagios@nagiosserver libexec]$ ./check_ntlm_website.sh -u 'domain\_satmr_t' -p 'sp\!pru6h' -U 'satmr1t.domain.com/TT/sitestatus.aspx' -s '12'
OK - Authenticated Successfully.
Not good should be critical as 12 is not present.
[nagios@nagiosserver libexec]$ ./check_ntlm_website.sh -u 'domain\_satmr_t' -p 'sp!pru6h' -U 'satmr1t.domain.com/TT/sitestatus.aspx' -s '12'
OK - Authenticated Successfully.
Not OK, I removed the \ in front of the special character but 12 is on the page.
[nagios@nagiosserver libexec]$ ./check_ntlm_website.sh -u 'domain\_satmr_t' -p 'sp!pru6' -U 'satmr1t.domain.com/TT/sitestatus.aspx' -s '12'
OK - Authenticated Successfully.
Same as above
[nagios@nagiosserver libexec]$ ./check_ntlm_website.sh -u 'domain\_satmr_q' -p 'sp!pru6' -U 'satmr1t.domain.com/TT/sitestatus.aspx' -s '12'
OK - Authenticated Successfully.
Not OK, this user doesn't exist.
Am I using this correctly? I cannot get a critical on anything I try but everything is OK - Authenticated Successfully.
curl
http://satmr1t.domain.com/TT/sitestatus.aspx -v
* About to connect() to satmr1tdomain.com port 80 (#0)
* Trying IP_of_website... connected
* Connected to satmr1t.domain.com (IP_of_website) port 80 (#0)
> GET /TT/sitestatus.aspx HTTP/1.1
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.27.1 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: satmr1t.domain.com
> Accept: */*
>
< HTTP/1.1 401 Unauthorized
< Content-Type: text/html
< Server: Microsoft-IIS/7.5
< WWW-Authenticate: Negotiate
< WWW-Authenticate: NTLM
< WWW-Authenticate: Basic realm="satmr1t.domain.com"
< X-Powered-By: ASP.NET
< Date: Wed, 09 Aug 2017 13:11:52 GMT
< Content-Length: 1293
<
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<title>401 - Unauthorized: Access is denied due to invalid credentials.</title>
<style type="text/css">
<!--
body{margin:0;font-size:.7em;font-family:Verdana, Arial, Helvetica, sans-serif;background:#EEEEEE;}
fieldset{padding:0 15px 10px 15px;}
h1{font-size:2.4em;margin:0;color:#FFF;}
h2{font-size:1.7em;margin:0;color:#CC0000;}
h3{font-size:1.2em;margin:10px 0 0 0;color:#000000;}
#header{width:96%;margin:0 0 0 0;padding:6px 2% 6px 2%;font-family:"trebuchet MS", Verdana, sans-serif;color:#FFF;
background-color:#555555;}
#content{margin:0 0 0 2%;position:relative;}
.content-container{background:#FFF;width:96%;margin-top:8px;padding:10px;position:relative;}
-->
</style>
</head>
<body>
<div id="header"><h1>Server Error</h1></div>
<div id="content">
<div class="content-container"><fieldset>
<h2>401 - Unauthorized: Access is denied due to invalid credentials.</h2>
<h3>You do not have permission to view this directory or page using the credentials that you supplied.</h3>
</fieldset></div>
</div>
</body>
</html>
* Connection #0 to host satmr1t.domain.com left intact
* Closing connection #0