From: Yehuda Sadeh Date: Thu, 20 Feb 2020 19:33:33 +0000 (-0800) Subject: rgw: ssl: don't try to init certificate if not needed X-Git-Tag: v15.1.1~123^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c48f944a2ef025d6cecc2da231db7d161f2d7db0;p=ceph.git rgw: ssl: don't try to init certificate if not needed Signed-off-by: Yehuda Sadeh --- diff --git a/src/rgw/rgw_asio_frontend.cc b/src/rgw/rgw_asio_frontend.cc index 6855a18c403b..4fca9aece663 100644 --- a/src/rgw/rgw_asio_frontend.cc +++ b/src/rgw/rgw_asio_frontend.cc @@ -690,6 +690,17 @@ int AsioFrontend::init_ssl() return -EINVAL; } + auto ports = config.equal_range("ssl_port"); + auto endpoints = config.equal_range("ssl_endpoint"); + + /* + * don't try to config certificate if frontend isn't configured for ssl + */ + if (ports.first == ports.second && + endpoints.first == endpoints.second) { + return 0; + } + bool key_is_cert = false; if (cert) { @@ -719,7 +730,6 @@ int AsioFrontend::init_ssl() } // parse ssl endpoints - auto ports = config.equal_range("ssl_port"); for (auto i = ports.first; i != ports.second; ++i) { if (!have_cert) { lderr(ctx()) << "no ssl_certificate configured for ssl_port" << dendl; @@ -739,7 +749,6 @@ int AsioFrontend::init_ssl() listeners.back().use_ssl = true; } - auto endpoints = config.equal_range("ssl_endpoint"); for (auto i = endpoints.first; i != endpoints.second; ++i) { if (!have_cert) { lderr(ctx()) << "no ssl_certificate configured for ssl_endpoint" << dendl;