1 | #!/bin/sh |
---|
2 | |
---|
3 | ##################################################################### |
---|
4 | # scenario #5 |
---|
5 | # Explores relationship between slice and qualified controls |
---|
6 | # |
---|
7 | # Drd, a geniPI, created slices 'sliceA' and 'sliceB' |
---|
8 | # Drd grants controlsQ/info to Lisa |
---|
9 | # Drd grants controlsQ_/info and controlsQ_/stop to Tim |
---|
10 | # Drd grants delegate_controlsQ_/info to John and |
---|
11 | # delegate_controlsQ_/instantiate to Tim |
---|
12 | # SA grants controlsQ/info and controlsQ/stop to Dan |
---|
13 | # SA grants controlsQ_/info and controlsQ_/stop to Frank and |
---|
14 | # controlsQ_/instantiate to Frank |
---|
15 | # SA grants delegate_controlsQ_/info to James and delegate_controlsQ_/stop to Lisa |
---|
16 | # SA grants delegate_controlsQ_/info (sliceB) to John |
---|
17 | # SA grants controls(sliceB) to Dan |
---|
18 | # SA grants delegate_controls_(sliceB) to Lisa |
---|
19 | # John grants controlsQ_/info (sliceB) to James |
---|
20 | # John grants controlsQ/info (sliceB) to Joe |
---|
21 | # |
---|
22 | unset ABAC_CN |
---|
23 | keyloc=`pwd` |
---|
24 | sidx=s5 |
---|
25 | |
---|
26 | makeWho() { |
---|
27 | WHO=$1 |
---|
28 | rm -rf ${WHO}_*.pem |
---|
29 | creddy --generate --cn ${WHO} |
---|
30 | } |
---|
31 | makeWho GR |
---|
32 | makeWho IDP |
---|
33 | makeWho EXO |
---|
34 | makeWho Drd |
---|
35 | makeWho Frank |
---|
36 | makeWho Dan |
---|
37 | makeWho Lisa |
---|
38 | makeWho John |
---|
39 | makeWho Joe |
---|
40 | makeWho Tim |
---|
41 | makeWho James |
---|
42 | |
---|
43 | g=`creddy --keyid --cert $keyloc/G_ID.pem` |
---|
44 | gr=`creddy --keyid --cert $keyloc/GR_ID.pem` |
---|
45 | pa=`creddy --keyid --cert $keyloc/PA_ID.pem` |
---|
46 | sa=`creddy --keyid --cert $keyloc/SA_ID.pem` |
---|
47 | idp=`creddy --keyid --cert $keyloc/IDP_ID.pem` |
---|
48 | exo=`creddy --keyid --cert $keyloc/EXO_ID.pem` |
---|
49 | drd=`creddy --keyid --cert $keyloc/Drd_ID.pem` |
---|
50 | frank=`creddy --keyid --cert $keyloc/Frank_ID.pem` |
---|
51 | dan=`creddy --keyid --cert $keyloc/Dan_ID.pem` |
---|
52 | lisa=`creddy --keyid --cert $keyloc/Lisa_ID.pem` |
---|
53 | john=`creddy --keyid --cert $keyloc/John_ID.pem` |
---|
54 | joe=`creddy --keyid --cert $keyloc/Joe_ID.pem` |
---|
55 | tim=`creddy --keyid --cert $keyloc/Tim_ID.pem` |
---|
56 | james=`creddy --keyid --cert $keyloc/James_ID.pem` |
---|
57 | |
---|
58 | pname=${sidx}_yap_clauses |
---|
59 | namespace=access1 |
---|
60 | sfile=sfile_${sidx} |
---|
61 | |
---|
62 | idp_gUser() |
---|
63 | { |
---|
64 | eval "namename=[keyid:\$$1]" |
---|
65 | attr="[keyid:$idp].role:geniUser <- $namename" |
---|
66 | name=${sidx}_IDP_gUser__$1_attr.der |
---|
67 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
68 | } |
---|
69 | |
---|
70 | ## drd requesting a sliceA from sa |
---|
71 | ## makeSlice $drd sliceA Drd |
---|
72 | makeSlice() { |
---|
73 | what="'$2'" |
---|
74 | # Drd.slice <- 'sliceA' |
---|
75 | attr="[keyid:$1].oset:slice <- [string:$what]" |
---|
76 | name=${sidx}_$3_slice__$2_attr.der |
---|
77 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
78 | # SA.standard <- 'sliceA' |
---|
79 | attr="[keyid:$sa].oset:standard <- [string:$what]" |
---|
80 | name=${sidx}_SA_standard__$2_attr.der |
---|
81 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
82 | # SA.owner('sliceA') <- Drd |
---|
83 | attr="[keyid:$sa].role:owner([string:$what]) <- [keyid:$1]" |
---|
84 | name=${sidx}_SA_owner_$2__$3_attr.der |
---|
85 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
86 | # SA.root('sliceA') <-Drd |
---|
87 | attr="[keyid:$sa].role:root([string:$what]) <- [keyid:$1]" |
---|
88 | name=${sidx}_SA_root_$2__$3_attr.der |
---|
89 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
90 | } |
---|
91 | |
---|
92 | ############################################################################### |
---|
93 | echo "s/$g/G/g " > $sfile |
---|
94 | echo "s/$gr/GR/g " >> $sfile |
---|
95 | echo "s/$sa/SA/g " >> $sfile |
---|
96 | echo "s/$sa/SA/g " >> $sfile |
---|
97 | echo "s/$idp/IDP/g " >> $sfile |
---|
98 | echo "s/$exo/EXO/g " >> $sfile |
---|
99 | echo "s/$drd/Drd/g " >> $sfile |
---|
100 | echo "s/$frank/Frank/g " >> $sfile |
---|
101 | echo "s/$dan/Dan/g " >> $sfile |
---|
102 | echo "s/$lisa/Lisa/g " >> $sfile |
---|
103 | echo "s/$john/John/g " >> $sfile |
---|
104 | echo "s/$joe/Joe/g " >> $sfile |
---|
105 | echo "s/$tim/Tim/g " >> $sfile |
---|
106 | echo "s/$james/James/g " >> $sfile |
---|
107 | |
---|
108 | # G.geniRoot <- GR |
---|
109 | attr="[keyid:$g].role:geniRoot <- [keyid:$gr]" |
---|
110 | name=${sidx}_G_geniRoot__gr_attr.der |
---|
111 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
112 | |
---|
113 | # GR.sliceAuthorithority <- SA |
---|
114 | attr="[keyid:$gr].role:sliceAuthority <- [keyid:$sa]" |
---|
115 | name=${sidx}_GR_sliceAuthority__sa_attr.der |
---|
116 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
117 | |
---|
118 | # GR.identityProvider <- IDP |
---|
119 | attr="[keyid:$gr].role:identityProvider <- [keyid:$idp]" |
---|
120 | name=${sidx}_GR_identityProvider__idp_attr.der |
---|
121 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
122 | |
---|
123 | # GR.projectAuthority <- PA |
---|
124 | attr="[keyid:$gr].role:projectAuthority <- [keyid:$pa]" |
---|
125 | name=${sidx}_GR_projAuthority__pa_attr.der |
---|
126 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
127 | |
---|
128 | # GR.aggregate <- EXO |
---|
129 | attr="[keyid:$gr].role:aggregate <- [keyid:$exo]" |
---|
130 | name=${sidx}_GR_aggregate__exo_attr.der |
---|
131 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
132 | |
---|
133 | # IDP.geniUser <- Drd |
---|
134 | idp_gUser drd |
---|
135 | # IDP.geniUser <- Frank |
---|
136 | idp_gUser frank |
---|
137 | # IDP.geniUser <- Dan |
---|
138 | idp_gUser dan |
---|
139 | # IDP.geniUser <- Lisa |
---|
140 | idp_gUser lisa |
---|
141 | # IDP.geniUser <- John |
---|
142 | idp_gUser john |
---|
143 | # IDP.geniUser <- Joe |
---|
144 | idp_gUser joe |
---|
145 | # IDP.geniUser <- Tim |
---|
146 | idp_gUser tim |
---|
147 | # IDP.geniUser <- James |
---|
148 | idp_gUser james |
---|
149 | |
---|
150 | # IDP.geniPI <- Drd |
---|
151 | attr="[keyid:$idp].role:geniPI <- [keyid:$drd]" |
---|
152 | name=${sidx}_IDP_geniPI__drd_attr.der |
---|
153 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
154 | |
---|
155 | ## drd requesting a sliceB from sa |
---|
156 | makeSlice $drd sliceB Drd |
---|
157 | ## drd requesting a sliceA from sa |
---|
158 | makeSlice $drd sliceA Drd |
---|
159 | |
---|
160 | ## SA gives controlsQ/info permission on sliceA to Dan |
---|
161 | attr="[keyid:$sa].role:controlsQ([string:'sliceA'],[string:'info']) <- [keyid:$dan]" |
---|
162 | name=${sidx}_SA_controlsQ_sliceA_info__dan_attr.der |
---|
163 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
164 | |
---|
165 | ## SA gives controlsQ/stop permission on sliceA to Dan |
---|
166 | attr="[keyid:$sa].role:controlsQ([string:'sliceA'],[string:'stop']) <- [keyid:$dan]" |
---|
167 | name=${sidx}_SA_controlsQ_sliceA_stop__dan_attr.der |
---|
168 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
169 | |
---|
170 | ## SA gives controlsQ/instantiate permission on sliceA to Frank |
---|
171 | attr="[keyid:$sa].role:controlsQ([string:'sliceA'],[string:'instantiate']) <- [keyid:$frank]" |
---|
172 | name=${sidx}_SA_controlsQ_sliceA_instantiate__frank_attr.der |
---|
173 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
174 | |
---|
175 | ## SA gives controlsQ_/info permission on sliceA to Frank |
---|
176 | attr="[keyid:$sa].role:controlsQ_([string:'sliceA'],[string:'info']) <- [keyid:$frank]" |
---|
177 | name=${sidx}_SA_controlsQDel_sliceA__info_frank_attr.der |
---|
178 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
179 | |
---|
180 | ## SA gives controlsQ_/stop permission on sliceA to Frank |
---|
181 | attr="[keyid:$sa].role:controlsQ_([string:'sliceA'],[string:'stop']) <- [keyid:$frank]" |
---|
182 | name=${sidx}_SA_controlsQDel_sliceA__stop_frank_attr.der |
---|
183 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
184 | |
---|
185 | ## SA gives controlsQ_/instantiate permission on sliceA to John |
---|
186 | attr="[keyid:$sa].role:controlsQ_([string:'sliceA'],[string:'instantiate']) <- [keyid:$john]" |
---|
187 | name=${sidx}_SA_controlsQDel_sliceA_instantiate__john_attr.der |
---|
188 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
189 | |
---|
190 | ## SA gives delegate_controlsQ_/info permission on sliceA to James |
---|
191 | attr="[keyid:$sa].role:delegate_controlsQ_([string:'sliceA'],[string:'info']) <- [keyid:$james]" |
---|
192 | name=${sidx}_SA_delcontrolsQDel_sliceA_info__james_attr.der |
---|
193 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
194 | |
---|
195 | ## SA gives delegate_controlsQ_/stop permission on sliceA to Lisa |
---|
196 | attr="[keyid:$sa].role:delegate_controlsQ_([string:'sliceA'],[string:'stop']) <- [keyid:$lisa]" |
---|
197 | name=${sidx}_SA_delcontrolsQDel_sliceA_stop__lisa_attr.der |
---|
198 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
199 | |
---|
200 | ## SA gives controls permission on sliceB to Dan |
---|
201 | attr="[keyid:$sa].role:controls([string:'sliceB']) <- [keyid:$dan]" |
---|
202 | name=${sidx}_SA_controls_sliceB__dan_attr.der |
---|
203 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
204 | |
---|
205 | # SA grants delegate_controls_(sliceB) to Lisa |
---|
206 | attr="[keyid:$sa].role:delegate_controls_([string:'sliceB']) <- [keyid:$lisa]" |
---|
207 | name=${sidx}_SA_delcontrols_sliceB__lisa_attr.der |
---|
208 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
209 | |
---|
210 | ## Drd gives controlsQ/info permission on sliceA to Lisa |
---|
211 | attr="[keyid:$drd].role:controlsQ([string:'sliceA'],[string:'info']) <- [keyid:$lisa]" |
---|
212 | name=${sidx}_Drd_controlsQ_sliceA_info__lisa_attr.der |
---|
213 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
214 | |
---|
215 | ## Drd gives controlsQ/stop permission on sliceA to James |
---|
216 | attr="[keyid:$drd].role:controlsQ([string:'sliceA'],[string:'stop']) <- [keyid:$james]" |
---|
217 | name=${sidx}_Drd_controlsQ_sliceA_stop__james_attr.der |
---|
218 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
219 | |
---|
220 | ## Drd gives controlsQ_/info permission on sliceA to Tim |
---|
221 | attr="[keyid:$drd].role:controlsQ_([string:'sliceA'],[string:'info']) <- [keyid:$tim]" |
---|
222 | name=${sidx}_Drd_controlsQDel_sliceA_info__tim_attr.der |
---|
223 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
224 | |
---|
225 | ## Drd gives controlsQ/info permission on sliceA to Lisa |
---|
226 | attr="[keyid:$drd].role:controlsQ([string:'sliceA'],[string:'info']) <- [keyid:$lisa]" |
---|
227 | name=${sidx}_Drd_controlsQ_sliceA_info__lisa_attr.der |
---|
228 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
229 | |
---|
230 | ## Drd gives controlsQ_/stop permission on sliceA to Tim |
---|
231 | attr="[keyid:$drd].role:controlsQ_([string:'sliceA'],[string:'stop']) <- [keyid:$tim]" |
---|
232 | name=${sidx}_Drd_controlsQDel_sliceA_stop__tim_attr.der |
---|
233 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
234 | |
---|
235 | ## Drd gives delegate_controlsQ_/info permission on sliceA to John |
---|
236 | attr="[keyid:$drd].role:delegate_controlsQ_([string:'sliceA'],[string:'info']) <- [keyid:$john]" |
---|
237 | name=${sidx}_Drd_delcontrolsQDel_sliceA_info__john_attr.der |
---|
238 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
239 | |
---|
240 | ## Drd gives delegate_controlsQ_/instantiate permission on sliceA to Tim |
---|
241 | attr="[keyid:$drd].role:delegate_controlsQ_([string:'sliceA'],[string:'instantiate']) <- [keyid:$tim]" |
---|
242 | name=${sidx}_Drd_delcontrolsQDel_sliceA_instantiate__tim_attr.der |
---|
243 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
244 | |
---|
245 | |
---|
246 | ## SA gives info delegate_controlsQ_/info permission on sliceB to John |
---|
247 | attr="[keyid:$sa].role:delegate_controlsQ_([string:'sliceB'],[string:'info']) <- [keyid:$john]" |
---|
248 | name=${sidx}_Drd_delcontrolsQDel_sliceB_info__john_attr.der |
---|
249 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
250 | |
---|
251 | ## John gives controlsQ_/info permission on sliceB to James |
---|
252 | attr="[keyid:$john].role:controlsQ_([string:'sliceB'],[string:'info']) <- [keyid:$james]" |
---|
253 | name=${sidx}_SA_controlsQDel_sliceB_info__james_attr.der |
---|
254 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
255 | |
---|
256 | ## John gives controlsQ/info permission on sliceB to Joe |
---|
257 | attr="[keyid:$john].role:controlsQ([string:'sliceB'],[string:'info']) <- [keyid:$joe]" |
---|
258 | name=${sidx}_SA_controlsQ_sliceB_info__joe_attr.der |
---|
259 | creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace |
---|
260 | |
---|
261 | |
---|