AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 1083626
Accepted
user227963
user227963
Asked: 2021-11-16 09:16:55 +0800 CST2021-11-16 09:16:55 +0800 CST 2021-11-16 09:16:55 +0800 CST

将 dkimproxy 添加到 OpenSMTPD ... 发送到我自己的域时的邮件循环

  • 772

我有一个运行良好的 OpenSMTPD 配置,并在其中添加了 dkimproxy。

一切运行良好,邮件测试器等都报告说我有正确的 DKIM 签名,我的电子邮件分数是 10/10 等。

问题是 ...

如果我尝试从 [email protected] 向 [email protected] 发送电子邮件,则邮件服务器进入循环并且邮件永远不会发送。我看到这个maillog:

Nov 15 08:34:13 mail dkimproxy.out[38686]: DKIM signing - signed; message-id=<[email protected]>, signer=<[email protected]>, from=<[email protected]>
Nov 15 08:34:13 mail smtpd[33463]: 4dea90938ef29e98 smtp message msgid=0b62ff80 size=104666 nrcpt=1 proto=ESMTP
Nov 15 08:34:13 mail smtpd[33463]: 4dea90938ef29e98 smtp envelope evpid=0b62ff80eb408785 from=<> to=<[email protected]>                                                               
Nov 15 08:34:13 mail smtpd[33463]: 4dea9092f4274d88 mta delivery evpid=6fe8c750a74f16ac from=<> to=<[email protected]> rcpt=<-> source="200.100.240.135" relay="200.100.240.135 (mail.mydomain.com)" delay=1s result="Ok" stat="250 2.0.0 0b62ff80 Message accepted for delivery"

...并且它可能会一遍又一遍地循环 50 次 - 最终它放弃了这个错误:

Nov 15 08:34:18 mail smtpd[33463]: warn: loop detected                                                                                                                                            
Nov 15 08:34:18 mail smtpd[33463]: 4dea9097226c93aa smtp failed-command command="DATA" result="500 5.4.6 Routing loop detected: Loop detected"                                                    
Nov 15 08:34:18 mail smtpd[33463]: 4dea90969c6cf495 mta delivery evpid=49514d020281ac48 from=<> to=<[email protected]> rcpt=<-> source="200.100.240.135" relay="200.100.240.135 (mail.mydomain.com)" delay=1s result="PermFail" stat="500 5.4.6 Routing loop detected: Loop detected"

我不知道问题是什么。仅当我向自己或在此邮件服务器上托管的具有此域的其他用户发送电子邮件时,才会发生这种情况。

# cat dkimproxy_in.conf

# specify what address/port DKIMproxy should listen on
listen    200.100.240.135:10025

# specify what address/port DKIMproxy forwards mail to
relay     200.100.240.135:10026


# cat dkimproxy_out.conf 

# specify what address/port DKIMproxy should listen on
listen    200.100.240.135:10027

# specify what address/port DKIMproxy forwards mail to
relay     200.100.240.135:10028

# specify what domains DKIMproxy can sign for (comma-separated, no spaces)
domain    mydomain.com

# specify what signatures to add
signature dkim(c=relaxed)
signature domainkeys(c=nofws)

# specify location of the private key
keyfile   /root/dkim.private.key

# specify the selector (i.e. the name of the key record put in DNS)
selector  selector1

# control how many processes DKIMproxy uses
#  - more information on these options (and others) can be found by
#    running `perldoc Net::Server::PreFork'.
#min_servers 5
#min_spare_servers 2

......这就是一切......谢谢。

编辑 - 这是 opensmtpd.conf:

table aliases file:/usr/local/etc/mail/aliases

filter check_dyndns phase connect match rdns regex \
    { '.*\.dyn\..*', '.*\.dsl\..*' } \
    disconnect "550 no residential connections"

filter check_rdns phase connect match !rdns \
    disconnect "550 no rDNS"

filter check_fcrdns phase connect match !fcrdns \
    disconnect "550 no FCrDNS"

listen on 200.100.240.135 filter { check_dyndns, check_rdns, check_fcrdns }

