WebInject and .aspx pages?

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: WebInject and .aspx pages?

Post by rkennedy »

Can you show us the full input/output? What are the permissions on server-config.xml?
Former Nagios Employee
jsharris
Posts: 123
Joined: Wed Jul 03, 2013 7:00 am

Re: WebInject and .aspx pages?

Post by jsharris »

Input is "./webinject.pl -c /server-config.xml"
Output is "ERROR: Failed to open server-config.xml file"

Permissions on both the config and case file are rw-r--r-- with an owner of "apache". They both were originally set to an owner of "root" but the others we have running successfully use the apache owner configuration. Both owners result in the same output. I am logged on to the server as root.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: WebInject and .aspx pages?

Post by rkennedy »

What are the contents of server-config.xml?

I just tried to replicate what you're seeing, using the files provided in the zip, and I'm not able to replicate this.

Code: Select all

[root@localhost webinject-ntlm]# ./webinject.pl -c server-config.xml
WebInject CRITICAL - Unable to acces at http://ntlm-website |time=0.244;20;;0
[root@localhost webinject-ntlm]# ./webinject.pl -c /server-config.xml
WebInject CRITICAL - Unable to acces at http://ntlm-website |time=0.048;20;;0
[root@localhost webinject-ntlm]# ls -l
total 140
-rw-r--r-- 1 root nagios   224 Jan 20  2011 server-config.xml
-rw-r--r-- 1 root nagios   255 Jan 20  2011 server.xml
-rw-r--r-- 1 root nagios   681 Jan 20  2011 test.pl
-rwxr-xr-x 1 root nagios 64970 Jan 20  2011 webinject.pl
-rw-r--r-- 1 root nagios 63856 Jan 20  2011 webinject.pl.debug
Former Nagios Employee
jsharris
Posts: 123
Joined: Wed Jul 03, 2013 7:00 am

Re: WebInject and .aspx pages?

Post by jsharris »

server-config.xml is currently:

Code: Select all

<testcasefile>cases_ALVAReports.xml</testcasefile>
<useragent>Nagios</useragent>
<httpauth>http://<servername>/Reports/Pages/Folder.aspx?ItemPath=%2fAlva+Reports&ViewMode=Listclear:80::DOMAIN\account:password</httpauth>
<timeout>10</timeout>
<globaltimeout>20</globaltimeout>
<reporttype>nagios</reporttype>
The server-config.xml and case file are both located at /usr/local/nagiosxi/etc/components/webinject with the webinject.pl file located with the rest of the Nagios plugin files. I tried the above file configuration with both the full URL in <httpauth> and the ntlm-website value it was originally configured with.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: WebInject and .aspx pages?

Post by ssax »

I've seen older versions of the plugin put the XML files in /usr/local/nagios/libexec, do you see any of the test files in there?
jsharris
Posts: 123
Joined: Wed Jul 03, 2013 7:00 am

Re: WebInject and .aspx pages?

Post by jsharris »

/usr/local/Nagios/libexec is the current location for the plugin files (webinject.pl, webinject.pl.debug, and test.pl). I put the server-config.xml and server.xml files there and retried it with the following result:

Code: Select all

Starting WebInject Engine...

-------------------------------------------------------

junk after document element at line 2, column 0, byte 40 at /usr/lib64/perl5/XML/Parser.pm line 187
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: WebInject and .aspx pages?

Post by rkennedy »

Can you try running the webinject.pl script with the default server-config.xml and server.xml files as a test real quick? I'd like to rule out that everything is setup properly on your system before making changes to the configuration files.

Looking at the default server-config.xml file, I see this -

Code: Select all

<httpauth>ntlm-website:80::DOMAIN\Login:Password</httpauth>
I see you're using -

Code: Select all

<httpauth>http://<servername>/Reports/Pages/Folder.aspx?ItemPath=%2fAlva+Reports&ViewMode=Listclear:80::DOMAIN\account:password</httpauth>
Can you try removing the http:// part, this could be causing the error (as : seem to be a delimiter).

Lastly, can you please post the cases_ALVAReports.xml file?
Former Nagios Employee
jsharris
Posts: 123
Joined: Wed Jul 03, 2013 7:00 am

Re: WebInject and .aspx pages?

Post by jsharris »

No luck; tried removing http: and http://. Also saw that I was running only webinject.pl server-config.xml instead of webinject.pl -c server-config.xml. The second has virtually the same error; different line information and no "Starting webinject engine":

Code: Select all

junk after document element at line 3, column 0, byte 130 at /usr/lib64/perl5/XML/Parser.pm line 187
Contents of config_ALVAReports.xml:

Code: Select all

<testvar varname="URL">http://<server>/Reports/Pages/Folder.aspx?ItemPath=%2fAlva+Reports&ViewMode=Listclear</testvar>

<case
    id="1"
    description1="NTLM"
    method="get"
    url="${URL}"
    verifypositive="Reporting"
    errormessage="Unable to access at ${URL}"
/>

</testcases>
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: WebInject and .aspx pages?

Post by rkennedy »

Just to verify - did you run the the plugin with the default included server-config.xml and server.xml? I'm not seeing issues on my end running the default way -

Code: Select all

[root@localhost webinject-ntlm]# ./webinject.pl -c server-config.xml
WebInject CRITICAL - Unable to acces at http://ntlm-website |time=0.222;20;;0
As there is limited debugging available here, I'd like to make sure the script can actually run on your system (and we're not just hitting errors with the configuration) -- otherwise, it seems we're hitting a perl issue.

Also - your server.xml seems to be missing the initial <testcases> tag, as you can see below is the original one. You have a </testcases>, but not an initial one.

Code: Select all

<testcases repeat="1">

<testvar varname="URL">http://ntlm-website</testvar>

<case
    id="1"
    description1="NTLM"
    method="get"
    url="${URL}"
    verifypositive="WORD"
    errormessage="Unable to acces at ${URL}"
/>

</testcases>
Former Nagios Employee
jsharris
Posts: 123
Joined: Wed Jul 03, 2013 7:00 am

Re: WebInject and .aspx pages?

Post by jsharris »

Results with the default files (same as you provided now that the files are all in the same location; webinject doesn't seem to like files elsewhere even if the full path is provided):

Code: Select all

WebInject CRITICAL - Unable to acces at http://ntlm-website |time=0.098;20;;0
As for the testcases tag, is <testcases repeat="1"> not the opening tag? That is what is in the default file.
Locked