Exim 无法接收电子邮件但可以在 Amazon EC2 上发送

Exim 无法接收电子邮件但可以在 Amazon EC2 上发送

我在 Amazon EC2 实例上安装了 Cenos 6。我还安装了 exim+dovecot 来发送和接收电子邮件。我有两个域和两个带有连接弹性 IP 的网络接口。示例中的内部 IP 为:

172.31.108.135
172.31.110.53

以及两个域:

domain1.com
domain2.com

我使用手册和示例 (+DKIM、PTR 等) 配置了 exim。发送工作正常。但我的邮箱无法接收电子邮件。

我的 /etc/exim/ 文件夹文件:

别名 空的文件

黑名单 空的文件

域名列表 空的文件

域名IP

domain1.com:172.31.108.135
domain2.com:172.31.110.53

domain1.com:domain1.com::no
domain2.com:domain2.com::no

密码

[email protected]:93:93:100:/var/mailboxes/domain1.com/noreply:no:
[email protected]:93:93:100:/var/mailboxes/domain2.com/info:no:

白名单 空的文件

管道别名 空的文件

主要配置:进出控制配置文件

log_selector =  \
        +all_parents \
        +lost_incoming_connection \
        +received_sender \
        +received_recipients \
        +tls_cipher +tls_peerdn \
        +smtp_confirmation \
        +smtp_syntax_error \
        +smtp_protocol_error

trusted_users = apache

domainlist local_domains = lsearch;/etc/exim/domains
domainlist dummy_domains =
hostlist relay_from_hosts = 127.0.0.1

domainlist relay_to_domains = lsearch;/etc/exim/domains
exim_user = exim
exim_group = exim

never_users = root
host_lookup = *
rfc1413_hosts = *
rfc1413_query_timeout = 0s
ignore_bounce_errors_after = 2d
timeout_frozen_after = 7d
acl_smtp_rcpt = acl_check_rcpt
acl_smtp_data = acl_check_data
tls_advertise_hosts = 
disable_ipv6 = true

begin acl
    acl_check_rcpt:
        accept  hosts = net-lsearch;/etc/exim/whitelist

        deny    hosts = net-lsearch;/etc/exim/blacklist
                message = $host_data                        

        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   = postmaster
                verify        = recipient
                domains       = +local_domains

        require verify        = sender

        accept  hosts         = +relay_from_hosts
                control       = submission

        accept  authenticated = *
                condition     = ${if eq{${extract{5}{:}{${lookup{$authenticated_id}lsearch{/etc/exim/passwd}}}}}{no} {yes}{no}}
                condition     = ${if eq{${extract{3}{:}{${lookup{${domain:$authenticated_id}}lsearch{/etc/exim/domains}}}}}{no} {yes}{no}}
                control       = submission/domain=

        deny    message       = rejected because $sender_host_address is in a black list at $dnslist_domain\\n$dnslist_text
                dnslists      = ${readfile {/etc/exim/dnsblists}{:}} 

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

        require verify        = recipient

        accept

    acl_check_data:
        accept

begin routers
    dnslookup:
        driver = dnslookup
        domains = !+dummy_domains
        transport = remote_smtp
        ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
        self = pass
        no_more

    disabled_domains:
        driver = redirect
        condition = ${extract{3}{:}{${lookup{$domain}lsearch{/etc/exim/domains}}}}
        allow_fail = yes
        data = :fail: Domain disabled
        no_more

    disabled_users:
        driver = redirect
        condition = ${extract{5}{:}{${lookup{$local_part@$domain}lsearch{/etc/exim/passwd}}}}
        allow_fail = yes
        data = :fail: User disabled
        no_more

    local_domains:
        driver = redirect
        data = ${quote_local_part:$local_part}@${extract{1}{:}{${lookup{$domain}lsearch{/etc/exim/domains}}}}
        cannot_route_message = Unknown user
        no_more

    group_aliases:
        driver = redirect
        data = ${extract{1}{:}{${lookup{$local_part@$domain}lsearch{/etc/exim/aliases}}}}
        condition = ${if and{\
                        {exists{/etc/exim/aliases}}\
                        {eq {${extract{2}{:}{${lookup{$local_part@$domain}lsearch{/etc/exim/aliases}}}}} {group} }\
                    } {yes} {no} }
        redirect_router = a_dnslookup

    aliases:
        driver = redirect
        data = ${extract{1}{:}{${lookup{$local_part@$domain}lsearch{/etc/exim/aliases}}}}
        condition = ${if exists{/etc/exim/aliases} {yes} {no} }

    aliases_pipe:
                driver = redirect
        pipe_transport = address_pipe
        data = ${lookup {$local_part@$domain} lsearch{/etc/exim/pipe-aliases}}
                condition =${lookup {$local_part@$domain} lsearch{/etc/exim/pipe-aliases} {yes} {no} }


    local_users:
        driver = redirect
        condition = ${lookup {$local_part@$domain} lsearch {/etc/exim/passwd} {yes} {no} }
        data = $local_part@$domain
        redirect_router = autoreplay

    catchall_for_domains:
        driver = redirect
        headers_add = X-redirected: yes
        data = ${extract{2}{:}{${lookup{$domain}lsearch{/etc/exim/domains}}}}
        file_transport = local_delivery

    unknown_users:
        driver = redirect
        allow_fail = yes
        data = :fail: Unknown user
        no_more

    autoreplay:
        driver = accept
        condition = ${if exists{${extract{4}{:}{${lookup{$local_part@$domain}lsearch{/etc/exim/passwd}}}}/message.txt} {yes} {no}}
        retry_use_local_part
        transport = address_reply
        unseen

    localuser:
        driver = accept
        transport = local_delivery


