Fix bug where password not used

This commit is contained in:
Michael Stanclift 2020-06-02 15:45:44 -05:00
parent 60dee286fd
commit 4f5c38c389

View File

@ -584,13 +584,20 @@ function validate_os_sshpass {
# MESSAGE="Checking SSH Configuration" # MESSAGE="Checking SSH Configuration"
# echo_info # echo_info
SSHPASSWORD=''
if hash sshpass 2>/dev/null if hash sshpass 2>/dev/null
then then
if test -z "$REMOTE_PASS" MESSAGE="SSHPASS Utility Detected"
echo_warn
if [ -z "$REMOTE_PASS" ]
then then
SSHPASSWORD=''
MESSAGE="Using SSH Key-Pair Authentication" MESSAGE="Using SSH Key-Pair Authentication"
echo_info
else else
MESSAGE="Testing Authentication Options"
echo_info
timeout 5 ssh -p ${SSH_PORT} -i "$HOME/${SSH_PKIF}" -o StrictHostKeyChecking=no ${REMOTE_USER}@${REMOTE_HOST} 'exit' >/dev/null 2>&1 timeout 5 ssh -p ${SSH_PORT} -i "$HOME/${SSH_PKIF}" -o StrictHostKeyChecking=no ${REMOTE_USER}@${REMOTE_HOST} 'exit' >/dev/null 2>&1
if [ "$?" != "0" ] if [ "$?" != "0" ]
then then
@ -598,11 +605,9 @@ function validate_os_sshpass {
MESSAGE="Using SSH Password Authentication" MESSAGE="Using SSH Password Authentication"
echo_warn echo_warn
else else
SSHPASSWORD='' MESSAGE="${RED}Password Override${NC} - Valid Key-Pair Detected"
MESSAGE="Using SSH Key-Pair Authentication"
echo_info echo_info
fi fi
fi fi
else else
SSHPASSWORD='' SSHPASSWORD=''
@ -995,6 +1000,9 @@ function config_generate {
fi fi
fi fi
MESSAGE="Testing Configuration"
echo_info
validate_os_sshpass validate_os_sshpass
exit_withchange exit_withchange