Re: [exim] Archiving Problems

Góra strony
Delete this message
Reply to this message
Autor: Dean Bishop
Data:  
Dla: Chris Wilson
CC: exim-users
Temat: Re: [exim] Archiving Problems
Hey Chris,

    Just when I thought I was getting it.


    The duplication is in the outgoing_local_copy.  There is a third
copy in the incoming_local_copy but that is expected and desired.  One
for the sender, one for the recipient and, unfortunately, one for the
alias.


    I had meant to just put the skipping router at the top or the
router list which would be just above the archiving routers.
Complicating things is that this is a cPanel system so I am limited in
which sections I can modify as updates and such overwrite other changes
:(.


    So the beginning of my routers would look something like this:


######################################################################
#                      ROUTERS CONFIGURATION                         #
#            Specifies how remote addresses are handled              #
######################################################################
#                          ORDER DOES MATTER                         #
#  A remote address is passed to each in turn until it is accepted.  #
######################################################################


# Remote addresses are those with a domain that does not match any item
# in the "local_domains" setting above.

#
# Demo Safety Router
#

democheck:
    driver = redirect
    require_files = "+/etc/demouids"
    condition = "${if eq {${lookup {$originator_uid} lsearch
{/etc/demouids} {$value}}}{}{false}{true}}"
    allow_fail
    data = :fail: demo accounts are not permitted to relay email


aliases:
driver = redirect
data = ${lookup{$local_part}wildlsearch{/etc/exim/domains/$domain}}
condition =
$(lookup($sender_domain}wildlsearch{/etc/userdomains}}{true}{false}
# this is the important part:
# don't archive redirected emails again!
redirect_router = checkspam2


# Dean's Archiver Router
outgoing_archiver:
# works but duplicates messages sent from local to a local alias
condition = ${if and {{exists{${extract{5}{:}{${lookup
passwd{${lookup{$sender_address_domain}lsearch*{/etc/userdomains}{$value
}}}{$value}}}}/mail/$sender_address_domain/$sender_address_local_part}}{
!eq{$sender_address_local_part}{root}} } }
debug_print = true
unseen
no_expn
verify
transport = outgoing_local_copy
driver = accept

incoming_archiver:
require_files = "+${extract{5}{::}{${lookup
passwd{${lookup{$domain}lsearch*{/etc/userdomains}{$value}}}{$value}}}}/
etc/$domain/passwd"
condition = ${lookup {$local_part} lsearch{${extract{5}{:}{${lookup
passwd{${lookup{$domain}lsearch*{/etc/userdomains}{$value}}}{$value}}}}/
etc/$domain/passwd}{true}{false}}
no_expn
no_verify
unseen
domains = +local_domains
transport = incoming_local_copy
driver = accept


# This router routes to remote hosts over SMTP using a DNS lookup with
# default options.

#
# Handles nobody and webspam and mail trap checks in checkspam2 and
gives a userful error
#

checkspam2:
    domains = ! +local_domains
    condition = "${perl{checkspam2}}"
    driver = redirect
    ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8 : 64.94.110.0/24
    allow_fail
    data = "${perl{checkspam2_results}}"


########################################################################
##########

Thanks,
dean





-----Original Message-----
From: Chris Wilson [mailto:chris@qwirx.com]
Sent: Saturday, December 03, 2011 5:36 PM
To: Dean Bishop
Cc: exim-users@???
Subject: Re: [exim] Archiving Problems

Hi Dean,

On Sat, 3 Dec 2011, Dean Bishop wrote:

> So my archiving routers are such:
> outgoing_archiver:
> # works but duplicates messages sent from local to a local alias


When you say it duplicates them, do you mean that they appear once in
outgoing_local_copy and once in incoming_local_copy, or do they appear
multiple times in outgoing_local_copy?

> I read the manual on redirect_router and it seems apropos but I can't
> see where to put it.


In all of your routers which have "driver = redirect".

> actually, reading your message again I may be beginning to see the
> light. If I put the redirect router at the top of my routers or at
> least before the outgoing_archiver router, it's checking to see if the


> message is directed at an alias and if it is then skip the
> outgoing_archiver.


No, if you put all your redirect routers (driver = redirect) before the
archivers, then you will get a copy of the message for every address
resulting from alias expansion, which is more or less the same as you're
seeing now.

The aim of adding redirect_router to your redirecting routers is to skip
passing through outgoing_archiver and incoming_archiver a second time
for each expanded alias, as you are seeing now. You can do this by
telling these routers that after redirection, they should start
processing the expanded addresses with the router after
incoming_archiver, instead of at the top.

> aliases:
>     driver = redirect
>     data =
> ${lookup{$local_part}wildlsearch{/etc/exim/domains/$domain}}
>     condition =
> $(lookup($sender_domain}wildlsearch{/etc/userdomains}}
>     # this is the important part:
>     # don't archive redirected emails again!
>     redirect_router = dnslookup

>
> Is that sane?


Kinda. The condition should evaluate to true or false, not a lookup. But
I don't think you even need to add it. Just add "redirect_router =
dnslookup" (assuming that dnslookup is the router immediately after
incoming_archiver) to all your redirecting routers.

Cheers, Chris.
-- 
_____ __     _
\  __/ / ,__(_)_  | Chris Wilson <chris+sig@???> Cambs UK | / (_/
,\/ _/ /_ \ | Security/C/C++/Java/Ruby/Perl/SQL Developer |
\__/_/_/_//_/___/ | We are GNU : free your mind & your software |