File tree Expand file tree Collapse file tree 7 files changed +98
-3
lines changed
Expand file tree Collapse file tree 7 files changed +98
-3
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ set -e
4+ set -o pipefail
5+
6+ env
7+
8+ pushd $CODEBUILD_SRC_DIR /samples/
9+
10+ ENDPOINT=$( aws secretsmanager get-secret-value --secret-id " ci/endpoint" --query " SecretString" | cut -f2 -d" :" | sed -e ' s/[\\\"\}]//g' )
11+
12+ echo " Basic Connect test"
13+ python3 basic_connect.py --endpoint $ENDPOINT --key /tmp/privatekey.pem --cert /tmp/certificate.pem
14+
15+ echo " Websocket Connect test"
16+ python3 websocket_connect.py --endpoint $ENDPOINT --signing_region us-east-1
17+
18+ popd
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ set -e
4+ set -o pipefail
5+
6+ env
7+
8+ pushd $CODEBUILD_SRC_DIR /samples/
9+
10+ ENDPOINT=$( aws secretsmanager get-secret-value --secret-id " ci/endpoint" --query " SecretString" | cut -f2 -d" :" | sed -e ' s/[\\\"\}]//g' )
11+ AUTH_NAME=$( aws secretsmanager get-secret-value --secret-id " ci/CustomAuthorizer/name" --query " SecretString" | cut -f2 -d" :" | sed -e ' s/[\\\"\}]//g' )
12+ AUTH_PASSWORD=$( aws secretsmanager get-secret-value --secret-id " ci/CustomAuthorizer/password" --query " SecretString" | cut -f2 -d" :" | sed -e ' s/[\\\"\}]//g' )
13+
14+ echo " Custom Authorizer test"
15+ python3 custom_authorizer_connect.py --endpoint $ENDPOINT --custom_auth_authorizer_name $AUTH_NAME --custom_auth_password $AUTH_PASSWORD
16+
17+ popd
Original file line number Diff line number Diff line change 1+ # Assumes are running using the Ubuntu Codebuild standard image
2+ # NOTE: This script assumes that the AWS CLI-V2 is pre-installed!
3+ # - AWS CLI-V2 is a requirement to run this script.
14version : 0.2
25phases :
36 install :
47 commands :
58 - add-apt-repository ppa:ubuntu-toolchain-r/test
69 - apt-get update -y
710 - apt-get install python3 softhsm -y
11+ - echo "\nBuild version data:"
12+ - echo "\nPython Version:"; python3 --version
13+ - echo "\nSoftHSM (PKCS11) version:"; softhsm2-util --version
14+ - echo "\n"
815 build :
916 commands :
1017 - echo Build started on `date`
1118 - $CODEBUILD_SRC_DIR/codebuild/samples/setup-linux.sh
19+ - $CODEBUILD_SRC_DIR/codebuild/samples/connect-linux.sh
20+ - $CODEBUILD_SRC_DIR/codebuild/samples/custom-auth-linux.sh
21+ - $CODEBUILD_SRC_DIR/codebuild/samples/pkcs11-connect-linux.sh
1222 - $CODEBUILD_SRC_DIR/codebuild/samples/pubsub-linux.sh
23+ - $CODEBUILD_SRC_DIR/codebuild/samples/shadow-linux.sh
1324 post_build :
1425 commands :
1526 - echo Build completed on `date`
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ set -e
4+ set -o pipefail
5+
6+ pushd $CODEBUILD_SRC_DIR /samples/
7+
8+ ENDPOINT=$( aws secretsmanager get-secret-value --secret-id " ci/endpoint" --query " SecretString" | cut -f2 -d" :" | sed -e ' s/[\\\"\}]//g' )
9+
10+ # from hereon commands are echoed. don't leak secrets
11+ set -x
12+
13+ softhsm2-util --version
14+
15+ # SoftHSM2's default tokendir path might be invalid on this machine
16+ # so set up a conf file that specifies a known good tokendir path
17+ mkdir -p /tmp/tokens
18+ export SOFTHSM2_CONF=/tmp/softhsm2.conf
19+ echo " directories.tokendir = /tmp/tokens" > /tmp/softhsm2.conf
20+
21+ # create token
22+ softhsm2-util --init-token --free --label my-token --pin 0000 --so-pin 0000
23+
24+ # add private key to token (must be in PKCS#8 format)
25+ openssl pkcs8 -topk8 -in /tmp/privatekey.pem -out /tmp/privatekey.p8.pem -nocrypt
26+ softhsm2-util --import /tmp/privatekey.p8.pem --token my-token --label my-key --id BEEFCAFE --pin 0000
27+
28+ # run sample
29+ python3 pkcs11_connect.py --endpoint $ENDPOINT --cert /tmp/certificate.pem --pkcs11_lib /usr/lib/softhsm/libsofthsm2.so --pin 0000 --token_label my-token --key_label my-key
30+
31+ popd
Original file line number Diff line number Diff line change 11#! /bin/bash
22
33set -e
4+ set -o pipefail
45
56env
67
78pushd $CODEBUILD_SRC_DIR /samples/
89
9- ENDPOINT=$( aws secretsmanager get-secret-value --secret-id " unit-test /endpoint" --query " SecretString" | cut -f2 -d" :" | sed -e ' s/[\\\"\}]//g' )
10+ ENDPOINT=$( aws secretsmanager get-secret-value --secret-id " ci /endpoint" --query " SecretString" | cut -f2 -d" :" | sed -e ' s/[\\\"\}]//g' )
1011
1112echo " PubSub test"
1213python3 pubsub.py --endpoint $ENDPOINT --key /tmp/privatekey.pem --cert /tmp/certificate.pem
Original file line number Diff line number Diff line change 11#! /bin/bash
22
33set -e
4+ set -o pipefail
45
56env
67
@@ -10,5 +11,6 @@ cd $CODEBUILD_SRC_DIR
1011ulimit -c unlimited
1112python3 -m pip install .
1213
13- cert=$( aws secretsmanager get-secret-value --secret-id " unit-test/certificate" --query " SecretString" | cut -f2 -d" :" | cut -f2 -d\" ) && echo -e " $cert " > /tmp/certificate.pem
14- key=$( aws secretsmanager get-secret-value --secret-id " unit-test/privatekey" --query " SecretString" | cut -f2 -d" :" | cut -f2 -d\" ) && echo -e " $key " > /tmp/privatekey.pem
14+ cert=$( aws secretsmanager get-secret-value --secret-id " ci/CodeBuild/cert" --query " SecretString" | cut -f2 -d" :" | cut -f2 -d\" ) && echo -e " $cert " > /tmp/certificate.pem
15+ key=$( aws secretsmanager get-secret-value --secret-id " ci/CodeBuild/key" --query " SecretString" | cut -f2 -d" :" | cut -f2 -d\" ) && echo -e " $key " > /tmp/privatekey.pem
16+ key_p8=$( aws secretsmanager get-secret-value --secret-id " ci/CodeBuild/keyp8" --query " SecretString" | cut -f2 -d" :" | cut -f2 -d\" ) && echo -e " $key_p8 " > /tmp/privatekey_p8.pem
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ set -e
4+ set -o pipefail
5+
6+ env
7+
8+ pushd $CODEBUILD_SRC_DIR /samples/
9+
10+ ENDPOINT=$( aws secretsmanager get-secret-value --secret-id " ci/endpoint" --query " SecretString" | cut -f2 -d" :" | sed -e ' s/[\\\"\}]//g' )
11+
12+ echo " Shadow test"
13+ python3 shadow.py --endpoint $ENDPOINT --key /tmp/privatekey.pem --cert /tmp/certificate.pem --thing_name CI_CodeBuild_Thing --is_ci true
14+
15+ popd
You can’t perform that action at this time.
0 commit comments