Skip to content

libssh2: show crypto backend in the verbose connect log #16790

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from

Conversation

vszakats
Copy link
Member

@vszakats vszakats commented Mar 21, 2025

With libssh2 1.11.0 or newer.

Different crypto backends may offer different features, e.g. in the keys
and algos they support.

Examples:

*   Trying 127.0.0.1:22...
* Connected to localhost (127.0.0.1) port 22
* libssh2 crypto backend: openssl compatible
[or]
* libssh2 crypto backend: WinCNG

Also fix indentation and drop redundant curly braces.


w/o ws https://github.com/curl/curl/pull/16790/files?w=1

@vszakats vszakats changed the title libssh2: include crypto backend in version string version: include libssh2 crypto backend in version string Mar 21, 2025
@jay
Copy link
Member

jay commented Mar 24, 2025

  • curl 8.13.0-DEV (Windows) libcurl/8.13.0-DEV mbedTLS/3.6.2 zlib/1.3.1 brotli/1.1.0 zstd/1.5.7 libpsl/0.21.5 libssh/0.10.6/openssl nghttp2/1.64.0 libgsasl/2.2.1

I think it's confusing that libssh does it that way. Do we really need to know anything more than the version number for any of these libraries?

diff --git a/lib/vssh/libssh.c b/lib/vssh/libssh.c
index 299b7c8..e27ee1b 100644
--- a/lib/vssh/libssh.c
+++ b/lib/vssh/libssh.c
@@ -2982,7 +2982,13 @@ void Curl_ssh_cleanup(void)
 
 void Curl_ssh_version(char *buffer, size_t buflen)
 {
+  char *p;
   (void)msnprintf(buffer, buflen, "libssh/%s", ssh_version(0));
+  /* remove libssh supporting libraries from version number
+     eg: libssh/0.10.6/openssl => libssh/0.10.6 */
+  p = strchr(buffer + 7, '/');
+  if(p)
+    *p = '\0';
 }
 
 #endif                          /* USE_LIBSSH */

@vszakats
Copy link
Member Author

vszakats commented Mar 24, 2025

Speaking of libssh2 it can significantly change behavior, in accepted keys, supported algos, stability.

Probably '/openssl' could be dropped for libssh as well. Edit: this needs care because that may be followed by a /zlib (or more I guess).

Vast majority of builds is with openssl. But seeing the rarer non-openssl ones seems useful.

@vszakats vszakats changed the title version: include libssh2 crypto backend in version string libssh2: show crypto backend in the verbose connect log Mar 31, 2025
@vszakats
Copy link
Member Author

vszakats commented Mar 31, 2025

Reworked to show this information in the verbose connect log.

@vszakats vszakats closed this in 1dd361c Mar 31, 2025
@vszakats vszakats deleted the libssh2-crypto branch March 31, 2025 20:50
pps83 pushed a commit to pps83/curl that referenced this pull request Apr 26, 2025
With libssh2 1.11.0 or newer.

Different crypto backends may offer different features, e.g. in the keys
and algos they support.

Examples:
```
*   Trying 127.0.0.1:22...
* Connected to localhost (127.0.0.1) port 22
* libssh2 crypto backend: openssl compatible
[or]
* libssh2 crypto backend: WinCNG
```

Also fix indentation and drop redundant curly braces.

Closes curl#16790
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

3 participants