Page 1 of 1

The web site doesn´t take the credencials

Posted: Fri Sep 27, 2019 1:16 pm
by jguzzetti
Hi there! I´m trying to check the state of a internal web site in our company. The site needs to be authenticated by username and password but it doesn't have a login screen, it takes the credencials from the session of the user that is authenticated against the local pc or the browser, i´m not sure. When i passed my credencials by the param -a username:password the site doesn't take them as is expected. It allways return 401 (Not Authorized). The question is: is there a chance to pass the credencial like a cookie session? Or what is the way to authenticate against a site with this carateristic?
I´m using the plugin check_http

Thanks in advance.
Best regards!

Re: The web site doesn´t take the credencials

Posted: Fri Sep 27, 2019 1:50 pm
by cdienger
The site looks to be expecting NTLM authentication and the plugin is using basic. Try using:

https://exchange.nagios.org/directory/P ... lm/details

Re: The web site doesn´t take the credencials

Posted: Fri Sep 27, 2019 2:07 pm
by jguzzetti
All rigth, now I could authenticate against the site, but I don´t get the HTTP STATUS CODE, wich ir required by Opers to get them known if the site is running ok or not. Is there a way to authenticate with this protocal but get the status code too?
Output:
|ntlm=0;1;0;0OK

Re: The web site doesn´t take the credencials

Posted: Fri Sep 27, 2019 2:15 pm
by ssax
Please see here:

https://support.nagios.com/forum/viewto ... 07#p229207
-- Let us know if you have trouble viewing it

Use the plugin attached though.

Let us know if you have any questions.

Re: The web site doesn´t take the credencials

Posted: Mon Sep 30, 2019 8:31 am
by jguzzetti
OK, i can authenticate now against the site but i¿m steel not getting the HTTP STATUS CODE wich is required to be sure about the page's health.
Attached the command and the output. I don't see an option at the plugin to get the status code, i search for it by passing the search string with -s argument.

Re: The web site doesn´t take the credencials

Posted: Mon Sep 30, 2019 12:04 pm
by mbellerue
The best way to get the status code from the page is by using the -s argument the way that you used it. There isn't a specific flag for grabbing the status code. Will -s not work for your purposes?

Re: The web site doesn´t take the credencials

Posted: Mon Sep 30, 2019 3:02 pm
by jguzzetti
Thanks a million! I could get the search string 'HTTP/1.1 200' and with this plugin I can authenticate at the site.
You can close this issue, very appreciate your help.