diff --git a/misc/CA.sh b/misc/CA.sh index 5ed1e97b..502915e5 100755 --- a/misc/CA.sh +++ b/misc/CA.sh @@ -53,6 +53,17 @@ clean() rm -rf $OUTPUT } +gen_crl() +{ + echo $ECHO_OPTS "${GREEN}Generate crl.pem${COLOR_RST}" + openssl ca -config ${OPENSSL_CONF} -gencrl -out ${TOP_DIR}/crl.pem > $OUTPUT 2>&1 + if [ $? -ne 0 ]; then + echo $ECHO_OPTS "${RED}Generate crl.pem failed" + cat $OUTPUT + exit 5 + fi +} + [ $# -lt 1 ] && usage OUTPUT=$(mktemp) @@ -108,6 +119,7 @@ case $1 in exit 4 fi ;; + "-newserver" ) echo $ECHO_OPTS "${GREEN}Making the Server key and cert${COLOR_RST}" if ! [ -f ${TOP_DIR}/private/${CAKEY} ]; then @@ -193,6 +205,7 @@ case $1 in echo "$pass" clean "client" $2 ;; + "-revoke" ) if [ $# -ne 2 ]; then echo "Usage: $0 -revoke NAME" @@ -210,24 +223,13 @@ case $1 in rm ${TOP_DIR}/certs/${2}.crt rm ${TOP_DIR}/pkcs/${2}.p12 - echo $ECHO_OPTS "${GREEN}Generate crl.pem${COLOR_RST}" - openssl ca -config ${OPENSSL_CONF} -gencrl -out ${TOP_DIR}/crl.pem > $OUTPUT 2>&1 - if [ $? -ne 0 ]; then - echo $ECHO_OPTS "${RED}Generate crl.pem failed" - cat $OUTPUT - exit 5 - fi - + gen_crl ;; + "-gencrl" ) - echo $ECHO_OPTS "${GREEN}Generate crl.pem${COLOR_RST}" - openssl ca -config ${OPENSSL_CONF} -gencrl -out ${TOP_DIR}/crl.pem > $OUTPUT 2>&1 - if [ $? -ne 0 ]; then - echo $ECHO_OPTS "${RED}Generate crl.pem failed" - cat $OUTPUT - exit 5 - fi + gen_crl ;; + * ) usage ;;