httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jerome Zago <apache-httpd...@agt-the-walker.net>
Subject [users@httpd] Cannot make AuthnProviderAlias work in VirtualHost (2.4.2)
Date Sat, 02 Jun 2012 09:49:37 GMT
ENVIRONMENT

Ubuntu 10.04.4 LTS
apr 1.4.6, apr-util 1.4.1, httpd 2.4.2 compiled from source


HOW TO REPRODUCE

$ cd /usr/local/opt/httpd-2.4.2  # corresponding to ./configure --prefix
 sudo cp -pr htdocs htdocs.81
 sudo ./bin/htpasswd -b -c conf/passwords1 test1 test1
 sudo ./bin/htpasswd -b -c conf/passwords2 test2 test2

$ sudo vim conf/httpd.conf; diff conf/{original/,httpd.conf}
52a53
> Listen 81
187c188
< #ServerName www.example.com:80
---
> ServerName 127.0.1.1
461c462
< #Include conf/extra/httpd-vhosts.conf
---
> Include conf/extra/httpd-vhosts.conf

$ sudo vim conf/extra/httpd-vhosts.conf
<AuthnProviderAlias file file1>
   AuthUserFile conf/passwords1
</AuthnProviderAlias>

<AuthnProviderAlias file file2>
   AuthUserFile conf/passwords2
</AuthnProviderAlias>

<VirtualHost *:81>
   DocumentRoot "/usr/local/opt/httpd/htdocs.81"

   <Directory "/usr/local/opt/httpd/htdocs.81">
       AuthBasicProvider file1 file2

       AuthType Basic
       AuthName "Protected Area"
       Require valid-user
   </Directory>
</VirtualHost>

$ sudo ./bin/apachectl restart

$ for user in test{1..3}; do
      echo -n "$user: "
      curl --head --silent --user $user:$user \
          http://localhost:81/ | grep 'HTTP'
  done
test1: HTTP/1.1 401 Authorization Required
test2: HTTP/1.1 401 Authorization Required
test3: HTTP/1.1 401 Authorization Required


EXPECTED RESULT

test1: HTTP/1.1 200 OK
test2: HTTP/1.1 200 OK
test3: HTTP/1.1 401 Authorization Required


NOTES

If I use AuthUserFile directly instead of
AuthnProviderAlias/AuthBasicProvider, it works as expected (with one
password file only):

$ sudo vim conf/extra/httpd-vhosts.conf
<VirtualHost *:81>
   DocumentRoot "/usr/local/opt/httpd/htdocs.81"

   <Directory "/usr/local/opt/httpd/htdocs.81">
       AuthUserFile conf/passwords1

       AuthType Basic
       AuthName "Protected Area"
       Require valid-user
   </Directory>
</VirtualHost>

$ sudo ./bin/apachectl restart

$ for user in test{1..3}; do
      echo -n "$user: "
      curl --head --silent --user $user:$user \
         http://localhost:81/ | grep 'HTTP'
 done
test1: HTTP/1.1 200 OK
test2: HTTP/1.1 401 Authorization Required
test3: HTTP/1.1 401 Authorization Required


What am I missing?
Thanks for your time. More details upon request.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message