Skip to content

Instantly share code, notes, and snippets.

@RichGuk
Created April 4, 2010 07:51
Show Gist options
  • Save RichGuk/355213 to your computer and use it in GitHub Desktop.
Save RichGuk/355213 to your computer and use it in GitHub Desktop.
#!/bin/sh
export PASSPHRASE=SomeMagiclySecurePassphrase
export SSH_AUTH_SOCK=/tmp/ssh-agent
#
# Dump mySQL databases, relying on backup of /var/lib/mysql isn't advised.
#
mysqldump --all-databases -uroot -pTEHPAZZ | bzip2 -c > /root/backups/db/all_databases_$(date +%Y_%m_%d).sql.bz2
#
# Main backup.
#
duplicity --sign-key '7F73FA36' --encrypt-key '5FD0100F' --exclude-filelist=/root/scripts/backups/ignorelist / scp://rich@backup_server//mnt/backups/edge/main
#
# Clean up.
#
# Remove the temp database dump.
rm /root/backups/db/all_databases_$(date +%Y_%m_%d).sql.bz2
# Delete duplicity backups older than 30 days.
duplicity remove-older-than 30D scp://rich@backup_server//mnt/backups/edge/main
gpg --gen-key
gpg (GnuPG) 1.4.10; Copyright (C) 2008 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Please select what kind of key you want:
(1) RSA and RSA (default)
(2) DSA and Elgamal
(3) DSA (sign only)
(4) RSA (sign only)
Your selection?
*press enter*
RSA keys may be between 1024 and 4096 bits long.
What keysize do you want? (2048)
Requested keysize is 2048 bits
*press enter*
Please specify how long the key should be valid.
0 = key does not expire
<n> = key expires in n days
<n>w = key expires in n weeks
<n>m = key expires in n months
<n>y = key expires in n years
Key is valid for? (0)
*press enter*
Key does not expire at all
Is this correct? (y/N) y
You need a user ID to identify your key; the software constructs the user ID
from the Real Name, Comment and Email Address in this form:
"Heinrich Heine (Der Dichter) <heinrichh@duesseldorf.de>"
Real name: Edge Backup Encryption Key
Email address: me@domain.com
Comment: Encryption key for Edge backups
You selected this USER-ID:
"Edge Backup Encryption Key (Encryption key for Edge backups) <me@domain.com>"
Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? O
You need a Passphrase to protect your secret key.
*enter passphrase, make sure secure*
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
....................+++++
...+++++
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
.....+++++
+++++
gpg: key B5FC8737 marked as ultimately trusted
public and secret key created and signed.
gpg: checking the trustdb
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
gpg: depth: 0 valid: 2 signed: 0 trust: 0-, 0q, 0n, 0m, 0f, 2u
pub 2048R/B5FC8737 2010-04-03
Key fingerprint = 2365 2F64 0808 8A90 644C 9AEF FBBD B843 B5FC 8737
uid Edge Backup Encryption Key (Encryption key for Edge backups) <me@domain.com>
sub 2048R/9ABB5804 2010-04-03
/root/.gnupg/pubring.gpg
------------------------
pub 2048R/5FD0100F 2010-04-04
uid Edge Backup Encryption Key (Encryption key for edge backups) <me@domain.com>
sub 2048R/48F61F08 2010-04-04
pub 2048R/7F73FA36 2010-04-04
uid Edge Backup Signature Key (Signature key for edge backups) <me@domain.com>
sub 2048R/A67F8410 2010-04-04
/root/.gnupg/secring.gpg
------------------------
sec 2048R/7F73FA36 2010-04-04
uid Edge Backup Signature Key (Signature key for edge backups) <me@domain.com>
ssb 2048R/A67F8410 2010-04-04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment