1 | #!/bin/sh |
---|
2 | |
---|
3 | # geni s6_run_query |
---|
4 | # using aba_prover_yap |
---|
5 | |
---|
6 | echo "=====================s6_run_query==================" |
---|
7 | |
---|
8 | pwd=`pwd` |
---|
9 | |
---|
10 | eloc=`which abac_prover_yap | sed 's/\/abac_prover_yap//'` |
---|
11 | if [ "$eloc" = "" ]; then |
---|
12 | echo "ERROR: abac_prover_yap is not in the search path!!!" |
---|
13 | exit 1 |
---|
14 | fi |
---|
15 | |
---|
16 | keyloc=$pwd |
---|
17 | |
---|
18 | g=`creddy --keyid --cert $keyloc/G_ID.pem` |
---|
19 | pa=`creddy --keyid --cert $keyloc/PA_ID.pem` |
---|
20 | sa=`creddy --keyid --cert $keyloc/SA_ID.pem` |
---|
21 | |
---|
22 | drd=`creddy --keyid --cert $keyloc/Drd_ID.pem` |
---|
23 | frank=`creddy --keyid --cert $keyloc/Frank_ID.pem` |
---|
24 | dan=`creddy --keyid --cert $keyloc/Dan_ID.pem` |
---|
25 | alice=`creddy --keyid --cert $keyloc/Alice_ID.pem` |
---|
26 | |
---|
27 | ## dump all credentials |
---|
28 | env ABAC_CN=1 $eloc/abac_prover_yap --keystore $keyloc --dump s6_creds_dump |
---|
29 | |
---|
30 | # [keyid:SA].role:controlsQ("sliceA","info") <-?- [keyid:Frank] |
---|
31 | # runControlsQ Frank $frank good bad |
---|
32 | runControlsQ() { |
---|
33 | id=$2 |
---|
34 | role="[keyid:$sa].role:controlsQ([string:'sliceA'],[string:'info'])" |
---|
35 | prin="[keyid:$id]" |
---|
36 | echo "\n\n===$3============ SA.controlsQ('sliceA','info') <-?- $1" |
---|
37 | $eloc/abac_prover_yap --keystore $keyloc --role "$role" --principal "$prin" |
---|
38 | |
---|
39 | role="[keyid:$sa].role:controlsQ([string:'sliceA'],[string:'stop'])" |
---|
40 | prin="[keyid:$id]" |
---|
41 | echo "\n===$4============ SA.controlsQ('sliceA','stop') <-?- $1" |
---|
42 | $eloc/abac_prover_yap --keystore $keyloc --role "$role" --principal "$prin" |
---|
43 | } |
---|
44 | |
---|
45 | |
---|
46 | runControlsQ Drd $drd good good |
---|
47 | runControlsQ Frank $frank good bad |
---|
48 | runControlsQ Dan $dan bad bad |
---|
49 | runControlsQ Alice $alice good good |
---|
50 | |
---|
51 | echo "\n\n" |
---|
52 | |
---|
53 | |
---|