backup2l driver for encrypted backups with mcrypt

This backup2l driver encrypts and decrypts backups on the fly with a single password-key found in the file /backup_key/backup_key.txt. Of course you should save the file in some other space or rembember it, because if your harddisk fails and you don’t have the key you can’t restore your backups. Beware: the filelists are not encrypted.

Add this lines to your backup2l conf

CREATE_DRIVER="DRIVER_TAR_BZIP2_ENCRYPT"
USER_DRIVER_LIST="DRIVER_TAR_BZIP2_ENCRYPT" 
 
DRIVER_TAR_BZIP2_ENCRYPT ()
{
    case $1 in
        -test)
            require_tools tar bzip2 mcrypt
            test -f /backup_key/backup_key.txt
            echo "ok"
            ;;
        -suffix)
            echo "tarbz2_encrypt"
            ;;
        -create)        # Arguments: $2 = BID, $3 = archive file name, $4 = file list file
            tar cj -T $4 --no-recursion | mcrypt -a rijndael-256 -f /backup_key/backup_key.txt > ${3}
            ;;
        -toc)           # Arguments: $2 = BID, $3 = archive file name
            cat ${3} | mdecrypt -a rijndael-256 -f /backup_key/backup_key.txt | tar tj | sed 's#^#/#'
            ;;
        -extract)       # Arguments: $2 = BID, $3 = archive file name, $4 = file list file
            cat ${3} | mdecrypt -a rijndael-256 -f /backup_key/backup_key.txt | tar xj --same-permission --same-owner -T $4 2>&1
            ;;
    esac
}
pixelstats trackingpixel

Leave a comment

Your comment

Security Code: