Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm protecting a few different directories with LDAP. My problem is that you have to log into each directory separately even though it's the same user for almost all of them. Here's the pertinent part of my httpd.conf:

LoadModule vhost_alias_module /usr/lib/apache2/modules/mod_vhost_alias.so

<Directory /var/www/wiki>
  AuthType Basic
  AuthName "Restricted Files"
  AuthUserFile /etc/apache2/passwords
  Require user galapagos
</Directory>

<Directory /var/www/staging>
  AuthType Basic
  AuthName "Restricted Files"
  AuthUserFile /etc/apache2/passwords
  Require user galapagos
</Directory>

<Directory /var/www/mantis>
  AuthType Basic
  AuthName "Restricted Files"
  AuthUserFile /etc/apache2/passwords
  Require user galapagos
</Directory>

<Directory /home/jason/projects>
  AuthType Basic
  AuthName "Restricted Files"
  AuthUserFile /etc/apache2/passwords
  Require user jason
</Directory>

How do I factor out all the parts that are the same and only require galapagos' login once?

share|improve this question
    
Having the same AuthName should tell the client to reuse its cached userid/password. What browser are you using? –  Chris Nava Sep 27 '10 at 21:06
    
Firefox on Windows. –  Jason Swett Sep 27 '10 at 21:44
6  
Hmm...where does LDAP enter into the picture? Looks like basic auth with password files. –  Mark Wagner Sep 27 '10 at 22:06
    
Okay, whatever. How do I make the login prompt appear only once instead of once per directory? –  Jason Swett Sep 28 '10 at 12:48
    
The wiki, staging and mantis folders wouldn't happen to be on different virtual hosts would they? In that case the browser will not use the cached login as realm is host specific. In order to get around this you would need to use some sort of single-sign-in feature. –  Chris Nava Sep 29 '10 at 15:40
show 2 more comments

3 Answers

up vote 0 down vote accepted

Since there were no great answers here, my answer was to buy the book LDAP System Administration.

share|improve this answer
1  
Huh, I've never seen anybody actually RTFM themself! –  gWaldo Oct 28 '10 at 15:07
    
You may want to look at an Apache book (maybe the Apache Cookbook) would be of more help to you. –  gWaldo Oct 28 '10 at 15:12
add comment

What have you tried to do? Your conf file appears to use local (to the server) accounts, not LDAP accounts.

Searching for "apache with ldap authentication" on your favorite search engine should get you some reasonable results. (I'd recommend that you specify the flavor of LDAP that you're using, especially if it's Active Directory.) I see:

Further, it actually looks like you actually want to learn how to make a session persistent and/or cache credentials. Try searching using those terms.

share|improve this answer
add comment

If the directories are on different virtual hosts you will have to use NTLM authentication to get SSO functionality.

share|improve this answer
    
Is that a Windows thing? I'm on Linux. –  Jason Swett Oct 4 '10 at 12:36
    
I'm not 100% sure, but both FF and Apache support NTLM authentication, no mater the platform. You could try setting up Kerberos for real SSO, but it is much more complicated. –  Hubert Kario Oct 4 '10 at 15:47
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.