Restore CentOS support

Reviewers: teon.banek

Reviewed By: teon.banek

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1777
This commit is contained in:
Matej Ferencevic 2018-12-17 13:50:36 +01:00
parent cc3192cef7
commit a4cce253c0
3 changed files with 23 additions and 4 deletions
CMakeLists.txt
release/rpm
src/communication

View File

@ -342,7 +342,7 @@ set(CPACK_RPM_PACKAGE_DESCRIPTION "Contains Memgraph, the graph database.
It aims to deliver developers the speed, simplicity and scale required to build
the next generation of applications driver by real-time connected data.")
# Add `openssl` package to dependencies list. Used to generate SSL certificates.
set(CPACK_RPM_PACKAGE_REQUIRES "openssl >= 1.0.0")
set(CPACK_RPM_PACKAGE_REQUIRES "openssl >= 1.0.0, curl >= 7.29.0")
# All variables must be set before including.
include(CPack)

View File

@ -69,8 +69,17 @@ chown memgraph:memgraph /var/lib/memgraph || exit 1
chmod 750 /var/lib/memgraph || exit 1
chown memgraph:adm /var/log/memgraph || exit 1
chmod 750 /var/log/memgraph || exit 1
# Make examples directory immutable (optional)
chattr +i -R /usr/share/memgraph/examples || true
# Create telemetry directory in examples
for i in /usr/share/memgraph/examples/*; do
# The telemetry directory may already exist from some prior installation
if [ ! -d $i/telemetry ]; then
mkdir $i/telemetry || exit 1
fi
chown -R memgraph:memgraph $i/telemetry || exit 1
# Make snapshots directory immutable (optional)
chattr +i -R $i/snapshots || true
done
# Generate SSL certificates
if [ ! -d /etc/memgraph/ssl ]; then

View File

@ -6,7 +6,11 @@ namespace communication {
ClientContext::ClientContext(bool use_ssl) : use_ssl_(use_ssl), ctx_(nullptr) {
if (use_ssl_) {
#if OPENSSL_VERSION_NUMBER < 0x10100000L
ctx_ = SSL_CTX_new(SSLv23_client_method());
#else
ctx_ = SSL_CTX_new(TLS_client_method());
#endif
CHECK(ctx_ != nullptr) << "Couldn't create client SSL_CTX object!";
// Disable legacy SSL support. Other options can be seen here:
@ -37,7 +41,13 @@ ServerContext::ServerContext() : use_ssl_(false), ctx_(nullptr) {}
ServerContext::ServerContext(const std::string &key_file,
const std::string &cert_file,
const std::string &ca_file, bool verify_peer)
: use_ssl_(true), ctx_(SSL_CTX_new(TLS_server_method())) {
: use_ssl_(true),
#if OPENSSL_VERSION_NUMBER < 0x10100000L
ctx_(SSL_CTX_new(SSLv23_server_method()))
#else
ctx_(SSL_CTX_new(TLS_server_method()))
#endif
{
// TODO (mferencevic): add support for encrypted private keys
// TODO (mferencevic): add certificate revocation list (CRL)
CHECK(SSL_CTX_use_certificate_file(ctx_, cert_file.c_str(),