Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


Is it possible to use HTTP Basic Auth instead of Cacti login
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cacti Forum Index -> Help: General
Author Message
nick
Guest





PostPosted: Wed May 15, 2002 7:25 pm    Post subject: Is it possible to use HTTP Basic Auth instead of Cacti login Reply with quote

I have to implement cacti in a directory tree that is already protected by HTTP Basic Authentication under Apache. I don't want my users to have to log in twice, so I'd like to have cacti accept the auth credentials passed to it by Apache.

Is this possible?
Back to top
raX
Lead Developer


Joined: 13 Oct 2001
Posts: 2234
Location: Carlisle, PA

PostPosted: Thu May 16, 2002 6:07 pm    Post subject: Reply with quote

You can disable cacti's builtin authentication, and use HTTP authentication instead. You cannot however currently have cacti interface with HTTP security.

-Ian
Back to top
robsweet



Joined: 22 Mar 2002
Posts: 35
Location: Atlanta, GA

PostPosted: Fri May 17, 2002 3:38 pm    Post subject: Actually.... Reply with quote

It would be pretty easy to make Cacti use the username from HTTP Basic Auth and have it pull the user info permissions just like if the user had logged in through the Cacti interface. Just a matter of checking to see if credentials are already being passed. If they are, you look up the user and carry on. If the user doesn't exist in Cacti, you check for guest access and presuming it's turned on, you set them up as a guest.

Ian - thoughts?

Rob.
Back to top
Fred
Cacti User


Joined: 03 Jan 2003
Posts: 78

PostPosted: Tue Feb 04, 2003 6:44 pm    Post subject: Re: Actually.... Reply with quote

robsweet wrote:
It would be pretty easy to make Cacti use the username from HTTP Basic Auth and have it pull the user info permissions just like if the user had logged in through the Cacti interface.


Does anybody have any information on how to do this? I'd love to let .htaccess determine who can see cacti, as we only allow a select few to view/use it, and have no guest users.

I know that it has something to do with disabling cacti's internal authentication, but I don't know how to get the user account information to carry over.
Back to top
tirvin
Guest





PostPosted: Sun Feb 22, 2004 5:24 pm    Post subject: Basic auth tied to cacti user database... Reply with quote

Hi:

Quote:
robsweet wrote:
It would be pretty easy to make Cacti use the username from HTTP Basic Auth and have it pull the user info permissions just like if the user had logged in through the Cacti interface


It would be a big win for us to have basic auth authorization, since we have a network management system built around basic auth (nagios, rt, wiki, 14all, and now hopefully cacti as the newest member), but I don't want our customers to have to continually sign in as they move around the system.

Has anyone done any work on this. Before we reinvent the wheel....

Thanks,

Tim
Back to top
mwoliver



Joined: 23 Feb 2004
Posts: 6
Location: Lakeland, FL, US

PostPosted: Tue Mar 23, 2004 11:36 am    Post subject: Reply with quote

Same here... want to integrate the existing Nagios http auth into Cacti to avoid the whole multiple-login process, as well as the out-of-sync password garbage.

Anyone with any tips on making this happen? I would be soooo nice....
Back to top
mwoliver



Joined: 23 Feb 2004
Posts: 6
Location: Lakeland, FL, US

PostPosted: Tue Mar 23, 2004 2:05 pm    Post subject: Reply with quote

well, I am not sure if this is right, but this worked for me... so far...


auth.php-patch.txt
 Description:
Patch against auth.php from Cacti v0.8.5

Download
 Filename:  auth.php-patch.txt
 Filesize:  401 Bytes
 Downloaded:  413 Time(s)

Back to top
flashbac



Joined: 01 May 2004
Posts: 1

PostPosted: Sat May 01, 2004 5:11 pm    Post subject: Is it possible to use HTTP Basic Auth instead of Cacti login Reply with quote

Hello,

I'm a newbie to php, and i have a dumb question, how do i use/apply the file posted above?

Thanks
Back to top
mwoliver



Joined: 23 Feb 2004
Posts: 6
Location: Lakeland, FL, US

PostPosted: Sat May 01, 2004 6:57 pm    Post subject: Reply with quote

Here is a very short answer that skips a lot of details. The file is a "unified diff", and in those files, any lines that are preceeded with a single "+" are additions, and lines that are preceeded with a single "-" are deletions. Typically, there are three lines of context provided before and after the affected lines of code. Additionally, the lines that begin with "@@" tell you which line to start making changes.

So, what this diff tells you to do is go to line 35 (32 + 3 lines of context), and add the two lines that are preceeded with a single "+" (but not the "+" itself!).

If you are using a flavor of *nix (hopefully FreeBSD ), then you can use the `patch` utility to apply this patch to the auth.php file.

HOLY CRAP! I just noticed that there are two 'auth.php' files in the unpacked code! This diff is supposed to be against ./include/auth.php, NOT ./lib/auth.php
Back to top
muckl



Joined: 19 Mar 2004
Posts: 9
Location: Germany

PostPosted: Fri May 14, 2004 1:21 pm    Post subject: Reply with quote

