[exim] Exim+amavisd+cyrus

Góra strony
Delete this message
Reply to this message
Autor: Alexandru E. Ungur
Data:  
Dla: exim-users
Temat: [exim] Exim+amavisd+cyrus
Hi all,

I am trying to get an Exim to work with Cyrus and Amavisd-new.
I must confess I'm new to exim, and the setup I'm working on is
'a little' over my head... I do have quite a few simple exim
servers I maintain, but nothing like this one...

I got amavis installed ok, following the README.exim4 I setup
exim as well. Emails are being passed to amavis (I had it open
in another window in debug mode) and then back to Exim, but
they never make it to the cyrus inbox.

Here are my configurations and log messages. I would really
appreciate any tips on how to debug/setup this further.
Thank you in advance.

=== /etc/exim/configuration ===================================
helo_accept_junk_hosts = IP1 : IP2
spool_directory = /var/spool/exim
system_filter_reply_transport = address_reply

BLOCKIPS         = IP3 : IP4
LOCALMACHINE     = mail.DOMAIN.COM
RECEIVER_DOMAIN  = ${sg{$received_for}{.*@}{}}
RECEIVED_FROM    = 
LOCAL_RECIPIENTS = mysql;select alias from popusers where alias='$local_part' and domain='$domain'
RELAY_DOMAINS    = mysql;select redirect_to from domain_redirect where domain='$domain' and redirect_to <> 'LOCALMACHINE'
BACKUP_MX        = 
LOCAL_DOMAINS    = mysql;select redirect_to from domain_redirect where domain='$domain' and redirect_to = 'LOCALMACHINE' 
NODNS_CLIENTS    = !HOST_X.COM : !HOST_Y.COM
REJECT_FROM      = mysql;select reject from reject_inbound where (reject = '$sender_address' OR reject = '$sender_address_domain') and mail_from = 'Yes'
REJECT_TO        = mysql;select reject from reject_inbound where reject = '$local_part@$domain' and mail_to = 'Yes'


received_header_text = "Received: \
    ${if def:sender_rcvhost {from ${if match {$sender_rcvhost}{.*(\.)?DOMAIN.COM}{mail.$sender_address_domain}{$sender_rcvhost}}\n\t}\
    {${if def:sender_ident {from ${if match {$sender_ident}{root}{mail.$sender_address_domain}{$sender_ident}}\n\t}}\
    ${if def:sender_helo_name {(helo=${if match {$sender_helo_name}{.*(\.)?.DOMAIN.COM}{mail.$sender_address_domain}{$sender_helo_name}})\n\t}}}}\
    by ${lookup mysql{select domain from domain_redirect where domain='$sender_address_domain'}\
            {mail.$sender_address_domain}\
            {${lookup mysql{select domain from domain_redirect where domain='RECEIVER_DOMAIN'}\
                {mail.RECEIVER_DOMAIN}\
                {$primary_hostname}\
              }\
            }\
        } \
    ${if def:received_protocol {with ${received_protocol}}} \
    (Exim ${version_number} #${compile_number})\n\t\
    id ${message_id}\
    ${if def:received_for {\n\tfor $received_for}}"


acl_smtp_rcpt = check_recipient
acl_smtp_data = check_message
addresslist local_recipients = LOCAL_RECIPIENTS
domainlist local_domains = mysql;select distinct domain from popusers where domain='$domain' : LOCAL_DOMAINS : mail.DOMAIN.COM
domainlist relay_domains = RELAY_DOMAINS : \
    !LIST1.COM : \
    !LIST2.COM : \
    !LIST3.COM : \
    NODNS_CLIENTS : \
    BACKUP_MX : \
    !BAK.DOMAIN.COM : \
    OTHERHOST.DOMAIN.COM 


hostlist relay_hosts = 127.0.0.1 : \
    IP5 : \
    IP6 : \
    IP7 : \
    IP8 : \
    net-dbm;/cyrus/imap/dracd.db : \
    net-mysql;select distinct ip from relay_ip where ip = '$sender_host_address'


log_selector =  \
              -retry_defer \
              -skip_delivery


mysql_servers = 127.0.0.1/email/cyrus/cypass
trusted_users = mail : amavis

