[exim] aliases problem

Pàgina inicial
Delete this message
Reply to this message
Autor: Klauss Fumuldavijus
Data:  
A: exim-users
Assumpte: [exim] aliases problem
hello people,

I got stuck on sending emails to recipients aliased names. After digging
google for solutions for a whole day i decided to ask for you help.
Actualy problem is obvious - aliased addres as@??? is replaced
with non existent esu@??? instead of pointing to
esu@???,
but why?

Some short advance info:
mysql> select * from domains;
+----------------+---------+
| domain         | type    |

+----------------+---------+
| numerouno.com | LOCAL |
| numeroduo.com | VIRTUAL |

+----------------+---------+
2 rows in set (0.00 sec)

mysql> select * from users;
+----------+------------------+---------------+---------+------+------+----------------+-------+--------+
| login    | name             | password      | decrypt | uid  | gid  | 

domain         | quota | status |
+----------+------------------+---------------+---------+------+------+----------------+-------+--------+

| admin    | Administrator    | A.NDa\fsaADSd | qwertyu | 1005 |    6 | 

numerouno.com  |     0 | 1      |

| esu      | esu              | Ie3MOEtnsfWDF | asdfg   | 1003 |    6 | 

numeroduo.com  |     0 | 1      |
+----------+------------------+---------------+---------+------+------+----------------+-------+--------+
2 rows in set (0.00 sec)


mysql> select * from aliases;
+---------------+----------------+------------+
| local_part    | domain         | recipients |

+---------------+----------------+------------+
| mailer-daemon | numerouno.com  | admin      |
| root          | numerouno.com  | admin      |
| as            | numeroduo.com  | esu        |

+---------------+----------------+------------+
3 rows in set (0.00 sec)

logs doesn't help much...can't understand why on line 22 esu@numerouno
apears:

1: calling system_aliases router
2: rda_interpret (string): ${lookup mysql{SELECT recipients FROM aliases 
WHERE local_part='${local_part}' AND domain='${domain}'}}
3: expanding: SELECT recipients FROM aliases WHERE 
local_part='${local_part}' AND domain='${domain}'
4:    result: SELECT recipients FROM aliases WHERE local_part='as' AND 
domain='numeroduo.com'
5: search_open: mysql "NULL"
6:   cached open
7: search_find: file="NULL"
8:   key="SELECT recipients FROM aliases WHERE local_part='as' AND 
domain='numeroduo.com'" partial=-1 affix=NULL starflags=0
9: LRU list:
10: internal_search_find: file="NULL"
11:   type=mysql key="SELECT recipients FROM aliases WHERE local_part='as' 
AND domain='numeroduo.com'"
12: database lookup required for SELECT recipients FROM aliases WHERE 
local_part='as' AND domain='numeroduo.com'
13: MYSQL query: SELECT recipients FROM aliases WHERE local_part='as' AND 
domain='numeroduo.com'
14: MYSQL using cached connection for 192.168.0.2/user/pass
15: lookup yielded: esu
16: expanding: ${lookup mysql{SELECT recipients FROM aliases WHERE 
local_part='${local_part}' AND domain='${domain}'}}
17:    result: esu
18: expanded: esu
19: file is not a filter file
20: parse_forward_list: esu
21: extract item: esu
22: system_aliases router generated esu@??? (should be 
esu@??? here)
23:   errors_to=NULL transport=NULL
24:   uid=unset gid=unset home=NULL
25: routed by system_aliases router
26:   envelope to: as@???
27:   transport: <none>
28: >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
29: Considering esu@???
30: >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
31: routing esu@???


AFAIK this might be te result of qualify_domain. But, if so, what makes to
use error-reporting domain name?
On the other hand - one more line in the logs seems suspicious to me : "
MYSQL using cached connection for 192.168.0.2/user/pass"
Maybe use of cached connection somehow looses previously defined ${domain}
constant and default one "numerouno.com" comes instead?


exim's config below:
primary_hostname = numerouno.com
domainlist local_domains = ${lookup mysql{SELECT domain FROM domains \
                        WHERE domain='${domain}' AND \
                        (type='LOCAL' OR type='VIRTUAL')}}
domainlist relay_to_domains = ${lookup mysql{SELECT domain FROM domains \
                        WHERE domain='${domain}' AND type='RELAY'}}
