Changeset - 57b59b8220e5
[Not reviewed]
0 3 0
HanzZ - 14 years ago 2011-06-16 22:26:12
hanzz.k@gmail.com
Added a way to set PKCS#12 server certificate to allow TLS
3 files changed with 8 insertions and 2 deletions:
0 comments (0 inline, 0 general)
spectrum/src/sample.cfg
Show inline comments
 
@@ -6,6 +6,8 @@ port = 5222
 
server_mode = 1
 
backend_host=localhost # < this option doesn't work yet
 
backend_port=10001
 
#cert= #patch to PKCS#12 certificate
 
#cert_password= #password to that certificate if any
 
users_per_backend=2
 
backend=../../backends/libpurple/libpurple_backend
 
#backend=../../backends/libircclient-qt/libircclient-qt_backend
src/config.cpp
Show inline comments
 
@@ -42,6 +42,8 @@ bool Config::load(const std::string &configfile, boost::program_options::options
 
		("service.users_per_backend", value<int>()->default_value(100), "Number of users per one legacy network backend")
 
		("service.backend_host", value<std::string>()->default_value("localhost"), "Host to bind backend server to")
 
		("service.backend_port", value<std::string>()->default_value("10000"), "Port to bind backend server to")
 
		("service.cert", value<std::string>()->default_value(""), "PKCS#12 Certificate.")
 
		("service.cert_password", value<std::string>()->default_value(""), "PKCS#12 Certificate password.")
 
		("registration.enable_public_registration", value<bool>()->default_value(true), "True if users should be able to register.")
 
		("registration.language", value<std::string>()->default_value("en"), "Default language for registration form")
 
		("registration.instructions", value<std::string>()->default_value(""), "Instructions showed to user in registration form")
src/transport.cpp
Show inline comments
 
@@ -71,8 +71,10 @@ Component::Component(Swift::EventLoop *loop, Config *config, Factory *factory) {
 
	if (CONFIG_BOOL(m_config, "service.server_mode")) {
 
		m_userRegistry = new MyUserRegistry(this);
 
		m_server = new Swift::Server(loop, m_factories, m_userRegistry, m_jid, CONFIG_INT(m_config, "service.port"));
 
		TLSServerContextFactory *f = new OpenSSLServerContextFactory();
 
// 		m_server->addTLSEncryption(f, PKCS12Certificate("localhost.p12", createSafeByteArray("")));
 
		if (!CONFIG_STRING(m_config, "service.cert").empty()) {
 
			TLSServerContextFactory *f = new OpenSSLServerContextFactory();
 
			m_server->addTLSEncryption(f, PKCS12Certificate(CONFIG_STRING(m_config, "service.cert"), createSafeByteArray(CONFIG_STRING(m_config, "service.cert_password"))));
 
		}
 
		m_server->start();
 
		m_stanzaChannel = m_server->getStanzaChannel();
 
		m_iqRouter = m_server->getIQRouter();
0 comments (0 inline, 0 general)