]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
mon: fail fast when unauthorized global_id (re)use is disallowed
authorIlya Dryomov <idryomov@gmail.com>
Thu, 25 Mar 2021 19:59:13 +0000 (20:59 +0100)
committerIlya Dryomov <idryomov@gmail.com>
Mon, 12 Apr 2021 19:59:41 +0000 (21:59 +0200)
commit01c52b1eae929e86fc7777ba3fcff544c5aba8af
tree73888b8b23c626824153c4665ddc33f78e1ba155
parent059eabcc0ada81078a898cdc25cf72bf3d506ad0
mon: fail fast when unauthorized global_id (re)use is disallowed

When unauthorized global_id (re)use is disallowed, we don't want to
let unpatched clients in because they wouldn't be able to reestablish
their monitor session later, resulting in subtle hangs and disrupted
user workloads.

Denying the initial connect for all legacy (CephXAuthenticate < v3)
clients is not feasible because a large subset of them never stopped
presenting their ticket on reconnects and are therefore compatible with
enforcing mode: most notably all kernel clients but also pre-luminous
userspace clients.  They don't need to be patched and excluding them
would significantly hamper the adoption of enforcing mode.

Instead, force clients that we are not sure about to reconnect shortly
after they go through authentication and obtain global_id.  This is
done in Monitor::dispatch_op() to capture both msgr1 and msgr2, most
likely instead of dispatching mon_subscribe.

We need to let mon_getmap through for "ceph ping" and "ceph tell" to
work.  This does mean that we share the monmap, which lets the client
return from MonClient::authenticate() considering authentication to be
finished and causing the potential reconnect error to not propagate to
the user -- the client would hang waiting for remaining cluster maps.
For msgr1, this is unavoidable because the monmap is sent immediately
after the final MAuthReply.  But for msgr2 this is rare: most of the
time we get to their mon_subscribe and cut the connection before they
process the monmap!

Regardless, the user doesn't get a chance to start a workload since
there is no proper higher-level session at that point.

To help with identifying clients that need patching, add global_id and
global_id_status to "sessions" output.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
(cherry picked from commit 08766a17edebb7450cd9b17cc2dc01efc068bb94)

Conflicts:
src/mon/Monitor.cc [ commit e1163b445bbf ("mon: print
  entity_name along with caps to debug log") not in nautilus ]
src/auth/AuthServiceHandler.cc
src/auth/AuthServiceHandler.h
src/common/legacy_config_opts.h
src/common/options.cc
src/mon/Monitor.cc
src/mon/Session.h