File: linux_debugging_ssl.md

package info (click to toggle)
chromium-browser 57.0.2987.98-1~deb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 2,637,852 kB
  • ctags: 2,544,394
  • sloc: cpp: 12,815,961; ansic: 3,676,222; python: 1,147,112; asm: 526,608; java: 523,212; xml: 286,794; perl: 92,654; sh: 86,408; objc: 73,271; makefile: 27,698; cs: 18,487; yacc: 13,031; tcl: 12,957; pascal: 4,875; ml: 4,716; lex: 3,904; sql: 3,862; ruby: 1,982; lisp: 1,508; php: 1,368; exp: 404; awk: 325; csh: 117; jsp: 39; sed: 37
file content (38 lines) | stat: -rw-r--r-- 1,574 bytes parent folder | download | duplicates (17)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Debugging SSL on Linux

To help anyone looking at the SSL code, here are a few tips I've found handy.

[TOC]

## Logging

There are several flavors of logging you can turn on.

*   `SSLClientSocketImpl` can log its state transitions and function calls
     using `base/logging.cc`.  To enable this, edit
     `net/socket/ssl_client_socket_impl.cc` and change `#if 1` to `#if 0`. See
     `base/logging.cc` for where the output goes (on Linux, usually stderr).
     
*   `HttpNetworkTransaction` and friends can log its state transitions using
    `base/trace_event.cc`. To enable this, arrange for your app to call
    `base::TraceLog::StartTracing()`. The output goes to a file named
    `trace...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.