Currently RGW can authenticate with vault via SSL using system certs.
With this patch user can provide custom ca cert and location of the file
can be specified in ceph.conf like this :
rgw_crypt_require_ssl = <file path>
Fixes: https://tracker.ceph.com/issues/47776
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
(cherry picked from commit
424dca0f3866c62e5c51cc8b2a080d680fddbe7f)
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
Conflicts:
src/common/options/rgw.yaml.in
- added required changes in options.cc and legacy_config_opts.h
OPTION(rgw_crypt_vault_secret_engine, OPT_STR) // kv, transit or other supported secret engines
OPTION(rgw_crypt_vault_namespace, OPT_STR) // Vault Namespace (only availabe in Vault Enterprise Version)
OPTION(rgw_crypt_vault_verify_ssl, OPT_BOOL) // should we try to verify vault's ssl
+OPTION(rgw_crypt_vault_ssl_cacert, OPT_STR) // optional ca certificate for accessing vault
OPTION(rgw_crypt_kmip_addr, OPT_STR) // kmip server address
OPTION(rgw_crypt_kmip_ca_path, OPT_STR) // ca for kmip servers
.set_default(true)
.set_description("Should RGW verify the vault server SSL certificate."),
+ Option("rgw_crypt_vault_ssl_cacert", Option::TYPE_STR, Option::LEVEL_ADVANCED)
+ .set_default("")
+ .set_description("Path for custom ca certificate for accessing vault server"),
+
Option("rgw_crypt_kmip_addr", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_default("")
.set_description("kmip server address"),
curl_easy_setopt(easy_handle, CURLOPT_SSL_VERIFYPEER, 0L);
curl_easy_setopt(easy_handle, CURLOPT_SSL_VERIFYHOST, 0L);
dout(20) << "ssl verification is set to off" << dendl;
+ } else if (!ca_path.empty()) {
+ curl_easy_setopt(easy_handle, CURLOPT_CAINFO, ca_path.c_str());
+ dout(20) << "using custom ca cert "<< ca_path.c_str() << " for ssl" << dendl;
}
curl_easy_setopt(easy_handle, CURLOPT_PRIVATE, (void *)req_data);
curl_easy_setopt(easy_handle, CURLOPT_TIMEOUT, req_timeout);
bool verify_ssl; // Do not validate self signed certificates, default to false
+ string ca_path;
+
std::atomic<unsigned> stopped { 0 };
void *get_io_user_info() override {
return user_info;
}
+
+ void set_ca_path(const string& _ca_path) {
+ ca_path = _ca_path;
+ }
};
secret_req.set_verify_ssl(cct->_conf->rgw_crypt_vault_verify_ssl);
+ if (!cct->_conf->rgw_crypt_vault_ssl_cacert.empty()) {
+ secret_req.set_ca_path(cct->_conf->rgw_crypt_vault_ssl_cacert);
+ }
+
res = secret_req.process(null_yield);
if (res < 0) {
ldout(cct, 0) << "ERROR: Request to Vault failed with error " << res << dendl;