]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
mon/MonClient: preserve auth state on reconnects
authorIlya Dryomov <idryomov@gmail.com>
Mon, 8 Mar 2021 14:37:02 +0000 (15:37 +0100)
committerIlya Dryomov <idryomov@gmail.com>
Mon, 12 Apr 2021 18:56:35 +0000 (20:56 +0200)
commitd5f52b2de7cea4ba3b6e6937a55423641fcc2b3f
treeb6f9e24524128acfdd21667869b03a62b52197d6
parenta39fe4928501514ca50fb6fdb805907cdfd7ac57
mon/MonClient: preserve auth state on reconnects

Commit a2eb6ae3fb57 ("mon/monclient: hunt for multiple monitor in
parallel") introduced a regression where auth state (global_id and
AuthClientHandler) was no longer preserved on reconnects.  The ensuing
breakage was quickly noticed and prompted a follow-on fix 8bb6193c8f53
("mon/MonClient: persist global_id across re-connecting").

However, as evident from the subject, the follow-on fix only took
care of the global_id part.  AuthClientHandler is still destroyed
and all cephx tickets are discarded.  A new from-scratch instance
is created for each MonConnection and CEPHX_GET_AUTH_SESSION_KEY
requests end up with CephXAuthenticate::old_ticket not populated.
The bug is in MonClient, so both msgr1 and msgr2 are affected.

This should have resulted in a similar sort of breakage but didn't
because of a much larger bug.  The monitor should have denied the
attempt to reclaim global_id with no valid ticket proving previous
possession of that global_id presented.  Alas, it appears that this
aspect of the cephx protocol has never been enforced.  This is dealt
with in the next patch.

To fix the issue at hand, clone AuthClientHandler into each
MonConnection so that each respective CEPHX_GET_AUTH_SESSION_KEY
request gets a copy of the current auth ticket.

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

Conflicts:
src/mon/MonClient.cc [ commit 1e9b18008c5e ("mon: set
  MonClient::_add_conn return type to void") not in octopus ]
src/auth/AuthClientHandler.h
src/auth/cephx/CephxClientHandler.h
src/auth/krb/KrbClientHandler.hpp
src/auth/none/AuthNoneClientHandler.h
src/mon/MonClient.cc