- User Since
- Nov 7 2017, 9:55 AM (97 w, 20 h)
Thank you for the reproducer. I can confirm and reproduce with your attached code. This is the backtrace:
#0 0x00007f8df8576c10 in __poll_nocancel () from /lib64/libc.so.6 #1 0x00007f8df14d58c0 in ssh_poll () from /lib64/libssh.so.4 #2 0x00007f8df14d6033 in ssh_poll_ctx_dopoll () from /lib64/libssh.so.4 #3 0x00007f8df14d798c in ssh_handle_packets () from /lib64/libssh.so.4 #4 0x00007f8df14d7a93 in ssh_handle_packets_termination () from /lib64/libssh.so.4 #5 0x00007f8df14ae889 in channel_request () from /lib64/libssh.so.4 #6 0x00007f8df14afa6b in ssh_channel_request_exec () from /lib64/libssh.so.4 #7 0x00007f8df1740837 in XS_Libssh__Session_ssh_channel_request_exec () from /usr/lib64/perl5/vendor_perl/auto/Libssh/Session/Session.so #8 0x00007f8df989c41f in Perl_pp_entersub () from /usr/lib64/perl5/CORE/libperl.so #9 0x00007f8df9894b96 in Perl_runops_standard () from /usr/lib64/perl5/CORE/libperl.so #10 0x00007f8df9831985 in perl_run () from /usr/lib64/perl5/CORE/libperl.so #11 0x0000000000400ce9 in main ()
In the server, log the event of failed session opening is visible here:
Sep 17 14:59:42 jjelen-rhel-7.3 sshd: debug1: channel 10: new [server-session] Sep 17 14:59:42 jjelen-rhel-7.3 sshd: debug1: session_open: channel 10 Sep 17 14:59:42 jjelen-rhel-7.3 sshd: error: no more sessions Sep 17 14:59:42 jjelen-rhel-7.3 sshd: debug1: session open failed, free channel 10 Sep 17 14:59:42 jjelen-rhel-7.3 sshd: debug1: channel 10: free: server-session, nchannels 11 Sep 17 14:59:42 jjelen-rhel-7.3 sshd: debug3: channel 10: status: The following connections are open:\r\n ... Sep 17 14:59:42 jjelen-rhel-7.3 sshd: debug1: server_input_channel_open: failure session
Mon, Sep 16
I implemented the match exec. Can you try if it works for you as expected in your use case? There are several commits adjusting the tests and as well as I had to implement new token parsing function, but my basic tests looked good. This code also does not work on windows since I am not Windows developer, but if interested, I believe there will be somebody who could implement that.
The original issue should be resolved in master now.
Aris, can you open a new bug for this, ideally with more debug information as proposed by @ansasaki?
Fri, Sep 13
Can you check the following patch if t addresses the issue for you?
I am getting exactly the same result as the OP when I remove the /usr/bin/nc, which is used in the respective failing test so I assume that this is the issue, but the error should be more properly reported and the test probably skipped in case the netcat is not in place. I will submit a patch.
Thank you for having a look into that. In that case, I am wondering why it did work for me and for the CI we run, but I think most of that is on Fedora, which might be a difference. Can you check whether the netcat (nc) is installed in your system?
I just tested the ssh-client from examples, which is using channel_open with sshd configured with MaxSessions 0 and it is correctly failing and not hanging for me. Can you test with current libssh master or 0.9 and provide more ellaborate reproducer?
The file doc/sftp.dox contains the following information (not sure whether it is rendered somewhere on the web):
This should be addressed by using the new API even inside of the deprecated functions without the change of functionality. Can you try the following patch?
The modification of the libssh.h is breaking other applications (for example the applications in example directory) using this header file not defining HAVE_INTTYPES_H and HAVE_UNISTD_H themselves. Can you clarify what problem are you solving by this and on what system you do not have these header files?
Did you try the latest libssh 0.9 . Not sure what went wrong with the old version, but the windows builds are part of CI and they should work in recent version
Tue, Aug 20
I think the multi-criteria matches are generally supported, but I agree that they are not tested and that should be fixed.
Aug 8 2019
Aug 7 2019
Just for the record, the OpenSSH position to implementing this key exchange algorithm:
Aug 1 2019
Jul 30 2019
Jul 25 2019
You are probably right, Can you try with the following patch:
Jun 27 2019
Jun 26 2019
The current version should have improved memory handling. Can you retest whether the speed is better now?
Jun 24 2019
Thank you for the clarification and updated reproducer. I can reproduce it with the latest version installed by the package manager in Debian (0.8.7), but I can not reproduce it when I build the example against current master. I can not reproduce it even if I manually checkout the version 0.8.7 from git.
This is already available in master (e989c4afffa154d92fe8c4ae1716ecc6bb4c2fd5) and will be in 0.9. Unfortunately, this did not got updated in Fedora as we updated the default configuration file so I would propose to wait few days for the updated libssh or fill a fedora bug.
Jun 21 2019
Jun 19 2019
FYI, as a workaround, you can use ProxyCommand='ncat -vvv --proxy <proxy server:port> --proxy-type socks5 %h %p' -o'User <user> 2>/dev/null', which drops the stderr. But indeed, this is something to fix in libssh.
This was resolved recently by 4a67c191188601c8d98ec73b9d53ce8a2b6c6cf8 which implemented EtM modes of the MACs in libssh and which is available in latest libssh release.
Can you provide example of such key? Do you mean private keys in PEM format or in OpenSSH format? Or public keys?
I think this got resolved over the time and the PEM files are readable including the inline comments (probably because of the removal of the SSH1 protocol, which had special conditions for the old RSA1 keys).
Please, check the following commits in the master-fix branch:
Do you have a minimal reproducer that demonstrates this issue? The following parts do not look correct:
[2019/02/21 16:35:31.187831, 3] callback_receive_banner: ssh_protocol_version_exchange: Ncat: Version 7.70 ( https://nmap.org/ncat )
a bit later is what should be coming -- the SSH identification banner:
[2019/02/21 16:40:54.932576, 3] callback_receive_banner: ssh_protocol_version_exchange: libnsock nsock_trace_handler_callback(): Callback: READ SUCCESS for EID 10 [peer unspecified] (33 bytes): SSH-2.0-1.36_sshlib GlobalSCAPE..`
I am afraid that the ncat dumps some additional data to stderr, which is unintentionally picked up by the libssh. This is caused by the code in the src/socket.c:815, where both stdout and stderr is redirected to libssh
You ca try to drop the second line above, which should let the stderr to be mixed up with the libssh stderr or dropped (not sure from top of my head), but it should let you move on.
The same thing works for me with the current openssh-portable master that I just built in my Fedora VM. Could this be somehow related to the Ubuntu toolchains or packages, rather than to the 32 bits itsef?
I tried also the 0.8.7 branch as reported in the previous comment, but with the same result. Could it be an issue in valgrind or some other part of the toolchain?
I just installed Fedora 27 i386 image (I was not successful with installing anything newer since it is secondary architecture for several releases and receives close to none testing) and current libssh master and I can not reproduce your issue.
Jun 13 2019
If I read correctly the manual page for ssh_config, your example is invalid:
May 20 2019
May 9 2019
@asn On the second though, I reworked the branch to optimize the pass and pass the given test cases. Can you check if the following would be acceptable?
May 6 2019
Apr 29 2019
I do not know a lot about the channels code. Sadly these functions do not have any documentation to clarify that to me.
The sftp server is using normal sftp_session. Why the sftp_free() function can not be used, since it is almost the same as your proposal?
Mar 11 2019
I just tested with Fedora 29 with the latest OpenSSL 1.1.1b (openssl-1.1.1b-2.fc29.x86_64) and I am able to build the libssh without any problem. Can you clarify on what OS are you trying to compile and you see these errors?
Feb 28 2019
Building with openssl-1.1.1a-1.fc29.x86_64 works fine so the support window is not a problem.
Feb 7 2019
Actually, man page for sshd from OpenSSH says the following:
This was fixed by the previously mentioned commits that made their way into master and 0.8 branch.
Dec 4 2018
@maiphi can you provide some debug log from libssh or at least the error you see? From what is covered in the test cases now, it should work with current libssh, but I do not think we will be able to establish two separate networks with the socket wrapper to reproduce the issue in the full size in the testsuite.
Nov 28 2018
This should be resolved by f622c4309b0ffe4679bd1b124638fc1bcddb5758
Nov 27 2018
After getting in a bit deeper, it really looks like the sshd is really closing the socket while doing something with PAM. The last logs from sshd are these in most of the cases:
debug2: input_userauth_request: try method none [preauth] debug3: user_specific_delay: user specific delay 0.000ms [preauth] debug3: ensure_minimum_time_since: elapsed 0.532ms, delaying 4.863ms (requested 5.395ms) [preauth] debug3: mm_request_receive entering debug3: monitor_read: checking request 100 debug1: PAM: initializing for "alice"
After that the socket is closed, test fails and the test kills the sshd.
Nov 25 2018
Should be resolved by the attached commits in both master and stable 0.8 branches.
Nov 19 2018
After more hours of digging in the code, I isolated this to the two SFTP calls that cause this issue to be reproducible reliably. These are calls to ssh_channel_send_eof() and ssh_channel_free() from sftp_free() called from the cleanup of the first sftp. If I remove these two calls, the testsuite passes reproducibly.
Nov 16 2018
Nov 13 2018
Nov 6 2018
No, this issue is still present it I am right.
Probably not. I assume this is not only about configuration parser (which was fixed in several aspects recently), but instead about the way how the proxycommand is implemented in libssh (I am actually not sure how does it work there). The important are errors with ProxyCommand, but for further investigation, some debugging log will be needed: