0

I'm using the http_check Nagios plugin to monitor an URL and I'd like to test if the login is working given specific user and password.

I've made several attempts with different approaches but none of them seems to validate the given authentication.

First I tried to submit HTTP POST data.

Check command:

./check_http '-u' 'https://myurlexample.com' '-P' 'userName=myUser&password=myWrongPass' '-T' 'text/html' '--sni'

Reply:

HTTP OK: HTTP/1.1 307 Temporary Redirect - 583 bytes in 0.009 second response time |time=0.008551s;;;0.000000;10.000000 size=583B;;;0

I've tried changing the '-T' parameter but the results were always positive, which either means this does not work as I thought it would or I'm missing some parameter.

The second approach was to use the authorization parameter + return code expected from the nginx server.

Check command:

./check_http '-u' 'https://myurlexample.com' '-a' 'myUser:myWrongPass' '-e' '302' '--sni'

Reply:

HTTP OK: Status line output matched "302" - 570 bytes in 0.005 second response time

The only reply I get is a 302, which means it does not validate the password.

The server does use openSSL 1.0.2 but any attempts on using the parameter I get a negative reply.

Check command:

./check_http '-u' 'https:myurlexample.com' '--ssl=1' '-a' 'user:password' '--sni'

Reply:

140701537494960:error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number:s3_pkt.c:365:

Is there a way I can validate the login using this plugin? The result I expected would be a negative reply of some kind indicating that the login was not possible.

1 Answer 1

0

Try following

check_http -S -H $HOSTNAME -u $URL -P "$USERFIELD=$USERNAME&$PWDFIELD=$PWD"

  • -S to use SSL
  • -H Hostname
  • -u URL containing the login form
  • -P POST
  • For USERFIELD & PWDFIELD, you'll need to inspect your page source to get User and Password fields. In my tests it was username and password

Here's an example of my test command for user foo with password bar:

check_http -S -H myurlexample.com -u /auth -P "username=foo&password=bar"

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.