diff --git a/README.md b/README.md index 6e837a0..03aadfc 100644 --- a/README.md +++ b/README.md @@ -6,4 +6,7 @@ Backup your Froxlor Webhosting to another server. Encrypted, via ssh. Works until version 0.9.32. SQL works now also for Versions > 0.9.32. -HTML is planned to be backed up with duplicity \ No newline at end of file +HTML is planned to be backed up with duplicity + +The decrypt.sh file has just two lines. With them you can decrypt and untar your backups as long as they are back on the local storage. +For $encrypt in this file use the same path as you do in any other file diff --git a/backup-server.sh b/backup-server.sh index 6650fa2..0d8744d 100644 --- a/backup-server.sh +++ b/backup-server.sh @@ -1,5 +1,5 @@ #!/bin/bash -# 2013 by Mainboarder.de +# 2014 by Mainboarder.de # # Keep this comment untouched and do not use this software for military purposes. # you are allowed to use this just like you want on your own risk. @@ -7,8 +7,10 @@ path="var/customers/backups/" temp="var/customers/temp-backup-path/" +sshkey="/etc/ssh/ssh_host_dsa_key" encryption="path/to/enc.key" external="user@extern.server.de" +externalpath="/media/mountpoint/backups" # um <> zu vermeiden cd / @@ -36,7 +38,7 @@ openssl aes-256-cbc -kfile $encryption -in backup-html-$datum.tar.gz -out ./back rm backup-html-$datum.tar.gz #Kopieren und verschlüsselte Datei löschen -scp -i /etc/ssh/ssh_host_dsa_key ./backup-html-$datum.enc.tar.gz $external:/mnt/usb/backups +scp -i $sshkey ./backup-html-$datum.enc.tar.gz $external:$externalpath rm backup-html-$datum.enc.tar.gz diff --git a/backup-sql.sh b/backup-sql.sh index 214c338..cfdb5f2 100644 --- a/backup-sql.sh +++ b/backup-sql.sh @@ -10,9 +10,10 @@ temp="var/customers/temp-backup-path" backuppath="/mnt/usb/backups" encryption="/path/to/enc.key" +sshkey="/etc/ssh/ssh_host_dsa_key" external="user@extern.server.de" -MYSQL_USER="root" -MYSQL_PASSWORD="root" +mysql_user="root" +mysql_password="root" # Programm @@ -23,11 +24,11 @@ cd / datum=$(date +"%d"."%m"."%y") #Datenbanken finden -databases=`mysql -u $MYSQL_USER -p$MYSQL_PASSWORD -e "SHOW DATABASES;" | grep -Ev "(Database|information_schema|performance_schema|mysql)"` +databases=`mysql -u $mysql_user -p$mysql_password -e "SHOW DATABASES;" | grep -Ev "(Database|information_schema|performance_schema|mysql)"` #Datenbanken exportieren for db in $databases; do - mysqldump -u $MYSQL_USER -p$MYSQL_PASSWORD $db > "$temp/$db.sql" + mysqldump -u $mysql_user -p$mysql_password $db > "$temp/$db.sql" done # Alle SQL-Dumps in ein Archiv packen @@ -39,7 +40,7 @@ openssl aes-256-cbc -kfile $encryption -in $temp/../backup-sql-$datum.tar.gz -ou rm $temp/../backup-sql-$datum.tar.gz #Kopieren und verschlüsselte Datei löschen -scp -i /etc/ssh/ssh_host_dsa_key $temp/backup-sql-$datum.enc.tar.gz $external:$backuppath +scp -i $sshkey $temp/backup-sql-$datum.enc.tar.gz $external:$backuppath rm -r $temp mkdir $temp diff --git a/decrypt.sh b/decrypt.sh new file mode 100644 index 0000000..e25bd26 --- /dev/null +++ b/decrypt.sh @@ -0,0 +1,7 @@ +## +# This just shows how to decrypt and untar files +# replace $encryption with your path to the encryption file +## + +openssl aes-256-cbc -d -kfile $encryption -in file.enc.tar.gz > file.tar.gz +tar xzfv file.tar.gz