I've got a strange issue that I just can't wrap my head around. I let DirectAdmin create backups with encryption enabled, but I am just unable to get the backups decrypted. I've tried to debug a lot but I'm currently stuck.
I use 24 character generated passwords. In /usr/local/directadmin/data/admin/backup.conf I can view the (base64) encoded version of the password - so the password seem to be stored correctly.
After the backup is encrypted and uploaded (FTP), I download the backup and upload it again to the server. Here I run the decrypt script:
In the key.txt I've entered the exact same password.
This gives me the following error:
A further attempt to figure out the issue, I modified the encrypt_file.sh script to write the key directly to key.txt to make sure that the exact same key is used for encrypting and decrypting, and that it's not some other kind of mixup.
This still leads to the same error.
I see that the encrypt_file script executes the following command:
and that the decrypt_file script executes the following command:
Does anyone run into the same issues?
I use 24 character generated passwords. In /usr/local/directadmin/data/admin/backup.conf I can view the (base64) encoded version of the password - so the password seem to be stored correctly.
After the backup is encrypted and uploaded (FTP), I download the backup and upload it again to the server. Here I run the decrypt script:
Code:
/usr/local/directadmin/scripts/decrypt_file.sh /root/user.admin.xxxx.tar.gz.enc /root/user.admin.xxxx.tar.gz /tmp/key.txt
This gives me the following error:
Code:
*** WARNING : deprecated key derivation used.
Using -iter or -pbkdf2 would be better.
bad decrypt
140099618064192:error:0606506D:digital envelope routines:EVP_DecryptFinal_ex:wrong final block length:crypto/evp/evp_enc.c:632:
A further attempt to figure out the issue, I modified the encrypt_file.sh script to write the key directly to key.txt to make sure that the exact same key is used for encrypting and decrypting, and that it's not some other kind of mixup.
Code:
cat ${P} > /tmp/key.key
This still leads to the same error.
I see that the encrypt_file script executes the following command:
Code:
${OPENSSL} enc -e -aes-256-cbc -md sha256 -salt -in $F -out $E -kfile ${P} 2>&1
and that the decrypt_file script executes the following command:
Code:
RESULT=`${OPENSSL} enc -d -aes-256-cbc -md sha256 -salt -in $E -out $O -kfile ${P} 2>&1`
Does anyone run into the same issues?