Re: [exim] Exim sends message twice if alias points to itsel…

Top Page
Delete this message
Reply to this message
Author: Konstantin Boyandin
Date:  
To: exim-users
Subject: Re: [exim] Exim sends message twice if alias points to itself
Hello,

JFYI: I have tried to build brand-new Exim 4.69 out of sources. It
exhibits exactly the same behavior.

2008/5/5 Heiko Schlittermann <hs@???>:
> Konstantin Boyandin <temmokan@???> (Mo 05 Mai 2008 00:22:08 CEST):
>
> > Hello,
> >
>  > 2008/5/4 Heiko Schlittermann <hs@???>:
>  > > Konstantin Boyandin <temmokan@???> (So 04 Mai 2008 10:18:36 CEST):
>  > >  > [root@monstera lists]# exim -v -bv userlist
>  > >  > user1@???
>  > >  >     <-- itelsib-adm@???
>  > >  >   router = localuser, transport = local_delivery
>  > >  > user2@???
>  > >  >     <-- itelsib-adm@???
>  > >  >   router = localuser, transport = local_delivery
>  > >  > userlist@???
>  > >  >     <-- itelsib-adm@???
>  > >  >   router = localuser, transport = local_delivery

> > >
> > > Where do you see the dups here? I do not.
> > > And I tested it in my setup with sending a real mail and didn't get
> > > dups. (This I did just to prove that there is no difference between
> > > that what 'exim -v -bv' tells and a real delivery.)
> >
> > I'm still not sure why the messages are duplicated. May anyone explain
> > how one can see the whole logic of choosing routers and calling
> > transports for a given address?
>
> you may test
>
>     exim -d-all+route -v -bv userlist

