[Exim] Example config

Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: Vadim Vygonets
Fecha:  
A: exim-users
Asunto: [Exim] Example config
Something Hans Matzen and I did.

The file configure.snippets attached:

# These are config file snippets for handling certain remote
# addresses as local, and making only real external addresses
# visible to users.

The file configure.snippets attached:

# Change locally-generated Message-Id: and Resent-Message-Id:
# headers to world-unique values.

Vadik.

--
Bell Labs Unix -- Reach out and grep someone.
# Copyright (c) 1999
#    Hans Matzen <hans@???>,
#    Vadim Vygonets <vadik@???>.  All rights reserved.


#################################################################
# These are config file snippets for handling certain remote
# addresses as local, and making only real external addresses
# visible to users.
#
# First, adjust values of the following definitions, which will
# be used in configuration snippets below:

EXIM_DIR    = /var/exim
LOCAL_DOM    = home.dom
LOCAL_NET    = 192.168.0.0/16
SMART_HOST    = cc.huji.ac.il



# The scheme is to use global addresses everywhere, which is done
# by rewriting envelope sender and all headers, using a dbm file
# EXIM_DIR/in2ex, which maps internal local parts to external
# e-mail addresses using entries like:
#    user:    someone@???
#
# To do this, it good to hide hostnames in all envelope and
# header addresses first, using this rewriting rule:


*@*.LOCAL_DOM    $1@LOCAL_DOM                        Eh


# Then, rewrite envelope sender and all headers to external
# addresses with this rule:

*@LOCAL_DOM    ${lookup{${lc:$1}}dbm{EXIM_DIR/in2ex}{$value}fail}    Fh



# This means that envelope recipients must be somehow rewritten
# back to local addresses, which is done in one of the two
# proposed ways (you choose).
#
# One way to do it is by rewriting, using a dbm file
# EXIM_DIR/ex2in, which maps external e-mail addresses to
# internal local parts using entries like:
#    someone@???:    user
#
# This is done with the rewriting rule:
#
# *@*    ${lookup{${lc:$0}}dbm{EXIM_DIR/ex2in}{$value@LOCAL_DOM}fail}    T



# The preferred way to do it is by treating certain e-mail
# addresses on remote domains as local, using route_list and self
# options to the domainlist routers, looking up e-mail addresses
# in dbm file EXIM_DIR/ex2in and throwing values away. This is
# an example of such router. It should probably the only router
# in the configuration.

smart_route:
   driver = domainlist
   transport = remote_smtp
   route_list = "*    ${lookup{$local_part@$domain}dbm\
              {EXIM_DIR/ex2in}{@}{SMART_HOST}}    bydns_a"
   self = local



# Then, IF local parts of some of your users are different in
# their internal and external addresses, it's nice to have the
# internal_adjust smartuser director to rewrite the address. It
# should probably be the first director.

internal_adjust:
  driver = smartuser
  new_address = "${lookup{${lc:$local_part@$domain}}dbm{EXIM_DIR/ex2in}\
           {$value@LOCAL_DOM}fail}"

# Exim filter

# Copyright (c) 1999
#    Hans Matzen <hans@???>,
#    Vadim Vygonets <vadik@???>.  All rights reserved.


#################################################################
# Change locally-generated Message-Id: and Resent-Message-Id:
# headers to world-unique values.

# Notes:
# Change every occurence of "home.dom" to your home domain.
# Change every occurence of "uniqie.remote.dom" to some unique value.

# Unique values, as Vadik explained in his message to exim-users,
# can be chosen in different ways:

### The ideal way is to choose "hostnames" in existing domains whose
### admins you know, and you will be sure that no hostname ending
### with ".nonexistant.friendly.dom" will ever appear on this planet,
### not even on someone else's message IDs.

### Another ideas include putting after your hostname things like:
### .972.2.6412694.phone
### .29.32.columbia.street.jerusalem.96583.israel.addr
### .1122.3576.3847.1446.visa.01.2002.expiration.date.vadim.vygonets.name.credit.card

# This snippet provides to schemes to do such rewriting. The
# first scheme is to have mapping from local hostnames to unique
# "Message-Id domains". The second scheme is to use one unique
# "Message-Id domain", inserting the original "domain" into the
# "local-part" of the new Message-Id header.

# Precaution
headers remove "X-Vygo-Net-Temporary-Message-Id"

# Change Message-Id:
if "${if def:h_Message-Id: {yes}}" is yes and 
    ${lc:${domain:$h_Message-Id:}} is    "home.dom" or
    ${lc:${domain:$h_Message-Id:}} ends ".home.dom" then
# This is if you want to have a file mapping each hostname to a unique
# Message-Id domain part, or, if it fails, preserves the original domain part:
#    headers add "X-Vygo-Net-Temporary-Message-Id: <${local_part:$h_Message-Id:}@${lookup{${domain:$h_Message-Id:}}lsearch{/var/exim/msgid-hosts}{$value}{${domain:$h_Message-Id:}}}>\n"
# This rewrites Message-Id as <local_part.domain@???>:
    headers add "X-Vygo-Net-Temporary-Message-Id: <${local_part:$h_Message-Id:}.${domain:$h_Message-Id:}@unique.remote.dom>\n"
    headers remove "Message-Id"
    headers add "Message-Id: $h_X-Vygo-Net-Temporary-Message-Id:"
    headers remove "X-Vygo-Net-Temporary-Message-Id"
endif


# Change Resent-Message-Id:
if "${if def:h_Resent-Message-Id: {yes}}" is yes and 
    ${lc:${domain:$h_Resent-Message-Id:}} is    "home.dom" or
    ${lc:${domain:$h_Resent-Message-Id:}} ends ".home.dom" then
# This is if you want to have a file mapping each hostname to a unique
# Message-Id domain part, or, if it fails, preserves the original domain part:
#    headers add "X-Vygo-Net-Temporary-Message-Id: <${local_part:$h_Resent-Message-Id:}@${lookup{${domain:$h_Resent-Message-Id:}}lsearch{/var/exim/msgid-hosts}{$value}{${domain:$h_Resent-Message-Id:}}}>\n"
# This rewrites Message-Id as <local_part.domain@???>:
    headers add "X-Vygo-Net-Temporary-Message-Id: <${local_part:$h_Resent-Message-Id:}.${domain:$h_Resent-Message-Id:}@unique.remote.dom>\n"
    headers remove "Resent-Message-Id"
    headers add "Resent-Message-Id: $h_X-Vygo-Net-Temporary-Message-Id:"
    headers remove "X-Vygo-Net-Temporary-Message-Id"
endif