1 | #!/bin/sh |
---|
2 | |
---|
3 | # geni s4_run_query |
---|
4 | # using aba_prover_yap |
---|
5 | |
---|
6 | echo "=====================s4_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 | sa=`creddy --keyid --cert $keyloc/SA_ID.pem` |
---|
20 | |
---|
21 | drd=`creddy --keyid --cert $keyloc/Drd_ID.pem` |
---|
22 | frank=`creddy --keyid --cert $keyloc/Frank_ID.pem` |
---|
23 | dan=`creddy --keyid --cert $keyloc/Dan_ID.pem` |
---|
24 | jim=`creddy --keyid --cert $keyloc/Jim_ID.pem` |
---|
25 | nancy=`creddy --keyid --cert $keyloc/Nancy_ID.pem` |
---|
26 | lisa=`creddy --keyid --cert $keyloc/Lisa_ID.pem` |
---|
27 | cary=`creddy --keyid --cert $keyloc/Cary_ID.pem` |
---|
28 | alice=`creddy --keyid --cert $keyloc/Alice_ID.pem` |
---|
29 | |
---|
30 | ## dump all credentials |
---|
31 | env ABAC_CN=1 $eloc/abac_prover_yap --keystore $keyloc --dump s4_creds_dump |
---|
32 | |
---|
33 | # runControls Cary $cary slice good bad |
---|
34 | runControls() { |
---|
35 | id=$2 |
---|
36 | slice="'$3'" |
---|
37 | role="[keyid:$sa].role:controls_([string:$slice])" |
---|
38 | prin="[keyid:$id]" |
---|
39 | echo " " |
---|
40 | echo "===$4============ SA.controls_($3)<-?-$1" |
---|
41 | $eloc/abac_prover_yap --keystore $keyloc --role "$role" --principal "$prin" |
---|
42 | |
---|
43 | role="[keyid:$sa].role:controls([string:$slice])" |
---|
44 | prin="[keyid:$id]" |
---|
45 | echo " " |
---|
46 | echo "===$5============ SA.controls("$3")<-?-$1" |
---|
47 | $eloc/abac_prover_yap --keystore $keyloc --role "$role" --principal "$prin" |
---|
48 | } |
---|
49 | |
---|
50 | |
---|
51 | ## SA.controls_("sliceA") <- Cary |
---|
52 | #[keyid:SA].role:controls_([string:'sliceA']) <-?- [keyid:Cary] |
---|
53 | ## SA.controls("sliceA") <- Cary |
---|
54 | #[keyid:SA].role:controls([string:'sliceA']) <-?- [keyid:Cary] |
---|
55 | |
---|
56 | runControls Frank $frank sliceA bad good |
---|
57 | runControls Dan $dan sliceA good good |
---|
58 | runControls Dan $dan sliceB good good |
---|
59 | runControls Jim $jim sliceA bad good |
---|
60 | runControls Nancy $nancy sliceA good good |
---|
61 | runControls Lisa $lisa sliceA bad good |
---|
62 | runControls Cary $cary sliceA bad good |
---|
63 | runControls Alice $alice sliceA good good |
---|
64 | runControls Drd $drd sliceA good good |
---|
65 | |
---|
66 | echo "\n\n" |
---|