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 / 问题 / 1178001
Accepted
Marco Castorina
Marco Castorina
Asked: 2025-04-01 04:22:24 +0800 CST2025-04-01 04:22:24 +0800 CST 2025-04-01 04:22:24 +0800 CST

无法接收来自某些域的电子邮件

  • 772

几年来,我的电子邮件服务器一直运行良好,没有出现任何问题,但最近我遇到了两次在网站上注册却从未收到验证邮件的情况。一次来自mcsignup.com域名,另一次来自mandrillapp.com。

这是邮件日志文件中的一个示例条目:

postfix/smtpd[1550221]: connect from mail17.mcsignup.com[198.2.179.112]
postfix/smtpd[1550221]: discarding EHLO keywords: CHUNKING
postfix/smtpd[1550221]: disconnect from mail17.mcsignup.com[198.2.179.112] ehlo=1 starttls=1 quit=1 commands=3
postfix/smtpd[1550221]: connect from mail17.mcsignup.com[198.2.179.112]
postfix/smtpd[1550221]: discarding EHLO keywords: CHUNKING
postfix/smtpd[1550221]: disconnect from mail17.mcsignup.com[198.2.179.112] ehlo=1 starttls=1 quit=1 commands=3

我在另一篇文章中看到,这可能是由于我的某些设置过于严格,但我想在进行任何更改之前先了解问题所在。我正在运行 spamassassin,但我认为邮件甚至还没有到达那个阶段。

还有其他日志文件需要我检查吗?

如果我需要共享一些配置文件以使事情变得更容易,请告诉我。

[编辑] main.cf

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
home_mailbox = Maildir/
inet_interfaces = all
inet_protocols = ipv4, ipv6
local_recipient_maps = proxy:unix:passwd.byname $alias_maps
mailbox_size_limit = 0
mailbox_transport = lmtp:unix:private/dovecot-lmtp
message_size_limit = 33554432
milter_default_action = accept
milter_protocol = 2
mydestination = mail.marcocastorina.com, marcocastorina.com, localhost.localdomain, localhost
mydomain = marcocastorina.com
myhostname = mail.marcocastorina.com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = $mydomain
non_smtpd_milters = $smtpd_milters
readme_directory = no
recipient_delimiter = +
relayhost =
smtp_dns_support_level = dnssec
smtp_host_lookup = dns
smtp_tls_mandatory_protocols = >=TLSv1.2
smtp_tls_protocols = >=TLSv1.2
smtp_tls_security_level = dane
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
smtpd_discard_ehlo_keywords = chunking
smtpd_forbid_unauth_pipelining = yes
smtpd_milters = inet:localhost:12301
smtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination reject_unknown_sender_domain
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $mydomain
smtpd_sasl_path = private/auth
smtpd_sasl_security_options = noanonymous
smtpd_sasl_type = dovecot
smtpd_sender_restrictions = permit_sasl_authenticated permit_mynetworks
smtpd_tls_CAfile = /etc/letsencrypt/live/mail.marcocastorina.com/fullchain.pem
smtpd_tls_cert_file = /etc/letsencrypt/live/mail.marcocastorina.com/cert.pem
smtpd_tls_key_file = /etc/letsencrypt/live/mail.marcocastorina.com/privkey.pem
smtpd_tls_mandatory_ciphers = high
smtpd_tls_mandatory_exclude_ciphers = aNULL, MD5
smtpd_tls_mandatory_protocols = >=TLSv1.2
smtpd_tls_protocols = >=TLSv1.2
smtpd_tls_security_level = encrypt
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache

主配置文件

smtp       inet  n       -       y       -       -       smtpd -o content_filter=spamassassin
submission inet  n       -       y       -       -       smtpd -o syslog_name=postfix/submission -o smtpd_tls_security_level=encrypt -o smtpd_sasl_auth_enable=yes -o smtpd_sasl_type=dovecot -o smtpd_sasl_path=private/auth -o smtpd_client_restrictions=permit_sasl_authenticated,reject -o smtpd_recipient_restrictions=reject_non_fqdn_recipient,reject_unknown_recipient_domain,permit_sasl_authenticated,reject_unauth_destination,reject
pickup     unix  n       -       y       60      1       pickup
cleanup    unix  n       -       y       -       0       cleanup
qmgr       unix  n       -       n       300     1       qmgr
tlsmgr     unix  -       -       y       1000?   1       tlsmgr
rewrite    unix  -       -       y       -       -       trivial-rewrite
bounce     unix  -       -       y       -       0       bounce
defer      unix  -       -       y       -       0       bounce
trace      unix  -       -       y       -       0       bounce
verify     unix  -       -       y       -       1       verify
flush      unix  n       -       y       1000?   0       flush
proxymap   unix  -       -       n       -       -       proxymap
proxywrite unix  -       -       n       -       1       proxymap
smtp       unix  -       -       y       -       -       smtp
relay      unix  -       -       y       -       -       smtp
showq      unix  n       -       y       -       -       showq
error      unix  -       -       y       -       -       error
retry      unix  -       -       y       -       -       error
discard    unix  -       -       y       -       -       discard
local      unix  -       n       n       -       -       local
virtual    unix  -       n       n       -       -       virtual
lmtp       unix  -       -       y       -       -       lmtp
anvil      unix  -       -       y       -       1       anvil
scache     unix  -       -       y       -       1       scache
maildrop   unix  -       n       n       -       -       pipe flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
uucp       unix  -       n       n       -       -       pipe flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
ifmail     unix  -       n       n       -       -       pipe flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp      unix  -       n       n       -       -       pipe flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
scalemail-backend unix - n       n       -       2       pipe flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
mailman    unix  -       n       n       -       -       pipe flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py ${nexthop} ${user}
spamassassin unix -      n       n       -       -       pipe user=debian-spamd argv=/usr/bin/spamc -f -e /usr/sbin/sendmail -oi -f ${sender} ${recipient}
postfix
  • 2 2 个回答
  • 153 Views

