tasket / wyng-backup

Fast backups for logical volumes & disk images
GNU General Public License v3.0
244 stars 16 forks source link

Remote server not playing well with multiple clients/archives dir (permission issue since same files are used) #114

Closed tlaurion closed 2 years ago

tlaurion commented 2 years ago

Use case linked to PoC #100

[user@dom0 ~]$ sudo wyng --meta-dir=/var/lib/wyng.backup-insurgo-RW --from=qubes-ssh://wyng-Insurgo-RW:rwuser@198.15.126.235/ --subdir=home/rwuser/q41_insurgo arch-init
Wyng 0.3.2 release 20220818

Metadata will be read from the archive;
Please check that the archive is in a trusted, secure condition!
Proceed? [y/N] y

No problem here. Doing my thing. Adding stuff, sending with tags and dedup etc.

Then when time comes to download changes from RO account:

[user@dom0 ~]$ sudo wyng --meta-dir=/var/lib/wyng.backup-insurgo --from=qubes-ssh://wyng-Insurgo:q41_insurgo@198.15.126.235/ --subdir=home/rwuser/q41_insurgo arch-init
Wyng 0.3.2 release 20220818

Metadata will be read from the archive;
Please check that the archive is in a trusted, secure condition!
Proceed? [y/N] y
Traceback (most recent call last):
  File "/usr/bin/wyng", line 2918, in <module>
    aset         = get_configs_remote()
  File "/usr/bin/wyng", line 773, in get_configs_remote
    do_exec([dest_run_args(desttype, [destcd + bkdir
  File "/usr/bin/wyng", line 1154, in do_exec
    raise subprocess.CalledProcessError(err.returncode, err.args)
subprocess.CalledProcessError: Command '['/bin/tar', '-xzf', '-']' returned non-zero exit status 2.
[user@dom0 ~]$ cat /tmp/wyng/err.log 
--+--
--+--
--+--
rm: cannot remove '/tmp/wyng-rpc/dest_helper.py': Permission denied
rm: cannot remove '/tmp/wyng-rpc/tar.lst': Permission denied
--+--
--+--
Traceback (most recent call last):
  File "/tmp/wyng-rpc/dest_helper.py", line 150, in <module>
    with open(tmpdir+"/tar.lst","w") as tarlstf:
PermissionError: [Errno 13] Permission denied: '/tmp/wyng-rpc/tar.lst'

gzip: stdin: unexpected end of file
/bin/tar: Child returned status 1
/bin/tar: Error is not recoverable: exiting now
--+--

Workaround:

Needed implementation:

This might be blocker in PoC.

tasket commented 2 years ago

Already looking at making tmp dirs unique. Fix coming soon.

Note this will only resolve simultaneously read operations; simultaneous writes are somewhere past the v0.4 horizon.

tasket commented 2 years ago

Related issues #15, #45

tasket commented 2 years ago

@tlaurion There is now a workaround to allow multiple remote helpers in the 'fix03' branch. It is based on simple (large) random number assignment, so there is a tiny chance of failure. The alternative would be to have the remote assign a dir name and then store that in a local variable, but I'm not comfortable using an untrusted filesystem parsed string at this time.

tasket commented 2 years ago

I went ahead and used a solution for sanitizing the remote tmp dir name... for complete collision avoidance.