Test new SSH function

This commit is contained in:
Michael Stanclift 2020-06-02 20:44:46 -05:00
parent b4cc029d7e
commit 92269fe4c3
2 changed files with 37 additions and 10 deletions

View File

@ -1,5 +1,12 @@
# The Changelog
## 1.8
### The Logical Release
- All of the SSH connection logic has been rewritten to be specific to client options between OpenSSH, OpenSSH w/ SSHPASS, and Dropbear.
- Removes INFO that SSHPASS is not installed during config, if it's not needed. Redirects user to documentation.
- Better error handling of configuration options.
## 1.7
### The Andrew Release
@ -11,10 +18,6 @@
**Known Issues**
- No new Star Trek references.
#### 1.7.8
- Removes INFO that SSHPASS is not installed during config, if it's not needed. Redirects user to documentation.
- Better error handling of configuration options.
#### 1.7.7
- `config` function will attempt to ping remote host to validate network connection, can by bypassed by adding `PING_AVOID='1'` to your `gravity-sync.conf` file.
- Changes some [INFO] messages to [WARN] where approprate.

View File

@ -617,23 +617,47 @@ function validate_os_sshpass {
MESSAGE="Validating Connection to ${REMOTE_HOST}"
echo_stat
ssh_function
CMD_TIMEOUT='5'
CMD_REQUESTED="exit"
${SSH_SEND}
error_validate
if hash ssh 2>/dev/null
then
if [ -z "$SSHPASSWORD" ]
then
timeout 5 ${SSH_CMD} -p ${SSH_PORT} -i "$HOME/${SSH_PKIF}" -o StrictHostKeyChecking=no ${REMOTE_USER}@${REMOTE_HOST} 'exit' >/dev/null 2>&1
error_validate
# timeout 5 ${SSH_CMD} -p ${SSH_PORT} -i "$HOME/${SSH_PKIF}" -o StrictHostKeyChecking=no ${REMOTE_USER}@${REMOTE_HOST} 'exit' >/dev/null 2>&1
# error_validate
else
timeout 5 ${SSHPASSWORD} ${SSH_CMD} -p ${SSH_PORT} -o StrictHostKeyChecking=no ${REMOTE_USER}@${REMOTE_HOST} 'exit' >/dev/null 2>&1
error_validate
# timeout 5 ${SSHPASSWORD} ${SSH_CMD} -p ${SSH_PORT} -o StrictHostKeyChecking=no ${REMOTE_USER}@${REMOTE_HOST} 'exit' >/dev/null 2>&1
# error_validate
fi
elif hash dbclient 2>/dev/null
then
timeout 5 ${SSHPASSWORD} ${SSH_CMD} -p ${SSH_PORT} -i "$HOME/${SSH_PKIF}" ${REMOTE_USER}@${REMOTE_HOST} 'exit' >/dev/null 2>&1
error_validate
# timeout 5 ${SSHPASSWORD} ${SSH_CMD} -p ${SSH_PORT} -i "$HOME/${SSH_PKIF}" ${REMOTE_USER}@${REMOTE_HOST} 'exit' >/dev/null 2>&1
# error_validate
fi
}
## Determine SSH Pathways
function ssh_function {
if hash ssh 2>/dev/null
then
if [ -z "$SSHPASSWORD" ]
then
SSH_SEND="timeout ${CMD_TIMEOUT} ${SSH_CMD} -p ${SSH_PORT} -i \"$HOME/${SSH_PKIF}\" -o StrictHostKeyChecking=no ${REMOTE_USER}@${REMOTE_HOST} \"${CMD_REQUESTED}\""
else
SSH_SEND="timeout ${CMD_TIMEOUT} ${SSHPASSWORD} ${SSH_CMD} -p ${SSH_PORT} -o StrictHostKeyChecking=no ${REMOTE_USER}@${REMOTE_HOST} \"${CMD_REQUESTED}\""
fi
elif hash dbclient 2>/dev/null
then
SSH_SEND="timeout ${CMD_TIMEOUT} ${SSH_CMD} -p ${SSH_PORT} -i \"$HOME/${SSH_PKIF}\" ${REMOTE_USER}@${REMOTE_HOST} \"${CMD_REQUESTED}\""
fi
}
## Detect SSH-KEYGEN
function detect_sshkeygen {
MESSAGE="Validating SSH-KEYGEN install on $HOSTNAME"