This is an automated email from the ASF dual-hosted git repository.
achennaka pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git
The following commit(s) were added to refs/heads/master by this push:
new a0c4bcab6 [server] log information on OpenSSL version
a0c4bcab6 is described below
commit a0c4bcab674351ba208e8affb5bfa43a67b2b4fc
Author: Alexey Serbin <[email protected]>
AuthorDate: Wed Sep 20 15:36:57 2023 -0700
[server] log information on OpenSSL version
This patch adds logging of the OpenSSL library's version string from
the RpcServer::Init() method. That's useful when trying to find out
what version of the OpenSSL library a Kudu server was running with.
Change-Id: I435119a0949aa9b933b06c1cc51c85d084f3d214
Reviewed-on: http://gerrit.cloudera.org:8080/20499
Tested-by: Kudu Jenkins
Reviewed-by: Abhishek Chennaka <[email protected]>
---
src/kudu/security/tls_context.cc | 13 ++++++++++++-
src/kudu/security/tls_context.h | 8 ++++++--
src/kudu/server/rpc_server.cc | 5 +++++
3 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/src/kudu/security/tls_context.cc b/src/kudu/security/tls_context.cc
index ba1ebedf2..3e91e86ad 100644
--- a/src/kudu/security/tls_context.cc
+++ b/src/kudu/security/tls_context.cc
@@ -28,9 +28,11 @@
#include <openssl/x509v3.h>
#include <algorithm>
+#include <functional>
+#include <memory>
#include <mutex>
-#include <ostream>
#include <optional>
+#include <ostream>
#include <string>
#include <type_traits>
#include <vector>
@@ -645,5 +647,14 @@ Status TlsContext::InitiateHandshake(TlsHandshake*
handshake) const {
return handshake->Init(std::move(ssl));
}
+const char* TlsContext::GetEngineVersionInfo() const {
+ CHECK(ctx_);
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
+ return CHECK_NOTNULL(SSLeay_version(SSLEAY_VERSION));
+#else
+ return CHECK_NOTNULL(OpenSSL_version(OPENSSL_VERSION));
+#endif
+}
+
} // namespace security
} // namespace kudu
diff --git a/src/kudu/security/tls_context.h b/src/kudu/security/tls_context.h
index e46cc7ffb..a092de939 100644
--- a/src/kudu/security/tls_context.h
+++ b/src/kudu/security/tls_context.h
@@ -18,8 +18,6 @@
#pragma once
#include <cstdint>
-#include <functional>
-#include <memory>
#include <optional>
#include <string>
#include <vector>
@@ -182,6 +180,12 @@ class TlsContext {
bool is_external_cert() const { return is_external_cert_; }
+ // Output information on the TLS engine/library. Essentially, this is
+ // a wrapper to get the OpenSSL version string. It must not return null.
+ // See https://www.openssl.org/docs/man1.1.1/man3/OpenSSL_version.html
+ // for details.
+ const char* GetEngineVersionInfo() const;
+
private:
Status VerifyCertChainUnlocked(const Cert& cert) WARN_UNUSED_RESULT;
diff --git a/src/kudu/server/rpc_server.cc b/src/kudu/server/rpc_server.cc
index 5d5791268..578263f45 100644
--- a/src/kudu/server/rpc_server.cc
+++ b/src/kudu/server/rpc_server.cc
@@ -38,6 +38,7 @@
#include "kudu/rpc/rpc_service.h"
#include "kudu/rpc/service_if.h"
#include "kudu/rpc/service_pool.h"
+#include "kudu/security/tls_context.h"
#include "kudu/util/flag_tags.h"
#include "kudu/util/flag_validators.h"
#include "kudu/util/net/net_util.h"
@@ -220,6 +221,10 @@ Status RpcServer::Init(const shared_ptr<Messenger>&
messenger) {
rpc_proxy_advertised_hostports_ = std::move(host_ports);
}
+ // Log information on the library used by the messenger's TLS context.
+ LOG(INFO) << Substitute("running with $0",
+ messenger_->tls_context().GetEngineVersionInfo());
+
server_state_ = INITIALIZED;
return Status::OK();
}