sigstore / cosign

Code signing and transparency for containers and binaries
Apache License 2.0
4.27k stars 516 forks source link

Add end-to-end testing for PKCS11 token signing #3343

Closed haydentherapper closed 5 months ago

haydentherapper commented 8 months ago

Description

Right now, the GitHub Actions tests do not run tests for PKCS11 signing. See https://github.com/sigstore/cosign/pull/3334#issuecomment-1791495933 for how we might go about adding this.

viveksahu26 commented 6 months ago

/assign

viveksahu26 commented 6 months ago

Manually on running below commands, the e2e test for softhsm and pkcs11 works:

sudo docker run -dit --name softhsm4 -p 2348:2345 vegardit/softhsm2-pkcs11-proxy

cd $HOME
apk update
# add git
apk add git
# clone cosign
git clone https://github.com/sigstore/cosign.git
# cd to cosign
cd cosign/
# add make pcsc-lite-libs go command
apk add make build-base go
# test
softhsm2-util --init-token --free --label "My Token" --pin 1234 --so-pin 1234
go test -v -cover -coverprofile=./cover.out -tags=softhsm,pkcs11key -coverpkg github.com/sigstore/cosign/v2/pkg/cosign/pkcs11key test/pkcs11_test.go

Now to automate this, hey @haydentherapper I need a help, after running a container I want to run all those command automatically inside container. Currently when I run the above script, the containers run but command doesn't run inside the container, instead command runs after container gets exit, which makes no sense.

viveksahu26 commented 6 months ago

Finally resolve the automation issue, now it works.