YunoHost-Apps / borg_ynh

An experimental Borg implementation for YunoHost
https://www.borgbackup.org/
GNU Affero General Public License v3.0
19 stars 23 forks source link

Part of the passphrase is interpreted as an empty variable #50

Closed SimonLefort closed 3 years ago

SimonLefort commented 3 years ago

Hello, I installed Borg on my Yunohost servers and when I want to see if I can read backups, I can't because passphrase seems incorrect. So I dug into it.

The problem is, I think, in this script :

# cat /etc/yunohost/hooks.d/backup_method/05-borg_app
(...)
BORG_PASSPHRASE="RGjauGbbg6d$jj77g*piabfbfGedE"
(...)

(I changed the passphrase, obviously..)

Yunohost saved the complete passphrase :

# yunohost app setting borg passphrase
RGjauGbbg6d$jj77g*piabfbfGedE

But "$jj77g" is considered like an empty variable. Finally, borg used "RGjauGbbg6d*piabfbfGedE". We have to change " -> ' in the script.

$ PASSPHRASE="gaghtbgg$TEXT*gloa"
$ echo $PASSPHRASE 
gaghtbgg*gloa

$ PASSPHRASE='gaghtbgg$TEXT*gloa'
$ echo $PASSPHRASE 
gaghtbgg$TEXT*gloa

Perhaps we should add a warning during installation to say it's better to avoid some special characters ( ' , " , $ , .. ) ?

zamentur commented 3 years ago

Fixed in #71