From 8e831283b0bd343b40c90bff521eef097e005637 Mon Sep 17 00:00:00 2001 From: sapthasurendran Date: Tue, 28 Jun 2022 15:03:53 +0530 Subject: [PATCH] ci pipeline changes Signed-off-by: sapthasurendran --- .../fabric-ca-client-config-template.yaml | 8 +----- .../scripts/generate-hsm-user.sh | 7 ++++- .../application-gateway-hsm/softhsm2.conf | 5 ++++ ci/scripts/run-test-network-basic.sh | 26 ++++++++++++++++--- 4 files changed, 35 insertions(+), 11 deletions(-) create mode 100644 asset-transfer-basic/application-gateway-hsm/softhsm2.conf diff --git a/asset-transfer-basic/application-gateway-hsm/ca-client-config/fabric-ca-client-config-template.yaml b/asset-transfer-basic/application-gateway-hsm/ca-client-config/fabric-ca-client-config-template.yaml index 6196ebc8..b721fbe8 100644 --- a/asset-transfer-basic/application-gateway-hsm/ca-client-config/fabric-ca-client-config-template.yaml +++ b/asset-transfer-basic/application-gateway-hsm/ca-client-config/fabric-ca-client-config-template.yaml @@ -165,10 +165,4 @@ bccsp: Pin: 98765432 Label: ForFabric hash: SHA2 - security: 256 - # sw: - # hash: SHA2 - # security: 256 - # filekeystore: - # # The directory used for the software file-based keystore - # keystore: msp/keystore + security: 256 \ No newline at end of file diff --git a/asset-transfer-basic/application-gateway-hsm/scripts/generate-hsm-user.sh b/asset-transfer-basic/application-gateway-hsm/scripts/generate-hsm-user.sh index 6252c2a1..481ca22b 100755 --- a/asset-transfer-basic/application-gateway-hsm/scripts/generate-hsm-user.sh +++ b/asset-transfer-basic/application-gateway-hsm/scripts/generate-hsm-user.sh @@ -32,7 +32,12 @@ echo 'directory' $PWD CLIENT_CONFIG_TEMPLATE=../ca-client-config/fabric-ca-client-config-template.yaml CLIENT_CONFIG=../ca-client-config/fabric-ca-client-config.yaml cp $CLIENT_CONFIG_TEMPLATE $CLIENT_CONFIG -sed -i '' -e s+REPLACE_ME_HSMLIB+${HSM2_LIB}+g $CLIENT_CONFIG + +if [[ "$OSTYPE" == "darwin"* ]]; then + sed -i '' s+REPLACE_ME_HSMLIB+${HSM2_LIB}+g $CLIENT_CONFIG +else + sed -i s+REPLACE_ME_HSMLIB+${HSM2_LIB}+g $CLIENT_CONFIG +fi # create the users, remove any existing users CRYPTO_PATH=$PWD/../crypto-material/hsm diff --git a/asset-transfer-basic/application-gateway-hsm/softhsm2.conf b/asset-transfer-basic/application-gateway-hsm/softhsm2.conf new file mode 100644 index 00000000..86687cf7 --- /dev/null +++ b/asset-transfer-basic/application-gateway-hsm/softhsm2.conf @@ -0,0 +1,5 @@ +directories.tokendir = /tmp/ +objectstore.backend = file + +# ERROR, WARNING, INFO, DEBUG +log.level = INFO \ No newline at end of file diff --git a/ci/scripts/run-test-network-basic.sh b/ci/scripts/run-test-network-basic.sh index f6b54390..0c87993c 100755 --- a/ci/scripts/run-test-network-basic.sh +++ b/ci/scripts/run-test-network-basic.sh @@ -103,13 +103,17 @@ node dist/app.js popd stopNetwork -# Run typescript HSM gateway application +# Run Typescript HSM gateway application createNetwork print "Initializing Typescript HSM gateway application" -pushd ../asset-transfer-basic/application-typescript-hsm +pushd ../asset-transfer-basic/application-gateway-hsm/ print "Setup SoftHSM" export SOFTHSM2_CONF=$PWD/softhsm2.conf -softhsm2-util --init-token --slot 0 --label "ForFabric" --pin 98765432 --so-pin 1234 +softhsm2-util --init-token --slot 1 --label "ForFabric" --pin 98765432 --so-pin 1234 +pushd scripts +print "Enroll and register User in HSM" +./generate-hsm-user.sh HSMUser +pushd ../node print "install dependencies" npm install print "Building app.ts" @@ -119,6 +123,22 @@ node dist/app.js popd stopNetwork +# Run Go HSM gateway application +createNetwork +print "Initializing Go HSM gateway application" +pushd ../asset-transfer-basic/application-gateway-hsm/ +print "Setup SoftHSM" +export SOFTHSM2_CONF=$PWD/softhsm2.conf +softhsm2-util --init-token --slot 2 --label "ForFabric" --pin 98765432 --so-pin 1234 +pushd scripts +print "Register and enroll user in HSM" +./generate-hsm-user.sh HSMUser +pushd ../go +print "Running the output app" +go run -tags pkcs11 hsm-sample.go +popd +stopNetwork + # Run Go gateway application createNetwork print "Initializing Go gateway application"