1
0
mirror of https://github.com/deajan/obackup.git synced 2024-12-27 07:53:40 +01:00

Work in progress for encryption

This commit is contained in:
deajan 2016-08-26 11:55:58 +02:00
parent a342b1ba1d
commit fc84c633a8

View File

@ -5,7 +5,7 @@ PROGRAM="obackup"
AUTHOR="(C) 2013-2016 by Orsiris de Jong" AUTHOR="(C) 2013-2016 by Orsiris de Jong"
CONTACT="http://www.netpower.fr/obackup - ozy@netpower.fr" CONTACT="http://www.netpower.fr/obackup - ozy@netpower.fr"
PROGRAM_VERSION=2.1-dev PROGRAM_VERSION=2.1-dev
PROGRAM_BUILD=2016082202 PROGRAM_BUILD=2016082501
IS_STABLE=no IS_STABLE=no
source "./ofunctions.sh" source "./ofunctions.sh"
@ -91,8 +91,8 @@ function CheckEnvironment {
if [ "$FILE_BACKUP" != "no" ]; then if [ "$FILE_BACKUP" != "no" ]; then
if [ "$ENCRYPTION" == "yes" ]; then if [ "$ENCRYPTION" == "yes" ]; then
if ! type duplicity > /dev/null 2>&1 ; then if ! type gpg > /dev/null 2>&1 ; then
Logger "duplicity not present. Cannot backup encrypted files." "CRITICAL" Logger "gpg not present. Cannot encrypt backup files." "CRITICAL"
CAN_BACKUP_FILES=0 CAN_BACKUP_FILES=0
fi fi
else else
@ -139,6 +139,15 @@ function CheckCurrentConfig {
fi fi
#TODO-v2.1: Add runtime variable tests (RSYNC_ARGS etc) #TODO-v2.1: Add runtime variable tests (RSYNC_ARGS etc)
if [ "$REMOTE_OPERATION" == "yes" ] && [ ! -f "$SSH_RSA_PRIVATE_KEY" ]; then
Logger "Cannot find rsa private key [$SSH_RSA_PRIVATE_KEY]. Cannot connect to remote system." "CRITICAL"
exit 1
fi
if [ -f "$ENCRYPT_GPG_PYUBKEY" ]; then
Logger "Cannot find gpg pubkey [$ENCRPYT_GPG_PUBKEY]. Cannot encrypt backup files." "CRITICAL"
exit 1
fi
} }
function CheckRunningInstances { function CheckRunningInstances {
@ -822,12 +831,28 @@ function BackupDatabases {
done done
} }
function EncryptFiles { function PrepareEncryptFiles {
local tmpPath="${2}"
__CheckArguments 1 $# ${FUNCNAME[0]} "$@" #__WITH_PARANOIA_DEBUG
if [ "$BACKUP_TYPE" == "local" ] || [ "$BACKUP_TYPE" == "push" ]; then
_CreateDirsLocal "$tmpPath"
elif [ "$BACKUP_TYPE" == "pull" ]; then
Logger "Encryption only works with [local] or [push] backup types." "CRITICAL"
exit 1
fi
#WIP: check disk space in tmp dir and compare to backup size else error
}
function EncrpytFiles {
local filePath="${1}" # Path of files to encrypt local filePath="${1}" # Path of files to encrypt
local tmpPath="${2}" local tmpPath="${2}"
__CheckArguments 2 $# ${FUNCNAME[0]} "$@" #__WITH_PARANOIA_DEBUG __CheckArguments 2 $# ${FUNCNAME[0]} "$@" #__WITH_PARANOIA_DEBUG
#WIP: template code to split into local & remote code
#crypt_cmd source temp #crypt_cmd source temp
# Send files to remote, rotate & copy # Send files to remote, rotate & copy
} }