hostlist   relay_from_hosts = 127.0.0.1
auth_advertise_hosts = *
helo_accept_junk_hosts = *
daemon_smtp_ports = 25
#tls_on_connect_ports = 465
#tls_advertise_hosts = *
#tls_certificate = /etc/ssl/certs/mail.pem
#tls_privatekey = /etc/ssl/certs/mail.pem
log_selector = \
+address_rewrite \
+all_parents \
+arguments \
+connection_reject \
+delay_delivery \
+delivery_size \
+dnslist_defer \
+incoming_interface \
+incoming_port \
+lost_incoming_connection \
+queue_run \
+received_sender \
+received_recipients \
+retry_defer \
+sender_on_delivery \
+size_reject \
+skip_delivery \
+smtp_confirmation \
+smtp_connection \
+smtp_protocol_error \
+smtp_syntax_error \
+subject \
+tls_cipher\
+tls_peerdn


acl_smtp_rcpt = acl_check_rcpt
acl_smtp_mime = acl_check_mime
qualify_domain = numerouno.com
allow_domain_literals = false
never_users = root
host_lookup = *
rfc1413_hosts = *
rfc1413_query_timeout = 0s
ignore_bounce_errors_after = 30m
timeout_frozen_after = 3d
freeze_tell = postmaster
message_size_limit = 10M
smtp_accept_max = 100
smtp_accept_max_per_connection = 5
smtp_accept_max_per_host = 2
split_spool_directory = true
remote_max_parallel = 15
smtp_banner = "${primary_hostname} ESMTP"
hide mysql_servers = 192.168.0.2/mail/user/pass

######################################################################
#                       ACL CONFIGURATION                            #
#         Specifies access control lists for incoming SMTP mail      #
######################################################################


begin acl

acl_check_rcpt:

accept hosts = :

  deny    domains       = +local_domains
          local_parts   = ^[.] : ^.*[@%!/|]


  deny    domains       = !+local_domains
          local_parts   = ^[./|] : ^.*[@%!] : ^.*/\\.\\./


  accept  local_parts   = postmaster
          domains       = +local_domains


  require verify        = sender


  deny    message       = HELO/EHLO required by SMTP RFC
          condition     = ${if eq{$sender_helo_name}{}{yes}{no}}


  deny    message       = Go Away! You are spammer.
          condition     = ${if match{$sender_host_name} \
                          {bezeqint\\.net|net\\.il|dialup|dsl|pool|peer|dhcp} 
\
                          {yes}{no}}


  deny    message       = rejected because \
  $sender_host_address is in a black list at $dnslist_domain\n$dnslist_text
          log_message   = found in $dnslist_domain
          dnslists      = relays.ordb.org
  deny    message       = message from \
  $sender_host_address rejected - see http://njabl.org/
          log_message   = found in $dnslist_domain
          dnslists      = dnsbl.njabl.org
  deny    message       = rejected because \
  $sender_host_address for bad WHOIS info, see http://www.rfc-ignorant.org/
          log_message   = found in $dnslist_domain
          dnslists      = ipwhois.rfc-ignorant.org
  deny    message       = rejected because $sender_host_address \
  is in a black list at $dnslist_domain\n$dnslist_text
          log_message   = found in $dnslist_domain
          dnslists      = dialups.mail-abuse.org
  deny    message       = rejected because $sender_host_address \
  is in a black list at $dnslist_domain\n$dnslist_text
          log_message   = found in $dnslist_domain
          dnslists      = list.dsbl.org
  deny    message       = Spam blocked see: \
  http://www.spamcop.net/w3m?action=checkblock&ip=$sender_host_address
          log_message   = found in $dnslist_domain
          dnslists      = bl.spamcop.net
  deny    message       = rejected, $sender_host_address \
  Open Proxy, see: $dnslist_domain\n$dnslist_text
          log_message   = found in $dnslist_domain
          dnslists      = dnsbl.void.ru


  accept  domains       = +local_domains
          endpass
          message       = unknown user
          verify        = recipient


  accept  domains       = +relay_to_domains
          endpass
          message       = unrouteable address
          verify        = recipient


  accept  hosts         = +relay_from_hosts
  accept  authenticated = *
  deny    message       = relay not permitted


acl_check_mime:

warn decode = default

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


  deny message = Sorry, noone speaks chinese here
       condition = ${if eq{$mime_charset}{gb2312}{1}{0}}


accept


