From beda864dbd961175ddc3398246655a566081a7b2 Mon Sep 17 00:00:00 2001 From: Jan Dittberner Date: Wed, 4 May 2011 22:22:30 +0200 Subject: [PATCH] use existing key and certificate - script creates the CA directory structure and copies the key and certificate to the appropriate directories --- createca.sh | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/createca.sh b/createca.sh index 72fa9e1..275038c 100644 --- a/createca.sh +++ b/createca.sh @@ -1,9 +1,9 @@ -#!/bin/sh +#!/bin/bash set -e usage() { - echo "Usage: $1 " + echo "Usage: $1 " 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"