Skip to content

Commit bf54760

Browse files
authored
remove support for session id based session resumption (#11157)
1 parent a96362a commit bf54760

File tree

15 files changed

+105
-934
lines changed

15 files changed

+105
-934
lines changed

doc/admin-guide/files/records.yaml.en.rst

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -3811,58 +3811,6 @@ SSL Termination
38113811
Setting a value less than or equal to ``0`` effectively disables
38123812
SSL session cache for the origin server.
38133813

3814-
.. ts:cv:: CONFIG proxy.config.ssl.session_cache INT 2
3815-
3816-
Enables the SSL session cache:
3817-
3818-
===== ======================================================================
3819-
Value Description
3820-
===== ======================================================================
3821-
``0`` Disables the session cache entirely.
3822-
``1`` Enables the session cache using OpenSSL's implementation.
3823-
``2`` Default. Enables the session cache using |TS|'s implementation. This
3824-
implementation should perform much better than the OpenSSL
3825-
implementation.
3826-
===== ======================================================================
3827-
3828-
.. ts:cv:: CONFIG proxy.config.ssl.session_cache.timeout INT 0
3829-
3830-
This configuration specifies the lifetime of SSL session cache
3831-
entries in seconds. If it is ``0``, then the SSL library will use
3832-
a default value, typically 300 seconds. Note: This option has no affect
3833-
when using the |TS| session cache (option ``2`` in
3834-
``proxy.config.ssl.session_cache``)
3835-
3836-
See :ref:`admin-performance-timeouts` for more discussion on |TS| timeouts.
3837-
3838-
.. ts:cv:: CONFIG proxy.config.ssl.session_cache.auto_clear INT 1
3839-
3840-
This will set the OpenSSL auto clear flag. Auto clear is enabled by
3841-
default with ``1`` it can be disabled by changing this setting to ``0``.
3842-
3843-
.. ts:cv:: CONFIG proxy.config.ssl.session_cache.size INT 102400
3844-
3845-
This configuration specifies the maximum number of entries
3846-
the SSL session cache may contain.
3847-
3848-
.. ts:cv:: CONFIG proxy.config.ssl.session_cache.num_buckets INT 256
3849-
3850-
This configuration specifies the number of buckets to use with the
3851-
|TS| SSL session cache implementation. The TS implementation
3852-
is a fixed size hash map where each bucket is protected by a mutex.
3853-
3854-
.. ts:cv:: CONFIG proxy.config.ssl.session_cache.skip_cache_on_bucket_contention INT 0
3855-
3856-
This configuration specifies the behavior of the |TS| SSL session
3857-
cache implementation during lock contention on each bucket:
3858-
3859-
===== ======================================================================
3860-
Value Description
3861-
===== ======================================================================
3862-
``0`` Default. Don't skip session caching when bucket lock is contented.
3863-
``1`` Disable the SSL session cache for a connection during lock contention.
3864-
===== ======================================================================
3865-
38663814
.. ts:cv:: CONFIG proxy.config.ssl.server.session_ticket.enable INT 1
38673815
38683816
Set to 1 to enable Traffic Server to process TLS tickets for TLS session resumption.

include/iocore/net/TLSSessionResumptionSupport.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ class TLSSessionResumptionSupport
5151
bool getSSLOriginSessionCacheHit() const;
5252
ssl_curve_id getSSLCurveNID() const;
5353

54-
SSL_SESSION *getSession(SSL *ssl, const unsigned char *id, int len, int *copy);
5554
std::shared_ptr<SSL_SESSION> getOriginSession(SSL *ssl, const std::string &lookup_key);
5655

5756
protected:

include/ts/ts.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1367,11 +1367,6 @@ int TSVConnIsSsl(TSVConn sslp);
13671367
int TSVConnProvidedSslCert(TSVConn sslp);
13681368
const char *TSVConnSslSniGet(TSVConn sslp, int *length);
13691369

1370-
TSSslSession TSSslSessionGet(const TSSslSessionID *session_id);
1371-
int TSSslSessionGetBuffer(const TSSslSessionID *session_id, char *buffer, int *len_ptr);
1372-
TSReturnCode TSSslSessionInsert(const TSSslSessionID *session_id, TSSslSession add_session, TSSslConnection ssl_conn);
1373-
TSReturnCode TSSslSessionRemove(const TSSslSessionID *session_id);
1374-
13751370
/* --------------------------------------------------------------------------
13761371
HTTP transactions */
13771372
void TSHttpTxnHookAdd(TSHttpTxn txnp, TSHttpHookID id, TSCont contp);

src/api/InkAPI.cc

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,6 @@ extern ClassAllocator<FetchSM> FetchSMAllocator;
131131
/* From proxy/http/HttpProxyServerMain.c: */
132132
extern bool ssl_register_protocol(const char *, Continuation *);
133133

134-
extern SSLSessionCache *session_cache; // declared extern in P_SSLConfig.h
135-
136134
// External converters.
137135
extern MgmtConverter const &HttpDownServerCacheTimeConv;
138136

@@ -8371,61 +8369,6 @@ TSVConnReenableEx(TSVConn vconn, TSEvent event)
83718369
}
83728370
}
83738371

