WIP. Add config parameters for Remote service
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
I) DEPENCIES
|
I) DEPENCIES
|
||||||
|
|
||||||
libboost-dev libextractor-dev libavcodec-dev libwt-dev
|
libboost-dev libextractor-dev libavcodec-dev libwt-dev libprotobuf-dev libconfig++-dev
|
||||||
|
|
||||||
Warning: your distrib may provide an outdated wt library. Using the latest Wt (>= 3.3.3) is highly recommended (http://www.webtoolkit.eu/wt)
|
Warning: your distrib may provide an outdated wt library. Using the latest Wt (>= 3.3.3) is highly recommended (http://www.webtoolkit.eu/wt)
|
||||||
|
|
||||||
@@ -32,7 +32,9 @@ Generate a self signed certificate:
|
|||||||
IV) RUNNING
|
IV) RUNNING
|
||||||
|
|
||||||
In the build directory:
|
In the build directory:
|
||||||
# ./lms --docroot=../ui --approot=../ui/approot --https-port=5081 --https-address=0.0.0.0 --ssl-certificate=./certUI.pem --ssl-private-key ./privkeyUI.pem --ssl-tmp-dh dh2048.pem
|
# ./lms lms.conf
|
||||||
|
|
||||||
|
Create the lms.conf file using the etc/lms.sample.conf
|
||||||
|
|
||||||
Depending of your SSL parameters, you may be asked for the PEM passphrase to unlock the private key.
|
Depending of your SSL parameters, you may be asked for the PEM passphrase to unlock the private key.
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
- Use our own WIOService
|
- Use our own WIOService
|
||||||
|
|
||||||
[Services]
|
[Services]
|
||||||
- [UI] generate argc/argv from a config file (crypto, port info, db path)
|
|
||||||
- [Remote] use config file to get crypto, port info, db path
|
|
||||||
- consider using external web server instead of builtin httpd (new FCGI service?)
|
- consider using external web server instead of builtin httpd (new FCGI service?)
|
||||||
|
|
||||||
[Users]
|
[Users]
|
||||||
|
|||||||
@@ -33,6 +33,9 @@ ConfigReader::getRemoteServerConfig(Service::RemoteServerService::Config& config
|
|||||||
|
|
||||||
config.port = static_cast<unsigned int>(_config.lookup("remote.listen-endpoint.port"));
|
config.port = static_cast<unsigned int>(_config.lookup("remote.listen-endpoint.port"));
|
||||||
config.address = boost::asio::ip::address::from_string((const char*)_config.lookup("remote.listen-endpoint.addr"));
|
config.address = boost::asio::ip::address::from_string((const char*)_config.lookup("remote.listen-endpoint.addr"));
|
||||||
|
config.sslCertificatePath = _config.lookup("remote.ssl-crypto.cert");
|
||||||
|
config.sslPrivateKeyPath = _config.lookup("remote.ssl-crypto.key");
|
||||||
|
config.sslTempDhPath = _config.lookup("remote.ssl-crypto.dh");
|
||||||
|
|
||||||
config.dbPath = _config.lookup("main.db");
|
config.dbPath = _config.lookup("main.db");
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -36,9 +36,9 @@ remote = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ssl-crypto = {
|
ssl-crypto = {
|
||||||
cert = "";
|
cert = "/var/lms/certs/certRemote.pem";
|
||||||
key = "";
|
key = "/var/lms/private/privkeyRemote.pem";
|
||||||
dh = "";
|
dh = "/var/lms/dh/dh2048.pem";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,14 +9,18 @@
|
|||||||
namespace Remote {
|
namespace Remote {
|
||||||
namespace Server {
|
namespace Server {
|
||||||
|
|
||||||
Server::Server(const endpoint_type& bindEndpoint, boost::filesystem::path dbPath)
|
Server::Server(const endpoint_type& bindEndpoint,
|
||||||
|
boost::filesystem::path certPath,
|
||||||
|
boost::filesystem::path privKeyPath,
|
||||||
|
boost::filesystem::path dhPath,
|
||||||
|
boost::filesystem::path dbPath)
|
||||||
:
|
:
|
||||||
_acceptor(_ioService, bindEndpoint, true /*SO_REUSEADDR*/),
|
_acceptor(_ioService, bindEndpoint, true /*SO_REUSEADDR*/),
|
||||||
_connectionManager(),
|
_connectionManager(),
|
||||||
_context(boost::asio::ssl::context::tlsv1_server),
|
_context(boost::asio::ssl::context::tlsv1_server),
|
||||||
_dbPath(dbPath)
|
_dbPath(dbPath)
|
||||||
{
|
{
|
||||||
_ioService.setThreadCount(1);
|
_ioService.setThreadCount(1); // TODO parametrize
|
||||||
|
|
||||||
_context.set_options( boost::asio::ssl::context::default_workarounds // TODO check this thing
|
_context.set_options( boost::asio::ssl::context::default_workarounds // TODO check this thing
|
||||||
| boost::asio::ssl::context::single_dh_use
|
| boost::asio::ssl::context::single_dh_use
|
||||||
@@ -24,9 +28,9 @@ _dbPath(dbPath)
|
|||||||
| boost::asio::ssl::context::no_sslv3
|
| boost::asio::ssl::context::no_sslv3
|
||||||
);
|
);
|
||||||
// context_.set_password_callback(boost::bind(&server::get_password, this));
|
// context_.set_password_callback(boost::bind(&server::get_password, this));
|
||||||
_context.use_certificate_chain_file("cert.pem"); // TODO parametrize
|
_context.use_certificate_chain_file(certPath.string());
|
||||||
_context.use_private_key_file("privkey.pem", boost::asio::ssl::context::pem); // TODO parametrize
|
_context.use_private_key_file(privKeyPath.string(), boost::asio::ssl::context::pem);
|
||||||
_context.use_tmp_dh_file("dh2048.pem"); // TODO parametrize
|
_context.use_tmp_dh_file(dhPath.string());
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -26,7 +26,11 @@ class Server
|
|||||||
typedef boost::asio::ip::tcp::endpoint endpoint_type;
|
typedef boost::asio::ip::tcp::endpoint endpoint_type;
|
||||||
|
|
||||||
// Serve up data from the given database
|
// Serve up data from the given database
|
||||||
Server(const endpoint_type& bindEndpoint, boost::filesystem::path dbPath);
|
Server(const endpoint_type& bindEndpoint,
|
||||||
|
boost::filesystem::path certPath,
|
||||||
|
boost::filesystem::path privKeyPath,
|
||||||
|
boost::filesystem::path dhPath,
|
||||||
|
boost::filesystem::path dbPath);
|
||||||
|
|
||||||
// Run the server's io_service loop.
|
// Run the server's io_service loop.
|
||||||
void start();
|
void start();
|
||||||
|
|||||||
@@ -4,7 +4,11 @@
|
|||||||
namespace Service {
|
namespace Service {
|
||||||
|
|
||||||
RemoteServerService::RemoteServerService(const Config& config)
|
RemoteServerService::RemoteServerService(const Config& config)
|
||||||
: _server(boost::asio::ip::tcp::endpoint(config.address, config.port), config.dbPath)
|
: _server(boost::asio::ip::tcp::endpoint(config.address, config.port),
|
||||||
|
config.sslCertificatePath,
|
||||||
|
config.sslPrivateKeyPath,
|
||||||
|
config.sslTempDhPath,
|
||||||
|
config.dbPath)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,9 @@ class RemoteServerService : public Service
|
|||||||
bool enable;
|
bool enable;
|
||||||
boost::asio::ip::address address;
|
boost::asio::ip::address address;
|
||||||
unsigned short port;
|
unsigned short port;
|
||||||
|
boost::filesystem::path sslCertificatePath;
|
||||||
|
boost::filesystem::path sslPrivateKeyPath;
|
||||||
|
boost::filesystem::path sslTempDhPath;
|
||||||
boost::filesystem::path dbPath;
|
boost::filesystem::path dbPath;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user