following situation:
bareos 15.2.1 @ debian jessie is up and running.
LTO-6 tape-drive is correncly set-up and doing backups.
I've successfully enabled LTO hardware encrytion using
https://github.com/bareos/bareos/blob/master/README.scsicrypto
and labeled a test-tape using "encrypt" option.
Backups are running, restores are running, everything fine.
Now, i want to verify, whether the stuff on the tape is really encrypted.
Question - how to i do it?
My current approach is - i want use "bextract"
and extract one of the sample encrypted backups from tape.
With a regular, non-ecrypted tape, the
bextract -v -b Job124.bsr /dev/nst0 /tmp/restore
should work.
Here i try
bextract -v -b Job123.bsr.encrypted /dev/nst0 /tmp/restore
using the BSR of the encryted job.
The last command fails with a
----------
bextract: butil.c:271-0 Using device: "/dev/nst0" for reading.
02-Nov 17:30 bextract JobId 0: Ready to read from volume "TAP006L6" on device "Drive-1" (/dev/nst0).
02-Nov 17:30 bextract JobId 0: Error: block.c:1003 Read error on fd=3 at file:blk 0:1 on device "Drive-1" (/dev/nst0). ERR=Input/output error.
Bareos status: file=0 block=1
Device status: ONLINE IM_REP_EN file=0 block=-1
0 files restored.
----------
Thus, for me it seems like it fails because of the not (yet) set encryption key.
So, i try to set the encrypton manually.
So, I've got the volume "encryptionkey", which was generated during the labeling procedure from DB.
But using it/setting it by
echo -n "....key..." > keyfile
bscrypto -s keyfile /dev/nst1
does not help.
Is the "encryptionkey" from DB also encrypted with the "Key encryption key" from the bareos-sd setup?
Decryption using kinda
KEY="...key encryption key ..."
echo "...encryptionkey..." | openssl enc -d -aes-256-cbc -k "$KEY"
fails.
So, the main question again: how can i verify, that the data on tape is encrypted / encryption works?
Thanks!!
Ilya
many thanks for such detailed answer.
Ok, as far i can recognize, in the current source
https://github.com/bareos/bareos/blob/master/src/lib/crypto_wrap.c
the actual tape encryption key is "wrapped" with "KEK" using AES-128-CBC and is not salted.
Now i've tried to decrypt it, but still fail:
--------------------
#:~$ export KEY='Ygo&fN2w^Y3CB&YeUPr0).o@M!nML_9a'
#:~$ echo -n "OKwtmV5wIqzFylV/ORM7qgE6NdnkzH9gXYeFfpUaBAiIKNHrro8RHw" | openssl enc -d -aes-128-cbc -k "$KEY"
bad magic number
#:~$
--------------------
Ist the password for the tape, ^^^ "OKwt..." kind of baseXX encoded?
Same ^^ openssl string but with "-a" fails too
--------------------
#:~$ echo -n "OKwtmV5wIqzFylV/ORM7qgE6NdnkzH9gXYeFfpUaBAiIKNHrro8RHw" | openssl enc -d -aes-128-cbc -k "$KEY" -a
error reading input file
#:~$
--------------------
Any ideas?
Thanks!
Hello Marco,
thanks.