mirror of
https://github.com/vmstan/gravity-sync.git
synced 2024-08-30 18:22:11 +00:00
Fixes places where SSH_PORT and SSH_PKIF were not utilized
This commit is contained in:
parent
27619b2252
commit
87246e4298
@ -125,7 +125,7 @@ function pull_gs {
|
||||
|
||||
MESSAGE="Pulling ${GRAVITY_FI} from ${REMOTE_HOST}"
|
||||
echo -en "${STAT} ${MESSAGE}"
|
||||
${SSHPASSWORD} rsync -e "ssh -p ${SSH_PORT}" ${REMOTE_USER}@${REMOTE_HOST}:${PIHOLE_DIR}/${GRAVITY_FI} $HOME/${LOCAL_FOLDR}/${BACKUP_FOLD}/${GRAVITY_FI}.pull >/dev/null 2>&1
|
||||
${SSHPASSWORD} rsync -e "ssh -p ${SSH_PORT} -i ${SSH_PKIF}" ${REMOTE_USER}@${REMOTE_HOST}:${PIHOLE_DIR}/${GRAVITY_FI} $HOME/${LOCAL_FOLDR}/${BACKUP_FOLD}/${GRAVITY_FI}.pull >/dev/null 2>&1
|
||||
error_validate
|
||||
|
||||
MESSAGE="Replacing ${GRAVITY_FI} on $HOSTNAME"
|
||||
@ -203,22 +203,22 @@ function push_gs {
|
||||
|
||||
MESSAGE="Backing Up ${GRAVITY_FI} from ${REMOTE_HOST}"
|
||||
echo -en "${STAT} ${MESSAGE}"
|
||||
${SSHPASSWORD} rsync -e "ssh -p ${SSH_PORT}" ${REMOTE_USER}@${REMOTE_HOST}:${PIHOLE_DIR}/${GRAVITY_FI} $HOME/${LOCAL_FOLDR}/${BACKUP_FOLD}/${GRAVITY_FI}.push >/dev/null 2>&1
|
||||
${SSHPASSWORD} rsync -e "ssh -p ${SSH_PORT} -i ${SSH_PKIF}" ${REMOTE_USER}@${REMOTE_HOST}:${PIHOLE_DIR}/${GRAVITY_FI} $HOME/${LOCAL_FOLDR}/${BACKUP_FOLD}/${GRAVITY_FI}.push >/dev/null 2>&1
|
||||
error_validate
|
||||
|
||||
MESSAGE="Pushing ${GRAVITY_FI} to ${REMOTE_HOST}"
|
||||
echo -en "${STAT} ${MESSAGE}"
|
||||
${SSHPASSWORD} rsync --rsync-path="sudo rsync" -e "ssh -p ${SSH_PORT}" ${PIHOLE_DIR}/${GRAVITY_FI} ${REMOTE_USER}@${REMOTE_HOST}:${PIHOLE_DIR}/${GRAVITY_FI} >/dev/null 2>&1
|
||||
${SSHPASSWORD} rsync --rsync-path="sudo rsync" -e "ssh -p ${SSH_PORT} -i ${SSH_PKIF}" ${PIHOLE_DIR}/${GRAVITY_FI} ${REMOTE_USER}@${REMOTE_HOST}:${PIHOLE_DIR}/${GRAVITY_FI} >/dev/null 2>&1
|
||||
error_validate
|
||||
|
||||
MESSAGE="Setting Permissions on ${GRAVITY_FI}"
|
||||
echo -en "${STAT} ${MESSAGE}"
|
||||
${SSHPASSWORD} ssh ${REMOTE_USER}@${REMOTE_HOST} "sudo chmod 664 ${PIHOLE_DIR}/${GRAVITY_FI}" >/dev/null 2>&1
|
||||
${SSHPASSWORD} ssh -p ${SSH_PORT} -i ${SSH_PKIF} ${REMOTE_USER}@${REMOTE_HOST} "sudo chmod 664 ${PIHOLE_DIR}/${GRAVITY_FI}" >/dev/null 2>&1
|
||||
error_validate
|
||||
|
||||
MESSAGE="Setting Ownership on ${GRAVITY_FI}"
|
||||
echo -en "${STAT} ${MESSAGE}"
|
||||
${SSHPASSWORD} ssh ${REMOTE_USER}@${REMOTE_HOST} "sudo chown pihole:pihole ${PIHOLE_DIR}/${GRAVITY_FI}" >/dev/null 2>&1
|
||||
${SSHPASSWORD} ssh -p ${SSH_PORT} -i ${SSH_PKIF} ${REMOTE_USER}@${REMOTE_HOST} "sudo chown pihole:pihole ${PIHOLE_DIR}/${GRAVITY_FI}" >/dev/null 2>&1
|
||||
error_validate
|
||||
|
||||
MESSAGE="Contacting Borg Collective"
|
||||
@ -227,12 +227,12 @@ function push_gs {
|
||||
|
||||
MESSAGE="Updating FTLDNS Configuration"
|
||||
echo -en "${STAT} ${MESSAGE}"
|
||||
${SSHPASSWORD} ssh ${REMOTE_USER}@${REMOTE_HOST} "${PIHOLE_BIN} restartdns reloadlists" >/dev/null 2>&1
|
||||
${SSHPASSWORD} ssh -p ${SSH_PORT} -i ${SSH_PKIF} ${REMOTE_USER}@${REMOTE_HOST} "${PIHOLE_BIN} restartdns reloadlists" >/dev/null 2>&1
|
||||
error_validate
|
||||
|
||||
MESSAGE="Reloading FTLDNS Services"
|
||||
echo -en "${STAT} ${MESSAGE}"
|
||||
${SSHPASSWORD} ssh ${REMOTE_USER}@${REMOTE_HOST} "${PIHOLE_BIN} restartdns" >/dev/null 2>&1
|
||||
${SSHPASSWORD} ssh -p ${SSH_PORT} -i ${SSH_PKIF} ${REMOTE_USER}@${REMOTE_HOST} "${PIHOLE_BIN} restartdns" >/dev/null 2>&1
|
||||
error_validate
|
||||
|
||||
logs_export
|
||||
@ -348,7 +348,7 @@ function validate_os_sshpass {
|
||||
SSHPASSWORD=''
|
||||
MESSAGE="Using SSH Key-Pair Authentication"
|
||||
else
|
||||
timeout 5 ssh -o StrictHostKeyChecking=no ${REMOTE_USER}@${REMOTE_HOST} 'exit' >/dev/null 2>&1
|
||||
timeout 5 ssh -p ${SSH_PORT} -i ${SSH_PKIF} -o StrictHostKeyChecking=no ${REMOTE_USER}@${REMOTE_HOST} 'exit' >/dev/null 2>&1
|
||||
if [ "$?" != "0" ]; then
|
||||
SSHPASSWORD="sshpass -p ${REMOTE_PASS}"
|
||||
MESSAGE="Using SSH Password Authentication"
|
||||
@ -367,7 +367,7 @@ function validate_os_sshpass {
|
||||
|
||||
MESSAGE="Testing SSH Connection"
|
||||
echo -en "${STAT} ${MESSAGE}"
|
||||
timeout 5 ${SSHPASSWORD} ssh -o StrictHostKeyChecking=no ${REMOTE_USER}@${REMOTE_HOST} 'exit' >/dev/null 2>&1
|
||||
timeout 5 ${SSHPASSWORD} ssh -p ${SSH_PORT} -i ${SSH_PKIF} -o StrictHostKeyChecking=no ${REMOTE_USER}@${REMOTE_HOST} 'exit' >/dev/null 2>&1
|
||||
error_validate
|
||||
|
||||
}
|
||||
@ -388,7 +388,7 @@ function md5_compare {
|
||||
|
||||
MESSAGE="Analyzing Remote ${GRAVITY_FI}"
|
||||
echo -en "${STAT} ${MESSAGE}"
|
||||
primaryMD5=$(${SSHPASSWORD} ssh ${REMOTE_USER}@${REMOTE_HOST} 'md5sum /etc/pihole/gravity.db')
|
||||
primaryMD5=$(${SSHPASSWORD} ssh -p ${SSH_PORT} -i ${SSH_PKIF} ${REMOTE_USER}@${REMOTE_HOST} 'md5sum /etc/pihole/gravity.db')
|
||||
error_validate
|
||||
|
||||
MESSAGE="Analyzing Local ${GRAVITY_FI}"
|
||||
|
Loading…
Reference in New Issue
Block a user