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 / 问题 / 1147040
Accepted
Nick Lockheart
Nick Lockheart
Asked: 2023-11-02 06:53:34 +0800 CST2023-11-02 06:53:34 +0800 CST 2023-11-02 06:53:34 +0800 CST

通过 LMTP 在 Postfix 和 Dovecot 之间启用 TLS 的正确设置是什么?

  • 772

我正在尝试让 Postfix 通过 LMTP 将邮件转发到 Dovecot。当双方设置中的 TLS 都关闭时,此功能可以正常工作。

启用 TLS 设置后,Postfix 通过 LMTP 连接,Dovecot 会看到连接,但两台服务器似乎都卡在那里,日志中没有更多信息(日志如下)。

实现此功能的正确 TLS 设置是什么?

这些是当前设置的两台服务器配置文件的相关部分:

/etc/dovecot/dovecot.conf:

protocols = imap lmtp

# Enable SSL (global) for IMAP connections
ssl = required
ssl_cert = </etc/ssl/imap.domain.com/imap.domain.com.crt
ssl_key = </etc/ssl/imap.domain.com/imap.domain.com.key


protocol lmtp {
    ssl_cert = </etc/ssl/imap.domain.com/imap.domain.com.crt
    ssl_key = </etc/ssl/imap.domain.com/imap.domain.com.key
    ssl_ca = </etc/ssl/imap.domain.com/authority.crt
    ssl_verify_client_cert = yes
    auth_ssl_require_client_cert = yes
    ssl=required
}


service lmtp {
  user = vmail
  inet_listener lmtp {
    address = * ::
    port = 24
    ssl=yes
  }
}

/etc/postfix/main.cf:

lmtp_use_tls = yes
lmtp_tls_security_level=encrypt
lmtp_tls_loglevel = 2
lmtp_tls_session_cache_database = btree:${data_directory}/lmtp_cache    
lmtp_tls_CApath = /etc/ssl/certs
lmtp_tls_CAfile=/etc/ssl/domain.com/authority.crt
lmtp_tls_cert_file=/etc/ssl/domain.com/domain.com.client.crt
lmtp_tls_key_file=/etc/ssl/domain.com/domain.com.key    
lmtp_tls_note_starttls_offer = yes

Dovecot服务器的邮件日志:

lmtp(1939): Info: Connect from xx.xx.xx.xx
lmtp(2500): Debug: SSL: where=0x10, ret=1: before SSL initialization
lmtp(2500): Debug: SSL: where=0x2001, ret=1: before SSL initialization
lmtp(2500): Debug: SSL: where=0x2002, ret=-1: before SSL initialization
lmtp(2500): Debug: SSL: where=0x2002, ret=-1: before SSL initialization
lmtp(2500): Debug: SSL: where=0x2002, ret=-1: before SSL initialization
lmtp(1944): Info: Disconnect from xx.xx.xx.xx: Disconnected for inactivity (state=GREETING)

Postfix 服务器的邮件日志:

Nov  1 22:35:18 servername postfix/lmtp[65067]: initializing the client-side TLS engine
Nov  1 22:35:18 servername postfix/lmtp[65050]: 9935F2317D: to=<[email protected]>, relay=remote.server.com[yy.yy.yy.yy]:24, delay=1220, delays=920/0.02/300/0, dsn=4.4.2, status=deferred (lost connection with remote.server.com[yy.yy.yy.yy] while receiving the initial server greeting)

更新

如果我运行:

openssl s_client -connect domain.com:24 -CAfile /etc/ssl/domain.com/authority.crt

在 Postfix 机器上,它通过 LMTP 通过 TLS 连接到 Dovecot 服务器,我可以向 Dovecot 发出 telnet 命令。因此,Dovecot 似乎正在接受 TLS 连接,但当 Postifx 尝试连接时,协商就会停止。

如果我运行:

openssl s_client -starttls lmtp -connect domain.com:24 -CAfile /etc/ssl/domain.com/authority.crt

我刚刚得到:

CONNECTED(00000003)

并且无法发出任何 telnet 命令。

ssl
  • 1 1 个回答
  • 103 Views

1 个回答

  • Voted
  1. Best Answer
    anx
    2023-11-02T20:02:48+08:002023-11-02T20:02:48+08:00

    如果(根据您的 openssl s_client 测试)将整个 LMTP 会话正确包装在 TLS 中有效,并且只是 STARTTLS 兼容性黑客造成了麻烦.. 告诉 Postfix 执行前者。

    lmtp_tls_wrappermode=yes
    

    但是,请验证您要求客户端证书的设置是否有效。您的s_client测试结果似乎尚未确定该部分。另外,删除lmtp_use_tls设置 - 它已被 覆盖和废弃lmtp_tls_security_level。

    • 2

相关问题

  • 如何使用 Tomcat 5.5 更新 SSL 证书

  • 为 IIS6 自行生成 SSL 证书?

  • plesk 上的域和子域 ssl 访问

  • 如何设置 SSL 邮件服务器?

  • 如何通过 SVN 命令行接受 SSL 证书?

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