######################################################################
#                    MAIN CONFIGURATION SETTINGS                     #
######################################################################
allow_mx_to_ip                   = true
remote_max_parallel              = 1
smtp_accept_max                  = 30
auto_thaw                        = 30m
queue_run_max                    = 10
delay_warning                    = 4h:8h:24h
smtp_accept_queue_per_connection = 200
ignore_bounce_errors_after       = 30m
local_interfaces                 = 0.0.0.0.25 : 127.0.0.1.10025
allow_domain_literals            = false
never_users                      =
host_reject_connection = "BLOCKIPS : net-mysql;select reject from reject_connections where reject = '$sender_host_address' : \
            net-mysql;select reject from reject_connections where reject = '$sender_host_name'"
perl_at_start


####################### REJECTION AREA ####################
recipients_max_reject
recipients_max = 500
host_lookup = *
check_spool_space = 100M

begin acl

check_recipient:
  accept  hosts = :
  deny    message = address format error
        local_parts = ^.*[@%!/|]
  accept  local_parts = postmaster
          domains = +local_domains
  deny    message = unrouteable address
        senders = REJECT_FROM
  deny    message = unrouteable address
          recipients = REJECT_TO
  accept  hosts = +relay_hosts
  accept  domains = +relay_domains
  deny    message = unknown user
          recipients = !+local_recipients
  accept
  deny    message = relay not permitted
check_message:
  accept


begin routers

#defer_router:
#      driver = manualroute
#      headers_remove =     X-Virus-Scanned : X-mailscanner : X-mailscanner-SpamCheck : X-AntiSpam-SPAM : X-AntiSpam-ADV : X-AntiSpam-MATURE 
#      route_list = "*  127.0.0.1  byname"
#      self = send
#      transport = defer_transport


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


amavis:
        driver = manualroute
        condition = "${if eq {$interface_port}{10025} {0}{1}}"
        transport = amavis
        route_list = "* localhost byname"
        self = send


domain_redirect:
driver = manualroute
route_data = ${lookup mysql{select INSERT(domain_redirect.redirect_to, LENGTH(redirect_to) + 1,2,' byname') from domain_redirect WHERE domain='$domain' AND redirect_to <> 'LOCALMACHINE';}}
transport = remote_smtp

lookuphost:
driver = dnslookup
domains = ! +local_domains
transport = remote_smtp
ignore_target_hosts = 127.0.0.1
no_more

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


mysql_forward:
  driver = redirect
  allow_defer
  allow_fail
  data = ${lookup mysql {select forwarding.sendto from forwarding, popusers where popusers.alias = '$local_part' and popusers.domain = '$domain'\
        and forwarding.emailid = popusers.emailid;}}
  pipe_transport = address_pipe
  retry_use_local_part
  user = mail


mysql_lookups:
driver = accept
condition = ${if eq {}{${lookup mysql {select alias from popusers where alias = '$local_part' and domain = '$domain'}}}{no}{yes}}
retry_use_local_part
transport = local_delivery

mysql_catchall_lookups:
driver = redirect
allow_defer
allow_fail
data = ${lookup mysql {select sendto from popusers as p, forwarding as f where alias = '*' and domain = '$domain' and f.emailid=p.emailid}}
retry_use_local_part
rewrite

system_aliases:
driver = redirect
allow_defer
allow_fail
data = ${lookup{$local_part@$domain}lsearch*@{/etc/aliases}}
file_transport = address_file
pipe_transport = address_pipe
retry_use_local_part
user = exim

system_aliases_final:
driver = redirect
allow_defer
allow_fail
data = ${lookup{$local_part}lsearch{/etc/aliases}}
file_transport = address_file
pipe_transport = address_pipe
retry_use_local_part
user = exim

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


begin transports

amavis:
driver = smtp
port = 10024
allow_localhost

#defer_transport:
# driver = smtp
# allow_localhost = false

remote_server:
driver = smtp
gethostbyname
hosts = mail.DOMAIN.COM

remote_smtp:
driver = smtp
headers_remove = Received
interface = IP6

local_delivery:
driver = pipe
command = "/usr/lib/cyrus-imapd/deliver -e ${local_part}@${domain}"
no_ignore_status
message_prefix = ""
return_output
return_path_add
temp_errors = 73 : 75
user = cyrus

address_file:
driver = appendfile
delivery_date_add
envelope_to_add
return_path_add

address_reply:
driver = autoreply

######################################################################
#                      RETRY CONFIGURATION                           #
######################################################################
# Domain               Error       Retries
# ------               -----       -------
begin retry


*                      *           F,2h,15m; G,16h,1h,1.5; F,4d,8h
=== END =================================================================


=== /etc/cyrus.conf =====================================================
# standard standalone server implementation

