OpenNebula / one

The open source Cloud & Edge Computing Platform bringing real freedom to your Enterprise Cloud 🚀
http://opennebula.io
Apache License 2.0
1.19k stars 473 forks source link

Restic Password with special characters cause restore to fail #6571

Open onenhansen opened 2 months ago

onenhansen commented 2 months ago

Description Using a restic password with special characters in it, such as $# will cause the restore options to fail. The backup operation will work properly however any restores will fail.

To Reproduce Create a restic datastore with RESTIC_PASSWORD=abc123$# and try to create and restore a VM.

Expected behavior Backup images should be restored properly, and the password should not get interpreted by bash at any point.

Details

Additional context

oneadmin@ubuntu2204-kvm-qcow2-6-8-bxeps-0:~$ cat restic.txt 
NAME="restic-test"
TYPE="BACKUP_DS"

DS_MAD="restic"
TM_MAD="-"

RESTIC_PASSWORD="abc123$#"
RESTIC_SFTP_SERVER="192.168.150.1"
oneadmin@ubuntu2204-kvm-qcow2-6-8-bxeps-0:~$ onedatastore create restic.txt 
ID: 119

oneadmin@ubuntu2204-kvm-qcow2-6-8-bxeps-0:~$ onedatastore list --no-expand | grep restic-tes
 119 restic-tes  83.2G 84% 0             1 bck  restic  -       on
oneadmin@ubuntu2204-kvm-qcow2-6-8-bxeps-0:~$ onevm backup 185 -d 119
oneadmin@ubuntu2204-kvm-qcow2-6-8-bxeps-0:~$ oneimage list --no-expand | grep 185
 281 oneadmin oneadmin 185 23-Apr 16.1 restic-tes    172M BK   Yes rdy     1
oneadmin@ubuntu2204-kvm-qcow2-6-8-bxeps-0:~$ oneimage restore 281 -d 1 --no_ip --no_nic --name restore-test 
[one.image.restore] Error restoring disk image: [one.image.allocate] Cannot parse image SIZE: Fatal: wrong password or no key found

Progress Status

onenhansen commented 2 months ago

The issue happens during backup actually, were the password is interpreted there. In the sample above where the password is set to abc123$#, if you change the password to abc1230 it will restore properly.