大网数据广告活动
服务器运维问答

How can I decrypt STARTTLS communication over SMTP in a packet capture (if I have the private key)?

· 52CE 我爱测

For the purpose of troubleshooting, I need to see what an email looks like when it's sent to my sendmail server via SMTP. The upstream server requires the SMTP connection to use STARTTLS so a packet capture only shows me encrypte…

问题原文

原帖链接 · Mike B · CC BY-SA 3.0

For the purpose of troubleshooting, I need to see what an email looks like when it's sent to my sendmail server via SMTP. The upstream server requires the SMTP connection to use STARTTLS so a packet capture only shows me encrypted data.

Is there a way to use wireshark to decrypt the transmission and see? Assuming of course that I have the private key used on my sendmail server?

I see several procedures available online referencing the RSA key lists feature in wireshark (for example: https://support.citrix.com/article/CTX116557). But this still doesn't seem to be working for me.

Is this related to forward secrecy? Can I just not do this on newer protocols / ciphers?

已采纳解答

原帖链接 · Steffen Ullrich · CC BY-SA 3.0

Knowledge of the RSA private key is only sufficient if RSA key exchange is done. Modern systems instead use Diffie Helmann key exchange (DHE*, ECDHE* ciphers) to provide forward secrecy. In this case the private key is only used in authenticating the server but not for the key exchange and thus knowledge of the private key does not help in getting the encryption keys.

Instead the SSL pre master secret would be needed since this is used to derive the encryption keys. While some browsers support exporting this secret in some special debug modes other clients usually don't.

As for your specific problem I would instead to try a man in the middle "attack" which logs all traffic in plain even though the client gets encrypted traffic. This works similar to man in the middle proxies for HTTPS, only that it supports the initial plain connection and understands that STARTTLS upgrades to TLS. From a quick search I've found starttls-mitm and that sslsplit has some beta support for this. Of course the client needs to connect to the man in the middle proxy and trust the certificate it gets, which might be the original server certificate since you seem to have access to this.

Another option would be to enable debugging in the specific MTA in case this provides detailed enough information for your specific problem.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-08-11)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。