add test script

This commit is contained in:
Andy 2018-06-30 21:27:14 +02:00
parent bb9f73a4ea
commit 1b62158977
Signed by: arno
GPG Key ID: 9076D5E6B31AE99C
2 changed files with 28 additions and 0 deletions

View File

@ -51,3 +51,13 @@ self-signed CA.
- The CA cert will be valid for 3650 days (10 years).
- The server cert will be valid for 365 days (1 year).
- The x509 certs are ECDSA with prime256v1 curve and SHA256 signatures.
## Testing
I have added a simplistic script [testme.sh](testme.sh) that helps to test this
script in the following Linux distributions:
- Alpine 3.7
- Ubuntu Bionic
- Debian Stretch
- CentOS 7

18
testme.sh Executable file
View File

@ -0,0 +1,18 @@
#!/bin/bash
set -e
TMPDIR="$(mktemp -d)"
cp -v gencert.sh "${TMPDIR}/"
pushd "${TMPDIR}"
for DISTRO in alpine:3.7 ubuntu:bionic debian:stretch centos:7; do
printf "\n\n\nTesting the script with ${DISTRO} ...\n\n\n"
rm -vf openssl.cnf private.key public.crt ca.crt ca.key ca.srl
docker run --rm -ti -v ${PWD}:/w -w /w ${DISTRO} sh gencert.sh --cn test.example.com
printf "\n\n\n"
done
popd
echo "WARNING, I am going to remove ${TMPDIR} entirely in 5 seconds!"
sleep 5
rm -rf "${TMPDIR}"