use existing key and certificate

- script creates the CA directory structure and copies the key and
  certificate to the appropriate directories
This commit is contained in:
Jan Dittberner 2011-05-04 22:22:30 +02:00
parent 129ee2a7c2
commit beda864dbd

View file

@ -1,9 +1,9 @@
#!/bin/sh
#!/bin/bash
set -e
usage() {
echo "Usage: $1 <cabasedir> <reqconf> <caconf>"
echo "Usage: $1 <cabasedir> <ca.key.pem> <ca.crt.pem>"
exit 1
}
@ -29,12 +29,10 @@ if [ -d "$1" ]; then
fi
CADIR="$1"
mkdir -p "${CADIR}/certs"
mkdir -p "${CADIR}/crl"
mkdir -p "${CADIR}/newcerts"
mkdir -p "${CADIR}/private"
mkdir -p "${CADIR}/{certs,crl,newcerts,private}"
openssl req -new -x509 -config "${REQCONF}" -out "${CADIR}/ca.crt.pem" -keyout "${CADIR}/private/ca.key.pem"
cp "$2" "${CADIR}/private/ca.key.pem"
cp "$3" "${CADIR}/ca.crt.pem"
echo "01" > "${CADIR}/serial"
touch "${CADIR}/index.txt"