Skip to content

Commit

Permalink
Merge pull request #20048 from jcsp/wip-22096
Browse files Browse the repository at this point in the history
mon: fix mgr using auth_client_required policy

Reviewed-by: Joao Eduardo Luis <joao@suse.de>
Reviewed-by: Kefu Chai <kchai@redhat.com>
  • Loading branch information
tchaikov committed Jan 26, 2018
2 parents 2d072dc + 86ee30c commit 73cc02d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
16 changes: 14 additions & 2 deletions src/mgr/DaemonServer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,14 @@ DaemonServer::DaemonServer(MonClient *monc_,
py_modules(py_modules_),
clog(clog_),
audit_clog(audit_clog_),
auth_registry(g_ceph_context,
auth_cluster_registry(g_ceph_context,
g_conf->auth_supported.empty() ?
g_conf->auth_cluster_required :
g_conf->auth_supported),
auth_service_registry(g_ceph_context,
g_conf->auth_supported.empty() ?
g_conf->auth_service_required :
g_conf->auth_supported),
lock("DaemonServer"),
pgmap_ready(false)
{
Expand Down Expand Up @@ -146,7 +150,15 @@ bool DaemonServer::ms_verify_authorizer(Connection *con,
bool& is_valid,
CryptoKey& session_key)
{
auto handler = auth_registry.get_handler(protocol);
AuthAuthorizeHandler *handler = nullptr;
if (peer_type == CEPH_ENTITY_TYPE_OSD ||
peer_type == CEPH_ENTITY_TYPE_MON ||
peer_type == CEPH_ENTITY_TYPE_MDS ||
peer_type == CEPH_ENTITY_TYPE_MGR) {
handler = auth_cluster_registry.get_handler(protocol);
} else {
handler = auth_service_registry.get_handler(protocol);
}
if (!handler) {
dout(0) << "No AuthAuthorizeHandler found for protocol " << protocol << dendl;
is_valid = false;
Expand Down
5 changes: 4 additions & 1 deletion src/mgr/DaemonServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ class DaemonServer : public Dispatcher, public md_config_obs_t
PyModuleRegistry &py_modules;
LogChannelRef clog, audit_clog;

AuthAuthorizeHandlerRegistry auth_registry;
// Authentication methods for cluster peers
AuthAuthorizeHandlerRegistry auth_cluster_registry;
// Authentication methods for clients
AuthAuthorizeHandlerRegistry auth_service_registry;

// Connections for daemons, and clients with service names set
// (i.e. those MgrClients that are allowed to send MMgrReports)
Expand Down
3 changes: 2 additions & 1 deletion src/mon/MonClient.cc
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,8 @@ int MonClient::init()
method = cct->_conf->auth_supported;
else if (entity_name.get_type() == CEPH_ENTITY_TYPE_OSD ||
entity_name.get_type() == CEPH_ENTITY_TYPE_MDS ||
entity_name.get_type() == CEPH_ENTITY_TYPE_MON)
entity_name.get_type() == CEPH_ENTITY_TYPE_MON ||
entity_name.get_type() == CEPH_ENTITY_TYPE_MGR)
method = cct->_conf->auth_cluster_required;
else
method = cct->_conf->auth_client_required;
Expand Down

0 comments on commit 73cc02d

Please sign in to comment.