-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support TLS transport encryption (#2584)
* Add the ssl support. * Add tests to tck. * Support CA signed certificate. * Remove the pssword configuration. * Remove the comment. * Support independent meta server ssl. * Initialize the ssl when enable meta ssl. * Fix typo. * Fix the header order. * clear logic. * Add test for ca signed mode. * Fix flag note.
- Loading branch information
1 parent
3941945
commit 6fa47a4
Showing
44 changed files
with
346 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Copyright (c) 2021 vesoft inc. All rights reserved. | ||
# | ||
# This source code is licensed under Apache 2.0 License, | ||
# attached with Common Clause Condition 1.0, found in the LICENSES directory. | ||
|
||
nebula_add_library( | ||
ssl_obj | ||
OBJECT | ||
SSLConfig.cpp | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* Copyright (c) 2021 vesoft inc. All rights reserved. | ||
* | ||
* This source code is licensed under Apache 2.0 License, | ||
* attached with Common Clause Condition 1.0, found in the LICENSES directory. | ||
*/ | ||
|
||
#include "common/ssl/SSLConfig.h" | ||
|
||
DEFINE_string(cert_path, "", "Path to cert pem."); | ||
DEFINE_string(key_path, "", "Path to cert key."); | ||
DEFINE_string(ca_path, "", "Path to trusted CA file."); | ||
DEFINE_bool(enable_ssl, false, "Whether to enable ssl."); | ||
DEFINE_bool(enable_graph_ssl, false, "Whether to enable ssl of graph server."); | ||
DEFINE_bool(enable_meta_ssl, false, "Whether to enable ssl of meta server."); | ||
|
||
namespace nebula { | ||
|
||
std::shared_ptr<wangle::SSLContextConfig> sslContextConfig() { | ||
auto sslCfg = std::make_shared<wangle::SSLContextConfig>(); | ||
sslCfg->addCertificate(FLAGS_cert_path, FLAGS_key_path, ""); | ||
sslCfg->isDefault = true; | ||
return sslCfg; | ||
} | ||
|
||
std::shared_ptr<folly::SSLContext> createSSLContext() { | ||
auto context = std::make_shared<folly::SSLContext>(); | ||
if (!FLAGS_ca_path.empty()) { | ||
context->loadTrustedCertificates(FLAGS_ca_path.c_str()); | ||
// don't do peer name validation | ||
context->authenticate(true, false); | ||
// verify the server cert | ||
context->setVerificationOption(folly::SSLContext::SSLVerifyPeerEnum::VERIFY); | ||
} | ||
folly::ssl::setSignatureAlgorithms<folly::ssl::SSLCommonOptions>(*context); | ||
return context; | ||
} | ||
|
||
} // namespace nebula |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
|
||
/* Copyright (c) 2021 vesoft inc. All rights reserved. | ||
* | ||
* This source code is licensed under Apache 2.0 License, | ||
* attached with Common Clause Condition 1.0, found in the LICENSES directory. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <folly/io/async/SSLContext.h> | ||
#include <gflags/gflags.h> | ||
#include <wangle/ssl/SSLContextConfig.h> | ||
|
||
#include <memory> | ||
|
||
DECLARE_bool(enable_ssl); | ||
DECLARE_bool(enable_graph_ssl); | ||
DECLARE_bool(enable_meta_ssl); | ||
|
||
namespace nebula { | ||
|
||
extern std::shared_ptr<wangle::SSLContextConfig> sslContextConfig(); | ||
|
||
extern std::shared_ptr<folly::SSLContext> createSSLContext(); | ||
|
||
} // namespace nebula |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.