Remote encrypted backup investigation

"Nathan G. Grennan" <[email protected]> Sun, 29 Aug 2004 23:14:42 -0700
Newsgroups gmane.comp.sysutils.backup.hdup.general
Organization Cygnus X-1
Message-ID <[email protected]>
   Restoring mcrypt or gpg backups remotely doesn't work for me. After
spending a number of hours testing things in various ways I think I see
why. gpg backups get sent across in the file format, while non-encrypted
backups go across in what I think is hdup's own protocol. mcrypt backups
seem to cause hdup to output nothing. Hence the error message below from
mcrypt,


Stdin was NOT decrypted successfully.




hdup non-encrypted:

echo (hdip protocol data) | /usr/bin/ssh  [email protected] hdup remote
testhost


hdup encrypted with mcrypt:

cat '' | /usr/bin/mcrypt -d -q -a rijndael-256 -f /etc/hdup/secret.key
| /usr/bin/ssh  [email protected] hdup remote testhost

hdup encrypted with gpg:

cat file.tar.bz2 | /usr/bin/gpg --always-trust -d -a -r miek -o -
| /usr/bin/ssh  [email protected] hdup remote testhost


Works:

cat file.tar.bz2 | /usr/bin/gpg --always-trust -d -a -r miek -o -
| /usr/bin/ssh  [email protected] tar jxf - -C /


I tested this by changing remote

hdup = /usr/sbin/hdup

to

hdup = /root/hdcat

Where /root/hdcat is

cat - > /root/test.tar.bz2

The resulting output from file for non-encrypted was

data

and gpg was

bzip2 compressed data, block size = 900k

and mcrypt was

empty


The command below uses a file, hdupdata, which was captured from a non-
encrypted restore with hdcat. It works perfectly.

cat hdupdata | /usr/bin/ssh  root-Q0ErXNX1RuaVKKwU8HH/[email protected] /usr/sbin/hdup remote
proton


Overall it seems the easiest way to fix hdup would be to have it decrypt
the data, then take the resulting file, and treat it like an non-
encrypted backup. Instead of it's current gpg method of sending the file
raw to the decryption program, and then the resulting gzip/bz2 tarball
directly to the remote hdup via ssh.

I also noticed that --always-trust was missing from GPG_CRYPT and
GPG_DECRYPT in hdup.h.in. Miek, you said you were going to add it in
1.6.33.