From be2881d629ead0f638729bee062548b45343dde6 Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Wed, 3 Jun 2020 13:58:05 -0500 Subject: [PATCH] Dropbear key creation update --- ADVANCED.md | 4 ++-- CHANGELOG.md | 2 ++ gravity-sync.sh | 10 ++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ADVANCED.md b/ADVANCED.md index fa461a8..36ea8aa 100644 --- a/ADVANCED.md +++ b/ADVANCED.md @@ -14,8 +14,8 @@ Download the latest release from [GitHub](https://github.com/vmstan/gravity-sync ```bash cd ~ -wget https://github.com/vmstan/gravity-sync/archive/v1.7.7.zip -unzip v1.7.7.zip -d gravity-sync +wget https://github.com/vmstan/gravity-sync/archive/v1.7.8.zip +unzip v1.7.8.zip -d gravity-sync cd gravity-sync ``` diff --git a/CHANGELOG.md b/CHANGELOG.md index 1dd3922..30fb765 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,8 @@ - SSH/RSYNC connection logic 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. +- Adds custom port specification to ssh-copy-id command during configuration generation. +- OpenSSH key generation works without user prompts. #### 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. diff --git a/gravity-sync.sh b/gravity-sync.sh index 87d3d8b..bf78339 100755 --- a/gravity-sync.sh +++ b/gravity-sync.sh @@ -692,13 +692,11 @@ function detect_sshkeygen { then MESSAGE="Using DROPBEARKEY Instead" echo_info - if [ -d $HOME/.ssh ] + if [ ! -d $HOME/.ssh ] then - KEYGEN_COMMAND="dropbearkey -t rsa -f" - else mkdir $HOME/.ssh >/dev/null 2>&1 - KEYGEN_COMMAND="dropbearkey -t rsa -f $HOME/${SSH_PKIF}" fi + KEYGEN_COMMAND="dropbearkey -t rsa -f" else MESSAGE="No Alternatives Located" echo_info @@ -987,7 +985,7 @@ function config_generate { MESSAGE="Using Existing ~/${SSH_PKIF}" echo_info else - KEYGEN_COMMAND="ssh-keygen -q -N '' -t rsa -f" + KEYGEN_COMMAND="ssh-keygen -q -N \"\" -t rsa -f" detect_sshkeygen MESSAGE="Generating ~/${SSH_PKIF}" @@ -1026,7 +1024,7 @@ function config_generate { echo -e "========================================================" if hash ssh-copy-id 2>/dev/null then - ssh-copy-id -f -i $HOME/${SSH_PKIF}.pub ${REMOTE_USER}@${REMOTE_HOST} + ssh-copy-id -f -p ${SSH_PORT} -i $HOME/${SSH_PKIF}.pub ${REMOTE_USER}@${REMOTE_HOST} elif hash dbclient 2>/dev/null then dropbearkey -y -f $HOME/${SSH_PKIF} | grep "^ssh-rsa " > $HOME/${SSH_PKIF}.pub