2010-11-09 23:51

Dans un précédent billet, j’expliquais comment mettre en place un “mangeur de courriel” avec Exim, de manière à se créer des adresses multiples qui redirigent toutes vers la même destination :

catchall_pub:
  driver = redirect
  domains = pub.mondomaine.com
  data = utilisateur@mondomaine.com

Ensuite, j’expliquais que sur l’adresse destination, on pouvait mettre en place un filtre Sieve ou Exim via un fichier .forward.

On peut vouloir mettre en place le filtre directement dans Exim, par soucis de centralisation de configuration, ou tout simplement si la boîte destination ne supporte pas les filtres.

Il suffit d’ajouter l’option local_parts :

catchall_pub:
  driver = redirect
  domains = pub.mondomaine.com
  local_parts = !/etc/exim4/pub.mondomaine.com.blacklist
  data = utilisateur@mondomaine.com

Dans /etc/exim4/pub.mondomaine.com.blacklist, on place les adresses rejetées, une par ligne :

toto1
titi2

Ainsi, les adresses toto1@pub.mondomaine.com et titi2@pub.mondomaine.com sont désormais rejetées.

Doc Exim4 :

2010-11-09 23:51 · Tags: , , ,

2 Comments

  1. This is almost what I want, except that this local_parts line doesn’t work for me. In particular, I look for a solution that filter both by blacklist and by anything that has a certain prefix (which works with local_part_prefix).

    I have:

    catchall_pub:
    driver = redirect
    domains = <mydomain>
    local_parts = ! <somefile> # This doesn’t work
    local_part_prefix = pass-
    data = <someaddress>
    retry_use_local_part

    Any ideas? I use Exim 4.71 on Ubuntu.

    The blacklist file is readable to anybody and I can’t see anything helpful in the logs.

    I’m close to thinking that writing a forwarder in Python would have been simpler…

    Répondre

  2. Hello,

    I found this on the page :
    http://www.exim.org/exim-html-4.30/doc/html/spec_3.html#SECT3.11

    ” If the local_parts option is set, the local part of the address must be in the set of local parts that it defines. If local_part_prefix or local_part_suffix is in use, the prefix or suffix is removed from the local part before this check. If you want to do precondition tests on local parts that include affixes, you can do so by using a condition option (see below) that uses the variables $local_part, $local_part_prefix, and $local_part_suffix as necessary. “

    seem you should use local_parts without the prefix in your blacklist file.

    Did you tried ??

    Marc

    Répondre

Leave a Reply

Your email address will not be published. Required fields are marked *