[Dovecot] SQL passdb lookups not working

Benjamin Montgomery bmontgom at montynet.org
Sun Aug 7 20:53:17 EEST 2011


Hello everyone,

I'm trying to make dovecot do user authentication against a SQL 
database.  The passwords (managed by Django) are stored as salted SHA1 
encoded in hex.  I monkey patched Django's password method so that the 
password hash is made with <password><salt> (Django does 
<salt><password>, the patched method was verified to return same value 
as dovecotpw) and the passwords are stored in the database separately as 
the salted hash and the salt.  When I query the values out of the 
database, I'm using MySQL's concat function to return the password as 
{SSHA.hex}<sha1 hash><salt>.  Dovecot is not able to verify any 
passwords right now.  I've scoured the wiki and I think my setup is 
correct...config info is below.  Any advice on where to look for 
debugging or setup of my passwords would be appreciated!

Ben


dovecot-sql.conf:

default_pass_scheme = SSHA.hex

password_query = \
     SELECT emailmanager_emailaddresses.account AS username, \
            emailmanager_domain.name AS domain, \
            CONCAT('{SSHA.hex}', \
                   emailmanager_userprofile.shadigest, \
                   emailmanager_userprofile.salt \
                  ) AS password \
            FROM emailmanager_emailaddresses \
            JOIN emailmanager_domain ON emailmanager_emailaddresses.id = 
emailmanager_domain.id \
            JOIN emailmanager_userprofile ON 
emailmanager_emailaddresses.id = emailmanager_userprofile.id \
            WHERE emailmanager_emailaddresses.account = '%n' \
            AND emailmanager_domain.name = '%d'



More information about the dovecot mailing list