feature(BACKUP): add SSH port customization

- borgSSHPort variable in details file
- read and appended to RSH connection string
- default to standard port 22

Closes github #9
This commit is contained in:
Asif Bacchus 2021-03-08 00:08:22 -07:00
parent de76918e81
commit 5ea25529b9
2 changed files with 16 additions and 4 deletions

View File

@ -18,14 +18,17 @@
# base configuration directory for borg, all borg parameters use this directory # base configuration directory for borg, all borg parameters use this directory
# as their 'root'. I recommend setups with this being "/var/borgbackup", the # as their 'root'. I recommend setups with this being "/var/borgbackup", the
# default is "$HOME" or "~$USER" in that order. If you're unsure, try "$HOME" # default is "$HOME" or "~$USER" in that order. If you're unsure, try "$HOME"
borgBaseDir="/var/borgbackup" borgBaseDir = "/var/borgbackup"
# SSH port on which your borg server listens. By default, this is port 22.
borgSSHPort = 22
# full path to the SSH key used to connect to your remote backup server # full path to the SSH key used to connect to your remote backup server
borgSSHKey="/var/borgbackup/private.key" borgSSHKey = "/var/borgbackup/private.key"
# connection string to access the borg repo on your remote backup server # connection string to access the borg repo on your remote backup server
# this is usually in the form user@servername.tld:repoName/ # this is usually in the form user@servername.tld:repoName/
borgConnectRepo="jdoe123@borg.server.net:mailcow/" borgConnectRepo = "jdoe123@borg.server.net:mailcow/"
# password to access repo # password to access repo
# this was set when the repo was initialized and, while optional, is HIGHLY # this was set when the repo was initialized and, while optional, is HIGHLY

View File

@ -529,7 +529,16 @@ elif [ ! -f "${borgSSHKey}" ]; then
fi fi
printf "%sdetails:borgSSHKey %s-- %s[OK]%s\n" \ printf "%sdetails:borgSSHKey %s-- %s[OK]%s\n" \
"$magenta" "$norm" "$ok" "$norm" >> "$logFile" "$magenta" "$norm" "$ok" "$norm" >> "$logFile"
export BORG_RSH="ssh -i ${borgSSHKey}" ## check SSH port
if [ -z "${borgSSHPort}" ]; then
borgSSHPort=22
printf "%sdetails:borgSSHPort %s-- %s[DEFAULT]%s\n" \
"$magenta" "$norm" "$ok" "$norm" >> "$logFile"
else
printf "%sdetails:borgSSHPort %s-- %s[CUSTOM]%s\n" \
"$magenta" "$norm" "$ok" "$norm" >> "$logFile"
fi
export BORG_RSH="ssh -i ${borgSSHKey} -p ${borgSSHPort}"
## check borg repo connect string ## check borg repo connect string
if [ -z "${borgConnectRepo}" ]; then if [ -z "${borgConnectRepo}" ]; then