8374-
TSSslSession
8375-
TSSslSessionGet(const TSSslSessionID *session_id)
8376-
{
8377-
SSL_SESSION *session = nullptr;
8378-
if (session_id && session_cache) {
8379-
session_cache->getSession(reinterpret_cast<const SSLSessionID &>(*session_id), &session, nullptr);
8380-
}
8381-
return reinterpret_cast<TSSslSession>(session);
8382-
}
8383-
8384-
int
8385-
TSSslSessionGetBuffer(const TSSslSessionID *session_id, char *buffer, int *len_ptr)
8386-
{
8387-
int true_len = 0;
8388-
// Don't get if there is no session id or the cache is not yet set up
8389-
if (session_id && session_cache && len_ptr) {
8390-
true_len = session_cache->getSessionBuffer(reinterpret_cast<const SSLSessionID &>(*session_id), buffer, *len_ptr);
8391-
}
8392-
return true_len;
8393-
}
8394-
8395-
TSReturnCode
8396-
TSSslSessionInsert(const TSSslSessionID *session_id, TSSslSession add_session, TSSslConnection ssl_conn)
8397-
{
8398-
// Don't insert if there is no session id or the cache is not yet set up
8399-
if (session_id && session_cache) {
8400-
if (is_debug_tag_set("ssl.session_cache")) {
8401-
const SSLSessionID *sid = reinterpret_cast<const SSLSessionID *>(session_id);
8402-
char buf[sid->len * 2 + 1];
8403-
sid->toString(buf, sizeof(buf));
8404-
Debug("ssl.session_cache.insert", "TSSslSessionInsert: Inserting session '%s' ", buf);
8405-
}
8406-
SSL_SESSION *session = reinterpret_cast<SSL_SESSION *>(add_session);
8407-
SSL *ssl = reinterpret_cast<SSL *>(ssl_conn);
8408-
session_cache->insertSession(reinterpret_cast<const SSLSessionID &>(*session_id), session, ssl);
8409-
// insertSession returns void, assume all went well
8410-
return TS_SUCCESS;
8411-
} else {
8412-
return TS_ERROR;
8413-
}
8414-
}
8415-
8416-
TSReturnCode
8417-
TSSslSessionRemove(const TSSslSessionID *session_id)
8418-
{
8419-
// Don't remove if there is no session id or the cache is not yet set up
8420-
if (session_id && session_cache) {
8421-
session_cache->removeSession(reinterpret_cast<const SSLSessionID &>(*session_id));
8422-
// removeSession returns void, assume all went well
8423-
return TS_SUCCESS;
8424-
} else {
8425-
return TS_ERROR;
8426-
}
8427-
}
8428-
84298372
// APIs for managing and using UUIDs.
84308373
TSUuid
84318374
TSUuidCreate()

src/iocore/net/P_SSLConfig.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,6 @@ using init_ssl_ctx_func = void (*)(void *, bool);
6060
using load_ssl_file_func = void (*)(const char *);
6161

