Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rgw/notification: allow sending bucket notifications secrets in cleartext #43436

Merged
merged 1 commit into from Aug 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/common/options/rgw.yaml.in
Expand Up @@ -3575,3 +3575,18 @@ options:
- rgw
- osd
with_legacy: true
- name: rgw_allow_notification_secrets_in_cleartext
type: bool
level: advanced
desc: Allows sending secrets (e.g. passwords) over non encrypted HTTP messages.
long_desc: When bucket notification endpoint require secrets (e.g. passwords),
we allow the topic creation only over HTTPS messages.
This parameter can be set to "true" to bypass this check.
Use this only if radosgw is on a trusted private network, and the message
broker cannot be configured without password authentication. Otherwise, this will
leak the credentials of your message broker and compromise its security.
default: false
services:
- rgw
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  see_also:
  - rgw_trust_forwarded_https

see_also:
- rgw_trust_forwarded_https
17 changes: 13 additions & 4 deletions src/rgw/rgw_rest_pubsub_common.cc
Expand Up @@ -10,6 +10,15 @@
#define dout_context g_ceph_context
#define dout_subsys ceph_subsys_rgw

bool verify_transport_security(CephContext *cct, const RGWEnv& env) {
const auto is_secure = rgw_transport_is_secure(cct, env);
if (!is_secure && g_conf().get_val<bool>("rgw_allow_notification_secrets_in_cleartext")) {
ldout(cct, 0) << "WARNING: bypassing endpoint validation, allow sending password over insecure transport" << dendl;
cbodley marked this conversation as resolved.
Show resolved Hide resolved
return true;
}
return is_secure;
}

bool validate_and_update_endpoint_secret(rgw_pubsub_sub_dest& dest, CephContext *cct, const RGWEnv& env) {
if (dest.push_endpoint.empty()) {
return true;
Expand All @@ -24,7 +33,7 @@ bool validate_and_update_endpoint_secret(rgw_pubsub_sub_dest& dest, CephContext
ceph_assert(user.empty() == password.empty());
if (!user.empty()) {
dest.stored_secret = true;
if (!rgw_transport_is_secure(cct, env)) {
if (!verify_transport_security(cct, env)) {
ldout(cct, 1) << "endpoint validation error: sending password over insecure transport" << dendl;
return false;
}
Expand Down Expand Up @@ -71,7 +80,7 @@ void RGWPSListTopicsOp::execute(optional_yield y) {
ldpp_dout(this, 1) << "failed to get topics, ret=" << op_ret << dendl;
return;
}
if (topics_has_endpoint_secret(result) && !rgw_transport_is_secure(s->cct, *(s->info.env))) {
if (topics_has_endpoint_secret(result) && !verify_transport_security(s->cct, *(s->info.env))) {
ldpp_dout(this, 1) << "topics contain secret and cannot be sent over insecure transport" << dendl;
op_ret = -EPERM;
return;
Expand All @@ -86,7 +95,7 @@ void RGWPSGetTopicOp::execute(optional_yield y) {
}
ps.emplace(static_cast<rgw::sal::RadosStore*>(store), s->owner.get_id().tenant);
op_ret = ps->get_topic(topic_name, &result);
if (topic_has_endpoint_secret(result) && !rgw_transport_is_secure(s->cct, *(s->info.env))) {
if (topic_has_endpoint_secret(result) && !verify_transport_security(s->cct, *(s->info.env))) {
ldpp_dout(this, 1) << "topic '" << topic_name << "' contain secret and cannot be sent over insecure transport" << dendl;
op_ret = -EPERM;
return;
Expand Down Expand Up @@ -135,7 +144,7 @@ void RGWPSGetSubOp::execute(optional_yield y) {
ps.emplace(static_cast<rgw::sal::RadosStore*>(store), s->owner.get_id().tenant);
auto sub = ps->get_sub(sub_name);
op_ret = sub->get_conf(&result);
if (subscription_has_endpoint_secret(result) && !rgw_transport_is_secure(s->cct, *(s->info.env))) {
if (subscription_has_endpoint_secret(result) && !verify_transport_security(s->cct, *(s->info.env))) {
ldpp_dout(this, 1) << "subscription '" << sub_name << "' contain secret and cannot be sent over insecure transport" << dendl;
op_ret = -EPERM;
return;
Expand Down