Fixed error ouput when pwgen was not found
This commit is contained in:
parent
3bd7654e81
commit
124a7c2a32
14
misc/CA.sh
14
misc/CA.sh
@ -25,8 +25,6 @@ usage()
|
||||
|
||||
[ $# -lt 1 ] && usage
|
||||
|
||||
OUTPUT=`mktemp`
|
||||
|
||||
case $1 in
|
||||
"-newca" )
|
||||
# echo -e -n "${GREEN}Create the directories, take care this will delete"
|
||||
@ -47,12 +45,14 @@ case $1 in
|
||||
sed -i "s/=.*#DIR/= ${ESCAPED} #DIR/" $OPENSSL_CONF
|
||||
sed -i "s/=.*#CERTTYPE/= server #CERTTYPE/" $OPENSSL_CONF
|
||||
|
||||
pass=`pwgen 10 1` 2> $OUTPUT
|
||||
type pwgen > /dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
cat $OUTPUT
|
||||
echo "command not found: pwgen"
|
||||
exit 5
|
||||
fi
|
||||
|
||||
pass=`pwgen 10 1`
|
||||
|
||||
openssl req -batch -new -keyout ${TOP_DIR}/private/${CAKEY} \
|
||||
-out ${TOP_DIR}/${CAREQ} -passout pass:$pass \
|
||||
-config $OPENSSL_CONF
|
||||
@ -100,12 +100,14 @@ case $1 in
|
||||
sed -i "s/=.*#COMMONNAME/= $2#COMMONNAME/" $OPENSSL_CONF
|
||||
sed -i "s/=.*#CERTTYPE/= client #CERTTYPE/" $OPENSSL_CONF
|
||||
|
||||
pass=`pwgen 10 1` 2> $OUTPUT
|
||||
type pwgen > /dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
cat $OUTPUT
|
||||
echo "command not found: pwgen"
|
||||
exit 5
|
||||
fi
|
||||
|
||||
pass=`pwgen 10 1`
|
||||
|
||||
openssl req -batch -new -keyout ${2}.key -out ${2}.csr \
|
||||
-config ${OPENSSL_CONF} -passout pass:$pass -days ${DAYS}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user