# Same routers without autoreplay

    a_dnslookup:
        driver = dnslookup
        domains = !+dummy_domains
        transport = remote_smtp
        ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
        self = pass
        no_more

    a_disabled_domains:
        driver = redirect
        condition = ${extract{3}{:}{${lookup{$domain}lsearch{/etc/exim/domains}}}}
        allow_fail = yes
        data = :fail: Domain disabled
        no_more

    a_disabled_users:
        driver = redirect
        condition = ${extract{5}{:}{${lookup{$local_part@$domain}lsearch{/etc/exim/passwd}}}}
        allow_fail = yes
        data = :fail: User disabled
        no_more

    a_local_domains:
        driver = redirect
        data = ${quote_local_part:$local_part}@${extract{1}{:}{${lookup{$domain}lsearch{/etc/exim/domains}}}}
        cannot_route_message = Unknown user
        redirect_router = a_dnslookup
        no_more

    a_aliases:
        driver = redirect
        data = ${extract{1}{:}{${lookup{$local_part@$domain}lsearch{/etc/exim/aliases}}}}
        condition = ${if exists{/etc/exim/aliases} {yes} {no} }
        redirect_router = a_dnslookup

    a_aliases_pipe:
        driver = accept
        transport = aliases_pipe
        condition = ${lookup {$local_part@$domain} lsearch {/etc/exim/pipe-aliases} {yes} {no} }

    a_local_users:
        driver = accept
        transport = local_delivery
        condition = ${lookup {$local_part@$domain} lsearch {/etc/exim/passwd} {yes} {no} }

    a_catchall_for_domains:
        driver = redirect
        headers_add = X-redirected: yes
        data = ${extract{2}{:}{${lookup{$domain}lsearch{/etc/exim/domains}}}}
        file_transport = local_delivery
        redirect_router = a_dnslookup

begin transports

    DKIM_DOMAIN = ${lc:${domain:$h_from:}}
    DKIM_FILE = /etc/exim/${lc:${domain:$h_from:}}.key
    DKIM_PRIVATE_KEY = ${if exists{DKIM_FILE}{DKIM_FILE}{0}}

    remote_smtp:
        driver = smtp
        dkim_domain = DKIM_DOMAIN
        dkim_selector = mail
        dkim_private_key = DKIM_PRIVATE_KEY
        interface = ${extract{1}{:}{${lookup{$sender_address_domain}lsearch{/etc/exim/domainips}}}}
        helo_data = $sender_address_domain

    local_delivery:
        driver = appendfile
        file = ${extract{4}{:}{${lookup{$local_part@$domain}lsearch{/etc/exim/passwd}}}}/inbox
        delivery_date_add
        envelope_to_add
        return_path_add
        mode = 0660
        quota = ${extract{3}{:}{${lookup{$local_part@$domain}lsearch{/etc/exim/passwd}}}}M
        quota_warn_threshold = 75%
        use_lockfile = no
        no_mode_fail_narrower
        user = ${extract{1}{:}{${lookup{$local_part@$domain}lsearch{/etc/exim/passwd}}}}
        group = ${extract{2}{:}{${lookup{$local_part@$domain}lsearch{/etc/exim/passwd}}}}

    address_pipe:
        driver = pipe
        return_output

    aliases_pipe:
        driver = pipe
        command = ${extract{1}{:}{${lookup{$local_part@$domain}lsearch{/etc/exim/pipe-aliases}}}}
        use_shell

    address_reply:
        driver = autoreply
        headers = ${readfile{${extract{4}{:}{${lookup{$local_part@$domain}lsearch{/etc/exim/passwd}}}}/message.txt}}
        to = $sender_address

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

begin rewrite

begin authenticators

login:
    driver = dovecot
    public_name = LOGIN
    server_socket = /var/run/dovecot/auth-client
    server_set_id = $1

plain:
    driver = dovecot
    public_name = PLAIN
    server_socket = /var/run/dovecot/auth-client
    server_set_id = $1

发送工作正常。但如果我向任何邮箱发送邮件,日志中都会出现此错误:(许多字符串) [电子邮件保护]是测试邮箱

2018-01-10 19:25:20 1eZM00-0007qZ-FJ DKIM: d=test.com s=mail2 c=relaxed/relaxed a=rsa-sha256 b=1024 [verification succeeded]
2018-01-10 19:25:20 1eZM00-0007qZ-FJ <= [email protected] H=smtp32.i.test.com [94.100.177.92] P=esmtp S=1801 [email protected] from <[email protected]> for [email protected]
2018-01-10 19:25:21 1eZM01-0007qc-9j DKIM: d=test.com s=mail2 c=relaxed/relaxed a=rsa-sha256 b=1024 [verification succeeded]
2018-01-10 19:25:21 1eZM01-0007qc-9j <= [email protected] H=mail.domain1.com (test.com) [52.88.16.47] P=esmtp K S=2045 [email protected] from <[email protected]> for [email protected]
2018-01-10 19:25:21 1eZM00-0007qZ-FJ => [email protected] R=dnslookup T=remote_smtp H=domain1.com [52.88.16.47] K C="250- 1831 byte chunk, total 1831\\n250 OK id=1eZM01-0007qc-9j"
2018-01-10 19:25:21 1eZM00-0007qZ-FJ Completed

并且邮箱是空的。

请帮忙解决这个问题。如果您需要任何其他日志,请告诉我。

答案1

我不是 Exim 专家,但您的 local_delivery 传输正在从密码文件中提取第 4 个字段,并且看起来文件名是第 5 个字段。

相关内容