2 个回答

  • Voted
  1. Esa Jokinen
    2025-04-01T14:44:43+08:002025-04-01T14:44:43+08:00

    这discarding EHLO keywords: CHUNKING表明你的 Postfix 配置了针对SMTP 走私的解决方法。这是一个相当严重的漏洞,在 3.8.5、3.7.10、3.6.14 和 3.5.24 中的长期修复之前的 Postfix 版本中,你应该已经设置了解决方法 - 设置并不太严格。

    ...电子邮件欺骗攻击涉及电子邮件服务的组合,这些服务在处理行尾的方式上存在特定差异,而不是<CR><LF>.

    从技术上讲,该攻击利用了接收邮件服务中的 END-OF-DATA 混淆,通过欺骗发送邮件服务发送非标准的 END-OF-DATA 序列<LF>.<LF>或<LF>.<CR><LF>在电子邮件消息中间发送,然后注入攻击者的 SMTP 命令来注入欺骗的电子邮件消息(标准 END-OF-DATA 序列是<CR><LF>.<CR><LF>)。

    您有以下解决方法之一(带main.cf语法的配置示例):

    • 对于所有 Postfix 版本:

      smtpd_data_restrictions = reject_unauth_pipelining  
      smtpd_discard_ehlo_keywords = chunking, silent-discard
      
    • Postfix 3.9、3.8.1、3.7.6、3.6.10 和 3.5.20 也可以使用以下命令阻止相同形式的已发布攻击:

      smtpd_forbid_unauth_pipelining = yes  
      smtpd_discard_ehlo_keywords = chunking, silent-discard
      

    一旦您确认您的 Postfix 已修补漏洞,您可以用以下方式替换它们:

    smtpd_forbid_bare_newline = normalize
    smtpd_forbid_bare_newline_exclusions = $mynetworks
    

    对于 Postfix ≥ 3.9,这些实际上是默认设置。

    • 1
  2. Best Answer
    anx
    2025-04-02T05:24:58+08:002025-04-02T05:24:58+08:00

    如果客户端在请求 STARTTLS 后没有返回,则可能是他们不喜欢在设置加密的握手过程中看到的内容。因此,您的第一步应该是验证您发送的证书以及您的服务器愿意协商的 TLS 密码/密码套件。

    openssl s_client -tls1_2 -showcerts -crlf -strict \
     -nocommands -cipher 'aNULL:@SECLEVEL=0' \
     -starttls smtp -connect mail.marcocastorina.com:25 <<<"QUIT"
    
    CONNECTED(00000003)
    ---
    no peer certificate available
    ---
    No client certificate CA names sent
    Server Temp Key: DH, 3072 bits
    

    您的服务器正在为 TLS1.2 提供匿名套件。请将您的smtpd_tls_mandatory_ciphers套件恢复为合理的套件或默认套件。

    dig +short TLSA _25._tcp.mail.marcocastorina.com
    2 1 1 0B9FA5A59EED715C26C1020C711B4F6EC42D58B0015E14337A39DAD3 01C5AFC3
    3 1 1 0B854CC5C7953AAC14AA30E3CD4B5360AFD0635BA7169D36BDEC97A6 FE1B36B2
    

    您使用的是 DANE,因此,即使提供商原则上愿意通过不安全的连接与您的服务器通信,在被要求检查您的证书后也会停止。您不一定会发送证书。


    此外,虽然我认为 DANE-TA (2)记录与 XSRG Root X1 的 SPKI 匹配,但 DANE-EE (3)记录与我获得的叶证书校验和不匹配—— 它很可能在 2023 年被放在那里,并因为密钥被反复旋转而被遗忘。

    除非您实际上要采用涉及所有复杂性的 3 + 3 密钥轮换方法,否则您可能希望停止一直轮换叶密钥,或者停止发布该哈希值(并依赖于类型 2 匹配),如果您不打算保持它更新的话。


    而且,这到底能达到什么目的呢?

    dig +short MX marcocastorina.com
    0 mail.marcocastorina.com.
    10 mail.marcocastorina.com.
    

    这是相同的 MX 名称,但优先级值不同。

    • 0

相关问题

  • Postfix 在特定端口上接受邮件

  • 让 Postfix 以两种方式处理垃圾邮件

  • Postfix 或 exim:自动/程序化和转发电子邮件设置

  • 后缀电子邮件地址

  • 什么是最好的开源电子邮件解决方案包

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