1

I would like to have LDAP authentication on a webpage.

On a CentOS server the .htaccess looks like this

Order deny,allow
Deny from All
AuthName "Only members"
AuthType Basic
AuthBasicProvider ldap
AuthzLDAPAuthoritative on
AuthLDAPUrl ldaps://nms.example.com/dc=ldap,dc=example,dc=com?uid
AuthLDAPGroupAttribute memberUid
AuthLDAPGroupAttributeIsDN off
Require ldap-group cn=example,ou=group,dc=ldap,dc=example,dc=com
Satisfy any

and apache configuration on the new Ubuntu server looks like this

<IfModule mod_ssl.c>
<VirtualHost 123.123.123.123:443>
    ServerAdmin webmaster@localhost
        ServerName example.com:443
    DocumentRoot /var/www/example.com
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /var/www/examle.com
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/example.com-error.log

    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/example.com-access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

    SSLEngine on
    SSLProtocol all -SSLv2
    SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
    SSLCertificateFile /etc/ssl/certs/example_com.cer
    SSLCertificateKeyFile /etc/ssl/private/example_com.key

    <FilesMatch "\.(cgi|shtml|phtml|php)$">
        SSLOptions +StdEnvVars
    </FilesMatch>
    <Directory /usr/lib/cgi-bin>
        SSLOptions +StdEnvVars
    </Directory>

</VirtualHost>
</IfModule>

But when I place the same .htaccess file on the new Ubuntu server, where SSL/HTTPS is working, no authentication box appears.

The log files doesn't register any errors.

Can anyone see what could be missing/wrong?

Sandra
  • 9,973
  • 37
  • 104
  • 160

2 Answers2

3

You need to change the AllowOverride line in your config to allow for authentication in htaccess file such as:

AllowOverride AuthConfig

A line like:

AllowOverride None

will prevent the execution of authentication directive in htaccess file.

Khaled
  • 35,688
  • 8
  • 69
  • 98
0

This is a working config I have, but I required any valid LDAP user from my search path;

Order deny,allow
Deny from All
AllowOverride AuthConfig
AuthName "Vostron Staff Only"
AuthType Basic
AuthBasicProvider ldap
AuthzLDAPAuthoritative off
AuthLDAPURL "ldap://auth01.int.vostron.net:389/dc=int,dc=vostron,dc=net"
AuthLDAPGroupAttribute memberUid
AuthLDAPGroupAttributeIsDn off
Require valid-user
Satisfy any

Also, don't forget to enable ldap.load and authnz_ldap.load

jwbensley
  • 4,122
  • 11
  • 57
  • 89