Refactor
This commit is contained in:
parent
f7a25e0afc
commit
099fdf4db1
32
misc/CA.sh
32
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
|
||||
;;
|
||||
|
Loading…
Reference in New Issue
Block a user