>
> (And I didn't have time to check your config file more in depth...)


I include both exim.conf and the result of the command 'exim
-d-all+route -v -bv userlist' below:

========= exim.conf below
######################################################################
#                  Runtime configuration file for Exim               #
######################################################################


queue_list_requires_admin = false

######################################################################
#                    MAIN CONFIGURATION SETTINGS                     #
######################################################################


primary_hostname = example.com

# The next three settings create two lists of domains and one list of hosts.
# These lists are referred to later in this configuration using the syntax
# +local_domains, +relay_to_domains, and +relay_from_hosts, respectively. They
# are all colon-separated lists:

domainlist local_domains = @ : monstera.local : localhost :
localhost.localdomain
domainlist relay_to_domains =
hostlist relay_from_hosts = 127.0.0.1 : 10.1.0.0/24
hostlist auth_relay_hosts = *

acl_smtp_mail = acl_check_mail
acl_smtp_rcpt = acl_check_rcpt
acl_smtp_data = acl_check_data
acl_smtp_mime = acl_check_mime

av_scanner = clamd:/var/run/clamd.exim/clamd.sock

# Allow any client to use TLS.

tls_advertise_hosts = *

tls_certificate = /etc/pki/tls/certs/exim.pem
tls_privatekey = /etc/pki/tls/private/exim.pem

daemon_smtp_ports = 25 : 465 : 587
tls_on_connect_ports = 465


never_users = root

host_lookup = *

auth_advertise_hosts = ${if eq {$tls_cipher}{}{}{*}}

rfc1413_hosts = *
rfc1413_query_timeout = 5s

ignore_bounce_errors_after = 2d

timeout_frozen_after = 7d

begin acl

acl_check_mail:

  deny condition = ${if eq{$sender_helo_name}{} {1}}
       message = Nice boys say HELO first



accept

acl_check_rcpt:

accept hosts = :

  deny    message       = Restricted characters in address
          domains       = +local_domains
          local_parts   = ^[.] : ^.*[@%!/|]


  deny    message       = Restricted characters in address
          domains       = !+local_domains
          local_parts   = ^[./|] : ^.*[@%!] : ^.*/\\.\\./


  accept  local_parts   = *
          domains       = +local_domains


  require verify        = sender


  accept  hosts         = +relay_from_hosts
          control       = submission


  accept  authenticated = *
          control       = submission


  require message = relay not permitted
          domains = +local_domains : +relay_to_domains


require verify = recipient

accept

acl_check_data:

accept

acl_check_mime:

  # File extension filtering.
  deny message = Blacklisted file extension detected
       condition = ${if match \
                        {${lc:$mime_filename}} \
                        {\N(\.exe|\.pif|\.bat|\.scr|\.lnk|\.com)$\N} \
                     {1}{0}}


accept


begin routers

dnslookup:
driver = dnslookup
domains = ! +local_domains
transport = remote_smtp
ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
no_more

system_aliases:
driver = redirect
allow_fail
allow_defer
data = ${lookup{$local_part}lsearch{/etc/aliases}}
# user = exim
check_ancestor = true
# repeat_use = false
file_transport = address_file
pipe_transport = address_pipe

dspam_router:
    no_verify
    check_local_user
# When to scan a message :
# - it isn't already flagged as spam from Spamassassin
# - it isn't already flagged as spam from DSPAM
# - it isn't already scanned
# - it isn't local
# - it isn't from one internal domain user to another
# - it is less than 2048k in size
    condition   = "${if and { \
        {!def:h_X-Spam-Flag:} \
        {!def:h_X-FILTER-DSPAM:} \
        {!eq {$received_protocol}{local}} \
        { <= {$message_size}{2048k}} \
        }\
        {1}{0}}"
    headers_add  = "X-FILTER-DSPAM: by $primary_hostname on $tod_full"
    driver       = accept
    transport    = dspam_spamcheck
# Which users to run dspam for.
#local_parts = /usr/local/etc/exim/dspam-testers


dspam_addspam_router:
    driver            = accept
    local_part_prefix = spam-
    transport         = dspam_addspam


dspam_falsepositive_router:
    driver            = accept
    local_part_prefix = nospam-
    transport         = dspam_falsepositive


#
# DSPAM-related routers end
#

userforward:
driver = redirect
check_local_user
# local_part_suffix = +* : -*
# local_part_suffix_optional
file = $home/.forward
allow_filter
no_verify
no_expn
check_ancestor = true
file_transport = address_file
pipe_transport = address_pipe
reply_transport = address_reply

procmail:
driver = accept
check_local_user
require_files = ${local_part}:+${home}/.procmailrc:/usr/bin/procmail
transport = procmail
no_verify

localuser:
driver = accept
check_local_user
# local_part_suffix = +* : -*
# local_part_suffix_optional
transport = local_delivery
cannot_route_message = Unknown user

######################################################################
#                      TRANSPORTS CONFIGURATION                      #
######################################################################
#                       ORDER DOES NOT MATTER                        #
#     Only one appropriate transport is called for each delivery.    #
######################################################################


begin transports

remote_smtp:
driver = smtp
transport_filter = /etc/mail/headers-rewrite

# This transport invokes procmail to deliver mail
procmail:
driver = pipe
command = "/usr/bin/procmail -d $local_part"
return_path_add
delivery_date_add
envelope_to_add
user = $local_part
initgroups
return_output

local_delivery:
driver = appendfile
file = /var/mail/$local_part
delivery_date_add
envelope_to_add
return_path_add
group = mail
mode = 0660

address_pipe:
driver = pipe
return_output

address_file:
driver = appendfile
group = mail
delivery_date_add
envelope_to_add
return_path_add

address_reply:
driver = autoreply

#
# DSPAM transports start
#

dspam_spamcheck:
    driver = pipe
        command = "/usr/local/dspam-3.8.0/bin/dspam --mode=teft
--feature=noise,whitelist --debug --deliver=innocent,spam --user
${lc:$local_part} -f \
        '$sender_address' -- %u"
    home_directory = "/tmp"
    current_directory = "/tmp"
    user = exim
    group = mail
    log_output = true
    return_fail_output = true
    return_path_add = false
    message_prefix =
    message_suffix =


dspam_addspam:
    driver = pipe
    command = "/usr/local/dspam-3.8.0/bin/dspam --debug --class=spam
--source=error --user \
        ${lc:$local_part} -f '$sender_address' -- %u"
    home_directory = "/tmp"
    current_directory = "/tmp"
    user = exim
    group = mail
    log_output = true
    return_fail_output = true
    return_path_add = false
    message_prefix =
    message_suffix =


dspam_falsepositive:
    driver = pipe
    command = "/usr/local/dspam-3.8.0/bin/dspam --debug
--class=innocent --source=error \
        --deliver=innocent,spam --user ${lc:$local_part}\
        -f '$sender_address' -- %u"
    home_directory = "/tmp"
    current_directory = "/tmp"
    user = exim
    group = mail
    log_output = true
    return_fail_output = true
    return_path_add = false
    message_prefix =
    message_suffix =


#
# DSPAM transports end
#


######################################################################
#                      RETRY CONFIGURATION                           #
######################################################################


begin retry

*                      *           F,2h,15m; G,16h,1h,1.5; F,4d,6h


######################################################################
#                      REWRITE CONFIGURATION                         #
######################################################################


begin rewrite

begin authenticators

PLAIN:
  driver                     = plaintext
  server_set_id              = $auth2
  server_prompts             = :
  server_condition           = ${if saslauthd{{$2}{$3}{smtp}} {1}}
  server_advertise_condition = ${if def:tls_cipher }
========= exim.conf above


========= output of 'exim -d-all+route -v -bv userlist' below
Exim version 4.62 uid=0 gid=0 pid=15199 D=2000001
Berkeley DB: Sleepycat Software: Berkeley DB 4.3.29: (March 24, 2006)
Support for: crypteq iconv() IPv6 PAM Perl TCPwrappers OpenSSL
Content_Scanning Old_Demime
Lookups: lsearch wildlsearch nwildlsearch iplsearch cdb dbm dbmnz
dnsdb dsearch ldap ldapdn ldapm mysql nis nis0 nisplus passwd pgsql
sqlite
Authenticators: cram_md5 cyrus_sasl plaintext spa
Routers: accept dnslookup ipliteral manualroute queryprogram redirect
Transports: appendfile/maildir/mailstore/mbx autoreply lmtp pipe smtp
Fixed never_users: 0
Size of off_t: 8
configuration file is /etc/exim/exim.conf
log selectors = 00000ffc 00089001
trusted user
admin user
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

routing userlist@???
--------> dnslookup router <--------
local_part=userlist domain=example.com
checking domains
dnslookup router skipped: domains mismatch
--------> system_aliases router <--------
local_part=userlist domain=example.com
calling system_aliases router
rda_interpret (string): ${lookup{$local_part}lsearch{/etc/aliases}}
expanded: userlist,user1
file is not a filter file
parse_forward_list: userlist,user1
extract item: userlist
extract item: user1
system_aliases router generated user1@???
errors_to=NULL transport=NULL
uid=unset gid=unset home=NULL
generated parent replaced by child
system_aliases router generated userlist@???
errors_to=NULL transport=NULL
uid=unset gid=unset home=NULL
routed by system_aliases router
envelope to: userlist@???
transport: <none>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

routing userlist@???
--------> dnslookup router <--------
local_part=userlist domain=example.com
checking domains
dnslookup router skipped: domains mismatch
--------> system_aliases router <--------
system_aliases router skipped: previously routed userlist@???
--------> dspam_router router <--------
local_part=userlist domain=example.com
dspam_router router skipped: verify 2 0 0
--------> dspam_addspam_router router <--------
local_part=userlist domain=example.com
dspam_addspam_router router skipped: prefix mismatch
--------> dspam_falsepositive_router router <--------
local_part=userlist domain=example.com
dspam_falsepositive_router router skipped: prefix mismatch
--------> userforward router <--------
local_part=userlist domain=example.com
userforward router skipped: verify 2 0 0
--------> procmail router <--------
local_part=userlist domain=example.com
procmail router skipped: verify 2 0 0
--------> localuser router <--------
local_part=userlist domain=example.com
checking for local user
calling localuser router
localuser router called for userlist@???
domain = example.com
set transport local_delivery
queued for local_delivery transport: local_part = userlist
domain = example.com
errors_to=NULL
domain_data=NULL localpart_data=NULL
routed by localuser router
envelope to: userlist@???
transport: local_delivery
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

routing user1@???
--------> dnslookup router <--------
local_part=user1 domain=example.com
checking domains
dnslookup router skipped: domains mismatch
--------> system_aliases router <--------
local_part=user1 domain=example.com
calling system_aliases router
rda_interpret (string): ${lookup{$local_part}lsearch{/etc/aliases}}
expanded:
file is not a filter file
parse_forward_list:
system_aliases router declined for user1@???
--------> dspam_router router <--------
local_part=user1 domain=example.com
dspam_router router skipped: verify 2 0 0
--------> dspam_addspam_router router <--------
local_part=user1 domain=example.com
dspam_addspam_router router skipped: prefix mismatch
--------> dspam_falsepositive_router router <--------
local_part=user1 domain=example.com
dspam_falsepositive_router router skipped: prefix mismatch
--------> userforward router <--------
local_part=user1 domain=example.com
userforward router skipped: verify 2 0 0
--------> procmail router <--------
local_part=user1 domain=example.com
procmail router skipped: verify 2 0 0
--------> localuser router <--------
local_part=user1 domain=example.com
checking for local user
calling localuser router
localuser router called for user1@???
domain = example.com
queued for local_delivery transport: local_part = user1
domain = example.com
errors_to=NULL
domain_data=NULL localpart_data=NULL
routed by localuser router
envelope to: user1@???
transport: local_delivery
>>>>>>>>>>>>>>>> Exim pid=15199 terminating with rc=0 >>>>>>>>>>>>>>>>

========= output of 'exim -d-all+route -v -bv userlist' above

The string in /eetc/aliases is

userlist: userlist,user1

I am at my wits' end. No combination of

check_ancestor
and
repeat_use

in system_aliases router seems to work. Any advise on where to look
for possible cause of this problem could be very appreciated. I have
no desire to downgrade back to Sendmail.

Thanks.

All the best,

Konstantin