Skip to content

Commit e52afe4

Browse files
committed
Remove TSSslSecretXxx TS API functions.
1 parent 9e26f9e commit e52afe4

File tree

15 files changed

+7
-1547
lines changed

15 files changed

+7
-1547
lines changed

doc/developer-guide/api/functions/TSLifecycleHookAdd.en.rst

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ specified by :arg:`id`. Lifecycle hooks are based on the Traffic Server
4040
process, not on any specific transaction or session. These will typically be
4141
called only once during the execution of the Traffic Server process and
4242
therefore should be added in :func:`TSPluginInit` (which could itself be
43-
considered a lifecycle hook). Unlike other hooks, lifecycle hooks may not have a
44-
well defined ordering and use of them should not assume that one of the hooks
43+
considered a lifecycle hook). Unlike other hooks, lifecycle hooks may not have
44+
a well defined ordering and use of them should not assume that one of the hooks
4545
is always called before another unless specifically mentioned.
4646

4747
Types
@@ -106,14 +106,6 @@ Types
106106
Invoked with the event :c:data:`TS_EVENT_LIFECYCLE_TASK_THREADS_READY` and ``NULL``
107107
data.
108108

109-
.. cpp:enumerator:: TS_LIFECYCLE_SSL_SECRET_HOOK
110-
111-
Called before the data for the certificate or key is loaded. The data argument to the callback is a pointer to a :type:`TSSecretID` which
112-
contains a pointer to the name of the certificate or key and the relevant version if applicable.
113-
114-
This hook gives the plugin a chance to load the certificate or key from an alternative source and set via the :c:func:`TSSslSecretSet` API.
115-
If there is no plugin override, the certificate or key will be loaded from disk and the secret name will be interpreted as a file path.
116-
117109
.. cpp:enumerator:: TS_LIFECYCLE_SHUTDOWN_HOOK
118110

119111
Called after |TS| receiving a shutdown signal, such as SIGTERM.

doc/developer-guide/api/functions/TSSslSecret.en.rst

Lines changed: 0 additions & 82 deletions
This file was deleted.

doc/release-notes/whats-new.en.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -547,9 +547,6 @@ make the older ``stats_over_http`` obsolete.
547547
Plugin APIs
548548
-----------
549549

550-
A new hook for loading certificates was added, :cpp:enumerator:`TS_LIFECYCLE_SSL_SECRET_HOOK`. When using
551-
this hook, the plugin recieved a structure with a type :c:type:`TSSecretID`.
552-
553550
The transction control APIs where refactored and promoted to that ``ts.h`` public APIs. This adds
554551
:c:func:`TSHttpTxnCntlGet` and :c:func:`TSHttpTxnCntlSet`, and the c:enum::`TSHttpCntlType` enum.
555552

include/ts/apidefs.h.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,8 +438,8 @@ typedef enum {
438438
TS_LIFECYCLE_MSG_HOOK,
439439
TS_LIFECYCLE_TASK_THREADS_READY_HOOK,
440440
TS_LIFECYCLE_SHUTDOWN_HOOK,
441-
TS_LIFECYCLE_SSL_SECRET_HOOK,
442-
TS_LIFECYCLE_LAST_HOOK
441+
// TS_LIFECYCLE_SSL_SECRET_HOOK, future release
442+
TS_LIFECYCLE_LAST_HOOK = TS_LIFECYCLE_SHUTDOWN_HOOK + 2
443443
} TSLifecycleHookID;
444444

445445
/**

include/ts/ts.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1302,15 +1302,6 @@ tsapi TSSslContext TSSslClientContextFindByName(const char *ca_paths, const char
13021302
tsapi TSReturnCode TSSslClientCertUpdate(const char *cert_path, const char *key_path);
13031303
tsapi TSReturnCode TSSslServerCertUpdate(const char *cert_path, const char *key_path);
13041304

1305-
/* Update the transient secret table for SSL_CTX loading */
1306-
tsapi TSReturnCode TSSslSecretSet(const char *secret_name, int secret_name_length, const char *secret_data, int secret_data_length);
1307-
1308-
/* Returns secret with given name (not null terminted). If there is no secret with the given name, return value will
1309-
** be null and secret_data_lenght will be zero. Calling code must free data buffer by calling TSfree(). */
1310-
tsapi char *TSSslSecretGet(const char *secret_name, int secret_name_length, int *secret_data_length);
1311-
1312-
tsapi TSReturnCode TSSslSecretUpdate(const char *secret_name, int secret_name_length);
1313-
13141305
/* Create a new SSL context based on the settings in records.config */
13151306
tsapi TSSslContext TSSslServerContextCreate(TSSslX509 cert, const char *certname, const char *rsp_file);
13161307
tsapi void TSSslContextDestroy(TSSslContext ctx);

