From 6b7d9f2b3ee7bbe901e6a04d53ee8626f2a3d2c9 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Sun, 14 Jul 2013 16:20:54 -0700 Subject: [PATCH] mon: include some (basic) auth info in report Nothing privileged! Signed-off-by: Sage Weil --- src/auth/cephx/CephxKeyServer.h | 3 +++ src/mon/AuthMonitor.cc | 10 ++++++++++ src/mon/AuthMonitor.h | 2 ++ src/mon/Monitor.cc | 1 + 4 files changed, 16 insertions(+) diff --git a/src/auth/cephx/CephxKeyServer.h b/src/auth/cephx/CephxKeyServer.h index 905eb71fe172..bc30fef640b1 100644 --- a/src/auth/cephx/CephxKeyServer.h +++ b/src/auth/cephx/CephxKeyServer.h @@ -268,6 +268,9 @@ public: map::const_iterator b = data.secrets_begin(); return (b != data.secrets_end()); } + int get_num_secrets() { + return data.secrets.size(); + } /*void add_rotating_secret(uint32_t service_id, ExpiringCryptoKey& key) { Mutex::Locker l(lock); diff --git a/src/mon/AuthMonitor.cc b/src/mon/AuthMonitor.cc index 9f8c2ea260d8..83b7ac2ce0cb 100644 --- a/src/mon/AuthMonitor.cc +++ b/src/mon/AuthMonitor.cc @@ -997,3 +997,13 @@ void AuthMonitor::upgrade_format() propose_pending(); } } + +void AuthMonitor::dump_info(Formatter *f) +{ + /*** WARNING: do not include any privileged information here! ***/ + f->open_object_section("auth"); + f->dump_unsigned("first_committed", get_first_committed()); + f->dump_unsigned("last_committed", get_last_committed()); + f->dump_unsigned("num_secrets", mon->key_server.get_num_secrets()); + f->close_section(); +} diff --git a/src/mon/AuthMonitor.h b/src/mon/AuthMonitor.h index f538e737856a..30d567a77caf 100644 --- a/src/mon/AuthMonitor.h +++ b/src/mon/AuthMonitor.h @@ -157,6 +157,8 @@ private: void pre_auth(MAuth *m); void tick(); // check state, take actions + + void dump_info(Formatter *f); }; diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 1db1b3363f86..6a401013de07 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -2118,6 +2118,7 @@ void Monitor::handle_command(MMonCommand *m) osdmon()->dump_info(f.get()); mdsmon()->dump_info(f.get()); pgmon()->dump_info(f.get()); + authmon()->dump_info(f.get()); paxos->dump_info(f.get()); -- 2.47.3