ceph auth export {TYPE.ID}
-The ``auth export`` command is identical to ``auth get``, but also prints
-out the internal ``auid``, which is not relevant to end users.
+The ``auth export`` command is identical to ``auth get``.
class Cond;
struct EntityAuth {
- uint64_t auid;
CryptoKey key;
map<string, bufferlist> caps;
- EntityAuth() : auid(CEPH_AUTH_UID_DEFAULT) {}
-
void encode(bufferlist& bl) const {
__u8 struct_v = 2;
using ceph::encode;
encode(struct_v, bl);
- encode(auid, bl);
+ encode((uint64_t)CEPH_AUTH_UID_DEFAULT, bl);
encode(key, bl);
encode(caps, bl);
}
using ceph::decode;
__u8 struct_v;
decode(struct_v, bl);
- if (struct_v >= 2)
- decode(auid, bl);
- else auid = CEPH_AUTH_UID_DEFAULT;
+ if (struct_v >= 2) {
+ uint64_t old_auid;
+ decode(old_auid, bl);
+ }
decode(key, bl);
decode(caps, bl);
}
WRITE_CLASS_ENCODER(EntityAuth)
static inline ostream& operator<<(ostream& out, const EntityAuth& a) {
- return out << "auth(auid = " << a.auid << " key=" << a.key << " with " << a.caps.size() << " caps)";
+ return out << "auth(key=" << a.key << " with " << a.caps.size() << " caps)";
}
struct AuthCapsInfo {
struct AuthTicket {
EntityName name;
uint64_t global_id; /* global instance id */
- uint64_t auid;
utime_t created, renew_after, expires;
AuthCapsInfo caps;
__u32 flags;
- AuthTicket() : global_id(0), auid(CEPH_AUTH_UID_DEFAULT), flags(0){}
+ AuthTicket() : global_id(0), flags(0){}
void init_timestamps(utime_t now, double ttl) {
created = now;
encode(struct_v, bl);
encode(name, bl);
encode(global_id, bl);
- encode(auid, bl);
+ encode((uint64_t)CEPH_AUTH_UID_DEFAULT, bl);
encode(created, bl);
encode(expires, bl);
encode(caps, bl);
decode(struct_v, bl);
decode(name, bl);
decode(global_id, bl);
- if (struct_v >= 2)
- decode(auid, bl);
- else auid = CEPH_AUTH_UID_DEFAULT;
+ if (struct_v >= 2) {
+ uint64_t old_auid;
+ decode(old_auid, bl);
+ }
decode(created, bl);
decode(expires, bl);
decode(caps, bl);
return new KeyRing();
}
-int KeyRing::set_modifier(const char *type, const char *val, EntityName& name, map<string, bufferlist>& caps)
+int KeyRing::set_modifier(const char *type,
+ const char *val,
+ EntityName& name,
+ map<string, bufferlist>& caps)
{
if (!val)
return -EINVAL;
caps[caps_entity] = bl;
set_caps(name, caps);
} else if (strcmp(type, "auid") == 0) {
- uint64_t auid = strtoull(val, NULL, 0);
- set_uid(name, auid);
+ // just ignore it so we can still decode "old" keyrings that have an auid
} else
return -EINVAL;
std::ostringstream keyss;
keyss << p->second.key;
f->dump_string("key", keyss.str());
- if (p->second.auid != CEPH_AUTH_UID_DEFAULT)
- f->dump_int("auid", p->second.auid);
f->open_object_section("caps");
for (map<string, bufferlist>::iterator q = p->second.caps.begin();
q != p->second.caps.end();
++p) {
out << "[" << p->first << "]" << std::endl;
out << "\tkey = " << p->second.key << std::endl;
- if (p->second.auid != CEPH_AUTH_UID_DEFAULT)
- out << "\tauid = " << p->second.auid << std::endl;
for (map<string, bufferlist>::iterator q = p->second.caps.begin();
q != p->second.caps.end();
void set_caps(EntityName& name, map<string, bufferlist>& caps) {
keys[name].caps = caps;
}
- void set_uid(EntityName& ename, uint64_t auid) {
- keys[ename].auid = auid;
- }
void set_key(EntityName& ename, CryptoKey& key) {
keys[ename].key = key;
}
if (ds) {
*ds << name.to_str() << std::endl;
*ds << "\tkey: " << mapiter->second.key << std::endl;
- if (mapiter->second.auid != CEPH_AUTH_UID_DEFAULT)
- *ds << "\tauid: " << mapiter->second.auid << std::endl;
}
if (f) {
f->open_object_section("auth_entities");
f->dump_string("entity", name.to_str());
f->dump_stream("key") << mapiter->second.key;
- if (mapiter->second.auid != CEPH_AUTH_UID_DEFAULT)
- f->dump_int("auid", mapiter->second.auid);
f->open_object_section("caps");
}
info.ticket.init_timestamps(ceph_clock_now(), cct->_conf->auth_mon_ticket_ttl);
info.ticket.name = entity_name;
info.ticket.global_id = global_id;
- info.ticket.auid = eauth.auid;
info.validity += cct->_conf->auth_mon_ticket_ttl;
key_server->generate_secret(session_key);
creating kring
$ ceph-authtool kring --add-key 'AQAK7yxNeF+nHBAA0SgSdbs8IkJrxroDeJ6SwQ== 18446744073709551615'
- added entity client.admin auth auth(auid = 18446744073709551615 key=AQAK7yxNeF+nHBAA0SgSdbs8IkJrxroDeJ6SwQ== with 0 caps)
+ added entity client.admin auth auth(key=AQAK7yxNeF+nHBAA0SgSdbs8IkJrxroDeJ6SwQ== with 0 caps)
# cram makes matching escape-containing lines with regexps a bit ugly
$ ceph-authtool kring --list