| 1 | // An example registry enrolling a YubiKey approval key, written against |
| 2 | // schema/identity.cue. The principal and both keys are examples: copy the |
| 3 | // shape, never the values. |
| 4 | // |
| 5 | // example-operator holds two keys. The first stands for a key generated |
| 6 | // in PIV slot 9c of a YubiKey with touch policy always, with the |
| 7 | // attestation that proves it. The second stands for an ordinary key on a |
| 8 | // laptop. Both keys' private halves are derived from published seeds, so |
| 9 | // neither is a secret. |
| 10 | // |
| 11 | // The compiler refuses this registry. The attestation chains to a |
| 12 | // test-only root, "the-valley example attestation root, not Yubico", and |
| 13 | // not to Yubico Attestation Root 1, so it does not verify. An entry made |
| 14 | // from this one compiles only once both certificates are the ones the |
| 15 | // enrolling YubiKey wrote: `yubico-piv-tool -a attest -s 9c` for slot, and |
| 16 | // `yubico-piv-tool -a read-certificate -s f9` for f9. The identity-e2e |
| 17 | // check compiles this registry and holds the compiler to that refusal. |
| 18 | package identity |
| 19 | |
| 20 | boundaries: { |
| 21 | "push": kind: "git-push" |
| 22 | "registry": kind: "registry" |
| 23 | "approve": kind: "approve" |
| 24 | } |
| 25 | |
| 26 | genesis: "example-operator" |
| 27 | |
| 28 | principals: { |
| 29 | "example-operator": { |
| 30 | kind: "human" |
| 31 | keys: [ |
| 32 | { // the example YubiKey key, PIV slot 9c |
| 33 | class: "ssh-ed25519" |
| 34 | bound: "hardware" |
| 35 | public: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAID/3+vgQhY5cdQ4AqspQ1A2yW60nn4j1FOyx04WfuQjc" |
| 36 | attestation: { |
| 37 | slot: """ |
| 38 | -----BEGIN CERTIFICATE----- |
| 39 | MIIBnzCCAVGgAwIBAgIBAzAFBgMrZXAwPTE7MDkGA1UEAxMydGhlLXZhbGxleSBl |
| 40 | eGFtcGxlIGY5IGNlcnRpZmljYXRlLCBub3QgYSBZdWJpS2V5J3MwIBcNMjQxMjAx |
| 41 | MDAwMDAwWhgPOTk5OTEyMzEyMzU5NTlaMEIxQDA+BgNVBAMTN3RoZS12YWxsZXkg |
| 42 | ZXhhbXBsZSBzbG90IDljIGNlcnRpZmljYXRlLCBub3QgYSBZdWJpS2V5J3MwKjAF |
| 43 | BgMrZXADIQA/9/r4EIWOXHUOAKrKUNQNslutJ5+I9RTssdOFn7kI3KNvMG0wHwYD |
| 44 | VR0jBBgwFoAUyUoEX5UuH7szTIEPGV+za/s50oYwEQYKKwYBBAGCxAoDAwQDBQcE |
| 45 | MBQGCisGAQQBgsQKAwcEBgIEALxhTjAQBgorBgEEAYLECgMIBAIDAjAPBgorBgEE |
| 46 | AYLECgMJBAEDMAUGAytlcANBAL3VEws3t6SNeFJXeiEOMHpdJkaFtDLvNJT/II4E |
| 47 | v0tMQ6pKimp/cI7lfdDBxASGFaft4vkUyg+3W5Qdadn9rQg= |
| 48 | -----END CERTIFICATE----- |
| 49 | """ |
| 50 | f9: """ |
| 51 | -----BEGIN CERTIFICATE----- |
| 52 | MIIBoTCCAVOgAwIBAgIBAjAFBgMrZXAwOjE4MDYGA1UEAxMvdGhlLXZhbGxleSBl |
| 53 | eGFtcGxlIGF0dGVzdGF0aW9uIHJvb3QsIG5vdCBZdWJpY28wIBcNMjQxMjAxMDAw |
| 54 | MDAwWhgPOTk5OTEyMzEyMzU5NTlaMD0xOzA5BgNVBAMTMnRoZS12YWxsZXkgZXhh |
| 55 | bXBsZSBmOSBjZXJ0aWZpY2F0ZSwgbm90IGEgWXViaUtleSdzMCowBQYDK2VwAyEA |
| 56 | Meen8osipGPgf/7tu2vDRTLuy64wglsPaCcoQx/mPfujeTB3MA4GA1UdDwEB/wQE |
| 57 | AwICBDASBgNVHRMBAf8ECDAGAQH/AgEAMB0GA1UdDgQWBBTJSgRflS4fuzNMgQ8Z |
| 58 | X7Nr+znShjAfBgNVHSMEGDAWgBQijekYIu2T50x1FfsEQsCgXG6MaTARBgorBgEE |
| 59 | AYLECgMDBAMFBwQwBQYDK2VwA0EAwNl9U1R6NYF1Bhr5E0zTN2iIkONbtq8zqO5E |
| 60 | gNmETkG/yax7c2cuGo6uw/9egP5AT1EfGH1quK7VVyW6peIbBw== |
| 61 | -----END CERTIFICATE----- |
| 62 | """ |
| 63 | } |
| 64 | }, |
| 65 | { // the example laptop key |
| 66 | class: "ssh-ed25519" |
| 67 | bound: "host" |
| 68 | public: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDgoIskk25f2EYhLkPeJniiairVGv46CCYt2CUZ8EoxH" |
| 69 | }, |
| 70 | ] |
| 71 | grants: { |
| 72 | push: boundary: "push" |
| 73 | approve: boundary: "approve" |
| 74 | govern: boundary: "registry" |
| 75 | } |
| 76 | } |
| 77 | } |