Skip to content

Commit 67b029b

Browse files
authored
cqssrt log field for TLS resumption type (#12404)
This adds the cqssrt log field that indicates the TLS resumption type: 0: no resumption 1: server session cache resumption 2: TLS ticket resumption
1 parent d76fe3b commit 67b029b

File tree

5 files changed

+49
-3
lines changed

5 files changed

+49
-3
lines changed

doc/admin-guide/logging/formatting.en.rst

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,7 @@ SSL / Encryption
618618
.. _cscert:
619619
.. _cqssl:
620620
.. _cqssr:
621+
.. _cqssrt:
621622
.. _cqssv:
622623
.. _cqssc:
623624
.. _cqssu:
@@ -639,9 +640,15 @@ cscert Client Request 1 if |TS| requested certificate from client during TLS
639640
handshake. 0 otherwise.
640641
cqssl Client Request SSL client request status indicates if this client
641642
connection is over SSL.
642-
cqssr Client Request SSL session ticket reused status; indicates if the current
643-
request hit the SSL session ticket and avoided a full SSL
644-
handshake.
643+
cqssr Client Request SSL session resumption status; indicates whether the
644+
current request was resumed from a previous SSL session
645+
and avoided a full TLS handshake. Resumption may have
646+
been via a server side session cache or via a TLS session
647+
ticket, see cqssrt_ for the resumption type.
648+
cqssrt Client Request SSL resumption type; indicates the type of TLS session
649+
resumption used for this request. 0 for no resumption,
650+
1 for server session cache resumption, 2 for TLS session
651+
ticket resumption.
645652
cqssv Client Request SSL version used to communicate with the client.
646653
cqssc Client Request SSL Cipher used by |TS| to communicate with the client.
647654
cqssu Client Request SSL Elliptic Curve used by |TS| to communicate with the

include/proxy/http/HttpUserAgent.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "records/RecHttp.h"
3333
#include "iocore/net/TLSBasicSupport.h"
3434
#include "iocore/net/TLSSessionResumptionSupport.h"
35+
#include "tscore/ink_assert.h"
3536

3637
#include <string>
3738

@@ -45,6 +46,7 @@ struct ClientConnectionInfo {
4546
bool tcp_reused{false};
4647
bool ssl_reused{false};
4748
bool connection_is_ssl{false};
49+
int ssl_resumption_type{0}; // 0=no resumption, 1=session cache, 2=session ticket
4850

4951
char const *protocol{"-"};
5052
char const *sec_protocol{"-"};
@@ -79,6 +81,8 @@ class HttpUserAgent
7981

8082
bool get_client_ssl_reused() const;
8183

84+
int get_client_ssl_resumption_type() const;
85+
8286
bool get_client_connection_is_ssl() const;
8387

8488
char const *get_client_protocol() const;
@@ -190,6 +194,20 @@ HttpUserAgent::set_txn(ProxyTransaction *txn, TransactionMilestones &milestones)
190194

191195
if (auto tsrs = netvc->get_service<TLSSessionResumptionSupport>()) {
192196
m_conn_info.ssl_reused = tsrs->getIsResumedSSLSession();
197+
198+
if (m_conn_info.ssl_reused) {
199+
if (tsrs->getIsResumedFromSessionCache()) {
200+
m_conn_info.ssl_resumption_type = 1;
201+
} else if (tsrs->getIsResumedFromSessionTicket()) {
202+
m_conn_info.ssl_resumption_type = 2;
203+
} else {
204+
// This should not happen if ssl_reused is true.
205+
ink_assert(!"ssl_resumption_type should be set for an SSL reused session");
206+
m_conn_info.ssl_resumption_type = 0;
207+
}
208+
} else {
209+
m_conn_info.ssl_resumption_type = 0;
210+
}
193211
}
194212

195213
if (auto protocol_str{txn->get_protocol_string()}; protocol_str) {
@@ -235,6 +253,12 @@ HttpUserAgent::get_client_ssl_reused() const
235253
return m_conn_info.ssl_reused;
236254
}
237255

256+
inline int
257+
HttpUserAgent::get_client_ssl_resumption_type() const
258+
{
259+
return m_conn_info.ssl_resumption_type;
260+
}
261+
238262
inline bool
239263
HttpUserAgent::get_client_connection_is_ssl() const
240264
{

include/proxy/logging/LogAccess.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ class LogAccess
147147
int marshal_client_req_tcp_reused(char *); // INT
148148
int marshal_client_req_is_ssl(char *); // INT
149149
int marshal_client_req_ssl_reused(char *); // INT
150+
int marshal_client_ssl_resumption_type(char *); // INT
150151
int marshal_client_req_is_internal(char *); // INT
151152
int marshal_client_req_mptcp_state(char *); // INT
152153
int marshal_client_security_protocol(char *); // STR

src/proxy/logging/Log.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,11 @@ Log::init_fields()
535535
global_field_list.add(field, false);
536536
field_symbol_hash.emplace("cqssr", field);
537537

538+
field = new LogField("client_req_ssl_resumption_type", "cqssrt", LogField::dINT, &LogAccess::marshal_client_ssl_resumption_type,
539+
&LogAccess::unmarshal_int_to_str);
540+
global_field_list.add(field, false);
541+
field_symbol_hash.emplace("cqssrt", field);
542+
538543
field = new LogField("client_req_is_internal", "cqint", LogField::sINT, &LogAccess::marshal_client_req_is_internal,
539544
&LogAccess::unmarshal_int_to_str);
540545
global_field_list.add(field, false);

src/proxy/logging/LogAccess.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2126,6 +2126,15 @@ LogAccess::marshal_client_req_ssl_reused(char *buf)
21262126
return INK_MIN_ALIGN;
21272127
}
21282128

2129+
int
2130+
LogAccess::marshal_client_ssl_resumption_type(char *buf)
2131+
{
2132+
if (buf) {
2133+
marshal_int(buf, m_http_sm->get_user_agent().get_client_ssl_resumption_type());
2134+
}
2135+
return INK_MIN_ALIGN;
2136+
}
2137+
21292138
int
21302139
LogAccess::marshal_client_req_is_internal(char *buf)
21312140
{

0 commit comments

Comments
 (0)