Skip to content

Commit

Permalink
common/options: add ms_mon_client_mode
Browse files Browse the repository at this point in the history
The server now has a list of *allowed* modes (no ordering) and the clients
have a list of modes in order of preference.  Since we want everything
connecting to the mon to be secure by default (think: ceph auth set ...),
we need a separate option to ensure we prefer secure mon connections from
the CLI etc.

Signed-off-by: Sage Weil <[email protected]>
  • Loading branch information
liewegas committed Feb 20, 2019
1 parent 2d53093 commit b9c294e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/auth/AuthRegistry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ void AuthRegistry::_refresh_config()
&mon_cluster_modes);
_parse_mode_list(cct->_conf.get_val<string>("ms_mon_service_mode"),
&mon_service_modes);
_parse_mode_list(cct->_conf.get_val<string>("ms_mon_client_mode"),
&mon_client_modes);
_parse_mode_list(cct->_conf.get_val<string>("ms_cluster_mode"),
&cluster_modes);
_parse_mode_list(cct->_conf.get_val<string>("ms_service_mode"),
Expand All @@ -115,8 +117,9 @@ void AuthRegistry::_refresh_config()
<< " client_methods " << client_methods
<< dendl;
ldout(cct,10) << __func__ << " mon_cluster_modes " << mon_cluster_modes
<< " mon_service_mdoes " << mon_service_modes
<< " cluster_modes " << cluster_modes
<< " mon_service_modes " << mon_service_modes
<< " mon_client_modes " << mon_client_modes
<< "; cluster_modes " << cluster_modes
<< " service_modes " << service_modes
<< " client_modes " << client_modes
<< dendl;
Expand Down Expand Up @@ -163,7 +166,13 @@ void AuthRegistry::get_supported_methods(
*methods = client_methods;
}
if (modes) {
*modes = client_modes;
switch (peer_type) {
case CEPH_ENTITY_TYPE_MON:
*modes = mon_client_modes;
break;
default:
*modes = client_modes;
}
}
return;
case CEPH_ENTITY_TYPE_MON:
Expand Down
1 change: 1 addition & 0 deletions src/auth/AuthRegistry.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class AuthRegistry : public md_config_obs_t {
// CEPH_CON_MODE_*
std::vector<uint32_t> mon_cluster_modes;
std::vector<uint32_t> mon_service_modes;
std::vector<uint32_t> mon_client_modes;
std::vector<uint32_t> cluster_modes;
std::vector<uint32_t> service_modes;
std::vector<uint32_t> client_modes;
Expand Down
11 changes: 11 additions & 0 deletions src/common/options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,7 @@ std::vector<Option> get_global_options() {
.set_default("crc secure")
.set_description("Connection modes (crc, secure) for intra-mon connections in order of preference")
.add_see_also("ms_mon_service_mode")
.add_see_also("ms_mon_client_mode")
.add_see_also("ms_service_mode")
.add_see_also("ms_cluster_mode")
.add_see_also("ms_client_mode"),
Expand All @@ -853,6 +854,16 @@ std::vector<Option> get_global_options() {
.set_description("Allowed connection modes (crc, secure) for connections to mons")
.add_see_also("ms_service_mode")
.add_see_also("ms_mon_cluster_mode")
.add_see_also("ms_mon_client_mode")
.add_see_also("ms_cluster_mode")
.add_see_also("ms_client_mode"),

Option("ms_mon_client_mode", Option::TYPE_STR, Option::LEVEL_BASIC)
.set_default("crc secure")
.set_description("Connection modes (crc, secure) for connections from clients to monitors in order of preference")
.add_see_also("ms_mon_service_mode")
.add_see_also("ms_mon_cluster_mode")
.add_see_also("ms_service_mode")
.add_see_also("ms_cluster_mode")
.add_see_also("ms_client_mode"),

Expand Down

0 comments on commit b9c294e

Please sign in to comment.