auto con_addrs = m->get_source_addrs();
string old_name = monmap.get_name(con_addrs);
const auto old_epoch = monmap.get_epoch();
+ const auto old_auth_epoch = monmap.auth_epoch;
auto p = m->monmapbl.cbegin();
decode(monmap, p);
cct->set_mon_addrs(monmap);
+ if (old_auth_epoch < monmap.auth_epoch) {
+ ldout(cct, 1) << "auth epoch has changed: invalidating tickets and rotating secrets" << dendl;
+ _wipe_secrets_and_tickets();
+ }
+
sub.got("monmap", monmap.get_epoch());
map_cond.notify_all();
want_monmap = false;
"rotate-key",
this,
"rotate live authentication key");
+ cct->get_admin_socket()->register_command(
+ "wipe-rotating-secrets",
+ this,
+ "wipe rotating secrets");
return 0;
}
return authenticate_err;
}
+void MonClient::_wipe_secrets_and_tickets()
+{
+ ldout(cct, 5) << " wiping rotating secrets and invalidating tickets" << dendl;
+ rotating_secrets->wipe();
+ auth->invalidate_all_tickets();
+ _check_auth_tickets();
+}
+
int MonClient::call(
std::string_view command,
const cmdmap_t& cmdmap,
errss << "cephx not enabled; no key to rotate";
return -EINVAL;
}
+ } else if (command == "wipe-rotating-secrets") {
+ ldout(cct, 1) << __func__ << ": " << command << dendl;
+ std::lock_guard l{monc_lock};
+ _wipe_secrets_and_tickets();
}
return 0;
}
#include "MonMap.h"
#include <algorithm>
+#include <limits>
#include <sstream>
#include <sys/types.h>
#include <sys/stat.h>
seastar::future<> MonMap::build_initial(const crimson::common::ConfigProxy& conf, bool for_mkfs)
{
+ /* an invalid epoch so the real monmap doesn't trigger rotation */
+ auth_epoch = std::numeric_limits<decltype(auth_epoch)>::max();
+
// mon_host_override?
if (maybe_init_with_mon_host(conf.get_val<std::string>("mon_host_override"),
for_mkfs)) {
lgeneric_dout(cct, 1) << __func__ << " for_mkfs: " << for_mkfs << dendl;
const auto& conf = cct->_conf;
+ /* an invalid epoch so the real monmap doesn't trigger rotation */
+ auth_epoch = std::numeric_limits<decltype(auth_epoch)>::max();
+
// mon_host_override?
auto mon_host_override = conf.get_val<std::string>("mon_host_override");
if (!mon_host_override.empty()) {