MySQL based authentication with crypt()ed password fails in Apache 2.2

Posted by Fester Bestertester on Server Fault See other posts from Server Fault or by Fester Bestertester
Published on 2013-11-01T15:56:10Z Indexed on 2013/11/01 15:57 UTC
Read the original article Hit count: 229

I'm trying to set up a simple CalDAV/CardDAV server with a Radicale backend and an Apache 2.2 frontend. So far, it's all nice and simple, but I can't get the MySQL based authentication to work. I'd like to authenticate users against an existing MySQL database, and I need the REMOTE_USER variable to be set (pretty much like in the configuration examples for Radicale). I've tried mod_auth_mysql, which authenticated the users nicely, but failed to set the REMOTE_USER variable. The newer alternative seems to be mod_authn_dbd, which doesn't seem to like the crypted passwords in the MySQL database. According to the documentation, crypted passwords should work, so maybe I'm just missing a simple parameter. The configuration looks like this:

DBDriver mysql
DBDParams "sock=/var/run/mysqld/mysqld.sock dbname=myAuthDB user=myAuthUser pass=myAuthPW
<Directory />
    AllowOverride None
    Order allow,deny
    allow from all

    AuthName 'CalDav'
    AuthType Basic
    AuthBasicProvider dbd
    require valid-user
    AuthDBDUserPWQuery "SELECT crypt FROM myAuthTable WHERE id=%s"
</Directory>

I've tested the query, it works fine. And as mentioned before, mod_auth_mysql worked nicely against the same database, but didn't set the required variables. Am I just missing some configuration parameter? Or is mod_authn_dbd just not the right tool to achieve what I want?

© Server Fault or respective owner

Related posts about apache2

Related posts about mysql