You've already forked mariadb-columnstore-engine
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:
@ -291,9 +291,6 @@
|
|||||||
<ModuleType2>um</ModuleType2>
|
<ModuleType2>um</ModuleType2>
|
||||||
<ModuleDesc2>User Module</ModuleDesc2>
|
<ModuleDesc2>User Module</ModuleDesc2>
|
||||||
<RunType2>SIMPLEX</RunType2>
|
<RunType2>SIMPLEX</RunType2>
|
||||||
<ModuleTLSCA2>unassigned</ModuleTLSCA2>
|
|
||||||
<ModuleTLSClientCert2>unassigned</ModuleTLSClientCert2>
|
|
||||||
<ModuleTLSClientKey2>unassigned</ModuleTLSClientKey2>
|
|
||||||
<ModuleCount2>1</ModuleCount2>
|
<ModuleCount2>1</ModuleCount2>
|
||||||
<ModuleIPAddr1-1-2>0.0.0.0</ModuleIPAddr1-1-2>
|
<ModuleIPAddr1-1-2>0.0.0.0</ModuleIPAddr1-1-2>
|
||||||
<ModuleHostName1-1-2>unassigned</ModuleHostName1-1-2>
|
<ModuleHostName1-1-2>unassigned</ModuleHostName1-1-2>
|
||||||
@ -523,6 +520,9 @@
|
|||||||
<Port>3306</Port>
|
<Port>3306</Port>
|
||||||
<User>root</User>
|
<User>root</User>
|
||||||
<Password></Password>
|
<Password></Password>
|
||||||
|
<TLSCA></TLSCA>
|
||||||
|
<TLSClientCert></TLSClientCert>
|
||||||
|
<TLSClientKey></TLSClientKey>
|
||||||
</CrossEngineSupport>
|
</CrossEngineSupport>
|
||||||
<QueryStats>
|
<QueryStats>
|
||||||
<Enabled>N</Enabled>
|
<Enabled>N</Enabled>
|
||||||
|
@ -278,9 +278,6 @@
|
|||||||
<ModuleType2>um</ModuleType2>
|
<ModuleType2>um</ModuleType2>
|
||||||
<ModuleDesc2>User Module</ModuleDesc2>
|
<ModuleDesc2>User Module</ModuleDesc2>
|
||||||
<RunType2>SIMPLEX</RunType2>
|
<RunType2>SIMPLEX</RunType2>
|
||||||
<ModuleTLSCA2>unassigned</ModuleTLSCA2>
|
|
||||||
<ModuleTLSClientCert2>unassigned</ModuleTLSClientCert2>
|
|
||||||
<ModuleTLSClientKey2>unassigned</ModuleTLSClientKey2>
|
|
||||||
<ModuleCount2>0</ModuleCount2>
|
<ModuleCount2>0</ModuleCount2>
|
||||||
<ModuleIPAddr1-1-2>0.0.0.0</ModuleIPAddr1-1-2>
|
<ModuleIPAddr1-1-2>0.0.0.0</ModuleIPAddr1-1-2>
|
||||||
<ModuleHostName1-1-2>unassigned</ModuleHostName1-1-2>
|
<ModuleHostName1-1-2>unassigned</ModuleHostName1-1-2>
|
||||||
@ -517,6 +514,9 @@
|
|||||||
<Port>3306</Port>
|
<Port>3306</Port>
|
||||||
<User>root</User>
|
<User>root</User>
|
||||||
<Password></Password>
|
<Password></Password>
|
||||||
|
<TLSCA></TLSCA>
|
||||||
|
<TLSClientCert></TLSClientCert>
|
||||||
|
<TLSClientKey></TLSClientKey>
|
||||||
</CrossEngineSupport>
|
</CrossEngineSupport>
|
||||||
<QueryStats>
|
<QueryStats>
|
||||||
<Enabled>N</Enabled>
|
<Enabled>N</Enabled>
|
||||||
|
@ -532,9 +532,6 @@ void Oam::getSystemConfig(const std::string& module, ModuleConfig& moduleconfig)
|
|||||||
const string MODULE_DISABLE_STATE = "ModuleDisableState";
|
const string MODULE_DISABLE_STATE = "ModuleDisableState";
|
||||||
const string MODULE_DBROOT_COUNT = "ModuleDBRootCount";
|
const string MODULE_DBROOT_COUNT = "ModuleDBRootCount";
|
||||||
const string MODULE_DBROOT_ID = "ModuleDBRootID";
|
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);
|
string moduletype = module.substr(0, MAX_MODULE_TYPE_SIZE);
|
||||||
int moduleID = atoi(module.substr(MAX_MODULE_TYPE_SIZE, MAX_MODULE_ID_SIZE).c_str());
|
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() );
|
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;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -833,9 +833,6 @@ struct ModuleConfig_s
|
|||||||
std::string ModuleType; //!< Module Type
|
std::string ModuleType; //!< Module Type
|
||||||
std::string ModuleDesc; //!< Module Description
|
std::string ModuleDesc; //!< Module Description
|
||||||
std::string DisableState; //!< Disabled State
|
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
|
HostConfigList hostConfigList; //!< IP Address and Hostname List
|
||||||
DBRootConfigList dbrootConfigList; //!< DBRoot ID list
|
DBRootConfigList dbrootConfigList; //!< DBRoot ID list
|
||||||
};
|
};
|
||||||
|
@ -22,10 +22,9 @@
|
|||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
#include "idberrorinfo.h"
|
#include "errorids.h"
|
||||||
using namespace logging;
|
#include "exceptclasses.h"
|
||||||
|
#include "configcpp.h"
|
||||||
#include "liboamcpp.h"
|
|
||||||
|
|
||||||
#include "libmysql_client.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);
|
fCon = mysql_init(NULL);
|
||||||
|
|
||||||
oam::Oam oam;
|
config::Config* cf = config::Config::makeConfig();
|
||||||
oam::oamModuleInfo_t moduleInfo;
|
const string TLSCA = cf->getConfig("CrossEngineSupport", "TLSCA");
|
||||||
moduleInfo = oam.getModuleInfo();
|
const string TLSClientCert = cf->getConfig("CrossEngineSupport", "TLSClientCert");
|
||||||
string moduleName = boost::get<0>(moduleInfo);
|
const string TLSClientKey = cf->getConfig("CrossEngineSupport", "TLSClientKey");
|
||||||
int serverTypeInstall = boost::get<5>(moduleInfo);
|
|
||||||
|
|
||||||
// This is single server installation so use um1 instead of pm1.
|
if (!(TLSCA.empty() || TLSClientCert.empty() || TLSClientKey.empty()))
|
||||||
if ( serverTypeInstall == 2 )
|
|
||||||
moduleName.assign("um1");
|
|
||||||
|
|
||||||
oam::ModuleConfig moduleconfig;
|
|
||||||
oam.getSystemConfig(moduleName, moduleconfig);
|
|
||||||
|
|
||||||
if (!(moduleconfig.TLSCA.empty() || moduleconfig.TLSClientCert.empty() || moduleconfig.TLSClientKey.empty()))
|
|
||||||
{
|
{
|
||||||
mysql_ssl_set(fCon, moduleconfig.TLSClientKey.c_str(), moduleconfig.TLSClientCert.c_str(),
|
mysql_ssl_set(fCon, TLSClientKey.c_str(), TLSClientCert.c_str(),
|
||||||
moduleconfig.TLSCA.c_str(), NULL, NULL);
|
TLSCA.c_str(), NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fCon != NULL)
|
if (fCon != NULL)
|
||||||
@ -136,7 +127,7 @@ void LibMySQL::handleMySqlError(const char* errStr, unsigned int errCode)
|
|||||||
else
|
else
|
||||||
oss << "(" << errCode << ")";
|
oss << "(" << errCode << ")";
|
||||||
|
|
||||||
throw IDBExcept(oss.str(), ERR_CROSS_ENGINE_CONNECT);
|
throw logging::IDBExcept(oss.str(), logging::ERR_CROSS_ENGINE_CONNECT);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user