6262
struct SSLConfigParams : public ConfigInfo {
63-
enum SSL_SESSION_CACHE_MODE {
64-
SSL_SESSION_CACHE_MODE_OFF = 0,
65-
SSL_SESSION_CACHE_MODE_SERVER_OPENSSL_IMPL = 1,
66-
SSL_SESSION_CACHE_MODE_SERVER_ATS_IMPL = 2
67-
};
68-
6963
SSLConfigParams();
7064
~SSLConfigParams() override;
7165

@@ -83,12 +77,6 @@ struct SSLConfigParams : public ConfigInfo {
8377
int verify_depth;
8478
int ssl_origin_session_cache;
8579
int ssl_origin_session_cache_size;
86-
int ssl_session_cache; // SSL_SESSION_CACHE_MODE
87-
int ssl_session_cache_size;
88-
int ssl_session_cache_num_buckets;
89-
int ssl_session_cache_skip_on_contention;
90-
int ssl_session_cache_timeout;
91-
int ssl_session_cache_auto_clear;
9280

9381
char *clientCertPath;
9482
char *clientCertPathOnly;
@@ -139,9 +127,6 @@ struct SSLConfigParams : public ConfigInfo {
139127

140128
static int origin_session_cache;
141129
static size_t origin_session_cache_size;
142-
static size_t session_cache_number_buckets;
143-
static size_t session_cache_max_bucket_size;
144-
static bool session_cache_skip_on_lock_contention;
145130

146131
static swoc::IPRangeSet *proxy_protocol_ip_addrs;
147132

@@ -263,5 +248,4 @@ struct SSLTicketKeyConfig {
263248
static int configid;
264249
};
265250

266-
extern SSLSessionCache *session_cache;
267251
extern SSLOriginSessionCache *origin_sess_cache;

src/iocore/net/SSLConfig.cc

Lines changed: 21 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -52,29 +52,26 @@
5252
#include "SSLSessionTicket.h"
5353
#include "iocore/net/YamlSNIConfig.h"
5454

55-
int SSLConfig::config_index = 0;
56-
int SSLConfig::configids[] = {0, 0};
57-
int SSLCertificateConfig::configid = 0;
58-
int SSLTicketKeyConfig::configid = 0;
59-
int SSLConfigParams::ssl_maxrecord = 0;
60-
int SSLConfigParams::ssl_misc_max_iobuffer_size_index = 8;
61-
bool SSLConfigParams::ssl_allow_client_renegotiation = false;
62-
bool SSLConfigParams::ssl_ocsp_enabled = false;
63-
int SSLConfigParams::ssl_ocsp_cache_timeout = 3600;
64-
bool SSLConfigParams::ssl_ocsp_request_mode = false;
65-
int SSLConfigParams::ssl_ocsp_request_timeout = 10;
66-
int SSLConfigParams::ssl_ocsp_update_period = 60;
67-
char *SSLConfigParams::ssl_ocsp_user_agent = nullptr;
68-
int SSLConfigParams::ssl_handshake_timeout_in = 0;
69-
int SSLConfigParams::origin_session_cache = 1;
70-
size_t SSLConfigParams::origin_session_cache_size = 10240;
71-
size_t SSLConfigParams::session_cache_number_buckets = 1024;
72-
bool SSLConfigParams::session_cache_skip_on_lock_contention = false;
73-
size_t SSLConfigParams::session_cache_max_bucket_size = 100;
74-
init_ssl_ctx_func SSLConfigParams::init_ssl_ctx_cb = nullptr;
75-
load_ssl_file_func SSLConfigParams::load_ssl_file_cb = nullptr;
76-
swoc::IPRangeSet *SSLConfigParams::proxy_protocol_ip_addrs = nullptr;
77-
bool SSLConfigParams::ssl_ktls_enabled = false;
55+
int SSLConfig::config_index = 0;
56+
int SSLConfig::configids[] = {0, 0};
57+
int SSLCertificateConfig::configid = 0;
58+
int SSLTicketKeyConfig::configid = 0;
59+
int SSLConfigParams::ssl_maxrecord = 0;
60+
int SSLConfigParams::ssl_misc_max_iobuffer_size_index = 8;
61+
bool SSLConfigParams::ssl_allow_client_renegotiation = false;
62+
bool SSLConfigParams::ssl_ocsp_enabled = false;
63+
int SSLConfigParams::ssl_ocsp_cache_timeout = 3600;
64+
bool SSLConfigParams::ssl_ocsp_request_mode = false;
65+
int SSLConfigParams::ssl_ocsp_request_timeout = 10;
66+
int SSLConfigParams::ssl_ocsp_update_period = 60;
67+
char *SSLConfigParams::ssl_ocsp_user_agent = nullptr;
68+
int SSLConfigParams::ssl_handshake_timeout_in = 0;
69+
int SSLConfigParams::origin_session_cache = 1;
70+
size_t SSLConfigParams::origin_session_cache_size = 10240;
71+
init_ssl_ctx_func SSLConfigParams::init_ssl_ctx_cb = nullptr;
72+
load_ssl_file_func SSLConfigParams::load_ssl_file_cb = nullptr;
73+
swoc::IPRangeSet *SSLConfigParams::proxy_protocol_ip_addrs = nullptr;
74+
bool SSLConfigParams::ssl_ktls_enabled = false;
7875

7976
const uint32_t EARLY_DATA_DEFAULT_SIZE = 16384;
8077
uint32_t SSLConfigParams::server_max_early_data = 0;
@@ -122,14 +119,7 @@ SSLConfigParams::reset()
122119
verifyServerProperties = YamlSNIConfig::Property::NONE;
123120
ssl_ctx_options = SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3;
124121
ssl_client_ctx_options = SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3;
125-
ssl_session_cache = SSL_SESSION_CACHE_MODE_SERVER_ATS_IMPL;
126-
ssl_session_cache_size = 1024 * 100;
127-
ssl_session_cache_num_buckets = 1024; // Sessions per bucket is ceil(ssl_session_cache_size / ssl_session_cache_num_buckets)
128-
ssl_session_cache_skip_on_contention = 0;
129-
ssl_session_cache_timeout = 0;
130-
ssl_session_cache_auto_clear = 1;
131-
configExitOnLoadError = 1;
132-
clientCertExitOnLoadError = 0;
122+
configExitOnLoadError = 1;
133123
}
134124

135125
void
@@ -442,23 +432,9 @@ SSLConfigParams::initialize()
442432
// SSL session cache configurations
443433
REC_ReadConfigInteger(ssl_origin_session_cache, "proxy.config.ssl.origin_session_cache.enabled");
444434
REC_ReadConfigInteger(ssl_origin_session_cache_size, "proxy.config.ssl.origin_session_cache.size");
445-
REC_ReadConfigInteger(ssl_session_cache, "proxy.config.ssl.session_cache.value");
446-
REC_ReadConfigInteger(ssl_session_cache_size, "proxy.config.ssl.session_cache.size");
447-
REC_ReadConfigInteger(ssl_session_cache_num_buckets, "proxy.config.ssl.session_cache.num_buckets");
448-
REC_ReadConfigInteger(ssl_session_cache_skip_on_contention, "proxy.config.ssl.session_cache.skip_cache_on_bucket_contention");
449-
REC_ReadConfigInteger(ssl_session_cache_timeout, "proxy.config.ssl.session_cache.timeout");
450-
REC_ReadConfigInteger(ssl_session_cache_auto_clear, "proxy.config.ssl.session_cache.auto_clear");
451435

452436
SSLConfigParams::origin_session_cache = ssl_origin_session_cache;
453437
SSLConfigParams::origin_session_cache_size = ssl_origin_session_cache_size;
454-
SSLConfigParams::session_cache_max_bucket_size =
455-
static_cast<size_t>(ceil(static_cast<double>(ssl_session_cache_size) / ssl_session_cache_num_buckets));
456-
SSLConfigParams::session_cache_skip_on_lock_contention = ssl_session_cache_skip_on_contention;
457-
SSLConfigParams::session_cache_number_buckets = ssl_session_cache_num_buckets;
458-
459-
if (ssl_session_cache == SSL_SESSION_CACHE_MODE_SERVER_ATS_IMPL) {
460-
session_cache = new SSLSessionCache();
461-
}
462438

463439
if (ssl_origin_session_cache == 1 && ssl_origin_session_cache_size > 0) {
464440
origin_sess_cache = new SSLOriginSessionCache();

0 commit comments

Comments
 (0)