Debugging SSL on Linux
Debugging SSL on Linux
To help anyone looking at the SSL code, here are a few tips I've found handy.
Contents
Logging
There are several flavors of logging you can turn on.
-
SSLClientSocketImpl
can log its state transitions and function calls usingbase/logging.cc
. To enable this, editnet/socket/ssl_client_socket_impl.cc
and change#if 1
to#if 0
. Seebase/logging.cc
for where the output goes (on Linux, usually stderr). -
HttpNetworkTransaction
and friends can log its state transitions usingbase/trace_event.cc
. To enable this, arrange for your app to callbase::TraceLog::StartTracing()
. The output goes to a file namedtrace...pid.log
in the same directory as the executable (e.g.Hammer/trace_15323.log
).
Network Traces
http://wiki.wireshark.org/SSL describes how to decode SSL traffic. Chromium SSL unit tests that use net/base/ssl_test_util.cc
to set up their servers always use port 9443 with net/data/ssl/certificates/ok_cert.pem
, and port 9666 with net/data/ssl/certificates/expired_cert.pem
This makes it easy to configure Wireshark to decode the traffic: do
Edit / Preferences / Protocols / SSL, and in the “RSA Keys List” box, enter
127.0.0.1,9443,http,<path to ok_cert.pem>;127.0.0.1,9666,http,<path to expired_cert.pem>
e.g.
127.0.0.1,9443,http,/home/dank/chromium/src/net/data/ssl/certificates/ok_cert.pem;127.0.0.1,9666,http,/home/dank/chromium/src/net/data/ssl/certificates/expired_cert.pem
Then capture all tcp traffic on interface lo, and run your test.
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
2019-04-02 Kafka分区分配策略(Partition Assignment Strategy
2018-04-02 go语言通道详解
2018-04-02 使用Spring Cloud连接不同服务
2018-04-02 并发之痛 Thread,Goroutine,Actor
2015-04-02 在Sqlite中通过Replace来实现插入和更新