// ssh orchestrator provisions new daemon keys
profile_grants.push_back(MonCapGrant("auth get-or-create"));
profile_grants.push_back(MonCapGrant("auth rm"));
+ // tell commands (this is a bit of a kludge)
+ profile_grants.push_back(MonCapGrant("smart"));
}
if (profile == "osd" || profile == "mds" || profile == "mon" ||
profile == "mgr") {
return;
}
if (!session->caps.is_allow_all()) {
- reply_tell_command(op, -EPERM, "insufficient caps");
+ // see if command is whitelisted
+ cmdmap_t cmdmap;
+ stringstream ss;
+ if (!cmdmap_from_json(m->cmd, &cmdmap, ss)) {
+ reply_command(op, -EINVAL, ss.str(), 0);
+ }
+ map<string,string> param_str_map;
+ _generate_command_map(cmdmap, param_str_map);
+ string prefix;
+ if (!cmd_getval(g_ceph_context, cmdmap, "prefix", prefix)) {
+ reply_command(op, -EINVAL, "no prefix", 0);
+ }
+ if (!session->caps.is_capable(
+ g_ceph_context,
+ CEPH_ENTITY_TYPE_MON,
+ session->entity_name,
+ "mon", prefix, param_str_map,
+ true, true, true,
+ session->get_peer_socket_addr())) {
+ reply_tell_command(op, -EPERM, "insufficient caps");
+ }
}
// pass it to asok
cct->get_admin_socket()->queue_tell_command(m);