Re: Problems with remote repository access via sftp
Martin Michel <martin-eJ/[email protected]> Mon, 07 Nov 2022 21:58:20 +0100
| Newsgroups | gmane.comp.sysutils.backup.dar.support |
|---|---|
| Message-ID | <[email protected]> |
Hi Denis,
>> * Set "ecdsa-sha2-nistp521" as SSH hostkey type
>> * Failure establishing ssh session: -5, Unable to exchange encryption keys
>
> This seems to be the type of SSH hostkey that libcurl cannot
> handle. You could bypass the known_host check of ssh/sftp by setting
> the environement variable DAR_SFTP_KNOWNHOSTS_FILE
>
> export DAR_SFTP_KNOWNHOSTS_FILE
>
> libdar will then not ask libcurl to check for knowhost (this opens a
> possible man-in-the-middle type of attack, but if you are OK to test
> that, this would validate this hypothesis).
Gotcha, this worked! My mistake, I also ran the "normal" curl sftp
command in insecure mode and I was misleaded by this (it is using the
same libssh2 version, see later) You wrote about this in your last email
and it is also on the man page, sorry for the extra round.
>> $ curl -V
>> curl 7.74.0 (x86_64-pc-linux-gnu) libcurl/7.74.0 OpenSSL/1.1.1n
>> zlib/1.2.11 brotli/1.0.9 libidn2/2.3.0 libpsl/0.21.0
>> (+libidn2/2.3.0) libssh2/1.9.0 nghttp2/1
>> .43.0 librtmp/2.3
>
> AFAIK, libcurl relies on libssh2 for ssh/sftp stuff. Here this is
> libssh2/1.9.0, I have an older one so I will upgrade and see.
In the dar_static you provided, it is also libssh2/1.9.0 ?:
$ dar_static -V | grep libssh2
Remote repository (libcurl) : YES (libcurl/7.85.0 OpenSSL/1.1.1n zlib/1.2.11 zstd/1.4.8 libssh2/1.9.0)
Concerning Segmentation fault on Void Linux:
>> I tested on both with `dar_static`.
>> On my local machine, I get a segfault both with and without running
>> with
>> -afile-auth.
>
> OK, I will try to reproduce this segfault under Void Linux.
Here is the strace tail, maybe it helps?:
```
write(1, "Asking libcurl to read directory"..., 99Asking libcurl to read directory content at sftp://****.your-storagebox.de/archives/server4you/
) = 99
brk(0x10d6000) = 0x10d6000
socket(AF_INET6, SOCK_DGRAM, IPPROTO_IP) = 4
close(4) = 0
socketpair(AF_UNIX, SOCK_STREAM, 0, [4, 5]) = 0
fcntl(4, F_GETFL) = 0x2 (flags O_RDWR)
fcntl(4, F_SETFL, O_RDWR|O_NONBLOCK) = 0
fcntl(5, F_GETFL) = 0x2 (flags O_RDWR)
fcntl(5, F_SETFL, O_RDWR|O_NONBLOCK) = 0
rt_sigaction(SIGPIPE, NULL, {sa_handler=SIG_IGN, sa_mask=[PIPE], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x8dea40}, 8) = 0
rt_sigaction(SIGPIPE, {sa_handler=SIG_IGN, sa_mask=[PIPE], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x8dea40}, NULL, 8) = 0
poll([{fd=4, events=POLLIN}], 1, 0) = 0 (Timeout)
rt_sigaction(SIGPIPE, NULL, {sa_handler=SIG_IGN, sa_mask=[PIPE], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x8dea40}, 8) = 0
rt_sigaction(SIGPIPE, {sa_handler=SIG_IGN, sa_mask=[PIPE], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x8dea40}, NULL, 8) = 0
socketpair(AF_UNIX, SOCK_STREAM, 0, [6, 7]) = 0
mmap(NULL, 8392704, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = 0x7f2000bf2000
mprotect(0x7f2000bf3000, 8388608, PROT_READ|PROT_WRITE) = 0
clone(child_stack=0x7f20013f2370, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tid=[11522], tls=0x7f20013f2700, child_tidptr=0x7f20013f29d0) = 11522
rt_sigaction(SIGPIPE, {sa_handler=SIG_IGN, sa_mask=[PIPE], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x8dea40}, NULL, 8) = 0
poll([{fd=6, events=POLLIN}, {fd=4, events=POLLIN}], 2, 1 <unfinished ...>) = ?
+++ killed by SIGSEGV +++
Speicherzugriffsfehler
```
Best regards,
Martin