START {
  # do not delete these entries!
  mboxlist      cmd="ctl_cyrusdb -c"
  deliver       cmd="ctl_cyrusdb -r"


  # this is only necessary if using idled for IMAP IDLE
#  idled                cmd="idled"
}


# UNIX sockets start with a slash and are put into /var/imap/socket
SERVICES {
  # add or remove based on preferences
  imap          cmd="imapd" listen="imap" prefork=0
#  imaps                cmd="imapd -s" listen="imaps" prefork=0
  pop3          cmd="pop3d" listen="pop3" prefork=0
#  pop3s                cmd="pop3d -s" listen="pop3s" prefork=0
#  sieve                cmd="timsieved" listen="sieve" prefork=0


  # at least one LMTP is required for delivery
#  lmtp         cmd="lmtpd" listen="lmtp" prefork=0
  lmtpunix      cmd="lmtpd" listen="/cyrus/imap/socket/lmtp" prefork=0
}


EVENTS {
  # this is required
  checkpoint    cmd="ctl_cyrusdb -c" period=30


  # this is only necessary if using duplicate delivery suppression
  delprune      cmd="ctl_deliver -E 3" period=1440
}
=== END =================================================================


=== tail /var/spool/exim/log/mainlog ====================================
2006-07-05 08:53:59 exim 4.62 daemon started: pid=27024, no queue runs, listening for SMTP on port 25 (IPv4) [127.0.0.1]:10025
2006-07-05 08:54:11 1Fy7pT-00071u-6i <= root@??? U=root P=local S=339
2006-07-05 08:54:11 1Fy7pT-000720-Rl <= root@??? H=localhost [127.0.0.1] P=esmtp S=776 id=E1Fy7pT-00071u-6i@???
2006-07-05 08:54:11 1Fy7pT-00071u-6i => cyrus@??? R=amavis T=amavis H=localhost [127.0.0.1]
2006-07-05 08:54:11 1Fy7pT-00071u-6i Completed
2006-07-05 08:54:11 1Fy7pT-000720-Rl ** alerts@??? <cyrus@???> R=mysql_lookups T=local_delivery: Child process of local_delivery transport returned 65 (could mean error in input data) from command: /usr/lib/cyrus-imapd/deliver
2006-07-05 08:54:12 1Fy7pU-000729-08 <= <> R=1Fy7pT-000720-Rl U=exim P=local S=1826
2006-07-05 08:54:12 1Fy7pT-000720-Rl Completed
2006-07-05 08:54:14 1Fy7pW-00072I-Dt <= <> H=localhost [127.0.0.1] P=esmtp S=2261 id=E1Fy7pU-000729-08@???
2006-07-05 08:54:14 1Fy7pU-000729-08 => root@??? R=amavis T=amavis H=localhost [127.0.0.1]
2006-07-05 08:54:14 1Fy7pU-000729-08 Completed
2006-07-05 08:54:14 1Fy7pW-00072I-Dt ** root@???: Unrouteable address
2006-07-05 08:54:14 1Fy7pW-00072I-Dt Frozen (delivery error message)
2006-07-05 09:08:41 1Fy7w5-00073E-RS <= root@??? U=root P=local S=692
2006-07-05 09:08:42 1Fy83W-00074i-OY <= root@??? H=localhost [127.0.0.1] P=esmtp S=1127 id=E1Fy7w5-00073E-RS@???
2006-07-05 09:08:42 1Fy7w5-00073E-RS => root@??? R=amavis T=amavis H=localhost [127.0.0.1]
2006-07-05 09:08:42 1Fy7w5-00073E-RS Completed
2006-07-05 09:08:42 1Fy83W-00074i-OY ** root@???: Unrouteable address
2006-07-05 09:08:42 1Fy83W-00074n-SE <= <> R=1Fy83W-00074i-OY U=exim P=local S=1957
2006-07-05 09:08:42 1Fy83W-00074i-OY Completed
2006-07-05 09:08:43 1Fy83X-00074s-BE <= <> H=localhost [127.0.0.1] P=esmtp S=2392 id=E1Fy83W-00074n-SE@???
2006-07-05 09:08:43 1Fy83W-00074n-SE => root@??? R=amavis T=amavis H=localhost [127.0.0.1]
2006-07-05 09:08:43 1Fy83W-00074n-SE Completed
2006-07-05 09:08:43 1Fy83X-00074s-BE ** root@???: Unrouteable address
2006-07-05 09:08:43 1Fy83X-00074s-BE Frozen (delivery error message)
=== END =================================================================

Thank you,
Alex