[7211a95] | 1 | # |
---|
| 2 | # This example shows how a parameterized role can be used to infer a role and |
---|
| 3 | # that the same role can also be directly assigned. The example has 4 |
---|
| 4 | # principals, the Acme company, a Coyote, a RoadRUnner and a Jackrabbit. |
---|
| 5 | # |
---|
| 6 | # The policy of the Acme company is that anyone the Acme company thinks is a |
---|
| 7 | # friend of the Roadrunner is a preferred customer. A friend of the roadrunner |
---|
| 8 | # has the [keyid:Acme}.role:friendOf([keyid:Roadrunner]) role, and a preferred |
---|
| 9 | # customer has the [keyid:Acme].role:preferred_customer role. |
---|
| 10 | # |
---|
| 11 | # This script creates the 4 and 3 credentials. Credential 1 lays out the rule |
---|
| 12 | # that friends of the Roadrunner are preferred customers. Credential 2 |
---|
| 13 | # directly makes the Coyote a preferred customer. Credential 3 recognizes that |
---|
| 14 | # Acme thinks that the Jackrabbit is the Roadrunner's friend. |
---|
| 15 | # |
---|
| 16 | # The attached ./run_query script tests whether the coyote is a friend of the |
---|
| 17 | # Roadrunner (which fails), whether the Jackrabbit is a friend of teh |
---|
| 18 | # Roadrunner (which succeeds), whether the Jackrabbit is a preferred customer |
---|
| 19 | # (which succeeds), whether the Coyote is a prefered customer (succeeds for a |
---|
| 20 | # different reason) and whether the system fails to load a bad certificate (it |
---|
| 21 | # does). |
---|
| 22 | |
---|
| 23 | # acme_friend_rt1 |
---|
| 24 | |
---|
| 25 | #[keyid:Acme].role:friendof([keyid:Roadrunner]) <-?- [keyid:Coyote] (no) |
---|
| 26 | #[keyid:Acme].role:preferred_customer <-?- [keyid:Jackrabbit] (yes) |
---|
| 27 | |
---|
| 28 | creddy --generate --cn Acme |
---|
| 29 | creddy --generate --cn Coyote |
---|
| 30 | creddy --generate --cn Roadrunner |
---|
| 31 | creddy --generate --cn Jackrabbit |
---|
| 32 | |
---|
| 33 | roadrunner_keyid=`creddy --keyid --cert Roadrunner_ID.pem` |
---|
| 34 | friendof_roadrunner="friendOf([keyid:$roadrunner_keyid])" |
---|
| 35 | |
---|
| 36 | #[keyid:Acme].role:preferred_customer <- [keyid:Acme].role:friendOf([keyid:Roadrunner]) |
---|
| 37 | |
---|
| 38 | #[keyid:Acme].role:prefered_customer <- [keyid:Coyote] |
---|
| 39 | |
---|
| 40 | #[keyid:Acme].role:friendOf([keyid:Roadrunner]) <- [keyid:Jackrabbit] |
---|
| 41 | |
---|