You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Ed Poe <th...@malted.net> on 2007/02/03 09:06:02 UTC
[users@httpd] Odd problem with mod_authn_dbd and mysql
I have been attempting for a day and a half now to replace an apache2
installation with mod_auth_mysql with an apache2.2 installation with
mod_authn_dbd and the mysql driver. I won't rehash all the compiling
issues here*, but after no small frustration I have the following:
A freshly compiled tree for httpd-2.2.4 in /usr/local/apache2, a
fresh perl build and a static build of mod_perl-2.0.3, and now a
fresh build of mysql in /usr/local/mysql-5.0.33 (this all has to run
in parallel with a customer-facing support system on a box that is
otherwise our dev machine). I rebuilt apr-utils with the mysql
driver and installed that in the apache path, and the server doesn't
balk at the DBDriver mysql configuration.
* OK, I'll rehash one compiling issue here. I'm not going to rant
about open source licensing conflicts, but I'll rant that if you're
going to have an open source licensing conflict, and you're also
going to have support for a database people might reasonably expect
to work with a basic compile, the INSTALL.MySQL file that tells you
why the mysql driver isn't there should be at the TOP LEVEL of the
tree, not buried in srclib/apr-util. Especially when people who
don't do a lot of apache-specific compiling might not be familiar
with apr and apr-util or know why they should be looking. It should
be documented better on, say, the page for mod_dbd too, right after
the sentence reading, "For example, DBDriver mysql will select the
MySQL driver in apr_dbd_mysql.so." It won't do that if you haven't
got it installed, and you haven't got it installed unless you've
spent a couple hours on google before you stumble on one of seven
pages (one in Japanese and one in Hungarian) that lead you to a post
where somebody says how to find the driver. But I digress.
Anyway, back on topic: I have a single vhost (well, two, but once I
get the one working I can do the other the same way) that runs PHP
and has been using mod_auth_mysql under apache2. I have the
following auth* modules loading, along with dbd:
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule authz_user_module modules/mod_authz_user.so
#LoadModule authz_host_module modules/mod_authz_host.so #(loaded in
another config file)
LoadModule dbd_module modules/mod_dbd.so
LoadModule authn_dbd_module modules/mod_authn_dbd.so
And the following global config:
DBDriver mysql
DBDParams "host=localhost user=<redacted> pass=<redacted>
dbname=<redacted>"
DBDPrepareSQL "SELECT encrypt(password) FROM <redacted> WHERE
login_id = %s" passquery
DBDPersist off
And the vhost looks like this:
<VirtualHost *:80>
ServerName blog.<redacted>.com
<Directory "/home/httpd/blog/wordpress">
AuthType Basic
AuthName "Redacted Technology"
AuthBasicProvider dbd
AuthDBDUserPWQuery passquery
Require valid-user
</Directory>
</VirtualHost>
The mysql server log, however shows just this:
070203 2:30:51 5166 Connect <redacted>@localhost on <redacted>
5166 Prepare [1]
5166 Quit
And the vhost error log has this:
[Sat Feb 03 02:30:51 2007] [error] [client <my-ip>] No DBD Authn
configured!
The query never gets sent to the DB. If I take out the DBDPrepareSQL
line and put the query itself in for AuthDBDUserPWQuery, the server
logs are even shorter: there's no 'Prepare' line in the mysql log.
Just a 'Connect' followed immediately by a 'Quit'.
I've checked the username and password six ways from Sunday. If I
put those same parameters into a perl script and run it I get back
the encrypted password. I know it's at least connecting to the DB
because I see it in the logs. Why isn't this query processing?
- e
"All ages will be allowed to rock."
---------------------------------------------------------------------
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] Odd problem with mod_authn_dbd and mysql
Posted by Ed Poe <th...@malted.net>.
On 3 Feb 2007, at 7:47 AM, Nick Kew wrote:
> On Sat, 3 Feb 2007 03:06:02 -0500
> Ed Poe <th...@malted.net> wrote:
>
>> And the following global config:
>> DBDriver mysql
>> DBDParams "host=localhost user=<redacted> pass=<redacted>
>> dbname=<redacted>"
>> DBDPrepareSQL "SELECT encrypt(password) FROM <redacted> WHERE
>> login_id = %s" passquery
>> DBDPersist off
>>
>>
>> And the vhost looks like this:
>> <VirtualHost *:80>
>> ServerName blog.<redacted>.com
>> <Directory "/home/httpd/blog/wordpress">
>> AuthType Basic
>> AuthName "Redacted Technology"
>> AuthBasicProvider dbd
>> AuthDBDUserPWQuery passquery
>
> That'll fail because "passquery" here is a literal.
> The label you defined above works at a different level,
> and is irrelevant here.
OK, but it also fails when it's not a literal like this:
<VirtualHost *:80>
ServerName blog.<redacted>.com
<Directory "/home/httpd/blog/wordpress">
AuthType Basic
AuthName "Redacted Technology"
AuthBasicProvider dbd
AuthDBDUserPWQuery "SELECT encrypt(password) FROM
people WHERE login_id = %s"
In that case, all I see in the DB log is a 'Connect' followed by a
'Quit', and the error_log for the vhost just says "No DBD Authn
configured!". Why won't the query execute?
- e
"All ages will be allowed to rock."
---------------------------------------------------------------------
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] Odd problem with mod_authn_dbd and mysql
Posted by Nick Kew <ni...@webthing.com>.
On Sat, 3 Feb 2007 03:06:02 -0500
Ed Poe <th...@malted.net> wrote:
> And the following global config:
> DBDriver mysql
> DBDParams "host=localhost user=<redacted> pass=<redacted>
> dbname=<redacted>"
> DBDPrepareSQL "SELECT encrypt(password) FROM <redacted> WHERE
> login_id = %s" passquery
> DBDPersist off
>
>
> And the vhost looks like this:
> <VirtualHost *:80>
> ServerName blog.<redacted>.com
> <Directory "/home/httpd/blog/wordpress">
> AuthType Basic
> AuthName "Redacted Technology"
> AuthBasicProvider dbd
> AuthDBDUserPWQuery passquery
That'll fail because "passquery" here is a literal.
The label you defined above works at a different level,
and is irrelevant here.
--
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