mouss escribió:
> Roman Medina-Heigl Hernandez a écrit :
>> Noel Jones escribió:
>>> [snip]
>>> Use 1-1 mappings.  Use a little script and a Makefile to let the
>>> computer build the aliased domain from the real domain list you already
>>> maintain.  Size of the table is not an issue.
>>>
>>> Your postconf output looks OK.
>> Yes, all tasks can usually be automatized but sometimes it's good to
>> simplify things. 
>> [snip]
> 
> 
> Here's an (I hope, illustrative) example of a mysql setup where this is
> not a problem:
> 
> - table User contains "user" and "domain" columns.
> - table DomainAlias contains "alias" and "destination" columns.
> 
> 
> query = select User.domain from User, DomainAlias where
>       alias = '%s' and destination = domain
> (the user column must never be empty).

I got the idea (i.e. playing with mysql tables) but I didn't catch your
example. Could you elaborate a bit? Which map would you use that query in?
Virtual_alias_maps?

I got my own (experimental) solution, which is not perfect either. Based on
my former config (see my former mail), I've added a second query to
virtual_alias_maps, so now it is:

virtual_alias_maps   = mysql:/etc/postfix/valias.mysql,
mysql:/etc/postfix/vdomainalias.mysql

Query for:
- valias.mysql:
query           = select destino from alias where origen = '%s'
- vdomainalias.mysql:
query           = select user from user, domainalias where origen =
substring_index('%s', '@', -1) and user = concat( substring_index('%s',
'@', 1), '@', destino);

Tips:
- substring_index('%s', '@', -1) is the domain part of '%s'
- substring_index('%s', '@', 1) is the user part of '%s'
- destino = destination, and origen = source

I think it won't work with "recursion", and it will not catch user aliases
either, but it could be a good starting point (it is working, if domain
alias directly point to a real -non-aliased- domain).

> The limitation is that you can't use "recursive" domain aliases, so you
> can't implement this:
> 
> @example.com  @example.org
> @example.org  @example.net
> 
> but such recursive aliases would be expensive anyway, and one can
> resolve them ahead of time (in the UI that adds them, for instance).

Yes, domain alias recursion wouldn't be a problem. But it should resolve
user aliases to be a complete solution.

Any ideas to improve this? I think this could be solved with more mysql
magic...

-- 

Saludos,
-Roman

PGP Fingerprint:
09BB EFCD 21ED 4E79 25FB  29E1 E47F 8A7D EAD5 6742
[Key ID: 0xEAD56742. Available at KeyServ]

Reply via email to