Marek Kozlowski:
> On 09/30/2014 02:47 PM, Wietse Venema wrote:
> > Marek Kozlowski:
> >> So the question is: can I "ignore" virtual map entries with domain names
> >> not present in some list if I cannot edit the virtual_alias_maps source?
> > 
> > See "man 5 ldap", and look for the domains parameter. This will
> > cause the LDAP client to ignore queries for domains not matching
> > the specified list, as well as lookups with the documented partial
> > address forms "user" and "@domain".
> 
> Yes, I know. As I wrote in one of the previous mails:
> 
> "Well, yes. I can define a more precise LDAP filter in
> `/etc/postfix/ldap-aliases.cf'. However: a way for disabling local
> delivery and forcing remote one even if the address is present in
> virtual_alias_maps would be a better (perfect) solution for me..."

The virtual_alias_maps does not know if the address is local or
not. Its behavior will not depend on that.

> So: yes, I can deal with it. One again the question: Can I do it at
> postfix (not postfix driver) level? Is there any postfix option which says:
>   "I'm serving only the following virtual domains; ignore those entries
> in virtual_alias_maps that don't match it"?

If you say "I'm serving only the following virtual domains; ignore
those entries in virtual_alias_maps that don't match it", then that
is exactly what the "domains" feature in ldap_table(5) does.

If that is now what you want, then you need to be more precise.

People often don't say what they want, so I will take the liberty
to assume that you want the following solution.

If you need to exclude some local domains only in the Postfix SMTP
server, then you can specify an alternate LDAP client.

/etc/postfix/master.cf
    smtp .. .. yadda yadda ... smtpd
        -o virtual_alias_maps=$smtpd_virtual_alias_maps

/etc/postfix/main.cf:
    smtpd_virtual_alias_maps = ldap:/path/to/file

path/to/file:
    # Filter based on inclusion:
    domains = domain1, domain2, domain3
    
You can also use an approach based on exclusion:

    domains = !example1, !example2, static:all

        Wietse

Reply via email to