|
|
e3c68b |
From 2b859d1a5499a215c8c37472d4fc7d7e4d70dac6 Mon Sep 17 00:00:00 2001
|
|
|
e3c68b |
From: Mohit Agrawal <moagrawal@redhat.com>
|
|
|
e3c68b |
Date: Tue, 31 Mar 2020 16:45:35 +0530
|
|
|
e3c68b |
Subject: [PATCH 360/362] rpc: Make ssl log more useful
|
|
|
e3c68b |
|
|
|
e3c68b |
Currently, ssl_setup_connection_params throws 4 messages for every
|
|
|
e3c68b |
rpc connection that irritates a user while reading the logs. The same
|
|
|
e3c68b |
info we can print in a single log with peerinfo to make it more
|
|
|
e3c68b |
useful.ssl_setup_connection_params try to load dh_param even user
|
|
|
e3c68b |
has not configured it and if a dh_param file is not available it throws
|
|
|
e3c68b |
a failure message.To avoid the message load dh_param only while the user
|
|
|
e3c68b |
has configured it.
|
|
|
e3c68b |
|
|
|
e3c68b |
> Change-Id: I9ddb57f86a3fa3e519180cb5d88828e59fe0e487
|
|
|
e3c68b |
> Fixes: #1141
|
|
|
e3c68b |
> Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>
|
|
|
e3c68b |
> Cherry pick from commit 80dd8cceab3b860bf1bc2945c8e2d8d0b3913e48
|
|
|
e3c68b |
> Reviewed on upstream link https://review.gluster.org/#/c/glusterfs/+/24270/
|
|
|
e3c68b |
|
|
|
e3c68b |
BUG: 1812824
|
|
|
e3c68b |
Change-Id: I9ddb57f86a3fa3e519180cb5d88828e59fe0e487
|
|
|
e3c68b |
Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
|
|
|
e3c68b |
Reviewed-on: https://code.engineering.redhat.com/gerrit/196371
|
|
|
e3c68b |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
e3c68b |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
e3c68b |
---
|
|
|
e3c68b |
rpc/rpc-transport/socket/src/socket.c | 46 ++++++++++++++++++++---------------
|
|
|
e3c68b |
1 file changed, 26 insertions(+), 20 deletions(-)
|
|
|
e3c68b |
|
|
|
e3c68b |
diff --git a/rpc/rpc-transport/socket/src/socket.c b/rpc/rpc-transport/socket/src/socket.c
|
|
|
e3c68b |
index f54ca83..65845ea 100644
|
|
|
e3c68b |
--- a/rpc/rpc-transport/socket/src/socket.c
|
|
|
e3c68b |
+++ b/rpc/rpc-transport/socket/src/socket.c
|
|
|
e3c68b |
@@ -4240,6 +4240,7 @@ ssl_setup_connection_params(rpc_transport_t *this)
|
|
|
e3c68b |
char *cipher_list = DEFAULT_CIPHER_LIST;
|
|
|
e3c68b |
char *dh_param = DEFAULT_DH_PARAM;
|
|
|
e3c68b |
char *ec_curve = DEFAULT_EC_CURVE;
|
|
|
e3c68b |
+ gf_boolean_t dh_flag = _gf_false;
|
|
|
e3c68b |
|
|
|
e3c68b |
priv = this->private;
|
|
|
e3c68b |
|
|
|
e3c68b |
@@ -4248,6 +4249,10 @@ ssl_setup_connection_params(rpc_transport_t *this)
|
|
|
e3c68b |
return 0;
|
|
|
e3c68b |
}
|
|
|
e3c68b |
|
|
|
e3c68b |
+ if (!priv->ssl_enabled && !priv->mgmt_ssl) {
|
|
|
e3c68b |
+ return 0;
|
|
|
e3c68b |
+ }
|
|
|
e3c68b |
+
|
|
|
e3c68b |
priv->ssl_own_cert = DEFAULT_CERT_PATH;
|
|
|
e3c68b |
if (dict_get_str(this->options, SSL_OWN_CERT_OPT, &optstr) == 0) {
|
|
|
e3c68b |
if (!priv->ssl_enabled) {
|
|
|
e3c68b |
@@ -4294,27 +4299,25 @@ ssl_setup_connection_params(rpc_transport_t *this)
|
|
|
e3c68b |
priv->crl_path = gf_strdup(optstr);
|
|
|
e3c68b |
}
|
|
|
e3c68b |
|
|
|
e3c68b |
- gf_log(this->name, priv->ssl_enabled ? GF_LOG_INFO : GF_LOG_DEBUG,
|
|
|
e3c68b |
- "SSL support on the I/O path is %s",
|
|
|
e3c68b |
- priv->ssl_enabled ? "ENABLED" : "NOT enabled");
|
|
|
e3c68b |
- gf_log(this->name, priv->mgmt_ssl ? GF_LOG_INFO : GF_LOG_DEBUG,
|
|
|
e3c68b |
- "SSL support for glusterd is %s",
|
|
|
e3c68b |
- priv->mgmt_ssl ? "ENABLED" : "NOT enabled");
|
|
|
e3c68b |
-
|
|
|
e3c68b |
if (!priv->mgmt_ssl) {
|
|
|
e3c68b |
- if (!dict_get_int32(this->options, SSL_CERT_DEPTH_OPT, &cert_depth)) {
|
|
|
e3c68b |
- gf_log(this->name, GF_LOG_INFO, "using certificate depth %d",
|
|
|
e3c68b |
- cert_depth);
|
|
|
e3c68b |
+ if (!dict_get_int32_sizen(this->options, SSL_CERT_DEPTH_OPT,
|
|
|
e3c68b |
+ &cert_depth)) {
|
|
|
e3c68b |
}
|
|
|
e3c68b |
} else {
|
|
|
e3c68b |
cert_depth = this->ctx->ssl_cert_depth;
|
|
|
e3c68b |
- gf_log(this->name, GF_LOG_INFO, "using certificate depth %d",
|
|
|
e3c68b |
- cert_depth);
|
|
|
e3c68b |
}
|
|
|
e3c68b |
- if (!dict_get_str(this->options, SSL_CIPHER_LIST_OPT, &cipher_list)) {
|
|
|
e3c68b |
+ gf_log(this->name, priv->ssl_enabled ? GF_LOG_INFO : GF_LOG_DEBUG,
|
|
|
e3c68b |
+ "SSL support for MGMT is %s IO path is %s certificate depth is %d "
|
|
|
e3c68b |
+ "for peer %s",
|
|
|
e3c68b |
+ (priv->mgmt_ssl ? "ENABLED" : "NOT enabled"),
|
|
|
e3c68b |
+ (priv->ssl_enabled ? "ENABLED" : "NOT enabled"), cert_depth,
|
|
|
e3c68b |
+ this->peerinfo.identifier);
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+ if (!dict_get_str_sizen(this->options, SSL_CIPHER_LIST_OPT, &cipher_list)) {
|
|
|
e3c68b |
gf_log(this->name, GF_LOG_INFO, "using cipher list %s", cipher_list);
|
|
|
e3c68b |
}
|
|
|
e3c68b |
- if (!dict_get_str(this->options, SSL_DH_PARAM_OPT, &dh_param)) {
|
|
|
e3c68b |
+ if (!dict_get_str_sizen(this->options, SSL_DH_PARAM_OPT, &dh_param)) {
|
|
|
e3c68b |
+ dh_flag = _gf_true;
|
|
|
e3c68b |
gf_log(this->name, GF_LOG_INFO, "using DH parameters %s", dh_param);
|
|
|
e3c68b |
}
|
|
|
e3c68b |
if (!dict_get_str(this->options, SSL_EC_CURVE_OPT, &ec_curve)) {
|
|
|
e3c68b |
@@ -4349,12 +4352,15 @@ ssl_setup_connection_params(rpc_transport_t *this)
|
|
|
e3c68b |
#ifdef SSL_OP_NO_COMPRESSION
|
|
|
e3c68b |
SSL_CTX_set_options(priv->ssl_ctx, SSL_OP_NO_COMPRESSION);
|
|
|
e3c68b |
#endif
|
|
|
e3c68b |
-
|
|
|
e3c68b |
- if ((bio = BIO_new_file(dh_param, "r")) == NULL) {
|
|
|
e3c68b |
- gf_log(this->name, GF_LOG_INFO,
|
|
|
e3c68b |
- "failed to open %s, "
|
|
|
e3c68b |
- "DH ciphers are disabled",
|
|
|
e3c68b |
- dh_param);
|
|
|
e3c68b |
+ /* Upload file to bio wrapper only if dh param is configured
|
|
|
e3c68b |
+ */
|
|
|
e3c68b |
+ if (dh_flag) {
|
|
|
e3c68b |
+ if ((bio = BIO_new_file(dh_param, "r")) == NULL) {
|
|
|
e3c68b |
+ gf_log(this->name, GF_LOG_ERROR,
|
|
|
e3c68b |
+ "failed to open %s, "
|
|
|
e3c68b |
+ "DH ciphers are disabled",
|
|
|
e3c68b |
+ dh_param);
|
|
|
e3c68b |
+ }
|
|
|
e3c68b |
}
|
|
|
e3c68b |
|
|
|
e3c68b |
if (bio != NULL) {
|
|
|
e3c68b |
--
|
|
|
e3c68b |
1.8.3.1
|
|
|
e3c68b |
|