From: Neha Ojha Date: Thu, 3 Dec 2020 19:18:04 +0000 (+0000) Subject: messages/MMonCommand, MMonCommandAck: don't log values for "config set" and "config... X-Git-Tag: v16.1.0~251^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3d54660ca1a9a7ae54e884c3181fca17a40d8cd3;p=ceph.git messages/MMonCommand, MMonCommandAck: don't log values for "config set" and "config-key set" This acts like a big hammer to avoid adding sensitive information, like passwords into mon/mgr/cluster logs when using "config set" and "config-key set" to set keys whose values should be secure. Fixes: https://tracker.ceph.com/issues/37503 Signed-off-by: Neha Ojha --- diff --git a/src/messages/MMonCommand.h b/src/messages/MMonCommand.h index fbba9629fb62..b2540ebffd08 100644 --- a/src/messages/MMonCommand.h +++ b/src/messages/MMonCommand.h @@ -15,6 +15,7 @@ #ifndef CEPH_MMONCOMMAND_H #define CEPH_MMONCOMMAND_H +#include "common/cmdparse.h" #include "messages/PaxosServiceMessage.h" #include @@ -41,10 +42,26 @@ private: public: std::string_view get_type_name() const override { return "mon_command"; } void print(std::ostream& o) const override { + cmdmap_t cmdmap; + std::ostringstream ss; + string prefix; + ceph::common::cmdmap_from_json(cmd, &cmdmap, ss); + ceph::common::cmd_getval(cmdmap, "prefix", prefix); + // Some config values contain sensitive data, so don't log them o << "mon_command("; - for (unsigned i=0; i