On Wed, 12 Apr 2006, Timo Sirainen wrote:
On Tue, 2006-04-11 at 09:36 -0500, Netlink Tech wrote:
Hello, Running FC5 x86_64 with dovecot-1.0-0_8.beta3.rhfc5.at Using system user/passwds for 99.99% of users...have sql user/pass enabled to test virtual users from mysql.
How do I strip off the domain when users provide user@domain.com so that my userdb and passdb use just 'user'? (disregarding sql auth...I'm not concerned with that right now).
In general I don't see this as very useful feature. Why are your users logging in with @domain? Or why not change your passdbs/userdbs to just contain the domain, and set auth_default_realm so everyone always logs in with domains?
To echo Michael Baird... Current setup has hundreds of people using just username. In the case of other ISP/userbase buyouts, etc., keeping their current config saves headaches. And then like Michael said, some users have trouble differentiating what their username is versus their email addres (username@domain.com). The less tech support calls I get, the happier I am! :)
My dovecot.conf auth config:
passdb pam { args = dovecot }
Here you could use some PAM plugin to strip it. I've no idea if such exists though.
From archive, Grant seemed to have PAM module that does this (March 30, 2006 thread that Michael started 'Strip Realms') Since I haven't attempted to write anything for PAM yet, I have asked Grant if he would share his module...maybe he will share with the list? I also would be modifying the PAM module to try to get it to work with SASL/SMTP_AUTH.
passdb sql { args = /etc/dovecot-sql.conf }
Here you can modify your SQL command to use %n instead of %u. Understood, the sql part was not a problem.
userdb passwd { }
If the PAM plugin which strips the domain from username does it properly, it should have returned the new username to Dovecot and this should work..
userdb sql { args = /etc/dovecot-sql.conf }
And here again you can use %n.
Thanks Timo (and everyone else that has contributed to dovecot)