mon/MonClient: handle ms_handle_fast_authentication return#52939
mon/MonClient: handle ms_handle_fast_authentication return#52939
Conversation
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
|
I think to test this would require having caps which parse correctly for the mon's |
Most likely, given that the only thing these handlers do is parse the caps string. |
Okay, I'll have to think of an easy way to test this. Alternatively we can just skip tests as risk is low, IMO. |
| virtual int ms_handle_fast_authentication(Connection *con) { | ||
| return 0; | ||
| virtual bool ms_handle_fast_authentication(Connection *con) { | ||
| return false; |
There was a problem hiding this comment.
@idryomov actually this should probably be true, yes? Otherwise every dispatcher that does not implement this method will fail here. I'll make this change.
There was a problem hiding this comment.
I think it's dangerous to provide a default "yup, authenticated" implementation. I would rather make this a pure virtual.
There was a problem hiding this comment.
So turning this into a pure virtual broke the build and required every dispatcher to be modified, even in places where it makes no sense, e.g. MonClient. I decided it's better to leave it as a regular virtual method which returns true.
Given how brittle the test would be, I think we'll just take this as-is. Please review at your convenience @idryomov . |
idryomov
left a comment
There was a problem hiding this comment.
I see two ms_handle_fast_authentication() calls in Monitor::handle_auth_request() where the return value is not checked. Is that intentional?
| virtual int ms_handle_fast_authentication(Connection *con) { | ||
| return 0; | ||
| virtual bool ms_handle_fast_authentication(Connection *con) { | ||
| return false; |
There was a problem hiding this comment.
I think it's dangerous to provide a default "yup, authenticated" implementation. I would rather make this a pure virtual.
This is up to @rzarzynski. |
|
| AuthCapsInfo &caps_info = con->get_peer_caps_info(); | ||
| if (caps_info.allow_all) { | ||
| s->caps.set_allow_all(); | ||
| return true; |
| << " failed to parse caps '" << str << "'" << dendl; | ||
| ret = -EACCES; | ||
| } | ||
| return false; |
| dout(10) << __func__ << " session " << s | ||
| << " " << s->entity_name | ||
| << " has caps " << s->caps << " '" << str << "'" << dendl; | ||
| return true; |
| } else { | ||
| dout(10) << __func__ << " session " << s << " " << s->entity_name | ||
| << " failed to parse caps '" << str << "'" << dendl; | ||
| return false; |
| return false; | ||
| } | ||
| } else { | ||
| return false; |
There was a problem hiding this comment.
This handles the original ret eq 0 case (neither allow_all nor caps_info.caps.length() > 0). This blurs the information with EACCESS but I think it's fine.
| s->caps.set_allow_all(); | ||
| s->authenticated = true; | ||
| ret = 1; | ||
| return true; |
| << " in auth db" << dendl; | ||
| str.clear(); | ||
| ret = -EACCES; | ||
| return false; |
| } | ||
| if (s->caps.parse(str, NULL)) { | ||
| s->authenticated = true; | ||
| return true; |
| } else { | ||
| derr << __func__ << " unparseable caps '" << str << "' for " | ||
| << con->get_peer_entity_name() << dendl; | ||
| return false; |
src/msg/Dispatcher.h
Outdated
| virtual int ms_handle_fast_authentication(Connection *con) { | ||
| return 0; | ||
| virtual bool ms_handle_fast_authentication(Connection *con) { | ||
| return true; |
There was a problem hiding this comment.
Any reason for not going pure virtual?
There was a problem hiding this comment.
Dispatchers that don't handle authentication would need to have the method which seemed unnecessarily obtrusive.
There was a problem hiding this comment.
I share the @idryomov's concern.
How about introducing an intermediary stage (with the default implementation) in the inheritance hierarchy to address those auth-uninterested dispatchers explicitly?
$ grep -r ms_handle_fast_authentication ./
./mon/MonClient.cc: handle_authentication_dispatcher->ms_handle_fast_authentication(con);
./mon/MonClient.cc: handle_authentication_dispatcher->ms_handle_fast_authentication(con);
./mon/Monitor.h: int ms_handle_fast_authentication(Connection *con) override;
./mon/AuthMonitor.cc: mon.ms_handle_fast_authentication(s->con.get()) > 0) {
./mon/Monitor.cc: ms_handle_fast_authentication(con);
./mon/Monitor.cc: ms_handle_fast_authentication(con);
./mon/Monitor.cc:int Monitor::ms_handle_fast_authentication(Connection *con)
./msg/Dispatcher.h: virtual int ms_handle_fast_authentication(Connection *con) {
./mds/MDSDaemon.h: int ms_handle_fast_authentication(Connection *con) override;
./mds/MDSDaemon.cc:int MDSDaemon::ms_handle_fast_authentication(Connection *con)
./mgr/DaemonServer.h: int ms_handle_fast_authentication(Connection *con) override;
./mgr/DaemonServer.cc:int DaemonServer::ms_handle_fast_authentication(Connection *con)
./osd/OSD.h: int ms_handle_fast_authentication(Connection *con) override {
./osd/OSD.h: int ms_handle_fast_authentication(Connection *con) override;
./osd/OSD.cc:int OSD::ms_handle_fast_authentication(Connection *con)
./test/fio/fio_ceph_messenger.cc: int ms_handle_fast_authentication(Connection *con) override {
./test/msgr/perf_msgr_client.cc: int ms_handle_fast_authentication(Connection *con) override {
./test/msgr/test_msgr.cc: int ms_handle_fast_authentication(Connection *con) override {
./test/msgr/test_msgr.cc: int ms_handle_fast_authentication(Connection *con) override {
./test/msgr/test_msgr.cc: int ms_handle_fast_authentication(Connection *con) override {
./test/msgr/perf_msgr_server.cc: int ms_handle_fast_authentication(Connection *con) override {
$ grep -r public\ Dispatcher ./
./mon/Monitor.h:class Monitor : public Dispatcher,
./mon/MonClient.h:struct MonClientPinger : public Dispatcher,
./mon/MonClient.h:class MonClient : public Dispatcher,
./neorados/RADOSImpl.h:class RADOS : public Dispatcher
./tools/cephfs_mirror/ClusterWatcher.h:class ClusterWatcher : public Dispatcher {
./tools/cephfs/MDSUtility.h:class MDSUtility : public Dispatcher {
./librados/RadosClient.h:class librados::RadosClient : public Dispatcher,
./librbd/io/ImageDispatcher.h:class ImageDispatcher : public Dispatcher<ImageCtxT, ImageDispatcherInterface> {
./librbd/io/ObjectDispatcherInterface.h: : public DispatcherInterface<ObjectDispatchInterface> {
./librbd/io/ObjectDispatcher.h: : public Dispatcher<ImageCtxT, ObjectDispatcherInterface> {
./librbd/io/ImageDispatcherInterface.h: : public DispatcherInterface<ImageDispatchInterface> {
./osdc/Objecter.h:class Objecter : public md_config_obs_t, public Dispatcher {
./mds/MDSDaemon.h:class MDSDaemon : public Dispatcher {
./mds/Beacon.h:class Beacon : public Dispatcher
./mds/MetricsHandler.h:class MetricsHandler : public Dispatcher {
./mds/MetricAggregator.h:class MetricAggregator : public Dispatcher {
./mgr/MgrStandby.h:class MgrStandby : public Dispatcher,
./mgr/DaemonServer.h:class DaemonServer : public Dispatcher, public md_config_obs_t
./mgr/MgrClient.h:class MgrClient : public Dispatcher
./osd/OSD.h:class OSD : public Dispatcher,
./osd/OSD.h: struct HeartbeatDispatcher : public Dispatcher {
./test/crimson/test_messenger.cc:class FailoverSuite : public Dispatcher {
./test/crimson/test_messenger.cc:class FailoverTest : public Dispatcher {
./test/crimson/test_messenger.cc:class FailoverSuitePeer : public Dispatcher {
./test/crimson/test_messenger.cc:class FailoverTestPeer : public Dispatcher {
./test/crimson/test_messenger_peer.cc:class FailoverSuitePeer : public Dispatcher {
./test/crimson/test_messenger_peer.cc:class FailoverTestPeer : public Dispatcher {
./test/fio/fio_ceph_messenger.cc:class FioDispatcher : public Dispatcher {
./test/mon/test_mon_workloadgen.cc:class TestStub : public Dispatcher
./test/mon/test-mon-msg.cc:class MonClientHelper : public Dispatcher
./test/direct_messenger/test_direct_messenger.cc:class MockDispatcher : public Dispatcher {
./test/testmsgr.cc:class Admin : public Dispatcher {
./test/msgr/perf_msgr_client.cc: class ClientDispatcher : public Dispatcher {
./test/msgr/test_msgr.cc:class FakeDispatcher : public Dispatcher {
./test/msgr/test_msgr.cc:class SyntheticDispatcher : public Dispatcher {
./test/msgr/test_msgr.cc:class MarkdownDispatcher : public Dispatcher {
./test/msgr/perf_msgr_server.cc:class ServerDispatcher : public Dispatcher {
./client/Client.h:class Client : public Dispatcher, public md_config_obs_t {
For many of them the burden could as low as running sed.
There was a problem hiding this comment.
I think my concern in
was not actually an issue. So I've changed the default return to false. That should render this conversation moot.
|
trivial rebase |
|
jenkins test windows |
|
This PR is under test in https://tracker.ceph.com/issues/66433. |
|
This PR is under test in https://tracker.ceph.com/issues/66462. |
* refs/pull/52939/head: mon/MonClient: handle ms_handle_fast_authentication return
|
This PR is under test in https://tracker.ceph.com/issues/66609. |
|
@idryomov @rzarzynski this is ready for merge; just blocked on your review please. |
|
jenkins test make check arm64 |
|
jenkins test make check |
Fixes: https://tracker.ceph.com/issues/62382 Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
|
jenkins test make check |
|
jenkins test make check arm64 |
|
jenkins test api |
|
jenkins test make check arm64 |
|
This PR is under test in https://tracker.ceph.com/issues/66822. |
|
jenkins test make check arm64 |
1 similar comment
|
jenkins test make check arm64 |
|
This PR is under test in https://tracker.ceph.com/issues/67214. |
Fixes: https://tracker.ceph.com/issues/62382
Contribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "pacific"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
Checklist
Show available Jenkins commands
jenkins retest this pleasejenkins test classic perfjenkins test crimson perfjenkins test signedjenkins test make checkjenkins test make check arm64jenkins test submodulesjenkins test dashboardjenkins test dashboard cephadmjenkins test apijenkins test docsjenkins render docsjenkins test ceph-volume alljenkins test ceph-volume toxjenkins test windows