tasket / wyng-backup

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

Control socket filename is too big when using host name of tor v3 hostname #194

Closed tlaurion closed 6 months ago

tlaurion commented 6 months ago

@tasket the socket filename is too big when using host name of tor v3 to be ssh'ed hostname. Could that be truncated to max size (100/108 chars from what I get?)

Originally posted by @tlaurion in https://github.com/tasket/wyng-backup/issues/187#issuecomment-2106238983

That is https://github.com/tasket/wyng-backup/blob/08177d45133d178a1f3b289b0e1c02d40d0076ae/src/wyng#L2149-L2152

tasket commented 6 months ago

Are there any captured ssh command lines from wyng --debug?

tasket commented 6 months ago

Also, have you tried replacing:

    ssh_opts    = ["-x", "-o", "ControlPath=~/.ssh/controlsocket-%r@%h-%p",
                         "-o", "ControlMaster=auto", "-o", "ControlPersist=60",
                         "-o", "ServerAliveInterval=30", "-o", "ConnectTimeout=30",
                         "-o", "Compression=no"]

with this:

    ssh_opts    = ["-x"]
tlaurion commented 6 months ago

Are there any captured ssh command lines from wyng --debug?

@tasket here you go:

[user@dom0 ~]
(5)$ time sudo wyng --dest qubes-ssh://wyng-InsurgoLab-tor:root@aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.onion/mnt/Backups/nv41 --all --dedup --remap --authmin 1080 send --verbose --debug
Wyng 0.8wip release 20240511
CalledProcessError(255, [['/usr/bin/qvm-run', '--no-color-stderr', '--no-color-output', '-p', 'wyng-InsurgoLab-tor', '/usr/bin/ssh -x -o ControlPath=~/.ssh/controlsocket-%r@%h-%p -o ControlMaster=auto -o ControlPersist=60 -o ServerAliveInterval=30 -o ConnectTimeout=30 -o Compression=no root@aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.onion "$(/usr/bin/cat /tmp/wyngrpc/tmp8h7tknkp)"'], ['/usr/bin/cat', '-v'], ['/usr/bin/tail', '--bytes=2000']])

, 'wyng-InsurgoLab-tor', '/usr/bin/mkdir -p /tmp/wyngrpc/; /usr/bin/cat >/tmp/wyngrpc/tmp8h7tknkp']]
[['/usr/bin/qvm-run', '--no-color-stderr', '--no-color-output', '-p', 'wyng-InsurgoLab-tor', '/usr/bin/ssh -x -o ControlPath=~/.ssh/controlsocket-%r@%h-%p -o ControlMaster=auto -o ControlPersist=60 -o ServerAliveInterval=30 -o ConnectTimeout=30 -o Compression=no root@aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.onion "$(/usr/bin/cat /tmp/wyngrpc/tmp8h7tknkp)"'], ['/usr/bin/cat', '-v'], ['/usr/bin/tail', '--bytes=2000']]
unix_listener: path "/home/user/.ssh/controlsocket-root@aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.onion-22.Db0STEBNvCJq6RQe" too long for Unix domain socket^M
[0, 255]
[['/usr/bin/cat', '-v', '/tmp/wyngfwqsrip4/dest-state.log'], ['/usr/bin/tail', '--bytes=1000'], ['/usr/bin/grep', '-vFx', ' --+--']]
[['/usr/bin/cat', '-v', '/tmp/wyngfwqsrip4/err.log'], ['/usr/bin/tail', '--bytes=1000'], ['/usr/bin/grep', '-vFx', ' --+--']]

Destination not ready to receive commands.

real    0m14.976s
user    0m0.339s
sys 0m0.181s
tlaurion commented 6 months ago

Also, have you tried replacing:

    ssh_opts    = ["-x", "-o", "ControlPath=~/.ssh/controlsocket-%r@%h-%p",
                         "-o", "ControlMaster=auto", "-o", "ControlPersist=60",
                         "-o", "ServerAliveInterval=30", "-o", "ConnectTimeout=30",
                         "-o", "Compression=no"]

with this:

    ssh_opts    = ["-x"]

@tasket : works.

Notes:

$ diff /sbin/wyng.orig /sbin/wyng
2159,2162c2159
<     ssh_opts    = ["-x", "-o", "ControlPath=~/.ssh/controlsocket-%r@%h-%p",
<                          "-o", "ControlMaster=auto", "-o", "ControlPersist=60",
<                          "-o", "ServerAliveInterval=30", "-o", "ConnectTimeout=30",
<                          "-o", "Compression=no"]
---
>     ssh_opts    = ["-x"]
[user@dom0 ~]
[user@dom0 ~]
(130)$ time sudo wyng --dest qubes-ssh://wyng-InsurgoLab-tor:root@aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.onion/mnt/Backups/nv41 --all --dedup --remap --authmin 1080 list --verbose --debug
Wyng 0.8wip release 20240511
Fetched archive.ini 5558
Fetched archive.salt 424
Fetched salt.bak 424
metadata cipher = xchacha20-poly1305-msr
[var]
uuid = 92b4ee16-735e-406b-963c-672064b8bcae
updated_at = 1715574096.7731464
format_ver = 3
chunksize = 131072
compression = zstd
compr_level = 3
hashtype = hmac-sha256
ci_mode = 35
dataci_count = 4965360
mci_count = 66460

[volumes]

[...redacted...]

real    1m30.680s
user    0m0.579s
sys 0m0.372s
tlaurion commented 6 months ago

"ControlPath=~/.ssh/controlsocket-%r@%h-%p"

I think you could truncate hostname so that archive id stays valid for current users, but limit the size for create unique ID that don't break things.

tor v3 is 57 chars + .onion here which causes https://github.com/tasket/wyng-backup/issues/187#issuecomment-2106238983

unix_listener: path "/home/user/.ssh/controlsocket-root@aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.onion-22.Db0STEBNvCJq6RQe" too long for Unix domain socket^M
[0, 255]

Reported with debug trace at https://github.com/tasket/wyng-backup/issues/194#issuecomment-2108322751

tlaurion commented 6 months ago

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.onion is std length of tor v3 hostname (of course redacted)

tasket commented 6 months ago

@tlaurion Fixed.