Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions doc/admin-guide/logging/formatting.en.rst
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,7 @@ SSL / Encryption
.. _cqssv:
.. _cqssc:
.. _cqssu:
.. _cqssa:
.. _pqssl:
.. _pscert:

Expand All @@ -628,6 +629,7 @@ cqssv Client Request SSL version used to communicate with the client.
cqssc Client Request SSL Cipher used by |TS| to communicate with the client.
cqssu Client Request SSL Elliptic Curve used by |TS| to communicate with the
client when using an ECDHE cipher.
cqssa Client Request ALPN Protocol ID negotiated with the client.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ins't it almost the same as cqpv? Do we need the both?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, please look at the updated description.

pqssl Proxy Request Indicates whether the connection from |TS| to the origin
was over SSL or not.
pscert Proxy Request 1 if origin requested certificate from |TS| during TLS
Expand Down
20 changes: 20 additions & 0 deletions iocore/net/P_ALPNSupport.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,31 @@ class ALPNSupport
return npnSet;
}

void set_negotiated_protocol_id(const ts::TextView &proto);
int get_negotiated_protocol_id() const;

private:
const SSLNextProtocolSet *npnSet = nullptr;
SessionProtocolSet protoenabled;
// Local copies of the npn strings
unsigned char *npn = nullptr;
size_t npnsz = 0;
Continuation *npnEndpoint = nullptr;
int _negotiated_proto_id = SessionProtocolNameRegistry::INVALID;
};

//
// Inline functions
//

inline void
ALPNSupport::set_negotiated_protocol_id(const ts::TextView &proto)
{
_negotiated_proto_id = globalSessionProtocolNameRegistry.indexFor(proto);
}

inline int
ALPNSupport::get_negotiated_protocol_id() const
{
return _negotiated_proto_id;
}
2 changes: 2 additions & 0 deletions iocore/net/QUICNetVConnection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2133,6 +2133,8 @@ QUICNetVConnection::_start_application()
app_name_len = IP_PROTO_TAG_HTTP_QUIC.size();
}

this->set_negotiated_protocol_id({reinterpret_cast<const char *>(app_name), static_cast<size_t>(app_name_len)});

if (netvc_context == NET_VCONNECTION_IN) {
if (!this->setSelectedProtocol(app_name, app_name_len)) {
this->_handle_error(std::make_unique<QUICConnectionError>(QUICTransErrorCode::PROTOCOL_VIOLATION));
Expand Down
2 changes: 2 additions & 0 deletions iocore/net/SSLNetVConnection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1325,6 +1325,8 @@ SSLNetVConnection::sslServerHandShakeEvent(int &err)
if (!this->setSelectedProtocol(proto, len)) {
return EVENT_ERROR;
}
this->set_negotiated_protocol_id({reinterpret_cast<const char *>(proto), static_cast<size_t>(len)});
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setSelectedProtocol and setSelectedProtocol are provided by the same class and these both receive exactly the same parameters. Why do we have to call two functions? Is there any case we want to call only one of them?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ALPN with Partial Blind Tunnel has a situation of that negotiated application protocol is different from the endpoint which is actually used.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, registering a different endpoint for tunneling vc maybe more generic.


Debug("ssl", "client selected next protocol '%.*s'", len, proto);
} else {
Debug("ssl", "client did not select a next protocol");
Expand Down
2 changes: 2 additions & 0 deletions proxy/http/HttpSM.cc
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,8 @@ HttpSM::attach_client_session(ProxyTransaction *client_vc, IOBufferReader *buffe
client_cipher_suite = cipher ? cipher : "-";
const char *curve = ssl_vc->getSSLCurve();
client_curve = curve ? curve : "-";
client_alpn_id = ssl_vc->get_negotiated_protocol_id();

if (!client_tcp_reused) {
// Copy along the TLS handshake timings
milestones[TS_MILESTONE_TLS_HANDSHAKE_START] = ssl_vc->sslHandshakeBeginTime;
Expand Down
1 change: 1 addition & 0 deletions proxy/http/HttpSM.h
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,7 @@ class HttpSM : public Continuation, public PluginUserArgs<TS_USER_ARGS_TXN>
const char *client_sec_protocol = "-";
const char *client_cipher_suite = "-";
const char *client_curve = "-";
int client_alpn_id = SessionProtocolNameRegistry::INVALID;
int server_transact_count = 0;

TransactionMilestones milestones;
Expand Down
2 changes: 1 addition & 1 deletion proxy/http/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ test_proxy_http_LDADD = \
$(top_builddir)/src/tscore/libtscore.la \
$(top_builddir)/proxy/hdrs/libhdrs.a \
$(top_builddir)/iocore/eventsystem/libinkevent.a \
$(top_builddir)/lib/records/librecords_p.a \
$(top_builddir)/proxy/logging/liblogging.a \
$(top_builddir)/lib/records/librecords_p.a \
$(top_builddir)/proxy/shared/libUglyLogStubs.a \
$(top_builddir)/mgmt/libmgmt_p.la \
$(top_builddir)/iocore/utils/libinkutils.a \
Expand Down
5 changes: 5 additions & 0 deletions proxy/logging/Log.cc
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,11 @@ Log::init_fields()
global_field_list.add(field, false);
field_symbol_hash.emplace("cqssu", field);

field = new LogField("client_sec_alpn", "cqssa", LogField::STRING, &LogAccess::marshal_client_security_alpn,
reinterpret_cast<LogField::UnmarshalFunc>(&LogAccess::unmarshal_str));
global_field_list.add(field, false);
field_symbol_hash.emplace("cqssa", field);

Ptr<LogFieldAliasTable> finish_status_map = make_ptr(new LogFieldAliasTable);
finish_status_map->init(N_LOG_FINISH_CODE_TYPES, LOG_FINISH_FIN, "FIN", LOG_FINISH_INTR, "INTR", LOG_FINISH_TIMEOUT, "TIMEOUT");

Expand Down
18 changes: 18 additions & 0 deletions proxy/logging/LogAccess.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2011,6 +2011,24 @@ LogAccess::marshal_client_security_curve(char *buf)
return round_len;
}

int
LogAccess::marshal_client_security_alpn(char *buf)
{
const char *alpn = "-";
if (const int alpn_id = m_http_sm->client_alpn_id; alpn_id != SessionProtocolNameRegistry::INVALID) {
ts::TextView client_sec_alpn = globalSessionProtocolNameRegistry.nameFor(alpn_id);
alpn = client_sec_alpn.data();
}

int round_len = LogAccess::strlen(alpn);

if (buf) {
marshal_str(buf, alpn, round_len);
}

return round_len;
}

/*-------------------------------------------------------------------------
-------------------------------------------------------------------------*/

Expand Down
1 change: 1 addition & 0 deletions proxy/logging/LogAccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ class LogAccess
inkcoreapi int marshal_client_security_protocol(char *); // STR
inkcoreapi int marshal_client_security_cipher_suite(char *); // STR
inkcoreapi int marshal_client_security_curve(char *); // STR
inkcoreapi int marshal_client_security_alpn(char *); // STR
inkcoreapi int marshal_client_finish_status_code(char *); // INT
inkcoreapi int marshal_client_req_id(char *); // INT
inkcoreapi int marshal_client_req_uuid(char *); // STR
Expand Down