#2371 Issue closed: BACKUP=YUM scripts append BACKUP_PROG_OPTIONS as string but it is an array

Labels: bug, fixed / solved / done

jsmeix opened issue at 2020-04-16 08:28:

While working on
https://github.com/rear/rear/issues/2364
I found (excerpts):

# find usr/sbin/rear usr/share/rear/ -type f | xargs grep 'BACKUP_PROG_OPTIONS='
...
usr/share/rear/restore/YUM/default/410_restore_backup.sh:
BACKUP_PROG_OPTIONS="$BACKUP_PROG_OPTIONS --selinux"
BACKUP_PROG_OPTIONS="$BACKUP_PROG_OPTIONS --xattrs"
BACKUP_PROG_OPTIONS="$BACKUP_PROG_OPTIONS --xattrs-include=\"*.*\""
BACKUP_PROG_OPTIONS="$BACKUP_PROG_OPTIONS --exclude-from=/tmp/restore-exclude-list.txt "

usr/share/rear/backup/YUM/default/500_make_backup.sh:
BACKUP_PROG_OPTIONS="$BACKUP_PROG_OPTIONS --selinux"
BACKUP_PROG_OPTIONS="$BACKUP_PROG_OPTIONS --xattrs"
BACKUP_PROG_OPTIONS="$BACKUP_PROG_OPTIONS --xattrs-include=\"*.*\""

Those must be fixed to

BACKUP_PROG_OPTIONS+=( additional elements )

jsmeix commented at 2020-04-16 08:48:

@N3WWN
FYI see https://github.com/rear/rear/issues/2371

jsmeix commented at 2020-04-16 08:57:

With
https://github.com/rear/rear/commit/cf15f626d2a19ffd6211dca65bf86e1955193851
and
https://github.com/rear/rear/commit/ddb717f5585b261a84955fea2fc6ef5ad46298b8
this issue should be fixed.

jsmeix commented at 2020-04-16 09:10:

@N3WWN
I have a question:

It seems support for BACKUP_PROG_CRYPT_ENABLED
(and its related config variables) is missing in
backup/YUM/default/500_make_backup.sh
while it seems to be there in
restore/YUM/default/410_restore_backup.sh
and in
restore/YUM/default/405_recreate_users_and_groups.sh

I don't see something about backup encryption in
https://github.com/rear/rear/blob/master/doc/user-guide/14-ZYPPER-and-YUM.adoc

How is backup encryption meant to work with BACKUP=YUM?

jsmeix commented at 2020-04-16 09:21:

With
https://github.com/rear/rear/commit/2ecd77c141c67f0ec0c774d553756c52fdfb0096
all YUM scripts that use BACKUP_PROG_OPTIONS

# find usr/share/rear/ -type f | xargs grep -l 'BACKUP_PROG_OPTIONS' | grep YUM

usr/share/rear/restore/YUM/default/405_recreate_users_and_groups.sh
usr/share/rear/restore/YUM/default/410_restore_backup.sh
usr/share/rear/backup/YUM/default/500_make_backup.sh

should now be fixed regarding using BACKUP_PROG_OPTIONS as string
while actually it must be used as an array.

N3WWN commented at 2020-04-16 19:32:

@N3WWN
I have a question:

It seems support for BACKUP_PROG_CRYPT_ENABLED
(and its related config variables) is missing in
backup/YUM/default/500_make_backup.sh
while it seems to be there in
restore/YUM/default/410_restore_backup.sh
and in
restore/YUM/default/405_recreate_users_and_groups.sh

I don't see something about backup encryption in
https://github.com/rear/rear/blob/master/doc/user-guide/14-ZYPPER-and-YUM.adoc

How is backup encryption meant to work with BACKUP=YUM?

@jsmeix That's a very good question! ;)

I have never used encryption with my backups and suppose I didn't catch that it was partially implemented.

Not seeing an issue for this, should I open one and either implement backup encryption or remove it entirely?

How would you prefer I proceed.

Thanks!

jsmeix commented at 2020-04-17 08:04:

@N3WWN
right now I did https://github.com/rear/rear/issues/2374
so the issue is described and false usage is now prohibited via
https://github.com/rear/rear/commit/0c4c49cbdfb58899390c82f5c6bd8a86790db411

Because BACKUP=YUM is a rather special backup method
there is no current need to implement support for
BACKUP_PROG_CRYPT_ENABLED
but of course it would be nice to have it supported.

If you like to add support for BACKUP_PROG_CRYPT_ENABLED
see the other scripts where that is currently used in particular
backup/NETFS/default/500_make_backup.sh and
restore/NETFS/default/400_restore_backup.sh and copy its code.
In particular note the special coding that is mandatory to avoid
that secret values show up somewhere (e.g. in the log with set -x).


[Export of Github issue for rear/rear.]