diff options
author | Andreas Ebner <pansy007@googlemail.com> | 2019-08-18 13:46:05 +0200 |
---|---|---|
committer | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2019-10-07 12:17:29 +0200 |
commit | 6ad2e1f1dce42e5c998425e80f48d512638e278e (patch) | |
tree | bb8e2d7d10aca751dc5711746c802c061846aff0 /src/credential/test_credential_bi_and.sh | |
parent | 7b749c91759eb75eda5cac1e02954cc82ef27db3 (diff) | |
download | gnunet-6ad2e1f1dce42e5c998425e80f48d512638e278e.tar.gz gnunet-6ad2e1f1dce42e5c998425e80f48d512638e278e.zip |
Bidirectional implementation finished, more complex tests for bidirectional, cleanup fix, todos done:
- fixed cleanup to not cause errors and uncommented it again
- added new tests for AND, linked roles and fw/bw
- fixed an older bug to make test ..own_and2.sh work
- replaced bidirectional matching of bw with unresolved_attribute.. (because it contains all the subject attributes/roles)
- introduced extra function for bidirectional match handling (is the same for bw and fw and pretty long)
- commandline: if not specified to use bw or fw search -> assume it's bidirectional
- moved the bidirecitonal matching list to vrh and removed it from being global
- valgrind on service (one error remaining, to be solved in future commits)
- use the vrh->dsq_head/tail for the cleanup stuff
Diffstat (limited to 'src/credential/test_credential_bi_and.sh')
-rwxr-xr-x | src/credential/test_credential_bi_and.sh | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/src/credential/test_credential_bi_and.sh b/src/credential/test_credential_bi_and.sh new file mode 100755 index 000000000..c69aea53f --- /dev/null +++ b/src/credential/test_credential_bi_and.sh | |||
@@ -0,0 +1,99 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT | ||
3 | |||
4 | LOCATION=$(which gnunet-config) | ||
5 | if [ -z $LOCATION ] | ||
6 | then | ||
7 | LOCATION="gnunet-config" | ||
8 | fi | ||
9 | $LOCATION --version 1> /dev/null | ||
10 | if test $? != 0 | ||
11 | then | ||
12 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" | ||
13 | exit 77 | ||
14 | fi | ||
15 | |||
16 | rm -rf `gnunet-config -c test_credential_lookup.conf -s PATHS -o GNUNET_HOME -f` | ||
17 | |||
18 | |||
19 | |||
20 | |||
21 | which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 10" | ||
22 | gnunet-arm -s -c test_credential_lookup.conf | ||
23 | |||
24 | gnunet-identity -C a -c test_credential_lookup.conf | ||
25 | gnunet-identity -C b -c test_credential_lookup.conf | ||
26 | gnunet-identity -C c -c test_credential_lookup.conf | ||
27 | gnunet-identity -C d -c test_credential_lookup.conf | ||
28 | gnunet-identity -C e -c test_credential_lookup.conf | ||
29 | gnunet-identity -C f -c test_credential_lookup.conf | ||
30 | gnunet-identity -C g -c test_credential_lookup.conf | ||
31 | gnunet-identity -C h -c test_credential_lookup.conf | ||
32 | AKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep a | awk '{print $3}') | ||
33 | BKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep b | awk '{print $3}') | ||
34 | CKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep c | awk '{print $3}') | ||
35 | DKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep d | awk '{print $3}') | ||
36 | EKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep e | awk '{print $3}') | ||
37 | FKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep f | awk '{print $3}') | ||
38 | GKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep g | awk '{print $3}') | ||
39 | HKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep h | awk '{print $3}') | ||
40 | |||
41 | # (1) (A.a) <- B.b | ||
42 | # (2) (B.b) <- C.c AND G.g | ||
43 | # (3) C.c <- (D.D) | ||
44 | # (4) D.d <- (E.e) | ||
45 | # (5) E.e <- (F) priv | ||
46 | # (6) (G.g) <- H.h | ||
47 | # (7) H.h <- (F) priv | ||
48 | |||
49 | # BIDIRECTIONAL | ||
50 | gnunet-credential --createIssuerSide --ego=a --attribute="a" --subject="$BKEY b" --ttl=5m -c test_credential_lookup.conf | ||
51 | gnunet-namestore -D -z a | ||
52 | gnunet-credential --createIssuerSide --ego=b --attribute="b" --subject="$CKEY c, $GKEY g" --ttl=5m -c test_credential_lookup.conf | ||
53 | gnunet-namestore -D -z b | ||
54 | gnunet-credential --createIssuerSide --ego=g --attribute="g" --subject="$HKEY h" --ttl=5m -c test_credential_lookup.conf | ||
55 | gnunet-namestore -D -z b | ||
56 | |||
57 | SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=c --attribute="c" --subject="$DKEY d" --ttl="2019-12-12 10:00:00"` | ||
58 | gnunet-credential --createSubjectSide --ego=d --import "$SIGNED" | ||
59 | gnunet-namestore -D -z d | ||
60 | SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=d --attribute="d" --subject="$EKEY e" --ttl="2019-12-12 10:00:00"` | ||
61 | gnunet-credential --createSubjectSide --ego=e --import "$SIGNED" | ||
62 | gnunet-namestore -D -z e | ||
63 | SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=e --attribute="e" --subject="$FKEY" --ttl="2019-12-12 10:00:00"` | ||
64 | gnunet-credential --createSubjectSide --ego=f --import "$SIGNED" --private | ||
65 | gnunet-namestore -D -z f | ||
66 | SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=h --attribute="h" --subject="$FKEY" --ttl="2019-12-12 10:00:00"` | ||
67 | gnunet-credential --createSubjectSide --ego=f --import "$SIGNED" --private | ||
68 | gnunet-namestore -D -z h | ||
69 | |||
70 | # Starting to resolve | ||
71 | echo "+++ Starting to Resolve +++" | ||
72 | |||
73 | DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=f --forward --backward -c test_credential_lookup.conf | paste -d, -s` | ||
74 | echo $DELS | ||
75 | echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf | ||
76 | RES_DELS=`gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf` | ||
77 | |||
78 | # Cleanup properly | ||
79 | gnunet-namestore -z epub -d -n $DISC_ATTR -t ATTR -c test_credential_lookup.conf | ||
80 | gnunet-namestore -z eorg -d -n $PREF_ATTR -t ATTR -c test_credential_lookup.conf | ||
81 | gnunet-namestore -z stateu -d -n $STATE_STUD_ATTR -t ATTR -c test_credential_lookup.conf | ||
82 | #gnunet-namestore -z a -d -n $STATE_STUD_ATTR -t ATTR -c test_credential_lookup.conf | ||
83 | #gnunet-namestore -z d -d -n $STATE_STUD_ATTR -t ATTR -c test_credential_lookup.conf | ||
84 | #gnunet-namestore -z e -d -n $STATE_STUD_ATTR -t ATTR -c test_credential_lookup.conf | ||
85 | #gnunet-namestore -z f -d -n $STATE_STUD_ATTR -t ATTR -c test_credential_lookup.conf | ||
86 | #gnunet-namestore -z g -d -n $STATE_STUD_ATTR -t ATTR -c test_credential_lookup.conf | ||
87 | |||
88 | gnunet-arm -e -c test_credential_lookup.conf | ||
89 | |||
90 | if [ "$RES_DELS" != "Failed." ] | ||
91 | then | ||
92 | # TODO: replace echo -e bashism | ||
93 | echo -e "${RES_DELS}" | ||
94 | exit 0 | ||
95 | else | ||
96 | echo "FAIL: Failed to verify credential $RES_DELS." | ||
97 | exit 1 | ||
98 | fi | ||
99 | |||