Page 1 of 3

WebInject and .aspx pages?

Posted: Wed Mar 23, 2016 9:21 am
by jsharris
We are using WebInject to check web pages for content. Every check works fine except for two .aspx pages. We can view the page without issue and when I view the source in my browser I see the text we are checking against. However, when Nagios checks using check_webinject it returns a failure. Has anyone been able to successfully check for text on something like this?

Re: WebInject and .aspx pages?

Posted: Wed Mar 23, 2016 12:21 pm
by rkennedy
Can you post your webinject data, and source for the page for us to take a look at?

Also, what error message are you seeing currently?

Re: WebInject and .aspx pages?

Posted: Wed Mar 23, 2016 12:59 pm
by jsharris
Returned by Nagios:

Code: Select all

COMMAND: /usr/local/nagios/libexec/check_webinject.sh config_ALVAReports.xml
OUTPUT: WebInject CRITICAL - Test case number 1 failed |time=0.145;30;;0

Test case configuration:

Code: Select all

<testcases>
<case
    id="1"
    description1="ALVA Reports check"
    method="get"
    url="http://<server>/Reports/Pages/Folder.aspx?ItemPath=%2fAlva+Reports&ViewMode=Listclear"
    verifypositive="report"
/>
</testcases>
Source info is attached.

Re: WebInject and .aspx pages?

Posted: Wed Mar 23, 2016 3:25 pm
by tmcdonald
Try saving the check and letting it run normally - The Test Check Command button is not always 100% accurate since it is run by the apache user instead of nagios.

Re: WebInject and .aspx pages?

Posted: Thu Mar 24, 2016 6:43 am
by jsharris
Same result. Still "WebInject CRITICAL - Test case number 1 failed". I just tried wget from the command line on the Nagios server and it looks like the server is refusing the connection as unauthorized. Are you aware of a means of providing alternate credentials for use in a WebInject test?

Re: WebInject and .aspx pages?

Posted: Thu Mar 24, 2016 11:02 am
by rkennedy
This varies based on the type of authentication. What is the output of curl -v "http://<server>/Reports/Pages/Folder.aspx?ItemPath=%2fAlva+Reports&ViewMode=Listclear" and curl -v "http://<server>/Reports/Pages/Folder.aspx?ItemPath=%2fAlva+Reports&ViewMode=Listclear" -u "u:p"?

Re: WebInject and .aspx pages?

Posted: Thu Mar 24, 2016 12:48 pm
by jsharris
Without credentials:

Code: Select all

[root@nagiosserver libexec]# curl -v "http://<server>/Reports/Pages/Folder.aspx?ItemPath=%2fAlva+Reports&ViewMode=Listclear"
* About to connect() to <server> port 80 (#0)
*   Trying a.b.c.d... connected
* Connected to <server> (a.b.c.d) port 80 (#0)
> GET /Reports/Pages/Folder.aspx?ItemPath=%2fAlva+Reports&ViewMode=Listclear HTTP/1.1
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.13.6.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: <server>
> Accept: */*
>
< HTTP/1.1 401 Unauthorized
< Content-Length: 0
< WWW-Authenticate: NTLM
< Date: Thu, 24 Mar 2016 17:43:27 GMT
<
* Connection #0 to host <server> left intact
* Closing connection #0

With credentials:

Code: Select all

[root@nagiosserver libexec]# curl -v "http://<server>/Reports/Pages/Folder.aspx?ItemPath=%2fAlva+Reports&ViewMode=Listclear" -u "domain\account:password"
* About to connect() to <server> port 80 (#0)
*   Trying a.b.c.d... connected
* Connected to <server> (a.b.c.d) port 80 (#0)
* Server auth using Basic with user 'domain\account'
> GET /Reports/Pages/Folder.aspx?ItemPath=%2fAlva+Reports&ViewMode=Listclear HTTP/1.1
> Authorization: Basic Y29ycFxhZG1pbmlzdHJhdG9yOnF2Y2hzbmEyZQ==
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.13.6.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: <server>
> Accept: */*
>
< HTTP/1.1 401 Unauthorized
< Content-Length: 0
< WWW-Authenticate: NTLM
< Date: Thu, 24 Mar 2016 17:43:31 GMT
<
* Connection #0 to host <server> left intact
* Closing connection #0

Re: WebInject and .aspx pages?

Posted: Thu Mar 24, 2016 4:49 pm
by rkennedy
The line we're interested in here is going to be -

Code: Select all

< WWW-Authenticate: NTLM
It looks like you're running NTLM authentication, and you're in luck! We have a plugin on our exchange that should support it. https://exchange.nagios.org/directory/P ... LM/details

Give this a try. I reccomend testing it over the CLI before Nagios XI.

Re: WebInject and .aspx pages?

Posted: Mon Mar 28, 2016 8:08 am
by jsharris
I'll give it a try. Thanks!

Re: WebInject and .aspx pages?

Posted: Mon Mar 28, 2016 8:49 am
by jsharris
I am sure I am missing something simple but when I try from the command line I get "ERROR: Failed to open server-config.xml" (also tried with the full file path for server-config.xml). When trying from the Nagios GUI the output returned is blank.