mwoliver wrote:
well, I am not sure if this is right, but this worked for me... so far...


Thaks a lot!
Works fine here, too! :-)
Back to top
rony
Developer/Forum Admin


Joined: 17 Nov 2003
Posts: 5448
Location: Wisconsin, USA

PostPosted: Wed Jul 21, 2004 9:33 am    Post subject: Web Basic Auth for Cacti 0.8.5a Reply with quote

Ok, well this has been bugging me for a while, so yesterday I wrote it into cacti. Normally I would supply a patch, but instead this time I have supplyed the whole files. Mostly because there is one addtional file.

Attached you will find a archive with 4 files in it:

./include/config_settings.php
./auth_login.php
./logout.php
./images/auth_logout.php

These files should be extracted into the cacti directory. Always remember to BACKUP YOU CURRENT CACTI, because you will be replacing these files.

These files are for Cacti version 0.8.5a. It has not been tested on earlier versions.

Note: Make sure you have added the users, with proper permissions, in cacti. The usernames must match and are case sensitive.
Note: Once Web Basic Auth is turned on, you will have to close your browsers, or goto http://server/cacti/logout.php to clear you current session. Then try loggin in.
Note: If the user does not exist and attempts to use graph_view.php, they will be considered a guest, and have right as such. Otherwise, they will not have console access to cacti.
Note: This is untested with LDAP, and turning both on may have interesting side effects.



Almost forgot....
Note: If you lock yourself out, run the following query on the cacti database. It will return cacti to internal authencation.
update settings set value = '' where name = 'web_basic_auth';



cacti-0.8.5a-basic-auth.tar.gz
 Description:
Web Basic Auth for Cacti-0.8.5a

Download
 Filename:  cacti-0.8.5a-basic-auth.tar.gz
 Filesize:  25.79 KB
 Downloaded:  243 Time(s)

Back to top
monachus



Joined: 06 Sep 2004
Posts: 30
Location: New York, NY

PostPosted: Thu Dec 02, 2004 11:44 pm    Post subject: Modification to auth.php to recognize realm permissions Reply with quote

To get the auth.php diff working (the first one, not the second one), you need to leave Cacti's authentication turned on. The change to auth.php sets the user's session up based upon the username used in the Basic authentication, thereby bypassing some PHP code that would have sent the user to the login page.

What's missing is a piece of code that recognizes where the user _is_ supposed to be directed after logging in. If your users don't have permissions for the Console realm, they will see a big fat ACCESS DENIED after logging in. The only way around this is if they went to graph_view.php directly.

My users should be able to go to /cacti and end up where they need to be.

The attached diff provides some additional logic to make that happen.

Enjoy.


To use this, do the following:

* Save this patch to /var/tmp.
* copy ./include/auth.php to /var/tmp.
* Change to /var/tmp and run
<pre>patch < auth.php.patch.txt</pre>
* Once that is complete (no errors), you will have auth.php.orig (the original file) and auth.php (the patched file).
* Copy auth.php back into your cacti distribution's include directory



auth.php.patch.txt
 Description:
Patch to ./include/auth.php to make "Cacti Authentication" recognize HTTP auth and Login Options.

Download
 Filename:  auth.php.patch.txt
 Filesize:  676 Bytes
 Downloaded:  203 Time(s)



Last edited by monachus on Thu Dec 02, 2004 11:57 pm; edited 1 time in total
Back to top
rony
Developer/Forum Admin


Joined: 17 Nov 2003
Posts: 5448
Location: Wisconsin, USA

PostPosted: Thu Dec 02, 2004 11:55 pm    Post subject: Reply with quote

When I originally wrote that patch, I didn't think about that, and at the time, I wasn't a developer either. Lame excuse, I know.

Version 0.8.7 alpha does include Web Basic auth and highly configurable LDAP support.

But it is alpha and changes daily. So I don't recommend using it unless you like pain.
Back to top
monachus



Joined: 06 Sep 2004
Posts: 30
Location: New York, NY

PostPosted: Thu Dec 02, 2004 11:59 pm    Post subject: Reply with quote

rony wrote:
When I originally wrote that patch, I didn't think about that, and at the time, I wasn't a developer either. Lame excuse, I know.

Version 0.8.7 alpha does include Web Basic auth and highly configurable LDAP support.



This is good to know. Since this app is client-facing, I can't deploy alpha code. I didn't want people to have to log in twice, and your patch was great in starting me in the right direction. Thx!
Back to top
romp



Joined: 08 Dec 2004
Posts: 6

PostPosted: Thu Dec 09, 2004 6:52 pm    Post subject: integration Reply with quote

Is there a chance that this becomes maybe integrated in the "official" cacti source.
IMHO, additional alternative Auth would be great, especial if you use/support the combination
-> htaccess
-> LDAP
with the acl's from cacti.

regards
Christian
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Help: General All times are GMT - 5 Hours
Goto page 1, 2  Next
Page 1 of 2

 



Powered by phpBB © 2001, 2005 phpBB Group