iocore/net/SSLSecret.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@
2828
// NOTE: The secret_map_mutex should not be held by the caller of this
2929
// function. The implementation of this function may call a plugin's
3030
// TS_EVENT_SSL_SECRET handler which in turn may grab a lock for
31-
// secret_map_mutex via a TSSslSecretSet call. These events will result in a
32-
// deadlock.
31+
// secret_map_mutex via a TSSslSecretSet (proposed in a future release) call.
32+
// These events will result in a deadlock.
3333
void
3434
SSLSecret::loadSecret(const std::string &name1, const std::string &name2, std::string &data1, std::string &data2)
3535
{
3636
// Call the load secret hooks
3737
//
38-
class APIHook *curHook = lifecycle_hooks->get(TS_LIFECYCLE_SSL_SECRET_HOOK);
38+
class APIHook *curHook = lifecycle_hooks->get(/* TS_LIFECYCLE_SSL_SECRET_HOOK */ TS_LIFECYCLE_LAST_HOOK /* dummy value */);
3939
TSSecretID secret_name;
4040
secret_name.cert_name = name1.data();
4141
secret_name.cert_name_len = name1.size();

src/traffic_server/InkAPI.cc

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -9640,74 +9640,6 @@ TSSslContextFindByAddr(struct sockaddr const *addr)
96409640
return ret;
96419641
}
96429642

9643-
/**
9644-
* This function sets the secret cache value for a given secret name. This allows
9645-
* plugins to load cert/key PEM information on for use by the TLS core
9646-
*/
9647-
tsapi TSReturnCode
9648-
TSSslSecretSet(const char *secret_name, int secret_name_length, const char *secret_data, int secret_data_len)
9649-
{
9650-
TSReturnCode retval = TS_SUCCESS;
9651-
std::string const secret_name_str{secret_name, unsigned(secret_name_length)};
9652-
SSLConfigParams *load_params = SSLConfig::load_acquire();
9653-
SSLConfigParams *params = SSLConfig::acquire();
9654-
if (load_params != nullptr) { // Update the current data structure
9655-
Debug("ssl.cert_update", "Setting secrets in SSLConfig load for: %.*s", secret_name_length, secret_name);
9656-
load_params->secrets.setSecret(secret_name_str, std::string_view(secret_data, secret_data_len));
9657-
load_params->updateCTX(secret_name_str);
9658-
SSLConfig::load_release(load_params);
9659-
}
9660-
if (params != nullptr) {
9661-
Debug("ssl.cert_update", "Setting secrets in SSLConfig for: %.*s", secret_name_length, secret_name);
9662-
params->secrets.setSecret(secret_name_str, std::string_view(secret_data, secret_data_len));
9663-
params->updateCTX(secret_name_str);
9664-
SSLConfig::release(params);
9665-
}
9666-
return retval;
9667-
}
9668-
9669-
tsapi TSReturnCode
9670-
TSSslSecretUpdate(const char *secret_name, int secret_name_length)
9671-
{
9672-
TSReturnCode retval = TS_SUCCESS;
9673-
SSLConfigParams *params = SSLConfig::acquire();
9674-
if (params != nullptr) {
9675-
params->updateCTX(std::string(secret_name, secret_name_length));
9676-
}
9677-
SSLConfig::release(params);
9678-
return retval;
9679-
}
9680-
9681-
tsapi char *
9682-
TSSslSecretGet(const char *secret_name, int secret_name_length, int *secret_data_length)
9683-
{
9684-
sdk_assert(secret_name != nullptr);
9685-
sdk_assert(secret_data_length != nullptr);
9686-
9687-
bool loading = true;
9688-
SSLConfigParams *params = SSLConfig::load_acquire();
9689-
if (params == nullptr) {
9690-
params = SSLConfig::acquire();
9691-
loading = false;
9692-
}
9693-
std::string const secret_data = params->secrets.getSecret(std::string(secret_name, secret_name_length));
9694-
char *data{nullptr};
9695-
if (secret_data.empty()) {
9696-
*secret_data_length = 0;
9697-
9698-
} else {
9699-
data = static_cast<char *>(ats_malloc(secret_data.size()));
9700-
memcpy(data, secret_data.data(), secret_data.size());
9701-
*secret_data_length = secret_data.size();
9702-
}
9703-
if (loading) {
9704-
SSLConfig::load_release(params);
9705-
} else {
9706-
SSLConfig::release(params);
9707-
}
9708-
return data;
9709-
}
9710-
97119643
/**
97129644
* This function retrieves an array of lookup keys for client contexts loaded in
97139645
* traffic server. Given a 2-level mapping for client contexts, every 2 lookup keys

0 commit comments

Comments
 (0)