Merge pull request #7833 from Icinga/feature/version-build-info-openssl

CLI: Add OpenSSL version to 'Build' section in --version
This commit is contained in:
Henrik Triem 2020-02-17 17:07:51 +01:00 committed by GitHub
commit 099cc5d8df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 1 deletions

View File

@ -14,6 +14,7 @@
#include "base/convert.hpp" #include "base/convert.hpp"
#include "base/scriptglobal.hpp" #include "base/scriptglobal.hpp"
#include "base/process.hpp" #include "base/process.hpp"
#include "base/tlsutility.hpp"
#include <boost/algorithm/string/trim.hpp> #include <boost/algorithm/string/trim.hpp>
#include <boost/exception/errinfo_api_function.hpp> #include <boost/exception/errinfo_api_function.hpp>
#include <boost/exception/errinfo_errno.hpp> #include <boost/exception/errinfo_errno.hpp>
@ -551,7 +552,8 @@ void Application::DisplayInfoMessage(std::ostream& os, bool skipVersion)
os << "\nBuild information:\n" os << "\nBuild information:\n"
<< " Compiler: " << systemNS->Get("BuildCompilerName") << " " << systemNS->Get("BuildCompilerVersion") << "\n" << " Compiler: " << systemNS->Get("BuildCompilerName") << " " << systemNS->Get("BuildCompilerVersion") << "\n"
<< " Build host: " << systemNS->Get("BuildHostName") << "\n"; << " Build host: " << systemNS->Get("BuildHostName") << "\n"
<< " OpenSSL version: " << GetOpenSSLVersion() << "\n";
os << "\nApplication information:\n" os << "\nApplication information:\n"
<< "\nGeneral paths:\n" << "\nGeneral paths:\n"

View File

@ -8,6 +8,8 @@
#include "base/application.hpp" #include "base/application.hpp"
#include "base/exception.hpp" #include "base/exception.hpp"
#include <boost/asio/ssl/context.hpp> #include <boost/asio/ssl/context.hpp>
#include <openssl/opensslv.h>
#include <openssl/crypto.h>
#include <fstream> #include <fstream>
namespace icinga namespace icinga
@ -17,6 +19,15 @@ static bool l_SSLInitialized = false;
static boost::mutex *l_Mutexes; static boost::mutex *l_Mutexes;
static boost::mutex l_RandomMutex; static boost::mutex l_RandomMutex;
String GetOpenSSLVersion()
{
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
return OpenSSL_version(OPENSSL_VERSION);
#else /* OPENSSL_VERSION_NUMBER >= 0x10100000L */
return SSLeay_version(SSLEAY_VERSION);
#endif /* OPENSSL_VERSION_NUMBER >= 0x10100000L */
}
#ifdef CRYPTO_LOCK #ifdef CRYPTO_LOCK
static void OpenSSLLockingCallback(int mode, int type, const char *, int) static void OpenSSLLockingCallback(int mode, int type, const char *, int)
{ {

View File

@ -23,6 +23,8 @@ namespace icinga
void InitializeOpenSSL(); void InitializeOpenSSL();
String GetOpenSSLVersion();
Shared<boost::asio::ssl::context>::Ptr MakeAsioSslContext(const String& pubkey = String(), const String& privkey = String(), const String& cakey = String()); Shared<boost::asio::ssl::context>::Ptr MakeAsioSslContext(const String& pubkey = String(), const String& privkey = String(), const String& cakey = String());
void AddCRLToSSLContext(const Shared<boost::asio::ssl::context>::Ptr& context, const String& crlPath); void AddCRLToSSLContext(const Shared<boost::asio::ssl::context>::Ptr& context, const String& crlPath);
void SetCipherListToSSLContext(const Shared<boost::asio::ssl::context>::Ptr& context, const String& cipherList); void SetCipherListToSSLContext(const Shared<boost::asio::ssl::context>::Ptr& context, const String& cipherList);