From 592c2e5f0d0ae4aaf67e4d0e9f61a4bd41971a67 Mon Sep 17 00:00:00 2001 From: Joe Rayhawk Date: Tue, 29 Mar 2011 13:51:04 -0700 Subject: Be more robust in the face of dumb users. --- gensignedcert.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'gensignedcert.sh') diff --git a/gensignedcert.sh b/gensignedcert.sh index 3564024..10c909c 100755 --- a/gensignedcert.sh +++ b/gensignedcert.sh @@ -2,6 +2,8 @@ # ./keygen [name] (configfile) # This is only suggested if you have a secured path to deliver this new key through. +set -e + SUPPLEMENTARY_CONFIG="$2" . ./configure.sh @@ -12,10 +14,11 @@ if ! [ $1 ]; then exit 2 fi -if [ $2 ]; then - export CA=$2 +if [ -e "$CA"/signed/"$1".key ]; then + echo "$CA/signed/$1.key already exists!" + exit 3 fi - + # Gen signed key mkdir -pv "$CA"/signed "$CA"/temp "$CA"/certs openssl req -config "$OPENSSL_CONFIG" -new -nodes -out "$CA"/temp/"$1".csr -keyout "$CA"/temp/"$1".key -- cgit v1.2.3