CA: add a error check
This commit is contained in:
parent
fa6fc60759
commit
eed6c42595
1 changed files with 5 additions and 1 deletions
|
@ -50,11 +50,11 @@ case $1 in
|
||||||
-selfsign -extensions v3_ca -infiles ${TOP_DIR}/${CAREQ}
|
-selfsign -extensions v3_ca -infiles ${TOP_DIR}/${CAREQ}
|
||||||
;;
|
;;
|
||||||
"-newserver" )
|
"-newserver" )
|
||||||
|
echo -e "${GREEN}Making the Server key and cert${COLOR_RST}"
|
||||||
if ! [ -f ${TOP_DIR}/private/${CAKEY} ]; then
|
if ! [ -f ${TOP_DIR}/private/${CAKEY} ]; then
|
||||||
echo -e "${RED}Can not found the CA's key${COLOR_RST}"
|
echo -e "${RED}Can not found the CA's key${COLOR_RST}"
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
echo -e "${GREEN}Making the Server key and cert${COLOR_RST}"
|
|
||||||
sed -i 's/=.*#COMMONNAME/= FIC2014 Server #COMMONNAME/' $OPENSSL_CONF
|
sed -i 's/=.*#COMMONNAME/= FIC2014 Server #COMMONNAME/' $OPENSSL_CONF
|
||||||
openssl req -batch -new -keyout server.key -out server.csr -days ${DAYS}
|
openssl req -batch -new -keyout server.key -out server.csr -days ${DAYS}
|
||||||
echo -e "${GREEN}Signing the Server crt${COLOR_RST}"
|
echo -e "${GREEN}Signing the Server crt${COLOR_RST}"
|
||||||
|
@ -72,6 +72,10 @@ case $1 in
|
||||||
[ $# -ne 2 ] && "Usage: $0 -newclient NAME"
|
[ $# -ne 2 ] && "Usage: $0 -newclient NAME"
|
||||||
echo -e "${GREEN}Making the client key and csr${COLOR_RST}"
|
echo -e "${GREEN}Making the client key and csr${COLOR_RST}"
|
||||||
|
|
||||||
|
if ! [ -f ${TOP_DIR}/private/${CAKEY} ]; then
|
||||||
|
echo -e "${RED}Can not found the CA's key${COLOR_RST}"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
sed -i "s/=.*#COMMONNAME/= $2#COMMONNAME/" $OPENSSL_CONF
|
sed -i "s/=.*#COMMONNAME/= $2#COMMONNAME/" $OPENSSL_CONF
|
||||||
sed -i "s/=.*#CERTTYPE/= client #CERTTYPE/" $OPENSSL_CONF
|
sed -i "s/=.*#CERTTYPE/= client #CERTTYPE/" $OPENSSL_CONF
|
||||||
|
|
||||||
|
|
Reference in a new issue