listen on 200.100.240.135 port 10028 tag DKIM

listen on 200.100.240.135 port submission

action "local_mail" mbox alias <aliases>
action "relay_dkim" relay host smtp://200.100.240.135:10027
action "outbound" relay helo mail.mydomain.com
    
match from any mail-from "[email protected]" action "local_mail"

match tag DKIM for any action "outbound"
match for any action "relay_dkim"

match from any for domain "mydomain.com" action "local_mail"
match for local action "local_mail"

match from any auth for any action "outbound"
match for any action "outbound"
email freebsd email-server dkim opensmtpd
  • 1 1 个回答
  • 287 Views

1 个回答

  • Voted
  1. Best Answer
    Paul
    2021-12-06T06:18:28+08:002021-12-06T06:18:28+08:00

    假设没有理由将外部接口用于内部流程,则编写此答案。该问题不包括pf.conf在使用环回以外的接口时可能具有与正常邮件处理冲突的设置并且应该具有set skip on lo或等效配置的配置。

    smtpd.conf:

    # Verify this is the correct location of aliases, which normally is
    # located in /etc/mail/aliases. If you have changed aliases
    # from default, be sure to run newaliases.
    table aliases file:/usr/local/etc/mail/aliases
    
    filter check_dyndns phase connect match rdns regex \
        { '.*\.dyn\..*', '.*\.dsl\..*' } \
        disconnect "550 no residential connections"
    
    filter check_rdns phase connect match !rdns \
        disconnect "550 no rDNS"
    
    filter check_fcrdns phase connect match !fcrdns \
        disconnect "550 no FCrDNS"
    
    listen on 127.0.0.1 port 10028 tag DKIM
    listen on 200.100.240.135 filter \
        { check_dyndns, check_rdns, check_fcrdns }
    listen on 200.100.240.135 port submission
    
    action "local_mail" mbox alias <aliases>
    action "relay_dkim" relay host smtp+notls://127.0.0.1:10027
    action "outbound" relay helo mail.mydomain.com
    
    match tag DKIM for any action "outbound"
    match mail-from "[email protected]" action "local_mail"
    match from any for domain "mydomain.com" action "local_mail"
    match from any auth for any action "outbound"
    match for local action "local_mail"
    match for any action "relay_dkim"
    
    # I interpret this to be redundant:
    # match for any action "outbound"
    
    # This original configuration line seems nonsensical because
    # "mail-from" is also "from any", so removed "from any"
    # match from any mail-from "[email protected]" action "local_mail"
    

    尽管dkimproxy_in.conf已配置,但目前在收到的消息中没有对 DKIM 标头进行身份验证,因为原始文件中没有配置smtpd.conf,所以我没有添加它。

    dkimproxy_in.conf:

    # specify what address/port DKIMproxy should listen on
    listen    127.0.0.1:10025
    
    # specify what address/port DKIMproxy forwards mail to
    relay     127.0.0.1:10026
    

    dkimproxy_out.conf:

    # specify what address/port DKIMproxy should listen on
    listen    127.0.0.1:10027
    
    # specify what address/port DKIMproxy forwards mail to
    relay     127.0.0.1:10028
    
    # specify what domains DKIMproxy can sign for (comma-separated, no spaces)
    domain    mydomain.com
    
    # specify what signatures to add
    signature dkim(c=relaxed)
    signature domainkeys(c=nofws)
    
    # specify location of the private key
    keyfile   /root/dkim.private.key
    
    # specify the selector (i.e. the name of the key record put in DNS)
    selector  selector1
    
    # control how many processes DKIMproxy uses
    #  - more information on these options (and others) can be found by
    #    running `perldoc Net::Server::PreFork'.
    #min_servers 5
    #min_spare_servers 2
    
    • 1

相关问题

  • 如何绕过 ISP 的限制性电子邮件政策?

  • SharePoint 传入电子邮件出现“未知别名”错误

  • 电子邮件帐户的角色名称与人名

  • 如何在笔记本电脑上使用 Tobit David?[关闭]

  • 随行人员通过 VPN 连接到 Exchange 2007

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve