1 | #!/bin/sh |
---|
2 | |
---|
3 | ##################################################################### |
---|
4 | # scenario #6 |
---|
5 | # Explores relationship between slice, createSlice, gmoc and |
---|
6 | # projects |
---|
7 | # |
---|
8 | # Drd is the owner of proj1, a standard project |
---|
9 | # Drd grants memberQ/instantiate permission to Dan |
---|
10 | # Drd grants memberQ/info permission to Frank |
---|
11 | # SA let Dan be a geniProxy |
---|
12 | # SA accepts PA as the projectAuthority |
---|
13 | # SA accepts Alice as a gmoc |
---|
14 | # SA accepts SliceA as a stadard slice and proj1 as standard project |
---|
15 | # SA let Dan speaks for Drd |
---|
16 | # Lisa is a geniProxy and speaks for Frank |
---|
17 | # |
---|
18 | unset ABAC_CN |
---|
19 | keyloc=`pwd` |
---|
20 | sidx=s6 |
---|
21 | |
---|
22 | makeWho() { |
---|
23 | WHO=$1 |
---|
24 | rm -rf ${WHO}_*.pem |
---|
25 | creddy --generate --cn ${WHO} |
---|
26 | } |
---|
27 | makeWho GR |
---|
28 | makeWho IDP |
---|
29 | makeWho EXO |
---|
30 | makeWho GM |
---|
31 | makeWho Drd |
---|
32 | makeWho Dan |
---|
33 | makeWho Frank |
---|
34 | makeWho Alice |
---|
35 | makeWho Lisa |
---|
36 | |
---|
37 | g=`creddy --keyid --cert $keyloc/G_ID.pem` |
---|
38 | gr=`creddy --keyid --cert $keyloc/GR_ID.pem` |
---|
39 | pa=`creddy --keyid --cert $keyloc/PA_ID.pem` |
---|
40 | sa=`creddy --keyid --cert $keyloc/SA_ID.pem` |
---|
41 | idp=`creddy --keyid --cert $keyloc/IDP_ID.pem` |
---|
42 | exo=`creddy --keyid --cert $keyloc/EXO_ID.pem` |
---|
43 | gm=`creddy --keyid --cert $keyloc/GM_ID.pem` |
---|
44 | drd=`creddy --keyid --cert $keyloc/Drd_ID.pem` |
---|
45 | dan=`creddy --keyid --cert $keyloc/Dan_ID.pem` |
---|
46 | frank=`creddy --keyid --cert $keyloc/Frank_ID.pem` |
---|
47 | alice=`creddy --keyid --cert $keyloc/Alice_ID.pem` |
---|
48 | lisa=`creddy --keyid --cert $keyloc/Lisa_ID.pem` |
---|
49 | |
---|
50 | pname=${sidx}_yap_clauses |
---|
51 | namespace=access1 |
---|
52 | sfile=sfile_${sidx} |
---|
53 | |
---|
54 | sa_gUser() |
---|
55 | { |
---|
56 | eval "namename=[keyid:\$$1]" |
---|
57 | attr="[keyid:$sa].role:geniUser <- $namename" |
---|
58 | name=${sidx}_SA_gUser__$1_attr.der |
---|
59 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
60 | } |
---|
61 | |
---|
62 | ## drd requesting a sliceA from sa |
---|
63 | ## makeSlice $drd proj1 sliceA Drd |
---|
64 | makeSlice() { |
---|
65 | proj="'$2'" |
---|
66 | what="'$3'" |
---|
67 | # SA.qualifiedProject <- 'proj1' |
---|
68 | attr="[keyid:$sa].oset:qualifiedProject <- [string:$proj]" |
---|
69 | name=${sidx}_SA_qualProject__$2_attr.der |
---|
70 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
71 | # SA.inProject('proj1') <- 'sliceA' |
---|
72 | attr="[keyid:$sa].oset:inProject([string:$proj]) <- [string:$what]" |
---|
73 | name=${sidx}_SA_inProject_$2__$3_attr.der |
---|
74 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
75 | # Drd.slice <- 'sliceA' |
---|
76 | attr="[keyid:$1].oset:slice <- [string:$what]" |
---|
77 | name=${sidx}_$4_slice__$3_attr.der |
---|
78 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
79 | # SA.standard <- 'sliceA' |
---|
80 | attr="[keyid:$sa].oset:standard <- [string:$what]" |
---|
81 | name=${sidx}_SA_standard__$2_attr.der |
---|
82 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
83 | # SA.owner('sliceA') <- Drd |
---|
84 | attr="[keyid:$sa].role:owner([string:$what]) <- [keyid:$1]" |
---|
85 | name=${sidx}_SA_owner_$2__$3_attr.der |
---|
86 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
87 | # SA.root('sliceA') <-Drd |
---|
88 | attr="[keyid:$sa].role:root([string:$what]) <- [keyid:$1]" |
---|
89 | name=${sidx}_SA_root_$2__$3_attr.der |
---|
90 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
91 | } |
---|
92 | |
---|
93 | ## drd requesting a proj1 from pa |
---|
94 | ## makeProject $drd proj1 Drd |
---|
95 | makeProject() { |
---|
96 | what="'$2'" |
---|
97 | # Drd.project <- 'proj1' |
---|
98 | attr="[keyid:$1].oset:project <- [string:$what]" |
---|
99 | name=${sidx}_$3_project__$2_attr.der |
---|
100 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
101 | # PA.standard <- 'proj1' |
---|
102 | attr="[keyid:$pa].oset:standard <- [string:$what]" |
---|
103 | name=${sidx}_PA_standard__$2_attr.der |
---|
104 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
105 | # PA.owner('proj1') <- Drd |
---|
106 | attr="[keyid:$pa].role:owner([string:$what]) <- [keyid:$1]" |
---|
107 | name=${sidx}_PA_owner_$2__$3_attr.der |
---|
108 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
109 | # PA.root('proj1') <-Drd |
---|
110 | attr="[keyid:$pa].role:root([string:$what]) <- [keyid:$1]" |
---|
111 | name=${sidx}_PA_root_$2__$3_attr.der |
---|
112 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
113 | } |
---|
114 | |
---|
115 | |
---|
116 | ############################################################################### |
---|
117 | echo "s/$g/G/g " > $sfile |
---|
118 | echo "s/$gr/GR/g " >> $sfile |
---|
119 | echo "s/$sa/SA/g " >> $sfile |
---|
120 | echo "s/$pa/PA/g " >> $sfile |
---|
121 | echo "s/$idp/IDP/g " >> $sfile |
---|
122 | echo "s/$exo/EXO/g " >> $sfile |
---|
123 | echo "s/$gm/GM/g " >> $sfile |
---|
124 | echo "s/$drd/Drd/g " >> $sfile |
---|
125 | echo "s/$dan/Dan/g " >> $sfile |
---|
126 | echo "s/$frank/Frank/g " >> $sfile |
---|
127 | echo "s/$alice/Alice/g " >> $sfile |
---|
128 | echo "s/$lisa/Lisa/g " >> $sfile |
---|
129 | |
---|
130 | # SA.geniProxy <- Lisa |
---|
131 | attr="[keyid:$sa].role:geniProxy <- [keyid:$lisa]" |
---|
132 | name=${sidx}_SA_gProxy__lisa_attr.der |
---|
133 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
134 | |
---|
135 | # G.geniRoot <- GR |
---|
136 | attr="[keyid:$g].role:geniRoot <- [keyid:$gr]" |
---|
137 | name=${sidx}_G_geniRoot__gr_attr.der |
---|
138 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
139 | |
---|
140 | # GR.sliceAuthorithority <- SA |
---|
141 | attr="[keyid:$gr].role:sliceAuthority <- [keyid:$sa]" |
---|
142 | name=${sidx}_GR_sliceAuthority__sa_attr.der |
---|
143 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
144 | |
---|
145 | # GR.identityProvider <- IDP |
---|
146 | attr="[keyid:$gr].role:identityProvider <- [keyid:$idp]" |
---|
147 | name=${sidx}_GR_identityProvider__idp_attr.der |
---|
148 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
149 | |
---|
150 | # GR.projectAuthority <- PA |
---|
151 | attr="[keyid:$gr].role:projectAuthority <- [keyid:$pa]" |
---|
152 | name=${sidx}_GR_projAuthority__pa_attr.der |
---|
153 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
154 | |
---|
155 | #???, SA trusts PA as the projectAuthority |
---|
156 | # SA.projectAuthority <- PA |
---|
157 | attr="[keyid:$sa].role:projectAuthority <- [keyid:$pa]" |
---|
158 | name=${sidx}_SA_projAuthority__pa_attr.der |
---|
159 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
160 | |
---|
161 | # SA.gmoc <- Alice |
---|
162 | attr="[keyid:$sa].role:gmoc <- [keyid:$alice]" |
---|
163 | name=${sidx}_SA_gmoc__alice_attr.der |
---|
164 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
165 | |
---|
166 | |
---|
167 | # GR.aggregate <- EXO |
---|
168 | attr="[keyid:$gr].role:aggregate <- [keyid:$exo]" |
---|
169 | name=${sidx}_GR_aggregate__exo_attr.der |
---|
170 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
171 | |
---|
172 | # IDP.geniUser <- Drd |
---|
173 | sa_gUser drd |
---|
174 | sa_gUser dan |
---|
175 | sa_gUser frank |
---|
176 | |
---|
177 | makeProject $drd proj1 Drd |
---|
178 | makeSlice $drd proj1 sliceA Drd |
---|
179 | |
---|
180 | # IDP.geniPI <- Drd |
---|
181 | attr="[keyid:$idp].role:geniPI <- [keyid:$drd]" |
---|
182 | name=${sidx}_IDP_geniPI__drd_attr.der |
---|
183 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
184 | |
---|
185 | ## Drd gives memberQ/instantiate permission on proj1 to Dan |
---|
186 | attr="[keyid:$drd].role:memberQ([string:'proj1'],[string:'instantiate']) <- [keyid:$dan]" |
---|
187 | name=${sidx}_PA_memberQ_proj1_instantiate__dan_attr.der |
---|
188 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
189 | |
---|
190 | ## Drd gives memberQ/info permission on proj1 to Frank |
---|
191 | attr="[keyid:$drd].role:memberQ([string:'proj1'],[string:'info']) <- [keyid:$frank]" |
---|
192 | name=${sidx}_PA_memberQ_proj1_info__frank_attr.der |
---|
193 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
194 | |
---|
195 | ## SA let Dan speaks for Drd |
---|
196 | attr="[keyid:$sa].role:speaksFor([keyid:$dan]) <- [keyid:$lisa]" |
---|
197 | name=${sidx}_SA_speaksfor_dan__lisa_attr.der |
---|
198 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
199 | |
---|
200 | |
---|
201 | |
---|
202 | |
---|