-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use did:web for the services so we can rotate keys without having to redo delegations #182
Comments
Here is some idea based on discussion https://filecoinproject.slack.com/archives/C02BZPRS9HP/p1668716338471879 an d https://filecoinproject.slack.com/archives/C02BZPRS9HP/p1668722431402189?thread_ts=1668716024.894469&cid=C02BZPRS9HP
Above setup would allow backend to do following:
In other words I think we have a tractable solution to key rotation, we could harden this further by adding another layer, meaning we could have "supreme key" used for rotating "certificate keys" which is used to rotate "service keys". |
I'm also observing some broad pattern here, where we could use UCANs inside UCANS as opposed to describing some custom fact encodings etc... What it boils down I trust some key principal, and it could state facts that I can trust without verification in other words, lets say we have this supreme {
iss: 'did:key:zAlice',
aud: 'did:dns:api.web3.storage',
att: [{ can: "store/add", with: 'did:key:zAlice', root }],
fct: [
{ iss: 'did:key:zCertificateAuthority',
aud: 'ucan:',
att: [{ can: 'did/set', with: 'did:dns:api.web3.storage', nb: { did: 'did:key:zServiceKey' } }]
}
]
} Basically we can generalize the whole idea of building up a lookup table using UCANs inside the facts, so if you can trust some |
Generally this makes sense (disclosure: I haven't seen the filecoin slack discussions). I do think there are some questions about DNS proofs. Obviously if you have an X509 with a cn that matches the DNS signed by an entity in a reasonable cert chain, then you could just use that key, or/that is we could use Let's Encrypt's mechanism (ACME) here. did:dns seems a bit comparatively complicated? The downside is that we'd need to figure out how to specify the verification of the X509 version if we go that route. did:web might be an alternative that's perhaps closer to ACME? (aside: reading did:dns and did:web, these methods seem awfully "spec-first" and theoretical – are there examples of them being used in the wild? Not to be contrarian, just thinking about what gaining adoption would look like) |
Why is dns:dns complicated it's just one TXT record that from which you can resolve did:key. I think |
That's a good question! 🤔 Maybe it's not! I'm not sure, tbh. I have a gut feeling that there's a missing piece around key management wrt did:dns; how do I get that did:key, how do I store it, etc? Maybe all these things are simple and I'm just not used to the ecosystem! |
I think I need to do some reading on the subject to understand what you're describing.
I'm not sure. I'm approaching it from very pragmatic standpoint, which is:
It seems that we could use did:dns effectively with very little effort, because all we need to do to rotate a key is publish DNS record
Now secondary goal is to be able to do UCAN verifications without having to do bunch of DNS lookups (or any IO really). We could achieve that by having a "certificate key" that we sign rotations with and embed actual keys in UCANs. That way our backend only needs certificate public key to verify everything without even doing any DNS lookups |
I think expected behavior is during verification you do a DNS lookup of for record that follows But as I alluded to earlier we'd like to avoid even that DNS lookup which I think we could do by embedding something along the lines of dns-sd announcements in the UCAN itself (signed by trusted did:key, which in our service case will be hard coded but also published as DNS record so others could do the lookup) |
Nice. Yeah, I think in general I'd say if this works for your use-case, especially in a closed-loop environment, full steam ahead! I'm prematurely expanding out the thought process and applying this to the NNS context, where it would be great to be able to do this in a more general way and where e.g., using the existing keys people use for HTTPS might be a viable option to delegate DNS record -> did |
In the original flow described in the message starting
It looks like the ID is rooted in a certificate authority.
|
(To clarify: for a lot — but not all! — cases, you can use a root UCAN as a de facto certificate authority. This keeps it in the authZ world though, and you may be trying to solve for authN?) |
No what I was calling a "certification key" is not related to CA and I realize maybe it was poor naming choice given the confusion it invoked. It is simply a ED25519 key that we want to keep secure & use rarely, only when we rotate actual keys of our services.
I think our use case maybe be better explained by drawing a following delegation chain:
If key we have rotated key and Proposed solution is as follows:
In other words we can rotate service keys on regular basis (e.g. once a month) and that is also only time we need to access private key of "certificate key". Due to less frequent use we can keep it more secure and avoid storing it on our servers. Can UCAN delegation be used here somehow ? Probably, which is kind of what this sketch does #182 (comment), is that a best option I don't know seems like it might be bit overkill. |
I also started thinking that perhaps did:web would be a better option for us than did:dns because:
On the flip side did:dns is simple because it’s just domain → did:key mapping without any of the complex DID document structures. Would love to hear feedback from @gobengo on all this |
Oh @expede it finally clicked 🤯 and now I no longer know how it was not obvious! |
Ok so here is the deal and what I think @expede meant all along. We do not need to rotate
With this setup:
Now lets step through this delegation scenario
|
I have put together a spec proposal for this stuff https://github.com/web3-storage/specs/pull/7/files |
fwiw there is a did:web now https://dev.uniresolver.io/#did:web:web3.storage |
Currently we use did:key as service identifier. That is problematic because every time we want to rotate key we have to update the clients with a new key and old clients will no longer work.
It would make sense to just switch to did:dns so we can rotate keys when needed without having to upgrade all the clients
Out of scope
did:dns -> dns:key
for our keys.did:dns
identifiers in delegation chains is out of scope (we can just error saying we failed to resolve the key).did:dns
in the chain but with key that is no longer in rotation. We do need to support that use case long term, but for now it's out of the scope, we can work on this when we actually go about rotating keysThe text was updated successfully, but these errors were encountered: