Is it possible to bypass http authentication?

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
kalianto
Posts: 7
Joined: Sun Apr 28, 2013 11:29 pm

Is it possible to bypass http authentication?

Post by kalianto »

Hi guys,

I am sure many will agree that the http authentication is a bit annoying albeit mandatory.
I am integrating nagios core web interface with other application, and I wish I could just bypass the http authentication without setting default username in the config file.

The ideal scenario will be:
1. User is authenticated into the external application.
2. Based on the user's role, we use the "nagiosadmin" or "nagiosuser" details to login to Nagios core web interface without popping up the authentication dialog.

I have tried using AJAX, CURL, and PEAR::HTTP_Request in php but still can't prevent the dialog box from showing especially in Chrome.
Some people suggest making the server returns 403 instead of 401, or even supply custom Authorization challenge

I understand that NagiosXI is using some kind of proxy, judging by the file called coreproxy.inc (or something similar).

Has anyone succeeded in doing so without using proxy?

Thank you very much!
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Is it possible to bypass http authentication?

Post by abrist »

I tested the following and it works (just not in IE though):

Code: Select all

http://username:[email protected]/nagios
Note: This is the standard way of handling automatic logins for htpasswd (basic auth) protected sites.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
kalianto
Posts: 7
Joined: Sun Apr 28, 2013 11:29 pm

Re: Is it possible to bypass http authentication?

Post by kalianto »

Thank you, abrist.

Code: Select all

 http://username:[email protected]/nagios 
That actually works, I can confirm it.
For IE 9, I think I use something like this in PHP to make it works.

Code: Select all

 header('P3P: CP="CAO PSA OUR"'); 
However, I forgot to mention that I am using Digest Authentication instead of Basic.
Using Digest, I have to combine my username and password with the challenge sent by the server and send it back in the header response.

With Basic authentication, my user can still see the username and password by simply right click and view page source, since I load the web interface in an iframe.

Code: Select all

<iframe src="http://username:[email protected]/nagios" ></iframe>
And, without SSL, this is a giveaway!
I have a very tight security requirements, so this solution is not applicable for me.

I am giving up :(

Thanks anyway.
User avatar
ruffsense
Posts: 140
Joined: Thu Apr 11, 2013 12:40 am

Re: Is it possible to bypass http authentication?

Post by ruffsense »

Why don't you use NTLM authentication with AD.
kalianto
Posts: 7
Joined: Sun Apr 28, 2013 11:29 pm

Re: Is it possible to bypass http authentication?

Post by kalianto »

Hmmmmm
ruffsense, I've never thought about that.

We're moving/going to use Kerberos in the future, so might be worth investing some time in it.
I'd do some reading before I ask more questions.
User avatar
ruffsense
Posts: 140
Joined: Thu Apr 11, 2013 12:40 am

Re: Is it possible to bypass http authentication?

Post by ruffsense »

kalianto wrote:Hmmmmm
ruffsense, I've never thought about that.

We're moving/going to use Kerberos in the future, so might be worth investing some time in it.
I'd do some reading before I ask more questions.
Kerberos is really old method but in my enviroment i use both.
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Is it possible to bypass http authentication?

Post by sreinhardt »

I'm going to lock this down since the question has been answered. Of course feel free to pm or create another topic if you wish to discuss kerberos or NTLM auth possibilities.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Locked