How do I make sure only authorized person access my backups stored on the tape drives (DAT, DLT, LTO-4 etc) under Linux or UNIX operating systems? How do I backup /array22/vol4/home/ to /dev/rmt/5mn or /dev/st0 in encrypted mode?
You can easily encrypt data to tape using combination of tar and openssl commands. The following is software based solution based upon encryption algorithms supported by openssl tool. Encrypted backup should be used when storing sensitive data on removable media or when storing backups on shared NAS / SAN servers or online backup servers. When using encryption the openssl ask for a password before you can create, view, open, or restore the files included in the backup. This is based upon pipes concept.
The following shows an example of writing the contents of "tapetest" to tape:
tar zcvf - /array22/vol4/home | openssl des3 -salt | dd of=/dev/st0
An encryption password would be entered by the administrator or backup operator i.e. the above will encrypt a tape using triple DES in CBC mode using a prompted password. You can put password in script itself:
tar zcvf - /array22/vol4/home | openssl des3 -salt -k "Your-Password-Here" | dd of=/dev/st0
Reading (listing) Files
Type the command as follows:
dd if=/dev/st0 | openssl des3 -d -salt | tar ztvf -
dd if=/dev/st0 | openssl des3 -d -salt -k "Your-Password-Here" | tar ztvf -
Restore The Data
Use the following command to read and restore data back:
dd if=/dev/st0 | openssl des3 -d -salt | tar xzf -
dd if=/dev/st0 | openssl des3 -d -salt -k "Your-Password-Here" | tar xzf -
- dd : Convert and copy a file.
- /dev/st0 : Tape device name.
- openssl : The OpenSSL toolkit command line utility.
- tar : The tar archiving utility.
- des3 : Triple-DES Cipher (Triple DES is the common name for the Triple Data Encryption Algorithm).
- -salt : The -salt option should ALWAYS be used if the key is being derived from a password unless you want compatibility with previous versions of OpenSSL and SSLeay. Without the -salt option it is possible to perform efficient dictionary attacks on the password and to attack stream cipher encrypted data. The reason for this is that without the salt the same password always generates the same encryption key. When the salt is being used the first eight bytes of the encrypted data are reserved for the salt: it is generated at random when encrypting a file and read from the encrypted file when it is decrypted. (source enc man page)
Hardware vs Software Encryption
The software encryption is different from the hardware encryption. The hadrware based encryption needs additional software+hardware and it use keys (and/or password) to protect data. I suggest you read vendor site such as HP or IBM to get further details on hardware encryption which may or may not be supported by your backup devices.
- Howto install duplicity under RedHat / CentOS / Fedora Core Linux to make to automatically encrypting and storing remote backups in a bandwidth efficient manner
- man pages tar, enc, openssl and bash/ksh
- 30 Cool Open Source Software I Discovered in 2013
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012
- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop