On 2/2/2011 6:27 PM, Matt wrote:
On Wed, Feb 2, 2011 at 5:31 PM, Mauricio Tavares<raubvo...@gmail.com>  wrote:
On Wed, Feb 2, 2011 at 5:10 PM, Matt<mhop...@gmail.com>  wrote:
I'm working on replacing an ageing Posfix install with a new server.

On the old and new server we use virtual domains.

On the old server we login with: username.domain.com
On the new server Postfix is configured to allow login as: usern...@domain.com

I'd actually rather prefer the new format, however, for ease of
transition is there a way I can configure Postfix to allow the . and
even better yet, to allow either?

      What are you using to do the authentication? And, when you mean
logging in do you mean to check mail (IMAP/POP3) or to send mail (SMTP
AUTH)?

I am using dovecot.  I mean IMAP/POP3 and SMTP.  It's really not a big
deal if I need to use the @ sign, I just figured if I could do both it
would ease the transition.
I'll expand on what Viktor said a bit in case it helps put you in the right direction.

Are you using PostgreSQL / MySQL for the Dovecot / SASL query as well as any followup virtual user Postfix (mailbox mapping) queries? If so (all of!) the SQL scripts need only be updated to accept both login formats.

For example if you are currently doing, in the dovecat SASL driver:

password_query = SELECT password from my_users where local_part = '%n' and domain_part = '%d'

then you would need to do some string manipulation to grandfather in the old format:

password_query = SELECT password from my_users where local_part = '%n' and domain_part = '%d' UNION SELECT password from my_users where local_part = LEFT('%n', POSITION('%n', '.')-1) and domain_part = MID('%n',...etc.)

Warning that such mappings are full of fencepost errors and gotchas, so work through all the cases. Make this code temporary; it's ugly. Policy-wise, maybe better to force users to upgrade to reasonable MUA settings now. Like I said in my post to Ignacio, I'm an advocate of paying the short term pain now in the name of a solid design. Users NEED the e-mail so they'll have to fix their MUA.

Anyway, I'm not going to debug or perfect anything here, just sketching the main idea. SQL has plenty of useful dynamic functions; it is not relegated to returning unprocessed table data. Note in particular that the old format is pretty broken, because: for example with the username daniel.bromb...@example.com, the old format would be daniel.bromberg.example.com, thus in my simplistic code above, 'bromberg.example.com' would be interpreted as the domain! It is also broken because '%d' cannot be gleaned from the login string, which would need to contain the '@'.

As Viktor said, focus on the translation layer, as Postfix is totally neutral to how these maps work. Think like a programmer, not a configurator*, and design the mapping function any way you want.

-Daniel

*You should never think like a configurator, because that's not even a word.

Reply via email to