1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +03:00

MCOL-497 Use CrossEngineSettings section of the XML config for cross-engine connections' TLS settings.

This commit is contained in:
Roman Nozdrin
2018-01-06 16:48:27 +03:00
parent c9ba4ace27
commit 631ba8ff64
5 changed files with 17 additions and 39 deletions

View File

@ -291,9 +291,6 @@
<ModuleType2>um</ModuleType2>
<ModuleDesc2>User Module</ModuleDesc2>
<RunType2>SIMPLEX</RunType2>
<ModuleTLSCA2>unassigned</ModuleTLSCA2>
<ModuleTLSClientCert2>unassigned</ModuleTLSClientCert2>
<ModuleTLSClientKey2>unassigned</ModuleTLSClientKey2>
<ModuleCount2>1</ModuleCount2>
<ModuleIPAddr1-1-2>0.0.0.0</ModuleIPAddr1-1-2>
<ModuleHostName1-1-2>unassigned</ModuleHostName1-1-2>
@ -523,6 +520,9 @@
<Port>3306</Port>
<User>root</User>
<Password></Password>
<TLSCA></TLSCA>
<TLSClientCert></TLSClientCert>
<TLSClientKey></TLSClientKey>
</CrossEngineSupport>
<QueryStats>
<Enabled>N</Enabled>

View File

@ -278,9 +278,6 @@
<ModuleType2>um</ModuleType2>
<ModuleDesc2>User Module</ModuleDesc2>
<RunType2>SIMPLEX</RunType2>
<ModuleTLSCA2>unassigned</ModuleTLSCA2>
<ModuleTLSClientCert2>unassigned</ModuleTLSClientCert2>
<ModuleTLSClientKey2>unassigned</ModuleTLSClientKey2>
<ModuleCount2>0</ModuleCount2>
<ModuleIPAddr1-1-2>0.0.0.0</ModuleIPAddr1-1-2>
<ModuleHostName1-1-2>unassigned</ModuleHostName1-1-2>
@ -517,6 +514,9 @@
<Port>3306</Port>
<User>root</User>
<Password></Password>
<TLSCA></TLSCA>
<TLSClientCert></TLSClientCert>
<TLSClientKey></TLSClientKey>
</CrossEngineSupport>
<QueryStats>
<Enabled>N</Enabled>

View File

@ -532,9 +532,6 @@ void Oam::getSystemConfig(const std::string& module, ModuleConfig& moduleconfig)
const string MODULE_DISABLE_STATE = "ModuleDisableState";
const string MODULE_DBROOT_COUNT = "ModuleDBRootCount";
const string MODULE_DBROOT_ID = "ModuleDBRootID";
const string MODULE_TLS_CA = "ModuleTLSCA";
const string MODULE_TLS_CL_CERT = "ModuleTLSClientCert";
const string MODULE_TLS_CL_KEY = "ModuleTLSClientKey";
string moduletype = module.substr(0, MAX_MODULE_TYPE_SIZE);
int moduleID = atoi(module.substr(MAX_MODULE_TYPE_SIZE, MAX_MODULE_ID_SIZE).c_str());
@ -609,13 +606,6 @@ void Oam::getSystemConfig(const std::string& module, ModuleConfig& moduleconfig)
sort ( moduleconfig.dbrootConfigList.begin(), moduleconfig.dbrootConfigList.end() );
if ( moduletype == "um" )
{
moduleconfig.TLSCA = sysConfig->getConfig(Section, MODULE_TLS_CA + itoa(moduleTypeID) );
moduleconfig.TLSClientCert = sysConfig->getConfig(Section, MODULE_TLS_CL_CERT + itoa(moduleTypeID) );
moduleconfig.TLSClientKey = sysConfig->getConfig(Section, MODULE_TLS_CL_KEY + itoa(moduleTypeID) );
}
return;
}
}

View File

@ -833,9 +833,6 @@ struct ModuleConfig_s
std::string ModuleType; //!< Module Type
std::string ModuleDesc; //!< Module Description
std::string DisableState; //!< Disabled State
std::string TLSCA; //!< TLS CA cert or path
std::string TLSClientCert; //!< TLS client cert path
std::string TLSClientKey; //!< TLS client key path
HostConfigList hostConfigList; //!< IP Address and Hostname List
DBRootConfigList dbrootConfigList; //!< DBRoot ID list
};

View File

@ -22,10 +22,9 @@
#include <iomanip>
using namespace std;
#include "idberrorinfo.h"
using namespace logging;
#include "liboamcpp.h"
#include "errorids.h"
#include "exceptclasses.h"
#include "configcpp.h"
#include "libmysql_client.h"
@ -61,23 +60,15 @@ int LibMySQL::init(const char* h, unsigned int p, const char* u, const char* w,
fCon = mysql_init(NULL);
oam::Oam oam;
oam::oamModuleInfo_t moduleInfo;
moduleInfo = oam.getModuleInfo();
string moduleName = boost::get<0>(moduleInfo);
int serverTypeInstall = boost::get<5>(moduleInfo);
config::Config* cf = config::Config::makeConfig();
const string TLSCA = cf->getConfig("CrossEngineSupport", "TLSCA");
const string TLSClientCert = cf->getConfig("CrossEngineSupport", "TLSClientCert");
const string TLSClientKey = cf->getConfig("CrossEngineSupport", "TLSClientKey");
// This is single server installation so use um1 instead of pm1.
if ( serverTypeInstall == 2 )
moduleName.assign("um1");
oam::ModuleConfig moduleconfig;
oam.getSystemConfig(moduleName, moduleconfig);
if (!(moduleconfig.TLSCA.empty() || moduleconfig.TLSClientCert.empty() || moduleconfig.TLSClientKey.empty()))
if (!(TLSCA.empty() || TLSClientCert.empty() || TLSClientKey.empty()))
{
mysql_ssl_set(fCon, moduleconfig.TLSClientKey.c_str(), moduleconfig.TLSClientCert.c_str(),
moduleconfig.TLSCA.c_str(), NULL, NULL);
mysql_ssl_set(fCon, TLSClientKey.c_str(), TLSClientCert.c_str(),
TLSCA.c_str(), NULL, NULL);
}
if (fCon != NULL)
@ -136,7 +127,7 @@ void LibMySQL::handleMySqlError(const char* errStr, unsigned int errCode)
else
oss << "(" << errCode << ")";
throw IDBExcept(oss.str(), ERR_CROSS_ENGINE_CONNECT);
throw logging::IDBExcept(oss.str(), logging::ERR_CROSS_ENGINE_CONNECT);
return;
}