Re: [exim] Address rewriting for spam control

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Matthew Newton
Dátum:  
Címzett: jeff sacksteder
CC: exim-users
Tárgy: Re: [exim] Address rewriting for spam control
Hi Jeff,

On Wed, Apr 20, 2005 at 01:20:28AM -0400, jeff sacksteder wrote:
> My problem now is that I need to host several distinct user mailboxes
> on the domain. I want to be able to process incoming messages and
> deliver them to the correct party without configuring exim ahead of
> time with those addresses. If we presume for a moment that I use the
> hyphen as a delimiter, the following addresses
>

<snip>
>
> I invite your educated opinions...


I do the following:

/etc/exim4/local-domains contains a list of domains I accept mail for,
and the name of a folder that messages can get put in. For example:

domain1.co.uk: auto-d1
thingy.com: wotsit

/etc/exim4/local-users contains a list of local parts and their
respective local user name, e.g.

myself: matthew
mywife: swmbo

I have the following in my config file (hope I haven't missed any
important bits here):

# define a domain list of the local domains

domainlist local_domains = lsearch;CONFIG_DIR/local-domains

# a router that checks to see if the domain matches. if so, it gets the
# folder name (now in $domain_data) and checks, using require_files, to
# see if that folder exists in the users Maildir. The username is
# searched using local_parts

auto_folder_delivery:
  driver = accept
  domains = +local_domains
  condition = ${if eq{$domain_data}{}{no}{yes}}
  local_part_suffix = -*
  local_parts = lsearch;CONFIG_DIR/local-users
  transport = local_auto_delivery
  user = $local_part_data
  transport_home_directory = /home/$local_part_data
  require_files = /home/$local_part_data/Maildir/.$domain_data.\
    ${substr{1}{$local_part_suffix}}


# the transport that is used:

local_auto_delivery:
driver = appendfile
create_directory
delivery_date_add
directory = $home/Maildir/.$domain_data.${substr{1}{$local_part_suffix}}
directory_mode = 0750
envelope_to_add
maildir_format
message_prefix = ""
message_suffix = ""
mode = 0600
no_mode_fail_narrower
return_path_add

This all goes together something like this:

Mail comes in for "myself-foo@???". "myself" is looked up in
local-users and found to be "matthew".

The domain "domain1.co.uk" is looked up and found to be the folder
"auto-d1".

If ~matthew/Maildir/.auto-d1.foo exists, then the mail will be delivered
there. If it doesn't exist, then the router will fail, and it will
presumably be rejected.

This allows the user to create/delete folders for specific domains that
will be allowed. Much better than my previous version which involved
changing the /etc/aliases file as root...

Hope this helps,

Matthew


--
Matthew Newton <mcn4@???>

UNIX and e-mail Systems Administrator, Network Support Section,
Computer Centre, University of Leicester,
Leicester LE1 7RH, United Kingdom