[ba6027a] | 1 | #!/bin/sh |
---|
| 2 | # |
---|
| 3 | # The example makes use of 2 principals, Acme and Coyote. |
---|
| 4 | # |
---|
| 5 | # This example shows a very simple delegation of roles by Acme. Acme's |
---|
| 6 | # buy_rockets role includes all of Acme's preferred customers. The example |
---|
| 7 | # creates the principals and 2 credentials. Credential 1 encodes the policy |
---|
| 8 | # that all of Acme's preferred customers can buy rockets from Acme and |
---|
| 9 | # Credential 2 defines the Coyote as an Acme preferred customer. |
---|
| 10 | # |
---|
| 11 | # In addition, Acme principal credential is base on a private key that is |
---|
| 12 | # encrypted with a passphrase (this is made by using an externally generated |
---|
| 13 | # private key using openssl) |
---|
| 14 | # |
---|
| 15 | |
---|
| 16 | # The ./run_query script issues queries to show that the Coyote is both a preferred |
---|
| 17 | # customer and can buy rockets. Two invalid queries are also made, checking if |
---|
| 18 | # Acme is the Coyote's friend, which it isn't and whether a query about |
---|
| 19 | # something other than a principal works (it doesn't). |
---|
| 20 | |
---|
| 21 | # acme_rockets_rt0 |
---|
| 22 | |
---|
| 23 | creddy --generate --cn Acme --key Acme_private.pem --p=pfile |
---|
| 24 | creddy --generate --cn Coyote |
---|
| 25 | |
---|
| 26 | #[keyid:Acme].role:buy_rockets <- [keyid:Acme].role:preferred_customer |
---|
| 27 | # Credential 1 |
---|
| 28 | creddy --attribute \ |
---|
| 29 | --issuer Acme_ID.pem --key Acme_private.pem --p=pfile --role buy_rockets \ |
---|
| 30 | --subject-cert Acme_ID.pem --subject-role preferred_customer \ |
---|
| 31 | --out Acme_buy_rockets__Acme_preferred_customer_attr.der |
---|
| 32 | |
---|
| 33 | #[keyid:Acme].role:preferred_customer <- [keyid:Coyote] |
---|
| 34 | # Credential 2 |
---|
| 35 | creddy --attribute \ |
---|
| 36 | --issuer Acme_ID.pem --key Acme_private.pem --p=pfile --role preferred_customer \ |
---|
| 37 | --subject-cert Coyote_ID.pem \ |
---|
| 38 | --out Acme_preferred_customer__Coyote_attr.der |
---|
| 39 | |
---|