Simply use the RADOS handle directly.
Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
sysobj_cache.get(),
bucket_sobj.get());
cls->init(zone.get(), radoshandle);
- config_key_rados->init(rados.get());
+ config_key_rados->init(radoshandle);
mdlog->init(rados.get(), zone.get(), sysobj.get(), cls.get());
meta->init(sysobj.get(), mdlog.get(), meta_bes);
meta_be_sobj->init(sysobj.get(), mdlog.get());
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab ft=cpp
+#include "auth/AuthRegistry.h"
+
#include "common/errno.h"
#include "librados/librados_asio.h"
librados::CB_AioCompleteAndSafe cb(pc);
cb(r);
}
+
+bool rgw_check_secure_mon_conn(const DoutPrefixProvider *dpp)
+{
+ AuthRegistry reg(dpp->get_cct());
+
+ reg.refresh_config();
+
+ std::vector<uint32_t> methods;
+ std::vector<uint32_t> modes;
+
+ reg.get_supported_methods(CEPH_ENTITY_TYPE_MON, &methods, &modes);
+ ldpp_dout(dpp, 20) << __func__ << "(): auth registy supported: methods=" << methods << " modes=" << modes << dendl;
+
+ for (auto method : methods) {
+ if (!reg.is_secure_method(method)) {
+ ldpp_dout(dpp, 20) << __func__ << "(): method " << method << " is insecure" << dendl;
+ return false;
+ }
+ }
+
+ for (auto mode : modes) {
+ if (!reg.is_secure_mode(mode)) {
+ ldpp_dout(dpp, 20) << __func__ << "(): mode " << mode << " is insecure" << dendl;
+ return false;
+ }
+ }
+
+ return true;
+}
+
+int rgw_clog_warn(librados::Rados* h, const string& msg)
+{
+ string cmd =
+ "{"
+ "\"prefix\": \"log\", "
+ "\"level\": \"warn\", "
+ "\"logtext\": [\"" + msg + "\"]"
+ "}";
+
+ bufferlist inbl;
+ return h->mon_command(cmd, inbl, nullptr, nullptr);
+}
// (Currently providing nullptr will wipe all attributes.)
std::map<std::string, ceph::buffer::list>* no_change_attrs();
+
+bool rgw_check_secure_mon_conn(const DoutPrefixProvider *dpp);
+int rgw_clog_warn(librados::Rados* h, const std::string& msg);
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab ft=cpp
-#include "svc_rados.h"
#include "svc_config_key_rados.h"
-using namespace std;
+#include "rgw_tools.h"
+
+using std::string;
RGWSI_ConfigKey_RADOS::~RGWSI_ConfigKey_RADOS(){}
int RGWSI_ConfigKey_RADOS::do_start(optional_yield, const DoutPrefixProvider *dpp)
{
- maybe_insecure_mon_conn = !svc.rados->check_secure_mon_conn(dpp);
+ maybe_insecure_mon_conn = !rgw_check_secure_mon_conn(dpp);
return 0;
}
return;
}
- string s = "rgw is configured to optionally allow insecure connections to the monitors (auth_supported, ms_mon_client_mode), ssl certificates stored at the monitor configuration could leak";
+ string s = ("rgw is configured to optionally allow insecure connections to "
+ "the monitors (auth_supported, ms_mon_client_mode), ssl "
+ "certificates stored at the monitor configuration could leak");
- svc.rados->clog_warn(s);
+ rgw_clog_warn(rados, s);
lderr(ctx()) << __func__ << "(): WARNING: " << s << dendl;
}
-int RGWSI_ConfigKey_RADOS::get(const string& key, bool secure, bufferlist *result)
+int RGWSI_ConfigKey_RADOS::get(const string& key, bool secure,
+ bufferlist *result)
{
string cmd =
"{"
"}";
bufferlist inbl;
- auto handle = svc.rados->handle();
- int ret = handle.mon_command(cmd, inbl, result, nullptr);
+ int ret = rados->mon_command(cmd, inbl, result, nullptr);
if (ret < 0) {
return ret;
}
-
-
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab ft=cpp
#include "svc_config_key.h"
-class RGWSI_RADOS;
-
class RGWSI_ConfigKey_RADOS : public RGWSI_ConfigKey
{
bool maybe_insecure_mon_conn{false};
void warn_if_insecure();
public:
- struct Svc {
- RGWSI_RADOS *rados{nullptr};
- } svc;
+ librados::Rados* rados{nullptr};
- void init(RGWSI_RADOS *rados_svc) {
- svc.rados = rados_svc;
+ void init(librados::Rados* rados_) {
+ rados = rados_;
}
RGWSI_ConfigKey_RADOS(CephContext *cct) : RGWSI_ConfigKey(cct) {}
int get(const std::string& key, bool secure, bufferlist *result) override;
};
-
-