source: examples/access_tests/creddy_prover/scenario_s6.sh @ 11ca336

mei_rt2
Last change on this file since 11ca336 was 2e9455f, checked in by Mei <mei@…>, 11 years ago

1) added namespace
2) tweak ?This,
3) allowing linking role/oset as constraining conditions
4) adding access_tests regression testing that uses GENI's access policy
5) added couple multi contexts regression tests
6) add compression/uncompression calls to abac_encode_string/abac_decode_string
(libstrongwan only allows 512 char for attribute rule storage)
7) add attribute_now option to creddy that takes a whole char string for attribute
rule

  • Property mode set to 100755
File size: 7.3 KB
Line 
1#!/bin/sh
2
3#####################################################################
4# scenario #6
5#     Explores relationship between slice, createSlice, and 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#
18unset ABAC_CN
19keyloc=`pwd`
20sidx=s6
21
22makeWho() {
23    WHO=$1
24    rm -rf ${WHO}_*.pem
25    creddy --generate --cn ${WHO}
26}
27makeWho GR
28makeWho IDP
29makeWho EXO
30makeWho GM
31makeWho Drd
32makeWho Dan
33makeWho Frank
34makeWho Alice
35makeWho Lisa
36
37g=`creddy --keyid --cert $keyloc/G_ID.pem`
38gr=`creddy --keyid --cert $keyloc/GR_ID.pem`
39pa=`creddy --keyid --cert $keyloc/PA_ID.pem`
40sa=`creddy --keyid --cert $keyloc/SA_ID.pem`
41idp=`creddy --keyid --cert $keyloc/IDP_ID.pem`
42exo=`creddy --keyid --cert $keyloc/EXO_ID.pem`
43gm=`creddy --keyid --cert $keyloc/GM_ID.pem`
44drd=`creddy --keyid --cert $keyloc/Drd_ID.pem`
45dan=`creddy --keyid --cert $keyloc/Dan_ID.pem`
46frank=`creddy --keyid --cert $keyloc/Frank_ID.pem`
47alice=`creddy --keyid --cert $keyloc/Alice_ID.pem`
48lisa=`creddy --keyid --cert $keyloc/Lisa_ID.pem`
49
50pname=${sidx}_yap_clauses
51namespace=access1
52sfile=sfile_${sidx}
53
54sa_gUser()
55{
56eval "namename=[keyid:\$$1]"
57attr="[keyid:$sa].role:geniUser <- $namename"
58name=${sidx}_SA_gUser__$1_attr.der
59creddy --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
64makeSlice() {
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
95makeProject() {
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###############################################################################
117echo "s/$g/G/g "  > $sfile 
118echo "s/$gr/GR/g "  >> $sfile 
119echo "s/$sa/SA/g "  >> $sfile
120echo "s/$pa/PA/g "  >> $sfile
121echo "s/$idp/IDP/g "  >> $sfile
122echo "s/$exo/EXO/g "  >> $sfile
123echo "s/$gm/GM/g "  >> $sfile
124echo "s/$drd/Drd/g "  >> $sfile
125echo "s/$dan/Dan/g "  >> $sfile
126echo "s/$frank/Frank/g "  >> $sfile
127echo "s/$alice/Alice/g "  >> $sfile
128echo "s/$lisa/Lisa/g "  >> $sfile
129
130# SA.geniProxy <- Lisa
131attr="[keyid:$sa].role:geniProxy <- [keyid:$lisa]"
132name=${sidx}_SA_gProxy__lisa_attr.der
133creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace
134
135# G.geniRoot <- GR
136attr="[keyid:$g].role:geniRoot <- [keyid:$gr]"
137name=${sidx}_G_geniRoot__gr_attr.der
138creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace
139
140# GR.sliceAuthorithority <- SA
141attr="[keyid:$gr].role:sliceAuthority <- [keyid:$sa]"
142name=${sidx}_GR_sliceAuthority__sa_attr.der
143creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace
144
145# GR.identityProvider <- IDP
146attr="[keyid:$gr].role:identityProvider <- [keyid:$idp]"
147name=${sidx}_GR_identityProvider__idp_attr.der
148creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace
149
150# GR.projectAuthority <- PA
151attr="[keyid:$gr].role:projectAuthority <- [keyid:$pa]"
152name=${sidx}_GR_projAuthority__pa_attr.der
153creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace
154
155#???, SA trusts PA as the projectAuthority
156# SA.projectAuthority <- PA
157attr="[keyid:$sa].role:projectAuthority <- [keyid:$pa]"
158name=${sidx}_SA_projAuthority__pa_attr.der
159creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace
160
161# SA.gmoc <- Alice
162attr="[keyid:$sa].role:gmoc <- [keyid:$alice]"
163name=${sidx}_SA_gmoc__alice_attr.der
164creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace
165
166
167# GR.aggregate <- EXO
168attr="[keyid:$gr].role:aggregate <- [keyid:$exo]"
169name=${sidx}_GR_aggregate__exo_attr.der
170creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace
171
172# IDP.geniUser <- Drd
173sa_gUser drd
174sa_gUser dan
175sa_gUser frank
176
177makeProject $drd proj1 Drd
178makeSlice $drd proj1 sliceA Drd
179
180# IDP.geniPI <- Drd
181attr="[keyid:$idp].role:geniPI <- [keyid:$drd]"
182name=${sidx}_IDP_geniPI__drd_attr.der
183creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace
184
185## Drd gives memberQ/instantiate permission on proj1 to Dan
186attr="[keyid:$drd].role:memberQ([string:'proj1'],[string:'instantiate']) <- [keyid:$dan]"
187name=${sidx}_PA_memberQ_proj1_instantiate__dan_attr.der
188creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace
189
190## Drd gives memberQ/info permission on proj1 to Frank
191attr="[keyid:$drd].role:memberQ([string:'proj1'],[string:'info']) <- [keyid:$frank]"
192name=${sidx}_PA_memberQ_proj1_info__frank_attr.der
193creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace
194
195## SA let Dan speaks for Drd
196## SA.speaksFor(?C:(SA.projectAuthority).memberQ(?P, "instantiate"))
197attr="[keyid:$sa].role:speaksFor([keyid:$dan]) <- [keyid:$lisa]"
198name=${sidx}_SA_speaksfor_dan__lisa_attr.der
199creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace
200
201
202
203
Note: See TracBrowser for help on using the repository browser.