mirror of
https://github.com/rootzoll/raspiblitz.git
synced 2025-03-01 00:59:23 +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
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check if a SFTP backup target is set
|
# check if a SCP backup target is set
|
||||||
# parameter in raspiblitz.conf:
|
# parameter in raspiblitz.conf:
|
||||||
# sftpBackupTarget='[USER]@[SERVER]:[DIRPATH-WITHOUT-ENDING-/]'
|
# scpBackupTarget='[USER]@[SERVER]:[DIRPATH-WITHOUT-ENDING-/]'
|
||||||
# optionally a custom option string for the sftp command can be set with
|
# optionally a custom option string for the scp command can be set with
|
||||||
# sftpBackupOptions='[YOUR-CUSTOM-OPTIONS]'
|
# scpBackupOptions='[YOUR-CUSTOM-OPTIONS]'
|
||||||
# On target server add the public key of your RaspiBlitz to the authorized_keys for the user
|
# 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/
|
# 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"
|
echo "--> Offsite-Backup SFTP Server"
|
||||||
if [ "${sftpBackupOptions}" == "" ]; then
|
if [ "${scpBackupOptions}" == "" ]; then
|
||||||
sftpBackupOptions="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
|
scpBackupOptions="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
|
||||||
fi
|
fi
|
||||||
# its ok to ignore known host, because data is encrypted (worst case of MiM would be: no offsite channel backup)
|
# 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
|
# 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}/
|
scp ${scpBackupOptions} ${localBackupPath} ${scpBackupTarget}/
|
||||||
sftp ${sftpBackupOptions} ${localTimestampedPath} ${sftpBackupTarget}/
|
scp ${scpBackupOptions} ${localTimestampedPath} ${scpBackupTarget}/
|
||||||
result=$?
|
result=$?
|
||||||
if [ ${result} -eq 0 ]; then
|
if [ ${result} -eq 0 ]; then
|
||||||
echo "OK - SFTP Backup exited with 0"
|
echo "OK - SCP Backup exited with 0"
|
||||||
else
|
else
|
||||||
echo "FAIL - SFTP Backup exited with ${result}"
|
echo "FAIL - SCP Backup exited with ${result}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -619,27 +619,27 @@ do
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check if a SFTP backup target is set
|
# check if a SCP backup target is set
|
||||||
# parameter in raspiblitz.conf:
|
# parameter in raspiblitz.conf:
|
||||||
# sftpBackupTarget='[USER]@[SERVER]:[DIRPATH-WITHOUT-ENDING-/]'
|
# scpBackupTarget='[USER]@[SERVER]:[DIRPATH-WITHOUT-ENDING-/]'
|
||||||
# optionally a custom option string for the sftp command can be set with
|
# optionally a custom option string for the scp command can be set with
|
||||||
# sftpBackupOptions='[YOUR-CUSTOM-OPTIONS]'
|
# scpBackupOptions='[YOUR-CUSTOM-OPTIONS]'
|
||||||
# On target server add the public key of your RaspiBlitz to the authorized_keys for the user
|
# 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/
|
# 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"
|
echo "--> Offsite-Backup SFTP Server"
|
||||||
if [ "${sftpBackupOptions}" == "" ]; then
|
if [ "${scpBackupOptions}" == "" ]; then
|
||||||
sftpBackupOptions="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
|
scpBackupOptions="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
|
||||||
fi
|
fi
|
||||||
# its ok to ignore known host, because data is encrypted (worst case of MiM would be: no offsite channel backup)
|
# 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
|
# 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}/
|
scp ${scpBackupOptions} ${localBackupPath} ${scpBackupTarget}/
|
||||||
sftp ${sftpBackupOptions} ${localTimestampedPath} ${sftpBackupTarget}/
|
scp ${scpBackupOptions} ${localTimestampedPath} ${scpBackupTarget}/
|
||||||
result=$?
|
result=$?
|
||||||
if [ ${result} -eq 0 ]; then
|
if [ ${result} -eq 0 ]; then
|
||||||
echo "OK - SFTP Backup exited with 0"
|
echo "OK - SCP Backup exited with 0"
|
||||||
else
|
else
|
||||||
echo "FAIL - SFTP Backup exited with ${result}"
|
echo "FAIL - SCP Backup exited with ${result}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue