Skip to content

Commit

Permalink
Issue 248: complete exercise (#249)
Browse files Browse the repository at this point in the history
* curl is used securely

Added the `--cacert` to verify the https connection rather than -k.

Added the `--cert` to show that it is a registered user. Also adjusted the port number to the controlled front-end.

---------

Co-authored-by: Al Niessner <[email protected]>
  • Loading branch information
al-niessner and Al Niessner authored Aug 19, 2024
1 parent 7e33534 commit 9524d92
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
21 changes: 13 additions & 8 deletions .ci/exercise_01.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
subjectAltName = @alt_names
[alt_names]
DNS.1 = exercise.dawgie" > v3.ext
DNS.1 = exercise.dawgie
DNS.2 = localhost
DNS.3 = server_ex" > v3.ext
# build the certificate
openssl x509 -req -in device.csr -signkey device.key -out device.crt \
-sha256 -extfile v3.ext -days 36500
Expand Down Expand Up @@ -92,10 +94,11 @@ then
-e DAWGIE_SSL_PEM_FILE=/proj/data/certs/server.pem \
-e DAWGIE_SSL_PEM_MYNAME=exercise.dawgie \
-e DAWGIE_SSL_PEM_MYSELF=/proj/data/certs/myself.pem \
-e MPLCONFIGDIR=/tmp \
-e USER=$USER --publish 8080-8085:8080-8085 -u $UID \
--name server_ex --network exer \
-v ${PWD}/Test:/proj/src -v ${tempdir}:/proj/data \
ex dawgie.pl --context-fe-path=/proj/data/fe
ex dawgie.pl --context-fe-path=/proj/data/fe -L logging.INFO
echo "server is booting"
python3 <<EOF
import json
Expand Down Expand Up @@ -127,15 +130,17 @@ EOF

if [[ 4 -eq $inc ]]
then
target=$(curl -k https://localhost:8080/app/db/targets)
target=${target:13:${#target}-15}
target=$(curl --cacert ${tempdir}/certs/server.pem.public https://localhost:8080/app/db/targets)
echo "target: $target"
curl -k -X POST \
-cert ${tempdir}/certs/guest.pem \
target=${target:1:${#target}-13}
echo "target: $target"
curl -X POST \
--cacert ${tempdir}/certs/server.pem.public \
--cert ${tempdir}/certs/guest.pem \
-F tasks=feedback.command \
-F tasks=feedback.sensor \
-F targets=${target} \
https://localhost:8080/app/run
https://localhost:8085/app/run
echo ""
fi

Expand Down Expand Up @@ -178,7 +183,7 @@ if v and not all ([9.9 < x < 10.1 for x in v[-3:]]):
with open ('.ci/status.txt', 'tw') as f: f.write ('failure')
pass
EOF
rm -rf ${tempdir} ert
rm -rf ${tempdir} acert ert
state=`get_state`
fi

Expand Down
2 changes: 1 addition & 1 deletion Python/dawgie/pl/state.dot
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
digraph SDP
digraph dawgie_fsm
{
/*
COPYRIGHT:
Expand Down

0 comments on commit 9524d92

Please sign in to comment.