Skip to content

Commit a0898e6

Browse files
author
Volodymyr Paprotski
committed
[FAB-1648] Install SoftHSM for testing PKCS11 CSP
Made part of the testenv docker image. Might be easier in baseimage but testenv is really intended for testing. Unresolved question is how fabric-ca and fabric-sdk gets softhsm Change-Id: I9cbb5590f23705b29c0cd0f80afdcc7920572072 Signed-off-by: Volodymyr Paprotski <[email protected]>
1 parent eca98bc commit a0898e6

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,8 @@ build/image/testenv/payload: build/gotools.tar.bz2 \
192192
orderer/orderer.yaml \
193193
build/docker/bin/peer \
194194
peer/core.yaml \
195-
build/msp-sampleconfig.tar.bz2
195+
build/msp-sampleconfig.tar.bz2 \
196+
images/testenv/install-softhsm2.sh
196197
build/image/runtime/payload: build/docker/busybox
197198
build/image/zookeeper/payload: images/zookeeper/docker-entrypoint.sh
198199
build/image/kafka/payload: images/kafka/docker-entrypoint.sh

images/testenv/Dockerfile.in

+4
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,9 @@ ADD payload/msp-sampleconfig.tar.bz2 $PEER_CFG_PATH
2121
COPY payload/orderer /usr/local/bin
2222
COPY payload/peer /usr/local/bin
2323

24+
# softhsm2
25+
COPY payload/install-softhsm2.sh /tmp
26+
RUN bash /tmp/install-softhsm2.sh && rm -f install-softhsm2.sh
27+
2428
# typically, this is mapped to a developer's dev environment
2529
WORKDIR /opt/gopath/src/github.com/hyperledger/fabric

images/testenv/install-softhsm2.sh

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
set -e
3+
4+
ARCH=`uname -m`
5+
6+
if [ $ARCH = "s390x" ]; then
7+
echo "deb http://ftp.us.debian.org/debian sid main" >> /etc/apt/sources.list
8+
fi
9+
10+
# Install softhsm2 package
11+
apt-get update
12+
apt-get -y install softhsm2
13+
14+
# Create tokens directory
15+
mkdir -p /var/lib/softhsm/tokens/
16+
17+
#Initialize token
18+
softhsm2-util --init-token --slot 0 --label "ForFabric" --so-pin 1234 --pin 98765432

0 commit comments

Comments
 (0)