From 2f21bddd947ad0bffe2a6bd2f12543d41c905a09 Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Tue, 2 Jun 2020 14:51:11 -0500 Subject: [PATCH] Cleanup SSHPASS prompts --- CHANGELOG.md | 5 ++++- gravity-sync.sh | 43 +++++++++++++++++++++++-------------------- 2 files changed, 27 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4431af2..6208fa7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,9 @@ **Known Issues** - No new Star Trek references. +#### 1.7.8 +- Removes INFO that SSHPASS is not installed during config, if it's not needed. + #### 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. @@ -23,7 +26,7 @@ - Less chatty about replication validation if it's not necessary. - Less chatty about file validation if no changes are required. - When applying `update` in DEV mode, the Git branch used will be shown. -- Validates log export operation +- Validates log export operation. #### 1.7.6 - Detects `dbclient` install as alternative to OpenSSH Client. diff --git a/gravity-sync.sh b/gravity-sync.sh index dc3a88a..85b7599 100755 --- a/gravity-sync.sh +++ b/gravity-sync.sh @@ -872,7 +872,7 @@ function config_generate { cp $HOME/${LOCAL_FOLDR}/${CONFIG_FILE}.example $HOME/${LOCAL_FOLDR}/${CONFIG_FILE} error_validate - MESSAGE="Enter IP or DNS of primary Pi-hole server" + MESSAGE="IP or DNS of primary Pi-hole" echo_need read INPUT_REMOTE_HOST @@ -887,7 +887,7 @@ function config_generate { echo_warn fi - MESSAGE="Enter SSH user with SUDO rights on primary Pi-hole server" + MESSAGE="SSH User with SUDO rights" echo_need read INPUT_REMOTE_USER @@ -904,28 +904,31 @@ function config_generate { if hash sshpass 2>/dev/null then MESSAGE="SSHPASS Utility Detected" - echo_info - - MESSAGE="Do you want to configure password based SSH authentication?" - echo_warn - MESSAGE="Your password will be stored clear-text in the ${CONFIG_FILE}!" echo_warn + if hash ssh 2>/dev/null + MESSAGE="Before proceeding reference ${BLUE}https://github.com/vmstan/gravity-sync/blob/master/ADVANCED.md#ssh-configuration${NC}" + echo_info - MESSAGE="Leave blank to use (preferred) SSH Key-Pair Authentication" - echo_need - read INPUT_REMOTE_PASS + MESSAGE="Leave blank to use SSH Key-Pair" + echo_warn - MESSAGE="Saving Password to ${CONFIG_FILE}" - echo_stat - sed -i "/REMOTE_PASS=''/c\REMOTE_PASS='${INPUT_REMOTE_PASS}'" $HOME/${LOCAL_FOLDR}/${CONFIG_FILE} - error_validate - + MESSAGE="SSH User Password" + echo_need + read INPUT_REMOTE_PASS + + MESSAGE="Saving Password to ${CONFIG_FILE}" + echo_stat + sed -i "/REMOTE_PASS=''/c\REMOTE_PASS='${INPUT_REMOTE_PASS}'" $HOME/${LOCAL_FOLDR}/${CONFIG_FILE} + error_validate + elif hash dbclient 2>/dev/null + MESSAGE="Dropbear SSH Detected" + echo_warn + MESSAGE="Skipping Password Setup" + echo_info + fi else - MESSAGE="SSHPASS Not Installed" - echo_info - - MESSAGE="Defaulting to SSH Key-Pair Authentication" - echo_info + # MESSAGE="Defaulting to SSH Key-Pair Authentication" + # echo_info fi if [ -z $INPUT_REMOTE_PASS ]