[461541a] | 1 | #!/bin/sh |
---|
| 2 | |
---|
| 3 | pwd=`pwd` |
---|
| 4 | eloc=`which abac_prover | sed 's/\/abac_prover//'` |
---|
| 5 | if [ "$eloc" = "" ]; then |
---|
| 6 | echo "ERROR: abac_prover is not in the search path!!!" |
---|
| 7 | exit 1 |
---|
| 8 | fi |
---|
| 9 | |
---|
| 10 | keyloc=$pwd |
---|
| 11 | |
---|
| 12 | acme=`creddy --keyid --cert $keyloc/Acme_ID.pem` |
---|
| 13 | coyote=`creddy --keyid --cert $keyloc/Coyote_ID.pem` |
---|
| 14 | |
---|
| 15 | preferred_customer="$acme.preferred_customer" |
---|
| 16 | buy_rockets="$acme.buy_rockets" |
---|
| 17 | coyote_prin="$coyote" |
---|
| 18 | friend="$acme.friend" |
---|
| 19 | acme_prin="$acme" |
---|
| 20 | |
---|
| 21 | #[keyid:Acme].role:preferred_customer <-?- [keyid:Coyote] |
---|
| 22 | #isMember(pCoyote, role(pAcme,preferred_customer), C). |
---|
| 23 | echo " " |
---|
| 24 | echo "===good============ Acme.preferred_customer <- Coyote" |
---|
| 25 | $eloc/abac_prover --keystore $keyloc \ |
---|
| 26 | --role "$preferred_customer" --principal "$coyote_prin" |
---|
| 27 | |
---|
| 28 | #[keyid:Acme].role:buy_rockets <-?- [keyid:Coyote] |
---|
| 29 | #isMember(pCoyote, role(pAcme,buy_rockets), C). |
---|
| 30 | echo " " |
---|
| 31 | echo "===good=============== Acme.buy_rockets <- Coyote" |
---|
| 32 | $eloc/abac_prover --keystore $keyloc \ |
---|
| 33 | --role "$buy_rockets" --principal "$coyote_prin" |
---|
| 34 | |
---|
| 35 | ## this is not suppose to work |
---|
| 36 | #[keyid:Acme].role:buy_rockets <-?- [keyid:Acme].role:preferred_customer |
---|
| 37 | echo " " |
---|
| 38 | echo "===bad=============== Acme.buy_rockets <- Acme.preferred_customer" |
---|
| 39 | $eloc/abac_prover --keystore $keyloc \ |
---|
| 40 | --role "$buy_rockets" --principal "$preferred_customer" |
---|
| 41 | |
---|
| 42 | #[keyid:Coyote].role:friend <-?- [keyid:Acme] |
---|
| 43 | #isMember(pAcme, role(pCoyote,friend), C). |
---|
| 44 | echo " " |
---|
| 45 | echo "===bad=============== Coyote.friend <- Acme" |
---|
| 46 | $eloc/abac_prover --keystore $keyloc \ |
---|
| 47 | --role "$friend" --principal "$acme_prin" |
---|
| 48 | |
---|