]> git.ipfire.org Git - thirdparty/squid.git/commit - src/ConfigParser.h
Add tls_key_log to report TLS communication secrets (#759) 458/head
authorAlex Rousskov <rousskov@measurement-factory.com>
Mon, 24 May 2021 20:02:52 +0000 (20:02 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Tue, 25 May 2021 02:34:04 +0000 (02:34 +0000)
commite227da8d1719b4b5f24a2fc62882ef9907348bc5
treeb5e6e51629558d4b48f36769c42547a124fb8e09
parent26cf7c3c01c3e58178054eb99b323471e40e9703
Add tls_key_log to report TLS communication secrets (#759)

The new log is meant for triage using traffic inspection tools like
Wireshark. Also known as SSLKEYLOGFILE, it is a common feature across
TLS-capable applications. By default, the new feature is disabled and
has negligible performance impact.

We have rejected the idea of adding an access_log %code instead, as
detailed in squid-dev thread titled "RFC: tls_key_log: report TLS
pre-master secrets, other key material". Such %code can still be added.
http://lists.squid-cache.org/pipermail/squid-dev/2020-July/009605.html

----

Generalized StoreClient::fillChecklist() API into Acl::ChecklistFiller

Code that establishes TLS connections outsources logging of secrets to
Security::KeyLogger. Security::KeyLogger::shouldLog() must consult
tls_key_log ACLs before logging the secrets but it does not know much
about the code/context that delegated this logging to KeyLogger. That
code could fill the checklist in advance, but that is an inferior
solution because it

* prevents outsourcing a rather mundane responsibility to KeyLogger
* creates a potentially stale Checklist, not reflecting TLS progress
* wastes resources on filling a checklist that may not be needed

While adding ConnStateData::fillChecklist() and looking through
ConnStateData code for examples on how to fill a checklist, it became
clear that there is a lot of code duplication in this area, including
some subtle problems with various checklist.foo assignments possibly
missing in some places (it is difficult to know for sure because some
checklist methods may extract the same information from _multiple_
sources). For example,

* on_unsupported_protocol and ssl_bump ignored acl_uses_indirect_client
* ident_lookup_access and delay_pool_access lacked port info and
  other ConnStateData details beyond src/dst addresses

Now, most of that duplicated code is replaced with unified
fillChecklist() calls. This unification is a significant improvement
that provides additional justification for the fillChecklist() design.

Also renamed ACLFilledChecklist::conn() to setConn(). Renaming is not
necessary for the compiler but will help detect no longer necessary
conn() setting calls when this code is ported to other Squid versions.
42 files changed:
acinclude/lib-checks.m4
compat/openssl.h
src/ConfigParser.cc
src/ConfigParser.h
src/Debug.h
src/DelayId.cc
src/Makefile.am
src/SquidConfig.h
src/StoreClient.h
src/acl/ChecklistFiller.h [new file with mode: 0644]
src/acl/FilledChecklist.cc
src/acl/FilledChecklist.h
src/acl/Gadgets.cc
src/acl/Gadgets.h
src/acl/InnerNode.cc
src/acl/InnerNode.h
src/acl/Makefile.am
src/acl/forward.h
src/adaptation/icap/Xaction.cc
src/cache_cf.cc
src/cf.data.depend
src/cf.data.pre
src/client_side.cc
src/client_side.h
src/debug.cc
src/main.cc
src/sbuf/SBuf.h
src/security/CommunicationSecrets.cc [new file with mode: 0644]
src/security/CommunicationSecrets.h [new file with mode: 0644]
src/security/KeyLog.cc [new file with mode: 0644]
src/security/KeyLog.h [new file with mode: 0644]
src/security/KeyLogger.cc [new file with mode: 0644]
src/security/KeyLogger.h [new file with mode: 0644]
src/security/Makefile.am
src/security/PeerConnector.cc
src/security/PeerConnector.h
src/security/Session.h
src/security/forward.h
src/store_client.cc
src/tests/stub_acl.cc
src/tests/stub_client_side.cc
src/tests/stub_libsecurity.cc