[Dovecot] Setting a Default Domain
I'm working on migrating to Dovecot. At the moment, I have a mail path that includes the domain, so I'm using %d to get that. However, if users authenticate without specifying a domain (i.e. using "bob" instead of "bob@wiktel.com"), then %d expands to nothing. I'd like to have that expand to a default domain (wiktel.com) instead. Is that possible?
Thanks, Richard
You could use the perdition proxy to achieve this:
http://www.vergenet.net/linux/perdition/
Richard Laager wrote:
I'm working on migrating to Dovecot. At the moment, I have a mail path that includes the domain, so I'm using %d to get that. However, if users authenticate without specifying a domain (i.e. using "bob" instead of "bob@wiktel.com"), then %d expands to nothing. I'd like to have that expand to a default domain (wiktel.com) instead. Is that possible?
Thanks, Richard
On Tue, 2006-03-28 at 14:19 +1000, Peter Fern wrote:
Richard Laager wrote:
I'm working on migrating to Dovecot. At the moment, I have a mail path that includes the domain, so I'm using %d to get that. However, if users authenticate without specifying a domain (i.e. using "bob" instead of "bob@wiktel.com"), then %d expands to nothing. I'd like to have that expand to a default domain (wiktel.com) instead. Is that possible?
You could use the perdition proxy to achieve this:
Thank you for the suggestion. However, adding another layer of proxying for something so small seems like a bad idea. I'm currently using a SQL lookup to decide which requests are handled locally and which are proxied to the existing ("legacy") system that I'm migrating away from. I have this SQL lookup doing double-duty and adding the default domain if necessary.
However, once the migration is complete, I won't need the proxy lookup anymore, so I'll want to get rid of the SQL overhead.
A default domain configuration option is common in other mail servers, and very useful, so I'd like to see this in Dovecot as well. I could try to code it myself, if someone could steer me to roughly the right section of code.
Thanks, Richard
Richard Laager wrote:
On Tue, 2006-03-28 at 14:19 +1000, Peter Fern wrote:
Richard Laager wrote:
I'm working on migrating to Dovecot. At the moment, I have a mail path that includes the domain, so I'm using %d to get that. However, if users authenticate without specifying a domain (i.e. using "bob" instead of "bob@wiktel.com"), then %d expands to nothing. I'd like to have that expand to a default domain (wiktel.com) instead. Is that possible?
You could use the perdition proxy to achieve this:
Thank you for the suggestion. However, adding another layer of proxying for something so small seems like a bad idea. I'm currently using a SQL lookup to decide which requests are handled locally and which are proxied to the existing ("legacy") system that I'm migrating away from. I have this SQL lookup doing double-duty and adding the default domain if necessary.
However, once the migration is complete, I won't need the proxy lookup anymore, so I'll want to get rid of the SQL overhead.
A default domain configuration option is common in other mail servers, and very useful, so I'd like to see this in Dovecot as well. I could try to code it myself, if someone could steer me to roughly the right section of code.
This would be a great feature. Although if you're going to go through the trouble why not create the ability for defaults for other variables? Eg %h,%u,%n
How about general %-prefixed variable support and operations ;o)
On Tue, 28 Mar 2006, Daniel Watts wrote:
This would be a great feature. Although if you're going to go through the trouble why not create the ability for defaults for other variables? Eg %h,%u,%n
How about general %-prefixed variable support and operations ;o)
Dunno if the last paragraphe means what I'd suggest:
In bash you can write: ${novar-defaultvalue} the %-expansion code could do something alike, e.g. one writes the default value in the %-string.
However, I'm not sure whether those variables are used internally somewhere, hence, then they would use without the default value.
Bye,
-- Steffen Kaiser
On Monday 27 March 2006 21:47, Richard Laager wrote:
I'm working on migrating to Dovecot. At the moment, I have a mail path that includes the domain, so I'm using %d to get that. However, if users authenticate without specifying a domain (i.e. using "bob" instead of "bob@wiktel.com"), then %d expands to nothing. I'd like to have that expand to a default domain (wiktel.com) instead. Is that possible?
Thanks, Richard
The best solution to this (afaik) is to let the SQL server to the dirty work for you, e.g.: SELECT [...] CASE WHEN ('%d' = '') THEN 'default.com' ELSE '%d' END AS domain [...]
Depending on your database schema, you may be able to get away without the CASE statement usage with something like this: SELECT ... WHERE (('%d' != '' AND domain='%d') OR ('%d' = '' AND domain='default.com') ...
It's not the greatest of solutions, but it works well enough.
HTH,
Ben Winslow rain@bluecherry.net
Ben Winslow wrote:
On Monday 27 March 2006 21:47, Richard Laager wrote:
I'm working on migrating to Dovecot. At the moment, I have a mail path that includes the domain, so I'm using %d to get that. However, if users authenticate without specifying a domain (i.e. using "bob" instead of "bob@wiktel.com"), then %d expands to nothing. I'd like to have that expand to a default domain (wiktel.com) instead. Is that possible?
Thanks, Richard
The best solution to this (afaik) is to let the SQL server to the dirty work for you, e.g.: SELECT [...] CASE WHEN ('%d' = '') THEN 'default.com' ELSE '%d' END AS domain [...]
Depending on your database schema, you may be able to get away without the CASE statement usage with something like this: SELECT ... WHERE (('%d' != '' AND domain='%d') OR ('%d' = '' AND domain='default.com') ...
It's not the greatest of solutions, but it works well enough.
I always wondered if you could do what with SQL. Thanks =) However the OP actually wants to move AWAY From sql so I don't think this will help him in his situation.
On Wednesday 29 March 2006 04:05, Daniel Watts wrote:
I always wondered if you could do what with SQL. Thanks =) However the OP actually wants to move AWAY From sql so I don't think this will help him in his situation.
Ah, oops... I hadn't seen the message where he said he was moving away from SQL (well, I think that's what he's saying, anyway) when I wrote my reply.
Ah well, as long as it helps somebody! I do agree that support for a 'default' domain would be useful, especially if there's some way to define it based on the server IP address (%l.)
-- Ben Winslow rain@bluecherry.net
On Wed, 2006-03-29 at 13:17 -0500, Ben Winslow wrote:
On Wednesday 29 March 2006 04:05, Daniel Watts wrote:
I always wondered if you could do what with SQL. Thanks =) However the OP actually wants to move AWAY From sql so I don't think this will help him in his situation.
Ah, oops... I hadn't seen the message where he said he was moving away from SQL (well, I think that's what he's saying, anyway) when I wrote my reply.
Yep, that's what I'm looking to do. I'm doing all my authentication via an existing PAM setup (which I use with Sendmail for SMTP AUTH), so I'd prefer not to have the overhead of the SQL setup. Less is more! :)
A generic way to set a default for substitution might be the best way to do this.
Richard
On Mon, 2006-03-27 at 20:47 -0600, Richard Laager wrote:
I'm working on migrating to Dovecot. At the moment, I have a mail path that includes the domain, so I'm using %d to get that. However, if users authenticate without specifying a domain (i.e. using "bob" instead of "bob@wiktel.com"), then %d expands to nothing. I'd like to have that expand to a default domain (wiktel.com) instead. Is that possible?
auth_default_realm = wiktel.com
On Fri, 2006-03-31 at 17:15 +0300, Timo Sirainen wrote:
On Mon, 2006-03-27 at 20:47 -0600, Richard Laager wrote:
I'd like to have that expand to a default domain (wiktel.com) instead. Is that possible?
auth_default_realm = wiktel.com
That seems to be working. Thanks. I'm sorry for bothering everyone. I don't know how I could've missed that in the example config file.
Richard
participants (6)
-
Ben Winslow
-
Daniel Watts
-
Peter Fern
-
Richard Laager
-
Steffen Kaiser
-
Timo Sirainen