added bonus dump example

This commit is contained in:
Randy Bush 2019-10-29 20:26:56 -07:00
parent e4e4c43e64
commit 1eb4641255
No known key found for this signature in database
GPG key ID: D5597695EA37E360

View file

@ -48,4 +48,33 @@ virtio_rng.0
---
2019.10.29
# As a Bonus, Using GPG to Encrypt a Remote Dump
```
#!/bin/sh
BSYS="raid.rg.net"
USYS="backup@$BSYS"
BDIR="/backup"
HOST=`hostname`
DATE=`date "+%Y-%m-%d"`
DDIR="$BDIR/$HOST.$DATE"
DEST="$USYS:$DDIR"
SSH="/usr/bin/ssh -i /home/backup/.ssh/id_rsa"
KEY_ID=C6E7437452CD33FD1C1247A7EE84C28C1F64EAAF
GPG="/usr/bin/gpg --no-options --batch --no-greeting --no-secmem-warning --keyring /home/backup/.gnupg/pubring.gpg --secret-keyring /home/backup/.gnupg/secring.gpg --trustdb-name /home/backup/.gnupg/trustdb.gpg --digest-algo sha256 --cipher-algo aes256 --s2k-cipher-algo aes256 --s2k-digest-algo sha512 --encrypt --recipient $KEY_ID"
# Filesystem Size Used Avail Use% Mounted on
# /dev/vda1 61G 2.5G 56G 5% /
$SSH $USYS mkdir $DDIR
for F in base; do
$SSH $USYS touch $DDIR/$F
done
sudo /sbin/dump -0uab 64 -f - / | $GPG | $SSH $USYS "/bin/cat > $DDIR/base"
```
---
2019.10.30