######################################################################
#                      ROUTERS CONFIGURATION                         #
#               Specifies how addresses are handled                  #
######################################################################
#     THE ORDER IN WHICH THE ROUTERS ARE DEFINED IS IMPORTANT!       #
# An address is passed to each router in turn until it is accepted.  #
######################################################################


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 mysql{SELECT recipients FROM aliases \
         WHERE local_part='${local_part}' AND domain='${domain}'}}
  no_more


userforward:
  driver = redirect
  allow_fail
  allow_defer
  data = ${lookup mysql{SELECT recipients FROM userforward \
         WHERE local_part='${local_part}' AND domain='${domain}'}}


virtual_localuser:
  driver = accept
  domains = ${lookup mysql{SELECT domain from domains WHERE 
domain='${domain}'}}
  local_parts = ${lookup mysql{SELECT login from users \
                WHERE login='${local_part}' AND domain='${domain}'}}
  transport = local_delivery



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


begin transports

remote_smtp:
driver = smtp

local_delivery:
driver = appendfile
check_string = ""
create_directory
delivery_date_add
directory = /var/mail/$domain/$local_part
directory_mode = 770
envelope_to_add
maildir_format
maildir_tag = ,S=$message_size
message_prefix = ""
message_suffix = ""
group = mail

  mode = 0660
  quota = ${lookup mysql{SELECT quota FROM users \
          WHERE login='${local_part}' AND domain='${domain}'}{${value}M}}
  quota_size_regex = S=(\d+)$
  quota_warn_threshold = 75%
  return_path_add


address_pipe:
driver = pipe
return_output

address_file:
driver = appendfile
delivery_date_add
envelope_to_add
return_path_add

address_reply:
driver = autoreply

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


begin retry

# This single retry rule applies to all domains and all errors. It specifies
# retries every 15 minutes for 2 hours, then increasing retry intervals,
# starting at 1 hour and increasing each time by a factor of 1.5, up to 16
# hours, then retries every 6 hours until 4 days have passed since the first
# failed delivery.

# Address or Domain    Error       Retries
# -----------------    -----       -------


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




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


# There are no rewriting specifications in this default configuration file.

begin rewrite



######################################################################
#                   AUTHENTICATION CONFIGURATION                     #
######################################################################


# There are no authenticator specifications in this default configuration
file.

begin authenticators
auth_plain:
  driver = plaintext
  public_name = PLAIN
  server_condition = ${lookup mysql{SELECT login FROM users \
                        WHERE login = '${quote_mysql:${local_part:$2}}' \
                        AND domain = '${quote_mysql:${domain:$2}}' \
                        AND decrypt = '${quote_mysql:$3}' \
                        AND status = '1'}{yes}{no}}
  server_prompts = :
server_set_id = $2


auth_login:
  driver = plaintext
  public_name = LOGIN
  server_condition = ${lookup mysql{SELECT login FROM users \
                        WHERE login = '${quote_mysql:${local_part:$1}}' \
                        AND domain = '${quote_mysql:${domain:$1}}' \
                        AND decrypt = '${quote_mysql:$2}' \
                        AND status = '1'}{yes}{no}}
  server_prompts = Username:: : Password::
server_set_id = $1


auth_cram_md5:
  driver = cram_md5
  public_name = CRAM-MD5
  server_secret = ${lookup mysql{SELECT decrypt FROM users \
                        WHERE login = '${quote_mysql:${local_part:$1}}' \
                        AND domain = '${quote_mysql:${domain:$1}}' \
                        AND status = '1'}{$value}fail}
server_set_id = $1




######################################################################
#                   CONFIGURATION FOR local_scan()                   #
######################################################################


# If you have built Exim to include a local_scan() function that contains
# tables for private options, you can define those options here. Remember to
# uncomment the "begin" line. It is commented by default because it provokes
# an error with Exim binaries that are not built with LOCAL_SCAN_HAS_OPTIONS
# set in the Local/Makefile.

# begin local_scan


# End of Exim configuration file


Exim version 4.66 #0 (FreeBSD 6.2) built 25-Mar-2007 17:33:27
Copyright (c) University of Cambridge 2006
Probably Berkeley DB version 1.8x (native mode)
Support for: crypteq iconv() IPv6 use_setclassresources PAM Perl OpenSSL
Content_Scanning Old_Demime
Lookups: lsearch wildlsearch nwildlsearch iplsearch cdb dbm dbmnz dnsdb
dsearch mysql nis nis0 passwd
Authenticators: cram_md5 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 /usr/local/etc/exim/configure