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
|
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
|
[ $# -lt 1 ] && usage
|
||||||
|
|
||||||
OUTPUT=$(mktemp)
|
OUTPUT=$(mktemp)
|
||||||
@ -108,6 +119,7 @@ case $1 in
|
|||||||
exit 4
|
exit 4
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"-newserver" )
|
"-newserver" )
|
||||||
echo $ECHO_OPTS "${GREEN}Making the Server key and cert${COLOR_RST}"
|
echo $ECHO_OPTS "${GREEN}Making the Server key and cert${COLOR_RST}"
|
||||||
if ! [ -f ${TOP_DIR}/private/${CAKEY} ]; then
|
if ! [ -f ${TOP_DIR}/private/${CAKEY} ]; then
|
||||||
@ -193,6 +205,7 @@ case $1 in
|
|||||||
echo "$pass"
|
echo "$pass"
|
||||||
clean "client" $2
|
clean "client" $2
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"-revoke" )
|
"-revoke" )
|
||||||
if [ $# -ne 2 ]; then
|
if [ $# -ne 2 ]; then
|
||||||
echo "Usage: $0 -revoke NAME"
|
echo "Usage: $0 -revoke NAME"
|
||||||
@ -210,24 +223,13 @@ case $1 in
|
|||||||
rm ${TOP_DIR}/certs/${2}.crt
|
rm ${TOP_DIR}/certs/${2}.crt
|
||||||
rm ${TOP_DIR}/pkcs/${2}.p12
|
rm ${TOP_DIR}/pkcs/${2}.p12
|
||||||
|
|
||||||
echo $ECHO_OPTS "${GREEN}Generate crl.pem${COLOR_RST}"
|
gen_crl
|
||||||
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
|
|
||||||
|
|
||||||
;;
|
|
||||||
"-gencrl" )
|
"-gencrl" )
|
||||||
echo $ECHO_OPTS "${GREEN}Generate crl.pem${COLOR_RST}"
|
gen_crl
|
||||||
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
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
* )
|
* )
|
||||||
usage
|
usage
|
||||||
;;
|
;;
|
||||||
|
Loading…
Reference in New Issue
Block a user