mirror of
https://github.com/rootzoll/raspiblitz.git
synced 2025-02-28 16:58:03 +01:00
SFTP StaticChannelBackup (#4382)
* Update FAQ.md. Typo: rebuild -> rebuilt (#4223) * SFTP StaticChannelBackup * Update _background.sh To resolve the variables, you have to use double quotes * change back to SCP * change back to scp --------- Co-authored-by: /rootzoll <christian@geektank.de> Co-authored-by: Glen Cooper <glen@glencooper.com>
This commit is contained in:
parent
be1ec81a58
commit
449b0a226c
1 changed files with 22 additions and 22 deletions
|
@ -513,27 +513,27 @@ do
|
|||
fi
|
||||
fi
|
||||
|
||||
# check if a SFTP backup target is set
|
||||
# check if a SCP backup target is set
|
||||
# parameter in raspiblitz.conf:
|
||||
# sftpBackupTarget='[USER]@[SERVER]:[DIRPATH-WITHOUT-ENDING-/]'
|
||||
# optionally a custom option string for the sftp command can be set with
|
||||
# sftpBackupOptions='[YOUR-CUSTOM-OPTIONS]'
|
||||
# scpBackupTarget='[USER]@[SERVER]:[DIRPATH-WITHOUT-ENDING-/]'
|
||||
# optionally a custom option string for the scp command can be set with
|
||||
# scpBackupOptions='[YOUR-CUSTOM-OPTIONS]'
|
||||
# On target server add the public key of your RaspiBlitz to the authorized_keys for the user
|
||||
# https://www.linode.com/docs/security/authentication/use-public-key-authentication-with-ssh/
|
||||
if [ ${#sftpBackupTarget} -gt 0 ]; then
|
||||
if [ ${#scpBackupTarget} -gt 0 ]; then
|
||||
echo "--> Offsite-Backup SFTP Server"
|
||||
if [ "${sftpBackupOptions}" == "" ]; then
|
||||
sftpBackupOptions="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
|
||||
if [ "${scpBackupOptions}" == "" ]; then
|
||||
scpBackupOptions="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
|
||||
fi
|
||||
# its ok to ignore known host, because data is encrypted (worst case of MiM would be: no offsite channel backup)
|
||||
# but its more likely that without ignoring known host, script might not run thru and that way: no offsite channel backup
|
||||
sftp ${sftpBackupOptions} ${localBackupPath} ${sftpBackupTarget}/
|
||||
sftp ${sftpBackupOptions} ${localTimestampedPath} ${sftpBackupTarget}/
|
||||
scp ${scpBackupOptions} ${localBackupPath} ${scpBackupTarget}/
|
||||
scp ${scpBackupOptions} ${localTimestampedPath} ${scpBackupTarget}/
|
||||
result=$?
|
||||
if [ ${result} -eq 0 ]; then
|
||||
echo "OK - SFTP Backup exited with 0"
|
||||
echo "OK - SCP Backup exited with 0"
|
||||
else
|
||||
echo "FAIL - SFTP Backup exited with ${result}"
|
||||
echo "FAIL - SCP Backup exited with ${result}"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -619,27 +619,27 @@ do
|
|||
fi
|
||||
fi
|
||||
|
||||
# check if a SFTP backup target is set
|
||||
# check if a SCP backup target is set
|
||||
# parameter in raspiblitz.conf:
|
||||
# sftpBackupTarget='[USER]@[SERVER]:[DIRPATH-WITHOUT-ENDING-/]'
|
||||
# optionally a custom option string for the sftp command can be set with
|
||||
# sftpBackupOptions='[YOUR-CUSTOM-OPTIONS]'
|
||||
# scpBackupTarget='[USER]@[SERVER]:[DIRPATH-WITHOUT-ENDING-/]'
|
||||
# optionally a custom option string for the scp command can be set with
|
||||
# scpBackupOptions='[YOUR-CUSTOM-OPTIONS]'
|
||||
# On target server add the public key of your RaspiBlitz to the authorized_keys for the user
|
||||
# https://www.linode.com/docs/security/authentication/use-public-key-authentication-with-ssh/
|
||||
if [ ${#sftpBackupTarget} -gt 0 ]; then
|
||||
if [ ${#scpBackupTarget} -gt 0 ]; then
|
||||
echo "--> Offsite-Backup SFTP Server"
|
||||
if [ "${sftpBackupOptions}" == "" ]; then
|
||||
sftpBackupOptions="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
|
||||
if [ "${scpBackupOptions}" == "" ]; then
|
||||
scpBackupOptions="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
|
||||
fi
|
||||
# its ok to ignore known host, because data is encrypted (worst case of MiM would be: no offsite channel backup)
|
||||
# but its more likely that without ignoring known host, script might not run thru and that way: no offsite channel backup
|
||||
sftp ${sftpBackupOptions} ${localBackupPath} ${sftpBackupTarget}/
|
||||
sftp ${sftpBackupOptions} ${localTimestampedPath} ${sftpBackupTarget}/
|
||||
scp ${scpBackupOptions} ${localBackupPath} ${scpBackupTarget}/
|
||||
scp ${scpBackupOptions} ${localTimestampedPath} ${scpBackupTarget}/
|
||||
result=$?
|
||||
if [ ${result} -eq 0 ]; then
|
||||
echo "OK - SFTP Backup exited with 0"
|
||||
echo "OK - SCP Backup exited with 0"
|
||||
else
|
||||
echo "FAIL - SFTP Backup exited with ${result}"
|
||||
echo "FAIL - SCP Backup exited with ${result}"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue