Hi, using dovecot 2.0 and I'm using a couple of user DBs, sql/prefetch and pam. Currently if the user logins with username@domain it authenticates off the sql DB and works fine. If the user logins with username with no @domain it fails on the sql lookup and succeeds on the pam user DB.
However I was wondering if I can have another sql DB lookup that says when the user logins and fails against the first two user DBs, sql/pam db, to try this last sql user DB and appends a default domain to it, because the sql DB lists username with the domain. Currently I have all users login in with no realm on the older mail server and I wanted to migrate these users to dovecot 2.x with minimal impact and wanted to have the ability for these virtual users to login with and without a realm.
Thanks paul.
You could use just sql to query for the username or username@domain like this ( i'm not a sql guru so any optimization is welcome) , this is how it works on my server with mysql (see user_query) :
password_query = SELECT mailbox.password FROM mailbox,domain WHERE
domain.default = '1' AND
(mailbox.username = '%Ln' AND mailbox.domain = '%Ld' ) OR
(mailbox.username = '%Ln' AND mailbox.domain = domain.domain ) AND
mailbox.active = '1'
user_query = SELECT CONCAT('/srv/vmail/',mailbox.domain,'/%Ln') AS
'home' ,'98' AS 'uid', '98' AS 'gid' ,
CONCAT('*:storage=', mailbox.quota,'M') AS quota_rule FROM
mailbox,domain WHERE
domain.default = '1' AND
(mailbox.username = '%Ln' AND mailbox.domain = '%Ld' ) OR
(mailbox.username = '%Ln' AND mailbox.domain = domain.domain ) AND
mailbox.active = '1'
Adrian Stoica
On 1/19/2011 7:36 PM, PA wrote:
Hi, using dovecot 2.0 and I'm using a couple of user DBs, sql/prefetch and pam. Currently if the user logins with username@domain it authenticates off the sql DB and works fine. If the user logins with username with no @domain it fails on the sql lookup and succeeds on the pam user DB.
However I was wondering if I can have another sql DB lookup that says when the user logins and fails against the first two user DBs, sql/pam db, to try this last sql user DB and appends a default domain to it, because the sql DB lists username with the domain. Currently I have all users login in with no realm on the older mail server and I wanted to migrate these users to dovecot 2.x with minimal impact and wanted to have the ability for these virtual users to login with and without a realm.
Thanks paul.
--
*DACRIS* Papetãrie & Tipografie
Otopeni - ROMÂNIA, Jud. Ilfov Str. Ardealului nr.9F TEL.: (004) 021 350 67 57 FAX: (004) 021 350 67 59
e-mail: office@dacris.net <mailto:office@dacris.net> www.dacris.net <http://www.dacris.net> Adopta atitudinea VERDE Printeaza acest document doar daca ai cu adevarat nevoie.
Basically after thinking about it I added another SQL user/password DB lookup that has a default domain name on the sql query.
passdb { args = /usr/local/etc/dovecot/sql.conf.ext driver = sql }
passdb {
args = /usr/local/etc/dovecot/sql.conf2.ext driver = sql }
passdb { driver = pam }
userdb { driver = prefetch }
userdb { args = /usr/local/etc/dovecot/sql.conf.ext driver = sql }
userdb {
args = /usr/local/etc/dovecot/sql.conf2.ext driver = sql }
password_query = SELECT username as user, password, concat('/var/vmail/test2000.com/', maildir) as userdb_home, concat('maildir:/var/vmail/test2000.com/', maildir) as userdb_mail, 101 as userdb_uid, 502 as userdb_gid, concat('user quota:messages=+:storage=+', quota) AS userdb_quota_rule FROM mailbox WHERE username = '%n@test2000.com'
user_query = SELECT maildir, 101 AS uid, 502 AS gid, concat('user quota:messages=+:storage=+', quota) as quota_rule FROM mailbox WHERE username = '%n@test2000.com' AND active = '1'
-----Original Message----- From: dovecot-bounces+razor=meganet.net@dovecot.org [mailto:dovecot-bounces+razor=meganet.net@dovecot.org] On Behalf Of PA Sent: Wednesday, January 19, 2011 12:36 PM To: 'Dovecot Mailing List' Subject: [Dovecot] domain stripping
Hi, using dovecot 2.0 and I'm using a couple of user DBs, sql/prefetch and pam. Currently if the user logins with username@domain it authenticates off the sql DB and works fine. If the user logins with username with no @domain it fails on the sql lookup and succeeds on the pam user DB.
However I was wondering if I can have another sql DB lookup that says when the user logins and fails against the first two user DBs, sql/pam db, to try this last sql user DB and appends a default domain to it, because the sql DB lists username with the domain. Currently I have all users login in with no realm on the older mail server and I wanted to migrate these users to dovecot 2.x with minimal impact and wanted to have the ability for these virtual users to login with and without a realm.
Thanks paul.
participants (2)
-
Adrian Stoica
-
PA