You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Zach Moazeni <za...@gmail.com> on 2007/02/23 18:18:01 UTC
[users@httpd] Problem with MySQL authn_dbd and virtual hosts
Hello,
I'm working with Apache 2.2.3, MySQL 4.1.12 on CentOS. I have
compiled mod_dbd, authn_dbd (along with the apr_dbd_mysql.c from
http://apache.webthing.com/database) and I've successfully
configured authn_dbd on the base config. (httpd.conf)
This is the sample httpd.conf blurb that works
DBDriver mysql
DBDParams "host=127.0.0.1 port=3306 user=daemon pass=daemon
dbname=htusers"
DBDMin 1
DBDKeep 2
DBDMax 10
DBDExptime 60
<Directory />
AuthType Basic
AuthName "My Server"
AuthBasicProvider dbd
AuthDBDUserPWQuery "select password from users where username = %s"
Require user test_user
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
However there's two different ways I've tried pushing it into a
virtual host.
Option a)
<VirtualHost __my_ip__:80>
DBDriver mysql
DBDParams "host=127.0.0.1 port=3306 user=daemon pass=daemon
dbname=htusers"
DBDMin 1
DBDKeep 2
DBDMax 10
DBDExptime 60
ServerName __my_server_name__
DocumentRoot /tmp/test_dbd_auth
<Directory /tmp/test_dbd_auth>
AuthType Basic
AuthName "My Server"
AuthBasicProvider dbd
AuthDBDUserPWQuery "select password from users where username = %s"
Require user test_user
Options +Indexes
Require valid-user
Allow from all
</Directory>
</VirtualHost>
Results in the only error message being:
[Fri Feb 23 11:11:53 2007] [error] [client __client_ip__] Error
looking up test_user in database
Option b)
DBDriver mysql
DBDParams "host=127.0.0.1 port=3306 user=daemon pass=daemon
dbname=htusers"
DBDMin 1
DBDKeep 2
DBDMax 10
DBDExptime 60
<VirtualHost __my_ip__:80>
ServerName __my_server_name__
DocumentRoot /tmp/test_dbd_auth
<Directory /tmp/test_dbd_auth>
AuthType Basic
AuthName "My Server"
AuthBasicProvider dbd
AuthDBDUserPWQuery "select password from users where username = %s"
Require user test_user
Options +Indexes
Require valid-user
Allow from all
</Directory>
</VirtualHost>
Results in an error message being:
[Fri Feb 23 11:13:10 2007] [error] [client __client_ip__] No DBD
Authn configured!
Is something really basic I'm doing wrong to get this working with
virtual hosts?
Thanks in advance to any help I may get.
-Zach
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Problem with MySQL authn_dbd and virtual hosts
Posted by Steven Simpson <ss...@comp.lancs.ac.uk>.
Hello,
Zach Moazeni wrote:
> I'm working with Apache 2.2.3, MySQL 4.1.12 on CentOS. I have compiled
> mod_dbd, authn_dbd (along with the apr_dbd_mysql.c from
> http://apache.webthing.com/database) and I've successfully configured
> authn_dbd on the base config.
Apache 2.2.4, MySQL 4.1.21, Linux, dbd same.
> DBDriver mysql
[snip: no vhost]
> However there's two different ways I've tried pushing it into a
> virtual host.
>
> Option a)
[snip: everything in vhost]
> Results in the only error message being:
>
> [Fri Feb 23 11:11:53 2007] [error] [client __client_ip__] Error
> looking up test_user in database
>
> Option b)
[snip: DBD* directives outside vhost]
> Results in an error message being:
> [Fri Feb 23 11:13:10 2007] [error] [client __client_ip__] No DBD Authn
> configured!
I've had similar results with 2.2.4, but with 2.2.3, option b did
partially work, IIRC (perhaps with DBDPersist Off?).
Even when it works, I've found it unreliable. I have three
subdirectories which require the same authentication (the authn config
is "Include"d from the same file), and I keep being asked for new
credentials as I moved between them, and sometimes the creds are
rejected several times. There is no such problem with the parallel
2.0.52 installation (using mod_auth_mysql) which I'm trying to migrate from.
If it's any help to anyone, I think I managed to trace the "No DBD..."
error some way, though I can't be sure of the precise circumstances. In
one case (perhaps with DBDPersist Off), in the file
"modules/aaa/mod_authn_dbd.c", the function "authn_dbd_password" calls
"apr_hash_get", which returns NULL.
In another case (DBDPersist On?):
* authn_dbd_password calls...
* authn_dbd_acquire_fn, which appears to be indirectly a call to...
* ap_dbd_acquire, which calls...
* ap_dbd_open, ...
* dbd_setup_lock...
* apr_thread_mutex_lock, which fails.
Cheers,
Steven
--
ss at comp dot lancs dot ac dot uk |
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Problem with MySQL authn_dbd and virtual hosts
Posted by Zach Moazeni <za...@gmail.com>.
Yeah I was on IRC earlier.
I think you helped me get to where I am now, with my error in the
DBDParams.
I'm fairly certain the query isn't failing since it's copy and paste
from a working example in the httpd.conf. Same for permissions. The
errors only arise when trying to use the configuration in conjunction
with Virtual Hosts
I can test this with 2.2.4 to see if the issue exists.
-Zach
On Feb 23, 2007, at 1:45 PM, Nick Kew wrote:
> On Fri, 23 Feb 2007 12:18:01 -0500
> Zach Moazeni <za...@gmail.com> wrote:
>
>> Hello,
>
> Were you on IRC earlier?
>
>
>> [Fri Feb 23 11:11:53 2007] [error] [client __client_ip__] Error
>> looking up test_user in database
>
> That means your query failed. The reason should be available from
> MySQL: it could for example be that your query has a typo in,
> or that the user it's running as doesn't have permission within
> MySQL's permissions.
>
>> Results in an error message being:
>> [Fri Feb 23 11:13:10 2007] [error] [client __client_ip__] No DBD
>> Authn configured!
>
> Hmmm. We've had issues with the configuration not being inherited
> correctly into a virtualhost. Does that still happen with 2.2.4?
>
>
> --
> Nick Kew
>
> Application Development with Apache - the Apache Modules Book
> http://www.apachetutor.org/
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server
> Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> " from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Problem with MySQL authn_dbd and virtual hosts
Posted by Nick Kew <ni...@webthing.com>.
On Fri, 23 Feb 2007 12:18:01 -0500
Zach Moazeni <za...@gmail.com> wrote:
> Hello,
Were you on IRC earlier?
> [Fri Feb 23 11:11:53 2007] [error] [client __client_ip__] Error
> looking up test_user in database
That means your query failed. The reason should be available from
MySQL: it could for example be that your query has a typo in,
or that the user it's running as doesn't have permission within
MySQL's permissions.
> Results in an error message being:
> [Fri Feb 23 11:13:10 2007] [error] [client __client_ip__] No DBD
> Authn configured!
Hmmm. We've had issues with the configuration not being inherited
correctly into a virtualhost. Does that still happen with 2.2.4?
--
Nick Kew
Application Development with Apache - the Apache Modules Book
http://www.apachetutor.org/
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org