Skip to content

Commit

Permalink
[FAB-1648] Install SoftHSM for testing PKCS11 CSP
Browse files Browse the repository at this point in the history
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 <vpaprots@ca.ibm.com>
  • Loading branch information
Volodymyr Paprotski committed Jan 24, 2017
1 parent eca98bc commit a0898e6
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ build/image/testenv/payload: build/gotools.tar.bz2 \
orderer/orderer.yaml \
build/docker/bin/peer \
peer/core.yaml \
build/msp-sampleconfig.tar.bz2
build/msp-sampleconfig.tar.bz2 \
images/testenv/install-softhsm2.sh
build/image/runtime/payload: build/docker/busybox
build/image/zookeeper/payload: images/zookeeper/docker-entrypoint.sh
build/image/kafka/payload: images/kafka/docker-entrypoint.sh
Expand Down
4 changes: 4 additions & 0 deletions images/testenv/Dockerfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,9 @@ ADD payload/msp-sampleconfig.tar.bz2 $PEER_CFG_PATH
COPY payload/orderer /usr/local/bin
COPY payload/peer /usr/local/bin

# softhsm2
COPY payload/install-softhsm2.sh /tmp
RUN bash /tmp/install-softhsm2.sh && rm -f install-softhsm2.sh

# typically, this is mapped to a developer's dev environment
WORKDIR /opt/gopath/src/github.com/hyperledger/fabric
18 changes: 18 additions & 0 deletions images/testenv/install-softhsm2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
set -e

ARCH=`uname -m`

if [ $ARCH = "s390x" ]; then
echo "deb http://ftp.us.debian.org/debian sid main" >> /etc/apt/sources.list
fi

# Install softhsm2 package
apt-get update
apt-get -y install softhsm2

# Create tokens directory
mkdir -p /var/lib/softhsm/tokens/

#Initialize token
softhsm2-util --init-token --slot 0 --label "ForFabric" --so-pin 1234 --pin 98765432

0 comments on commit a0898e6

Please sign in to comment.