Exit, seriously?

This commit is contained in:
Geoffrey Frogeye 2017-01-14 19:13:01 +01:00
parent b8ead05322
commit ab07bc5ddd

View file

@ -87,7 +87,9 @@ function _machines-regenKey {
function _machines-verifyCertificate {
if openssl verify $MACHINES_CONFIG/machines.crt | grep -v 'error18' | grep 'error' --quiet; then
echo "Invalid certificate"
exit 1
return 1
else
return 0
fi
}
@ -102,13 +104,17 @@ function _machines-ensurePub {
mv $CERT_FILE $MACHINES_CONFIG/machines.crt &> /dev/null
else
echo "Certificate rejected."
exit 1
return 1
fi
fi
_machines-verifyCertificate
if [ $? != 0 ]; then
return 1
fi
if [ ! -f $MACHINES_CONFIG/machines.pub ]; then
_machines-pubFromCrt
fi
return 0
}
# SSH ACCESS KEYS
@ -124,6 +130,9 @@ function _machines-signAkey { # network
function _machines-getAkey { # network
_machines-ensurePub
if [ $? != 0 ]; then
return 1
fi
KEY_FILE=$(mktemp)
SIGN_FILE=$(mktemp)
_machines-api akey/$1 > $KEY_FILE
@ -284,6 +293,9 @@ function machines-setup {
fi
_machines-ensurePub
if [ $? != 0 ]; then
return 1
fi
# Variables
read -p 'Machine name? ' name