Skip to content

Commit

Permalink
WL#15135 patch #3: add TlsKeyManager to TransporterRegistry
Browse files Browse the repository at this point in the history
Part of WL#15135 Certificate Architecture

This patch adds an instance of TlsKeyManager to class
TransporterRegistry. This TlsKeyManager will handle certificate
authentication in all node types.

A new method TransporterRegistry::init_tls() configures TLS at
node startup time.

Change-Id: I1f9d3fff21ea7f2d9f009cce48823304c2baead7
  • Loading branch information
jdduncan committed Jul 14, 2023
1 parent a6c1b92 commit a96f9f4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
8 changes: 8 additions & 0 deletions storage/ndb/include/transporter/TransporterRegistry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
#include "portlib/NdbTick.h"
#include "portlib/ndb_sockaddr.h"
#include "util/NdbSocket.h"
#include "util/TlsKeyManager.hpp"

#ifndef _WIN32
/*
Expand Down Expand Up @@ -233,6 +234,12 @@ class TransporterRegistry
*/
bool init(TransporterReceiveHandle&);

/**
* Initialize TLS context. Cannot be called prior to init(NodeId).
* Returns true on success.
*/
bool init_tls(const char * search_path, int node_type, bool is_primary);

/**
Perform handshaking of a client connection to accept it
as transporter.
Expand Down Expand Up @@ -568,6 +575,7 @@ class TransporterRegistry
Uint32 nMultiTransporters;
Uint32 nTCPTransporters;
Uint32 nSHMTransporters;
TlsKeyManager m_tls_keys;

#ifdef ERROR_INSERT
NodeBitmask m_blocked;
Expand Down
9 changes: 9 additions & 0 deletions storage/ndb/src/common/transporter/TransporterRegistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,15 @@ TransporterRegistry::init(TransporterReceiveHandle& recvhandle)
return recvhandle.init(maxTransporters);
}

bool
TransporterRegistry::init_tls(const char * searchPath, int nodeType,
bool isPrimary)
{
require(localNodeId);
m_tls_keys.init(searchPath, localNodeId, nodeType, isPrimary);
return m_tls_keys.ctx();
}

bool
TransporterRegistry::connect_server(NdbSocket & socket,
BaseString & msg,
Expand Down

0 comments on commit a96f9f4

Please sign in to comment.