Home | Comics | Gallery | (Amazon| ThinkGeek) wishlist | Donations | Impressum | The Book of Postfix | Postfix - Einrichtung, Betrieb und Wartung | Blog


Fuzzy

License

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at
your option) any later version.
    
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
    
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA

Download

here

Einsatzbereich / Where to use

In Unternehmen, die nicht wollen, daß zuviel Mail bounced.
Maybe you don't want the mail bounced without giving the original sender a clue who might be the real recipient.

Aktivierung / Activation

In main.cf:

recipient_delimiter = +

in /etc/postfix/aliases:

catchall:	"|/usr/bin/fuzzy /etc/postfix/virtual.proto"

This assumes that /etc/postfix/virtual.proto contains your ASCII sources to your virtual_maps.

Specify a regular expression style virtual_alias_maps:

/^(.*)@virtual\.com$/   catchall+$1@localhost

If you don't have virtual domains, simply use:

luser_relay = catchall+$user

instead of the virtual_alias_maps stuff above.

Funktionsweise / How does it work?

Als Argumente von /usr/bin/fuzzy kann eine beliebige Anzahl von Texdateien (im Format von canonical_maps oder virtual_alias_maps) angegeben werden.

You can specify an arbitrary number of textfiles (using the format of canonical_maps or virtual_alias_maps) as arguments to /usr/bin/fuzzy.

Der fehlerhafte $user-Teil wird mittels des Python-agrepy Moduls in den Textdateien gesucht.

The erroneous $user-part will be looked up in the textfiles using the python module agrepy.

Ist die Resultatliste klein genug, wird sie ausgegeben. Ansonsten werden entsprechende Meldungen generiert.

If the list of matches is sufficiently small, it will be used in the bounce message; otherwise a warning will be issued instead.

In jedem Fall wird die Mail an den Envelope-Sender gebounced.

In any case the mail will be bounced back to the envelope-sender.

Details

virtual_alias_maps sehen ja normalerweise so aus:
virtual_alias_maps usually look like this:

anton@virtual.de	   user1@localhost
berta@virtual.de	   user2@localhost
caesar@virtual.de	   user3@localhost

Problem: Mail an bertel@virtual.de wird mit User unknown abgewiesen. Von Postfix selbst. Jetzt kommt fuzzy ins Spiel:

Problem: Mail to bertel@virtual.de will be rejected with User unknown. By Postfix itself. This is where fuzzy comes into play:

Wir spalten virtual_maps in 2 maps auf. Eine hash: und eine regexp: map:

We split virtual_maps into 2 maps. One of type hash: and one of type regexp::

virtual_alias_maps = regexp:/etc/postfix/virtual.regexp,
                     hash:/etc/postfix/virtual

in /etc/postfix/virtual.regexp steht:
in /etc/postfix/virtual.regexp we have:

/^(.*)@virtual\.de$/   catchall+$1@localhost

in /etc/postfix/virtual steht der Rest:
in /etc/postfix/virtual we list the remaining entries:

anton@virtual.de	   user1@localhost
berta@virtual.de	   user2@localhost
caesar@virtual.de	   user3@localhost

Wenn nun Mail an bertel@virtual.de geht, greift die Zeile
If someone sends mail to bertel@virtual.de, this line matches

/^(.*)@virtual\.de$/   catchall+$1@localhost

und die Mail geht an:
and the mail goes to:

catchall+bertel@localhost

catchall war ja zuvor schon definiert in /etc/postfix/aliases:
catchall has already been defined in /etc/postfix/aliases:

catchall:       "|/usr/bin/fuzzy /etc/postfix/virtual"

Sodass unser fuzzy Programm mit dem username "bertel" in /etc/postfix/virtual nach dem besten Treffer sucht. Das wird wohl "berta" sein.
This causes fuzzy to search in /etc/postfix/virtual for the best match for "bertel". This will probably be "berta" in our example.

How does it work?

As arguments to /usr/bin/fuzzy you can specify an arbitrary number of plain textfiles (using the format of canonical_maps or virtual_maps).

The unknown $user-part will be searched in those using the agrepy module of Python.

Is the list of possible recipients small enough, it will be returned, otherwise the sender will receive a negative message (too many or no recipients found).


© by Ralf Hildebrandt
This document contains links to external information sources that I do neither monitor nor control. I explicitly disclaim any liabilities in respect to external references.
You are getting this document without any guarantees. Any methods shown above are meant as demonstration and may be wrong in some place. You may damage your system if you try to follow my hints and instructions. You do this at your own risk!

Valid HTML 4.01 Strict

Windows 7 Sins

Locations of visitors to this page

This file was last modified 27. Apr 2007 by root