Skip to content

libssh2_userauth_publickey_fromfile_ex not working on Windows #1517

Closed

Description

@pyscripter

In Windows when I try to use libssh2_userauth_publickey_fromfile_ex to authorize a connection to a WSL Ubuntu server, I get the following error message.

Callback returned error (-19)

Server Banner:

SSH-2.0-OpenSSH_8.9p1 Ubuntu-3ubuntu0.10
KEX: diffie-hellman-group-exchange-sha256, CRYPT: [email protected], MAC: hmac-sha2-256, COMP: none none, LANG:

Note that:

  • Password authorization works
  • Agent authorization with the same key works.
  • The key was generated with ssh-keygen and is using SHA256
  • I am providing the path to both public and private keys
  • I have tried to pass the names as "C:\path\key" or "C:/path/key" but made no difference.

**Version **

  • OS and version: Windows
  • libssh2 version: 1.11.1
  • crypto backend and version: WinCNG

Activity

  1. willco007 commented on Jan 23, 2025

    @willco007
    Member

    #define LIBSSH2_ERROR_PUBLICKEY_UNVERIFIED -19. Can you check the logs to see what the exact error message is?

  2. pyscripter commented on Jan 23, 2025

    @pyscripter
    Author

    Can you check the logs to see what the exact error message is?

    How do I do that?

  3. willco007 commented on Jan 23, 2025

    @willco007
    Member

    Enable tracing with a trace callback.

  4. pyscripter commented on Jan 23, 2025

    @pyscripter
    Author

    Will do. Please, note that the documentation has a wrong signature.

  5. pyscripter commented on Jan 23, 2025

    @pyscripter
    Author

    Tried, but I got no output. Then I noticed this:

    /* NOTE NOTE NOTE
       libssh2_trace() has no function in builds that aren't built with debug
       enabled
     */
    

    I will have to rebuild the libraries... This will take some time.

  6. pyscripter commented on Jan 23, 2025

    @pyscripter
    Author

    Here is the trace output: (condenced and masked)

    => libssh2_transport_write plain (34 bytes)
    0000: 32 00 00 00 07 6B 76 6C  61 68 6F 73 00 00 00 0E : 2....****....
    0010: 73 73 68 2D 63 6F 6E 6E  65 63 74 69 6F 6E 00 00 : ssh-connection..
    0020: 00 04                                            : ..
    => libssh2_transport_write plain2 (4 bytes)
    0000: 6E 6F 6E 65                                      : none
    [libssh2] 0.302552 Socket: Sent 68/68 bytes at 00000152437AB3B8
    => libssh2_transport_write send() (68 bytes)
    0000: 0B CC FB 13 E4 CB 10 35  52 64 B2 1B 0C E7 51 37 : .......5Rd....Q7
    0010: AE 7B 85 97 2B 72 27 C8  26 9C BA D4 E4 78 10 3E : .{..+r'.&....x.>
    0020: 38 8B B8 98 5F E6 70 9F  C9 6B 50 3A 00 1F 47 50 : 8..._.p..kP:..GP
    0030: 9B D0 55 3F 19 26 71 43  EF 15 C9 94 C5 1F E7 80 : ..U?.&qC........
    0040: 48 2F C8 80                                      : H/..
    [libssh2] 0.303521 Transport: Looking for packet of type: 52
    [libssh2] 0.303521 Transport: Looking for packet of type: 51
    [libssh2] 0.303521 Transport: Looking for packet of type: 53
    [libssh2] 0.304524 Failure Event: -37 - Would block requesting userauth list
    [libssh2] 0.309519 Transport: Looking for packet of type: 52
    [libssh2] 0.309519 Transport: Looking for packet of type: 51
    [libssh2] 0.309519 Transport: Looking for packet of type: 53
    [libssh2] 0.309519 Socket: Recved 52/35000 bytes to 00000152437A2AC0+0
    => libssh2_transport_read() raw (52 bytes)
    0000: F9 85 07 BA 2F B7 D0 EC  41 7F E6 F4 EB 42 99 2A : ..../...A....B.*
    0010: FA 1E 56 64 DA 03 BA F7  57 2D 3D 4B 11 2F AA 86 : ..Vd....W-=K./..
    0020: 24 16 E3 58 E4 7E 06 9C  8C 9A 92 53 A7 7C B3 46 : $..X.~.....S.|.F
    0030: 85 88 7C 9E                                      : ..|.
    => libssh2_transport_read() plain (24 bytes)
    0000: 33 00 00 00 12 70 75 62  6C 69 63 6B 65 79 2C 70 : 3....publickey,p
    0010: 61 73 73 77 6F 72 64 00                          : assword.
    [libssh2] 0.310522 Transport: Packet type 51 received, length=24
    [libssh2] 0.310522 Transport: Looking for packet of type: 52
    [libssh2] 0.310522 Transport: Looking for packet of type: 51
    [libssh2] 0.310522 Userauth: Permitted auth methods: publickey,password
    [libssh2] 0.310522 Userauth: Loading public key file: C:/Users/****/.ssh/id_rsa.pub
    [libssh2] 0.310522 Key Ex: Signing using rsa-sha2-512
    [libssh2] 0.310522 Userauth: Attempting publickey authentication
    => libssh2_transport_write plain (599 bytes)
    [libssh2] 0.312520 Socket: Sent 628/628 bytes at 00000152437AB3B8
    => libssh2_transport_write send() (628 bytes)
    [libssh2] 0.314522 Transport: Looking for packet of type: 52
    [libssh2] 0.314522 Transport: Looking for packet of type: 51
    [libssh2] 0.314522 Transport: Looking for packet of type: 60
    [libssh2] 0.314522 Socket: Recved 588/35000 bytes to 00000152437A2AC0+0
    => libssh2_transport_read() raw (588 bytes)
    => libssh2_transport_read() plain (556 bytes)
    0000: 3C 00 00 00 0C 72 73 61  2D 73 68 61 32 2D 35 31 : <....rsa-sha2-51
    0010: 32 00 00 02 17 00 00 00  07 73 73 68 2D 72 73 61 : 2........ssh-rsa
    ...
    [libssh2] 0.316520 Transport: Packet type 60 received, length=556
    [libssh2] 0.316520 Transport: Looking for packet of type: 52
    [libssh2] 0.316520 Transport: Looking for packet of type: 51
    [libssh2] 0.316520 Transport: Looking for packet of type: 60
    [libssh2] 0.316520 Userauth: Loading private key file: C:/Users/***/.ssh/id_rsa
    [libssh2] 0.316520 Failure Event: -16 - Unable to initialize private key from file
    [libssh2] 0.317518 Failure Event: -19 - Callback returned error
    [libssh2] 0.317518 Transport: Disconnecting: reason=11, desc=Bye, lang=
    => libssh2_transport_write plain (16 bytes)
    0000: 01 00 00 00 0B 00 00 00  03 42 79 65 00 00 00 00 : .........Bye....
    => libssh2_transport_write plain2 (0 bytes)
    [libssh2] 0.317518 Socket: Sent 44/44 bytes at 00000152437AB3B8
    => libssh2_transport_write send() (44 bytes)
    0000: FA 64 D3 C7 FE 03 4C C1  00 33 0A 42 30 07 9C 99 : .d....L..3.B0...
    0010: 1B 46 04 16 2D CE 9F 02  45 AA 78 34 3A CE D4 A8 : .F..-...E.x4:...
    0020: 63 45 1F 07 E0 38 7A 74  0A DE BE D4             : cE...8zt....
    [libssh2] 0.317518 Transport: Freeing session resource 00000152437E2040
    [libssh2] 0.317518 Transport: Extra packets left 0
    ESshError: LibSSh2 error: Callback returned error (-19), on API "libssh2_userauth_publickey_fromfile"
    
  7. willco007 commented on Jan 23, 2025

    @willco007
    Member

    It is showing your key file isn't being loaded, but there is no additional information as to where/why the failure occurs. It does look like WinCNG supports rsa-sha2-512 key types, so that shouldn't be the issue. That's about all I can tell you however.

  8. pyscripter commented on Jan 23, 2025

    @pyscripter
    Author

    @willco007

    Thank you.

    Interestingly, the error is just the same if I supply a non-existent private key file name:

    [libssh2] 0.360510 Userauth: Loading private key file: d_rsa
    [libssh2] 0.360510 Failure Event: -16 - Unable to initialize private key from file
    [libssh2] 0.360510 Failure Event: -19 - Callback returned error
    

    Does this give any clue? If on the other hand, I supply a missing public key the error message states so.

  9. willco007 commented on Jan 23, 2025

    @willco007
    Member

    Unfortunately no; it pretty much returns the same error regardless of where the key read failure is at.

  10. added a commit that references this issue on Jan 29, 2025
  11. vszakats commented on Mar 21, 2025

    @vszakats
    Member

    I wonder if this is causing the test failures we see in curl with the WinCNG build of libssh2 via vcpkg libssh2[core], e.g.:
    https://github.com/curl/curl/actions/runs/13861554395/job/38791104386#step:15:1

    details
    2025-03-14T17:04:18.3059220Z   test 0582...[SFTP upload using multi interface]
    2025-03-14T17:04:18.3074170Z   
    2025-03-14T17:04:18.3096983Z   lib582.exe returned 125, when expecting 0
    2025-03-14T17:04:18.3110922Z    582: exit FAILED
    2025-03-14T17:04:18.3190492Z   == Contents of files in the log/1/ dir after test 582
    2025-03-14T17:04:18.3229913Z   === Start of file commands.log
    2025-03-14T17:04:18.3263732Z    ./libtest/Debug/libtests lib582 Sftp://127.0.0.1:63150/d/a/curl/curl/bld/tests/log/1/upload582.txt D:/a/curl/curl/bld/tests/log/1/file582.txt runneradmin: log/1/server/curl_client_key.pub log/1/server/curl_client_key > log/1/stdout582 2> log/1/stderr582
    2025-03-14T17:04:18.3265552Z   === End of file commands.log
    2025-03-14T17:04:18.3344323Z   === Start of file file582.txt
    2025-03-14T17:04:18.3362624Z    Moooooooooooo
    2025-03-14T17:04:18.3400210Z     upload this
    2025-03-14T17:04:18.3407562Z   === End of file file582.txt
    2025-03-14T17:04:18.3422019Z   === Start of file server.cmd
    2025-03-14T17:04:18.3435476Z    Testnum 582
    2025-03-14T17:04:18.3480161Z   === End of file server.cmd
    2025-03-14T17:04:18.3500706Z   === Start of file sftp_server.log
    2025-03-14T17:04:18.3516627Z    debug1: Connecting to 127.0.0.1 [127.0.0.1] port 63150.
    2025-03-14T17:04:18.3521228Z    debug1: ssh_create_socket: bound to 127.0.0.1
    2025-03-14T17:04:18.3550763Z    debug2: fd 4 setting O_NONBLOCK
    2025-03-14T17:04:18.3559774Z    debug1: fd 4 clearing O_NONBLOCK
    2025-03-14T17:04:18.3578169Z    debug1: Connection established.
    2025-03-14T17:04:18.3598692Z    debug1: identity file /d/a/curl/curl/bld/tests/log/1/server/curl_client_key type 0
    2025-03-14T17:04:18.3621182Z    debug1: identity file /d/a/curl/curl/bld/tests/log/1/server/curl_client_key-cert type -1
    2025-03-14T17:04:18.3639076Z    debug1: Local version string SSH-2.0-OpenSSH_9.9
    2025-03-14T17:04:18.3650529Z    debug1: Remote protocol version 2.0, remote software version OpenSSH_9.9
    2025-03-14T17:04:18.3667737Z    debug1: compat_banner: match: OpenSSH_9.9 pat OpenSSH* compat 0x04000000
    2025-03-14T17:04:18.3674930Z    debug2: fd 4 setting O_NONBLOCK
    2025-03-14T17:04:18.3682451Z    debug1: Authenticating to 127.0.0.1:63150 as 'runneradmin'
    2025-03-14T17:04:18.3704620Z    debug1: SSH2_MSG_KEXINIT sent
    2025-03-14T17:04:18.3732833Z    debug1: SSH2_MSG_KEXINIT received
    2025-03-14T17:04:18.3797685Z    debug2: local client KEXINIT proposal
    2025-03-14T17:04:18.3817208Z    debug2: KEX algorithms: sntrup761x25519-sha512,[email protected],mlkem768x25519-sha256,curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,ext-info-c,[email protected]
    2025-03-14T17:04:18.3836950Z    debug2: host key algorithms: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],[email protected],rsa-sha2-512,rsa-sha2-256
    2025-03-14T17:04:18.3844089Z    debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
    2025-03-14T17:04:18.3853824Z    debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
    2025-03-14T17:04:18.3865116Z    debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
    2025-03-14T17:04:18.3870174Z    debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
    2025-03-14T17:04:18.3933981Z    debug2: compression ctos: none,[email protected]
    2025-03-14T17:04:18.3960493Z    debug2: compression stoc: none,[email protected]
    2025-03-14T17:04:18.3972378Z    debug2: languages ctos: 
    2025-03-14T17:04:18.3974284Z    debug2: languages stoc: 
    2025-03-14T17:04:18.3977315Z    debug2: first_kex_follows 0 
    2025-03-14T17:04:18.3993503Z    debug2: reserved 0 
    2025-03-14T17:04:18.4036974Z    debug2: peer server KEXINIT proposal
    2025-03-14T17:04:18.4061242Z    debug2: KEX algorithms: sntrup761x25519-sha512,[email protected],mlkem768x25519-sha256,curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,ext-info-s,[email protected]
    2025-03-14T17:04:18.4088041Z    debug2: host key algorithms: rsa-sha2-512,rsa-sha2-256,ssh-rsa
    2025-03-14T17:04:18.4093696Z    debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
    2025-03-14T17:04:18.4116818Z    debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
    2025-03-14T17:04:18.4121930Z    debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
    2025-03-14T17:04:18.4128151Z    debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
    2025-03-14T17:04:18.4131724Z    debug2: compression ctos: none
    2025-03-14T17:04:18.4134514Z    debug2: compression stoc: none
    2025-03-14T17:04:18.4138179Z    debug2: languages ctos: 
    2025-03-14T17:04:18.4196903Z    debug2: languages stoc: 
    2025-03-14T17:04:18.4213162Z    debug2: first_kex_follows 0 
    2025-03-14T17:04:18.4261746Z    debug2: reserved 0 
    2025-03-14T17:04:18.4266632Z    debug1: kex: algorithm: sntrup761x25519-sha512
    2025-03-14T17:04:18.4280203Z    debug1: kex: host key algorithm: rsa-sha2-512
    2025-03-14T17:04:18.4308403Z    debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
    2025-03-14T17:04:18.4323191Z    debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
    2025-03-14T17:04:18.4345570Z    debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
    2025-03-14T17:04:18.4351021Z    debug1: SSH2_MSG_KEX_ECDH_REPLY received
    2025-03-14T17:04:18.4367078Z    debug1: Server host key: ssh-rsa SHA256:fr2SCHhEBrIONaoQcDqvZlTc+uGfsMLqbMqFEfrCGDc
    2025-03-14T17:04:18.4372693Z    debug1: checking without port identifier
    2025-03-14T17:04:18.4384817Z    debug1: Host '127.0.0.1' is known and matches the RSA host key.
    2025-03-14T17:04:18.4390788Z    debug1: Found key in /d/a/curl/curl/bld/tests/log/1/server/curl_client_knownhosts:1
    2025-03-14T17:04:18.4395682Z    debug1: found matching key w/out port
    2025-03-14T17:04:18.4396248Z    debug1: ssh_packet_send2_wrapped: resetting send seqnr 3
    2025-03-14T17:04:18.4416254Z    debug2: ssh_set_newkeys: mode 1
    2025-03-14T17:04:18.4450914Z    debug1: rekey out after 134217728 blocks
    2025-03-14T17:04:18.4461817Z    debug1: SSH2_MSG_NEWKEYS sent
    2025-03-14T17:04:18.4482809Z    debug1: Sending SSH2_MSG_EXT_INFO
    2025-03-14T17:04:18.4520500Z    debug1: expecting SSH2_MSG_NEWKEYS
    2025-03-14T17:04:18.4526100Z    debug1: ssh_packet_read_poll2: resetting read seqnr 3
    2025-03-14T17:04:18.4529774Z    debug1: SSH2_MSG_NEWKEYS received
    2025-03-14T17:04:18.4531226Z    debug2: ssh_set_newkeys: mode 0
    2025-03-14T17:04:18.4546298Z    debug1: rekey in after 134217728 blocks
    2025-03-14T17:04:18.4569653Z    debug2: KEX algorithms: sntrup761x25519-sha512,[email protected],mlkem768x25519-sha256,curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,ext-info-c,[email protected]
    2025-03-14T17:04:18.4589332Z    debug2: host key algorithms: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],[email protected],rsa-sha2-512,rsa-sha2-256
    2025-03-14T17:04:18.4610641Z    debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
    2025-03-14T17:04:18.4620099Z    debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
    2025-03-14T17:04:18.4636542Z    debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
    2025-03-14T17:04:18.4647396Z    debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
    2025-03-14T17:04:18.4650812Z    debug2: compression ctos: none,[email protected]
    2025-03-14T17:04:18.4652437Z    debug2: compression stoc: none,[email protected]
    2025-03-14T17:04:18.4654027Z    debug2: languages ctos: 
    2025-03-14T17:04:18.4655920Z    debug2: languages stoc: 
    2025-03-14T17:04:18.4657517Z    debug2: first_kex_follows 0 
    2025-03-14T17:04:18.4658796Z    debug2: reserved 0 
    2025-03-14T17:04:18.4660295Z    debug1: SSH2_MSG_EXT_INFO received
    2025-03-14T17:04:18.4662881Z    debug1: kex_ext_info_client_parse: server-sig-algs=<ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],[email protected],rsa-sha2-512,rsa-sha2-256,ssh-rsa>
    2025-03-14T17:04:18.4665601Z    debug1: kex_ext_info_check_ver: [email protected]=<0>
    2025-03-14T17:04:18.4667250Z    debug1: kex_ext_info_check_ver: [email protected]=<0>
    2025-03-14T17:04:18.4669085Z    debug2: service_accept: ssh-userauth
    2025-03-14T17:04:18.4670574Z    debug1: SSH2_MSG_SERVICE_ACCEPT received
    2025-03-14T17:04:18.4671999Z    debug1: SSH2_MSG_EXT_INFO received
    2025-03-14T17:04:18.4674701Z    debug1: kex_ext_info_client_parse: server-sig-algs=<ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],[email protected],rsa-sha2-512,rsa-sha2-256,ssh-rsa>
    2025-03-14T17:04:18.4677282Z    debug1: Authentications that can continue: publickey
    2025-03-14T17:04:18.4678780Z    debug1: Next authentication method: publickey
    2025-03-14T17:04:18.4680832Z    debug1: Will attempt key: /d/a/curl/curl/bld/tests/log/1/server/curl_client_key RSA SHA256:/5lmYMqmvfzeMm5lYA/bceUSRrG6DOnqAGnTaPRsUNI explicit
    2025-03-14T17:04:18.4682848Z    debug2: pubkey_prepare: done
    2025-03-14T17:04:18.4684901Z    debug1: Offering public key: /d/a/curl/curl/bld/tests/log/1/server/curl_client_key RSA SHA256:/5lmYMqmvfzeMm5lYA/bceUSRrG6DOnqAGnTaPRsUNI explicit
    2025-03-14T17:04:18.4687000Z    debug2: we sent a publickey packet, wait for reply
    2025-03-14T17:04:18.4704512Z    debug1: Server accepts key: /d/a/curl/curl/bld/tests/log/1/server/curl_client_key RSA SHA256:/5lmYMqmvfzeMm5lYA/bceUSRrG6DOnqAGnTaPRsUNI explicit
    2025-03-14T17:04:18.4761986Z    Authenticated to 127.0.0.1 ([127.0.0.1]:63150) using "publickey".
    2025-03-14T17:04:18.4790145Z    debug2: fd 5 setting O_NONBLOCK
    2025-03-14T17:04:18.4811691Z    debug2: fd 6 setting O_NONBLOCK
    2025-03-14T17:04:18.4839209Z    debug2: fd 7 setting O_NONBLOCK
    2025-03-14T17:04:18.4896291Z    debug1: channel 0: new session [client-session] (inactive timeout: 0)
    2025-03-14T17:04:18.4896969Z    debug2: channel 0: send open
    2025-03-14T17:04:18.4917446Z    debug1: Requesting [email protected]
    2025-03-14T17:04:18.4975566Z    debug1: Entering interactive session.
    2025-03-14T17:04:18.5006402Z    debug1: pledge: network
    2025-03-14T17:04:18.5031891Z    debug1: client_input_global_request: rtype [email protected] want_reply 0
    2025-03-14T17:04:18.5080782Z    debug1: Remote: /d/a/curl/curl/bld/tests/log/1/server/curl_client_key.pub:1: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
    2025-03-14T17:04:18.5132052Z    debug1: Remote: /d/a/curl/curl/bld/tests/log/1/server/curl_client_key.pub:1: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
    2025-03-14T17:04:18.5177815Z    debug2: channel_input_open_confirmation: channel 0: callback start
    2025-03-14T17:04:18.5217565Z    debug2: fd 4 setting TCP_NODELAY
    2025-03-14T17:04:18.5254587Z    debug2: client_session2_setup: id 0
    2025-03-14T17:04:18.5276283Z    debug1: Sending subsystem: sftp
    2025-03-14T17:04:18.5337019Z    debug2: channel 0: request subsystem confirm 1
    2025-03-14T17:04:18.5356226Z    debug1: pledge: fork
    2025-03-14T17:04:18.5381482Z    debug2: channel_input_open_confirmation: channel 0: callback done
    2025-03-14T17:04:18.5440689Z    debug2: channel 0: open confirm rwindow 0 rmax 32768
    2025-03-14T17:04:18.5500537Z    debug2: channel 0: rcvd adjust 2097152
    2025-03-14T17:04:18.5525984Z    debug2: channel_input_status_confirm: type 99 id 0
    2025-03-14T17:04:18.5591262Z    debug2: subsystem request accepted on channel 0
    2025-03-14T17:04:18.5602002Z    sftp> pwd
    2025-03-14T17:04:18.5604511Z    Remote working directory: /home/runneradmin
    2025-03-14T17:04:18.5606166Z    sftp> quit
    2025-03-14T17:04:18.5607614Z    debug2: channel 0: read failed rfd 5 maxlen 32768: Broken pipe
    2025-03-14T17:04:18.5608762Z    debug2: channel 0: read failed
    2025-03-14T17:04:18.5610329Z    debug2: chan_shutdown_read: channel 0: (i0 o0 sock -1 wfd 5 efd 7 [write])
    2025-03-14T17:04:18.5611931Z    debug2: channel 0: input open -> drain
    2025-03-14T17:04:18.5613385Z    debug2: channel 0: ibuf empty
    2025-03-14T17:04:18.5614671Z    debug2: channel 0: send eof
    2025-03-14T17:04:18.5615847Z    debug2: channel 0: input drain -> closed
    2025-03-14T17:04:18.5617049Z    debug2: channel 0: rcvd eof
    2025-03-14T17:04:18.5619112Z    debug2: channel 0: output open -> drain
    2025-03-14T17:04:18.5620554Z    debug2: channel 0: obuf empty
    2025-03-14T17:04:18.5622507Z    debug2: chan_shutdown_write: channel 0: (i3 o1 sock -1 wfd 6 efd 7 [write])
    2025-03-14T17:04:18.5624379Z    debug2: channel 0: output drain -> closed
    2025-03-14T17:04:18.5625913Z    debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
    2025-03-14T17:04:18.5632539Z    debug2: channel 0: rcvd close
    2025-03-14T17:04:18.5635416Z    debug2: channel 0: almost dead
    2025-03-14T17:04:18.5636768Z    debug2: channel 0: gc: notify user
    2025-03-14T17:04:18.5637181Z    debug2: channel 0: gc: user detached
    2025-03-14T17:04:18.5638408Z    debug2: channel 0: send_close2
    2025-03-14T17:04:18.5639819Z    debug2: channel 0: send close for remote id 0
    2025-03-14T17:04:18.5643796Z    debug2: channel 0: is dead
    2025-03-14T17:04:18.5645091Z    debug2: channel 0: garbage collecting
    2025-03-14T17:04:18.5646762Z    debug1: channel 0: free: client-session, nchannels 1
    2025-03-14T17:04:18.5648602Z    Transferred: sent 5056, received 5408 bytes, in 0.2 seconds
    2025-03-14T17:04:18.5650697Z    Bytes per second: sent 32632.7, received 34904.6
    2025-03-14T17:04:18.5652238Z    debug1: Exit status 0
    2025-03-14T17:04:18.5652920Z   === End of file sftp_server.log
    2025-03-14T17:04:18.5654125Z   === Start of file ssh_server.log
    2025-03-14T17:04:18.5655343Z    debug2: fd 8 setting O_NONBLOCK
    2025-03-14T17:04:18.5656629Z    debug1: Bind to port 63150 on 127.0.0.1.
    2025-03-14T17:04:18.5662266Z    Server listening on 127.0.0.1 port 63150.
    2025-03-14T17:04:18.5665311Z    debug1: fd 9 clearing O_NONBLOCK
    2025-03-14T17:04:18.5666670Z    debug1: Forked child 4440.
    2025-03-14T17:04:18.5668061Z    debug1: rexec start in 9 out 9 newsock 9 pipe 11 sock 12/13
    2025-03-14T17:04:18.5669754Z    debug2: server_accept_loop: child 4440 for connection from 127.0.0.1 to 127.0.0.1 received config
    2025-03-14T17:04:18.5673681Z    debug1: network sockets: 4, 4
    2025-03-14T17:04:18.5676477Z    Connection from 127.0.0.1 port 63280 on 127.0.0.1 port 63150
    2025-03-14T17:04:18.5679234Z    debug1: Local version string SSH-2.0-OpenSSH_9.9
    2025-03-14T17:04:18.5681689Z    debug1: Remote protocol version 2.0, remote software version OpenSSH_9.9
    2025-03-14T17:04:18.5683597Z    debug1: compat_banner: match: OpenSSH_9.9 pat OpenSSH* compat 0x04000000
    2025-03-14T17:04:18.5685221Z    debug2: fd 4 setting O_NONBLOCK
    2025-03-14T17:04:18.5686603Z    debug2: Network child is on pid 4447
    2025-03-14T17:04:18.5688170Z    debug1: list_hostkey_types: rsa-sha2-512,rsa-sha2-256,ssh-rsa [preauth]
    2025-03-14T17:04:18.5703478Z    debug1: SSH2_MSG_KEXINIT sent [preauth]
    2025-03-14T17:04:18.5705812Z    debug1: SSH2_MSG_KEXINIT received [preauth]
    2025-03-14T17:04:18.5707308Z    debug2: local server KEXINIT proposal [preauth]
    2025-03-14T17:04:18.5728532Z    debug2: KEX algorithms: sntrup761x25519-sha512,[email protected],mlkem768x25519-sha256,curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,ext-info-s,[email protected] [preauth]
    2025-03-14T17:04:18.5799282Z    debug2: host key algorithms: rsa-sha2-512,rsa-sha2-256,ssh-rsa [preauth]
    2025-03-14T17:04:18.5811978Z    debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected] [preauth]
    2025-03-14T17:04:18.5819851Z    debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected] [preauth]
    2025-03-14T17:04:18.5827063Z    debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1 [preauth]
    2025-03-14T17:04:18.5829946Z    debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1 [preauth]
    2025-03-14T17:04:18.5878297Z    debug2: compression ctos: none [preauth]
    2025-03-14T17:04:18.5890531Z    debug2: compression stoc: none [preauth]
    2025-03-14T17:04:18.5937777Z    debug2: languages ctos:  [preauth]
    2025-03-14T17:04:18.5971230Z    debug2: languages stoc:  [preauth]
    2025-03-14T17:04:18.5998239Z    debug2: first_kex_follows 0  [preauth]
    2025-03-14T17:04:18.6139651Z    debug2: reserved 0  [preauth]
    2025-03-14T17:04:18.6189267Z    debug2: peer client KEXINIT proposal [preauth]
    2025-03-14T17:04:18.6221194Z    debug2: KEX algorithms: sntrup761x25519-sha512,[email protected],mlkem768x25519-sha256,curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,ext-info-c,[email protected] [preauth]
    2025-03-14T17:04:18.6228191Z    debug2: host key algorithms: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],[email protected],rsa-sha2-512,rsa-sha2-256 [preauth]
    2025-03-14T17:04:18.6240232Z    debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected] [preauth]
    2025-03-14T17:04:18.6269575Z    debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected] [preauth]
    2025-03-14T17:04:18.6340603Z    debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1 [preauth]
    2025-03-14T17:04:18.6345843Z    debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1 [preauth]
    2025-03-14T17:04:18.6388514Z    debug2: compression ctos: none,[email protected] [preauth]
    2025-03-14T17:04:18.6395107Z    debug2: compression stoc: none,[email protected] [preauth]
    2025-03-14T17:04:18.6421626Z    debug2: languages ctos:  [preauth]
    2025-03-14T17:04:18.6512000Z    debug2: languages stoc:  [preauth]
    2025-03-14T17:04:18.6523823Z    debug2: first_kex_follows 0  [preauth]
    2025-03-14T17:04:18.6563390Z    debug2: reserved 0  [preauth]
    2025-03-14T17:04:18.6570071Z    debug1: kex: algorithm: sntrup761x25519-sha512 [preauth]
    2025-03-14T17:04:18.6622580Z    debug1: kex: host key algorithm: rsa-sha2-512 [preauth]
    2025-03-14T17:04:18.6626123Z    debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none [preauth]
    2025-03-14T17:04:18.6650419Z    debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none [preauth]
    2025-03-14T17:04:18.6710863Z    debug1: expecting SSH2_MSG_KEX_ECDH_INIT [preauth]
    2025-03-14T17:04:18.6715219Z    debug1: SSH2_MSG_KEX_ECDH_INIT received [preauth]
    2025-03-14T17:04:18.6718501Z    debug2: monitor_read: 6 used once, disabling now
    2025-03-14T17:04:18.6722394Z    debug1: ssh_packet_send2_wrapped: resetting send seqnr 3 [preauth]
    2025-03-14T17:04:18.6725116Z    debug2: ssh_set_newkeys: mode 1 [preauth]
    2025-03-14T17:04:18.6739896Z    debug1: rekey out after 134217728 blocks [preauth]
    2025-03-14T17:04:18.6741998Z    debug1: SSH2_MSG_NEWKEYS sent [preauth]
    2025-03-14T17:04:18.6743703Z    debug1: Sending SSH2_MSG_EXT_INFO [preauth]
    2025-03-14T17:04:18.6751502Z    debug1: expecting SSH2_MSG_NEWKEYS [preauth]
    2025-03-14T17:04:18.6761396Z    debug1: ssh_packet_read_poll2: resetting read seqnr 3 [preauth]
    2025-03-14T17:04:18.6764001Z    debug1: SSH2_MSG_NEWKEYS received [preauth]
    2025-03-14T17:04:18.6887047Z    debug2: ssh_set_newkeys: mode 0 [preauth]
    2025-03-14T17:04:18.6955285Z    debug1: rekey in after 134217728 blocks [preauth]
    2025-03-14T17:04:18.6967195Z    debug2: KEX algorithms: sntrup761x25519-sha512,[email protected],mlkem768x25519-sha256,curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,ext-info-s,[email protected] [preauth]
    2025-03-14T17:04:18.6978855Z    debug2: host key algorithms: rsa-sha2-512,rsa-sha2-256,ssh-rsa [preauth]
    2025-03-14T17:04:18.6990201Z    debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected] [preauth]
    2025-03-14T17:04:18.7011812Z    debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected] [preauth]
    2025-03-14T17:04:18.7021744Z    debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1 [preauth]
    2025-03-14T17:04:18.7024509Z    debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1 [preauth]
    2025-03-14T17:04:18.7027738Z    debug2: compression ctos: none [preauth]
    2025-03-14T17:04:18.7032444Z    debug2: compression stoc: none [preauth]
    2025-03-14T17:04:18.7036557Z    debug2: languages ctos:  [preauth]
    2025-03-14T17:04:18.7039807Z    debug2: languages stoc:  [preauth]
    2025-03-14T17:04:18.7042085Z    debug2: first_kex_follows 0  [preauth]
    2025-03-14T17:04:18.7043602Z    debug2: reserved 0  [preauth]
    2025-03-14T17:04:18.7045066Z    debug1: KEX done [preauth]
    2025-03-14T17:04:18.7046517Z    debug1: SSH2_MSG_EXT_INFO received [preauth]
    2025-03-14T17:04:18.7048201Z    debug1: kex_ext_info_check_ver: [email protected]=<0> [preauth]
    2025-03-14T17:04:18.7050123Z    debug1: userauth-request for user runneradmin service ssh-connection method none [preauth]
    2025-03-14T17:04:18.7051888Z    debug1: attempt 0 failures 0 [preauth]
    2025-03-14T17:04:18.7053474Z    debug2: parse_server_config_depth: config reprocess config len 1288
    2025-03-14T17:04:18.7055108Z    debug2: monitor_read: 8 used once, disabling now
    2025-03-14T17:04:18.7056798Z    debug2: input_userauth_request: setting up authctxt for runneradmin [preauth]
    2025-03-14T17:04:18.7058581Z    debug1: kex_server_update_ext_info: Sending SSH2_MSG_EXT_INFO [preauth]
    2025-03-14T17:04:18.7062511Z    debug2: input_userauth_request: try method none [preauth]
    2025-03-14T17:04:18.7066639Z    debug2: monitor_read: 4 used once, disabling now
    2025-03-14T17:04:18.7068854Z    debug1: userauth-request for user runneradmin service ssh-connection method publickey [preauth]
    2025-03-14T17:04:18.7073063Z    debug1: attempt 1 failures 0 [preauth]
    2025-03-14T17:04:18.7075030Z    debug2: input_userauth_request: try method publickey [preauth]
    2025-03-14T17:04:18.7084308Z    debug2: userauth_pubkey: valid user runneradmin querying public key rsa-sha2-512 AAAAB3NzaC1yc2EAAAADAQABAAABgQCW072xnTtq8JURfULUtas3misFM27MMiiWB9gIGrtDPygzs+Lsox81QQKw4CuogM8U53ryfjW3kMwxJRnZIb7LyRnqUz5HMa/3Uo6uJ+IBc0QkEuX4Ps+5qs67PlgsaAecZs50wTSKnV41wEv7+RFovxp/+y0ffgG3uj7QMGmlwtiXImYMLvwgyqAvWvdU0DiElDsOAxEGmP2uiMQ+5eOMm580jHG8+4tyBFTBepiRaiLclTpYphn7fJngSZbR28Qe++8XIcGur8om7/FC0Ms4/+ZhxIwIU8qLFDTgG5d76dDBbjivvqiWq1KdSp1rDzJAtGz8E3PiZTmaJA9ooORQFqxbEOS3iaR23W06XOBksufRdN1NnQMf9RIMOvq6yaIuRi/qRoC9j/BzngufZZJi45are/fNY216VItKOQ7S5BsGmY1yELhiay/rFCPeJSwDOAlgEmmGlwNy2Lg/De7D1/76cKb+DAI2ReGF7pQozMRgrp4GV5rSXyE05CJRH98= [preauth]
    2025-03-14T17:04:18.7093567Z    debug1: userauth_pubkey: publickey test pkalg rsa-sha2-512 pkblob RSA SHA256:/5lmYMqmvfzeMm5lYA/bceUSRrG6DOnqAGnTaPRsUNI [preauth]
    2025-03-14T17:04:18.7098449Z    debug1: temporarily_use_uid: 197108/197121 (e=197108/197121)
    2025-03-14T17:04:18.7100315Z    debug1: trying public key file /d/a/curl/curl/bld/tests/log/1/server/curl_client_key.pub
    2025-03-14T17:04:18.7104002Z    debug1: fd 7 clearing O_NONBLOCK
    2025-03-14T17:04:18.7109323Z    debug1: /d/a/curl/curl/bld/tests/log/1/server/curl_client_key.pub:1: matching key found: RSA SHA256:/5lmYMqmvfzeMm5lYA/bceUSRrG6DOnqAGnTaPRsUNI
    2025-03-14T17:04:18.7111412Z    debug1: /d/a/curl/curl/bld/tests/log/1/server/curl_client_key.pub:1: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
    2025-03-14T17:04:18.7117141Z    Accepted key RSA SHA256:/5lmYMqmvfzeMm5lYA/bceUSRrG6DOnqAGnTaPRsUNI found at /d/a/curl/curl/bld/tests/log/1/server/curl_client_key.pub:1
    2025-03-14T17:04:18.7119835Z    debug2: auth_check_authkeys_file: /d/a/curl/curl/bld/tests/log/1/server/curl_client_key.pub: processed 1/1 lines
    2025-03-14T17:04:18.7123147Z    debug1: restore_uid: 197108/197121
    2025-03-14T17:04:18.7139919Z    debug2: userauth_pubkey: authenticated 0 pkalg rsa-sha2-512 [preauth]
    2025-03-14T17:04:18.7329933Z    Postponed publickey for runneradmin from 127.0.0.1 port 63280 ssh2 [preauth]
    2025-03-14T17:04:18.7423044Z    debug1: userauth-request for user runneradmin service ssh-connection method [email protected] [preauth]
    2025-03-14T17:04:18.7499737Z    debug1: attempt 2 failures 0 [preauth]
    2025-03-14T17:04:18.7598020Z    debug2: input_userauth_request: try method [email protected] [preauth]
    2025-03-14T17:04:18.7631728Z    debug2: userauth_pubkey: valid user runneradmin attempting public key rsa-sha2-512 AAAAB3NzaC1yc2EAAAADAQABAAABgQCW072xnTtq8JURfULUtas3misFM27MMiiWB9gIGrtDPygzs+Lsox81QQKw4CuogM8U53ryfjW3kMwxJRnZIb7LyRnqUz5HMa/3Uo6uJ+IBc0QkEuX4Ps+5qs67PlgsaAecZs50wTSKnV41wEv7+RFovxp/+y0ffgG3uj7QMGmlwtiXImYMLvwgyqAvWvdU0DiElDsOAxEGmP2uiMQ+5eOMm580jHG8+4tyBFTBepiRaiLclTpYphn7fJngSZbR28Qe++8XIcGur8om7/FC0Ms4/+ZhxIwIU8qLFDTgG5d76dDBbjivvqiWq1KdSp1rDzJAtGz8E3PiZTmaJA9ooORQFqxbEOS3iaR23W06XOBksufRdN1NnQMf9RIMOvq6yaIuRi/qRoC9j/BzngufZZJi45are/fNY216VItKOQ7S5BsGmY1yELhiay/rFCPeJSwDOAlgEmmGlwNy2Lg/De7D1/76cKb+DAI2ReGF7pQozMRgrp4GV5rSXyE05CJRH98= [preauth]
    2025-03-14T17:04:18.7641607Z    debug1: temporarily_use_uid: 197108/197121 (e=197108/197121)
    2025-03-14T17:04:18.7751019Z    debug1: trying public key file /d/a/curl/curl/bld/tests/log/1/server/curl_client_key.pub
    2025-03-14T17:04:18.7802614Z    debug1: fd 7 clearing O_NONBLOCK
    2025-03-14T17:04:18.7817056Z    debug1: /d/a/curl/curl/bld/tests/log/1/server/curl_client_key.pub:1: matching key found: RSA SHA256:/5lmYMqmvfzeMm5lYA/bceUSRrG6DOnqAGnTaPRsUNI
    2025-03-14T17:04:18.7897463Z    debug1: /d/a/curl/curl/bld/tests/log/1/server/curl_client_key.pub:1: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
    2025-03-14T17:04:18.7962639Z    Accepted key RSA SHA256:/5lmYMqmvfzeMm5lYA/bceUSRrG6DOnqAGnTaPRsUNI found at /d/a/curl/curl/bld/tests/log/1/server/curl_client_key.pub:1
    2025-03-14T17:04:18.7995972Z    debug2: auth_check_authkeys_file: /d/a/curl/curl/bld/tests/log/1/server/curl_client_key.pub: processed 1/1 lines
    2025-03-14T17:04:18.8097272Z    debug1: restore_uid: 197108/197121
    2025-03-14T17:04:18.8164534Z    debug1: auth_activate_options: setting new authentication options
    2025-03-14T17:04:18.8252857Z    Accepted publickey for runneradmin from 127.0.0.1 port 63280 ssh2: RSA SHA256:/5lmYMqmvfzeMm5lYA/bceUSRrG6DOnqAGnTaPRsUNI
    2025-03-14T17:04:18.8306021Z    debug1: monitor_child_preauth: user runneradmin authenticated by privileged process
    2025-03-14T17:04:18.8343404Z    debug1: auth_activate_options: setting new authentication options [preauth]
    2025-03-14T17:04:18.8364630Z    debug2: userauth_pubkey: authenticated 1 pkalg rsa-sha2-512 [preauth]
    2025-03-14T17:04:18.8379612Z    debug1: monitor_read_log: child log fd closed
    2025-03-14T17:04:18.8393580Z    debug2: server_accept_loop: child 4440 for connection from 127.0.0.1 to 127.0.0.1 auth done
    2025-03-14T17:04:18.8437028Z    debug1: child_close: enter (forcing)
    2025-03-14T17:04:18.8445108Z    User child is on pid 4457
    2025-03-14T17:04:18.8475624Z    debug1: permanently_set_uid: 197108/197121
    2025-03-14T17:04:18.8494362Z    debug2: ssh_set_newkeys: mode 0
    2025-03-14T17:04:18.8501168Z    debug1: rekey in after 134217728 blocks
    2025-03-14T17:04:18.8605122Z    debug2: ssh_set_newkeys: mode 1
    2025-03-14T17:04:18.8630755Z    debug1: rekey out after 134217728 blocks
    2025-03-14T17:04:18.8659336Z    debug1: ssh_packet_set_postauth: called
    2025-03-14T17:04:18.8676759Z    debug1: active: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
    2025-03-14T17:04:18.8695843Z    debug1: Entering interactive session for SSH2.
    2025-03-14T17:04:18.8810464Z    debug1: server_init_dispatch
    2025-03-14T17:04:18.8820204Z    debug1: server_input_channel_open: ctype session rchan 0 win 2097152 max 32768
    2025-03-14T17:04:18.8901352Z    debug1: input_session_request
    2025-03-14T17:04:18.8932622Z    debug1: channel 0: new session [server-session] (inactive timeout: 0)
    2025-03-14T17:04:18.8987049Z    debug2: session_new: allocate (allocated 0 max 10)
    2025-03-14T17:04:18.9122682Z    debug1: session_new: session 0
    2025-03-14T17:04:18.9162594Z    debug1: session_open: channel 0
    2025-03-14T17:04:18.9244135Z    debug1: session_open: session 0: link with channel 0
    2025-03-14T17:04:18.9271448Z    debug1: server_input_channel_open: confirm session
    2025-03-14T17:04:18.9295900Z    debug1: server_input_global_request: rtype [email protected] want_reply 0
    2025-03-14T17:04:18.9313595Z    debug1: server_input_channel_req: channel 0 request subsystem reply 1
    2025-03-14T17:04:18.9321278Z    debug1: session_by_channel: session 0 channel 0
    2025-03-14T17:04:18.9325215Z    debug1: session_input_channel_req: session 0 req subsystem
    2025-03-14T17:04:18.9328545Z    debug2: subsystem request for sftp by user runneradmin
    2025-03-14T17:04:18.9331350Z    debug1: subsystem: internal-sftp
    2025-03-14T17:04:18.9339093Z    debug2: channel_set_xtype: labeled channel 0 as session:subsystem:sftp (inactive timeout 0)
    2025-03-14T17:04:18.9350366Z    Starting session: subsystem 'sftp' for runneradmin from 127.0.0.1 port 63280 id 0
    2025-03-14T17:04:18.9413211Z    debug2: fd 4 setting TCP_NODELAY
    2025-03-14T17:04:18.9431814Z    debug2: fd 10 setting O_NONBLOCK
    2025-03-14T17:04:18.9555552Z    debug2: fd 9 setting O_NONBLOCK
    2025-03-14T17:04:18.9612274Z    debug2: fd 12 setting O_NONBLOCK
    2025-03-14T17:04:18.9612790Z    debug2: channel 0: read 44 from efd 12
    2025-03-14T17:04:18.9613438Z    debug2: channel 0: rcvd eof
    2025-03-14T17:04:18.9613934Z    debug2: channel 0: output open -> drain
    2025-03-14T17:04:18.9626714Z    debug2: channel 0: obuf empty
    2025-03-14T17:04:18.9641428Z    debug2: chan_shutdown_write: channel 0: (i0 o1 sock -1 wfd 9 efd 12 [ignore])
    2025-03-14T17:04:18.9648312Z    debug2: channel 0: output drain -> closed
    2025-03-14T17:04:18.9822486Z    debug2: channel 0: read failed rfd 10 maxlen 32768: Broken pipe
    2025-03-14T17:04:18.9857073Z    debug2: channel 0: read failed
    2025-03-14T17:04:18.9877384Z    debug2: chan_shutdown_read: channel 0: (i0 o3 sock -1 wfd 10 efd 12 [ignore])
    2025-03-14T17:04:18.9904956Z    debug2: channel 0: input open -> drain
    2025-03-14T17:04:19.0004668Z    debug2: channel 0: read 0 from efd 12
    2025-03-14T17:04:19.0016233Z    debug2: channel 0: closing read-efd 12
    2025-03-14T17:04:19.0066049Z    debug2: channel 0: ibuf empty
    2025-03-14T17:04:19.0095766Z    debug2: channel 0: send eof
    2025-03-14T17:04:19.0137371Z    debug2: channel 0: input drain -> closed
    2025-03-14T17:04:19.0156815Z    debug1: Received SIGCHLD.
    2025-03-14T17:04:19.0261626Z    debug1: session_by_pid: pid 4460
    2025-03-14T17:04:19.0376230Z    debug2: channel 0: request exit-status confirm 0
    2025-03-14T17:04:19.0397987Z    debug1: session_exit_message: session 0 channel 0 pid 4460 exit 0
    2025-03-14T17:04:19.0443946Z    debug1: session_exit_message: release channel 0
    2025-03-14T17:04:19.0458455Z    debug2: channel 0: send_close2
    2025-03-14T17:04:19.0475827Z    debug2: channel 0: send close for remote id 0
    2025-03-14T17:04:19.0547299Z    debug2: channel 0: rcvd close
    2025-03-14T17:04:19.0645026Z    Received disconnect from 127.0.0.1 port 63280:11: disconnected by user
    2025-03-14T17:04:19.0658754Z    Disconnected from user runneradmin 127.0.0.1 port 63280
    2025-03-14T17:04:19.0744313Z    debug1: do_cleanup
    2025-03-14T17:04:19.0819156Z    debug1: mm_reap: preauth child exited with status 255
    2025-03-14T17:04:19.0858798Z    debug1: do_cleanup
    2025-03-14T17:04:19.0873730Z    debug1: fd 9 clearing O_NONBLOCK
    2025-03-14T17:04:19.0885023Z    debug1: Forked child 4481.
    2025-03-14T17:04:19.0897523Z    debug1: rexec start in 9 out 9 newsock 9 pipe 11 sock 12/13
    2025-03-14T17:04:19.0929681Z    debug2: server_accept_loop: child 4481 for connection from 127.0.0.1 to 127.0.0.1 received config
    2025-03-14T17:04:19.0981136Z    debug1: network sockets: 4, 4
    2025-03-14T17:04:19.1032079Z    Connection from 127.0.0.1 port 63287 on 127.0.0.1 port 63150
    2025-03-14T17:04:19.1048657Z    debug1: Local version string SSH-2.0-OpenSSH_9.9
    2025-03-14T17:04:19.1087750Z    debug1: Remote protocol version 2.0, remote software version libssh2_1.11.1_DEV
    2025-03-14T17:04:19.1099332Z    debug1: compat_banner: no match: libssh2_1.11.1_DEV
    2025-03-14T17:04:19.1202321Z    debug2: fd 4 setting O_NONBLOCK
    2025-03-14T17:04:19.1228149Z    debug2: Network child is on pid 4485
    2025-03-14T17:04:19.1280322Z    debug1: list_hostkey_types: rsa-sha2-512,rsa-sha2-256,ssh-rsa [preauth]
    2025-03-14T17:04:19.1597587Z    debug1: SSH2_MSG_KEXINIT sent [preauth]
    2025-03-14T17:04:19.1690391Z    debug1: SSH2_MSG_KEXINIT received [preauth]
    2025-03-14T17:04:19.1711705Z    debug2: local server KEXINIT proposal [preauth]
    2025-03-14T17:04:19.1753457Z    debug2: KEX algorithms: sntrup761x25519-sha512,[email protected],mlkem768x25519-sha256,curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,ext-info-s,[email protected] [preauth]
    2025-03-14T17:04:19.1804217Z    debug2: host key algorithms: rsa-sha2-512,rsa-sha2-256,ssh-rsa [preauth]
    2025-03-14T17:04:19.1856548Z    debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected] [preauth]
    2025-03-14T17:04:19.1863247Z    debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected] [preauth]
    2025-03-14T17:04:19.1910954Z    debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1 [preauth]
    2025-03-14T17:04:19.1919640Z    debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1 [preauth]
    2025-03-14T17:04:19.1927189Z    debug2: compression ctos: none [preauth]
    2025-03-14T17:04:19.1929519Z    debug2: compression stoc: none [preauth]
    2025-03-14T17:04:19.1934132Z    debug2: languages ctos:  [preauth]
    2025-03-14T17:04:19.1934655Z    debug2: languages stoc:  [preauth]
    2025-03-14T17:04:19.1935346Z    debug2: first_kex_follows 0  [preauth]
    2025-03-14T17:04:19.1935771Z    debug2: reserved 0  [preauth]
    2025-03-14T17:04:19.1936191Z    debug2: peer client KEXINIT proposal [preauth]
    2025-03-14T17:04:19.1953032Z    debug2: KEX algorithms: diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1,ext-info-c,[email protected] [preauth]
    2025-03-14T17:04:19.1960991Z    debug2: host key algorithms: rsa-sha2-512,rsa-sha2-256,[email protected],[email protected],ssh-rsa,[email protected] [preauth]
    2025-03-14T17:04:19.1964469Z    debug2: ciphers ctos: [email protected],aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,[email protected],aes192-cbc,aes128-cbc,arcfour128,arcfour,3des-cbc [preauth]
    2025-03-14T17:04:19.2102372Z    debug2: ciphers stoc: [email protected],aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,[email protected],aes192-cbc,aes128-cbc,arcfour128,arcfour,3des-cbc [preauth]
    2025-03-14T17:04:19.2166369Z    debug2: MACs ctos: hmac-sha2-256,[email protected],hmac-sha2-512,[email protected],hmac-sha1,[email protected],hmac-sha1-96,hmac-md5,hmac-md5-96 [preauth]
    2025-03-14T17:04:19.2334276Z    debug2: MACs stoc: hmac-sha2-256,[email protected],hmac-sha2-512,[email protected],hmac-sha1,[email protected],hmac-sha1-96,hmac-md5,hmac-md5-96 [preauth]
    2025-03-14T17:04:19.2376142Z    debug2: compression ctos: none [preauth]
    2025-03-14T17:04:19.2469244Z    debug2: compression stoc: none [preauth]
    2025-03-14T17:04:19.2603108Z    debug2: languages ctos:  [preauth]
    2025-03-14T17:04:19.2640113Z    debug2: languages stoc:  [preauth]
    2025-03-14T17:04:19.2670171Z    debug2: first_kex_follows 0  [preauth]
    2025-03-14T17:04:19.2744232Z    debug2: reserved 0  [preauth]
    2025-03-14T17:04:19.2772250Z    debug1: kex: algorithm: diffie-hellman-group-exchange-sha256 [preauth]
    2025-03-14T17:04:19.2836454Z    debug1: kex: host key algorithm: rsa-sha2-512 [preauth]
    2025-03-14T17:04:19.2891094Z    debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none [preauth]
    2025-03-14T17:04:19.2917051Z    debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none [preauth]
    2025-03-14T17:04:19.2929792Z    debug1: expecting SSH2_MSG_KEX_DH_GEX_REQUEST [preauth]
    2025-03-14T17:04:19.3024925Z    debug1: SSH2_MSG_KEX_DH_GEX_REQUEST received [preauth]
    2025-03-14T17:04:19.3109324Z    debug2: monitor_read: 0 used once, disabling now
    2025-03-14T17:04:19.3297764Z    debug1: SSH2_MSG_KEX_DH_GEX_GROUP sent [preauth]
    2025-03-14T17:04:19.3329593Z    debug2: bits set: 2097/4096 [preauth]
    2025-03-14T17:04:19.3370844Z    debug1: expecting SSH2_MSG_KEX_DH_GEX_INIT [preauth]
    2025-03-14T17:04:19.3455021Z    debug1: SSH2_MSG_KEX_DH_GEX_INIT received [preauth]
    2025-03-14T17:04:19.3517654Z    debug2: bits set: 2054/4096 [preauth]
    2025-03-14T17:04:19.3659441Z    debug2: monitor_read: 6 used once, disabling now
    2025-03-14T17:04:19.3719213Z    debug1: ssh_packet_send2_wrapped: resetting send seqnr 4 [preauth]
    2025-03-14T17:04:19.3744902Z    debug2: ssh_set_newkeys: mode 1 [preauth]
    2025-03-14T17:04:19.3821023Z    debug1: rekey out after 134217728 blocks [preauth]
    2025-03-14T17:04:19.3913765Z    debug1: SSH2_MSG_NEWKEYS sent [preauth]
    2025-03-14T17:04:19.4043173Z    debug1: Sending SSH2_MSG_EXT_INFO [preauth]
    2025-03-14T17:04:19.4082348Z    debug1: expecting SSH2_MSG_NEWKEYS [preauth]
    2025-03-14T17:04:19.4087213Z    debug1: ssh_packet_read_poll2: resetting read seqnr 4 [preauth]
    2025-03-14T17:04:19.4141283Z    debug1: SSH2_MSG_NEWKEYS received [preauth]
    2025-03-14T17:04:19.4226925Z    debug2: ssh_set_newkeys: mode 0 [preauth]
    2025-03-14T17:04:19.4296990Z    debug1: rekey in after 134217728 blocks [preauth]
    2025-03-14T17:04:19.4525040Z    debug2: KEX algorithms: sntrup761x25519-sha512,[email protected],mlkem768x25519-sha256,curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,ext-info-s,[email protected] [preauth]
    2025-03-14T17:04:19.4576240Z    debug2: host key algorithms: rsa-sha2-512,rsa-sha2-256,ssh-rsa [preauth]
    2025-03-14T17:04:19.4634794Z    debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected] [preauth]
    2025-03-14T17:04:19.4667745Z    debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected] [preauth]
    2025-03-14T17:04:19.4735178Z    debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1 [preauth]
    2025-03-14T17:04:19.4848699Z    debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1 [preauth]
    2025-03-14T17:04:19.4909743Z    debug2: compression ctos: none [preauth]
    2025-03-14T17:04:19.4918384Z    debug2: compression stoc: none [preauth]
    2025-03-14T17:04:19.4936814Z    debug2: languages ctos:  [preauth]
    2025-03-14T17:04:19.4959732Z    debug2: languages stoc:  [preauth]
    2025-03-14T17:04:19.4963140Z    debug2: first_kex_follows 0  [preauth]
    2025-03-14T17:04:19.4967606Z    debug2: reserved 0  [preauth]
    2025-03-14T17:04:19.4998992Z    debug1: KEX done [preauth]
    2025-03-14T17:04:19.5052700Z    debug1: userauth-request for user runneradmin service ssh-connection method none [preauth]
    2025-03-14T17:04:19.5100810Z    debug1: attempt 0 failures 0 [preauth]
    2025-03-14T17:04:19.5223283Z    debug2: parse_server_config_depth: config reprocess config len 1288
    2025-03-14T17:04:19.5365699Z    debug2: monitor_read: 8 used once, disabling now
    2025-03-14T17:04:19.5444650Z    debug2: input_userauth_request: setting up authctxt for runneradmin [preauth]
    2025-03-14T17:04:19.5475311Z    debug2: input_userauth_request: try method none [preauth]
    2025-03-14T17:04:19.5553201Z    debug2: monitor_read: 4 used once, disabling now
    2025-03-14T17:04:19.5601800Z    debug1: userauth-request for user runneradmin service ssh-connection method publickey [preauth]
    2025-03-14T17:04:19.5702071Z    debug1: attempt 1 failures 0 [preauth]
    2025-03-14T17:04:19.5767167Z    debug2: input_userauth_request: try method publickey [preauth]
    2025-03-14T17:04:19.5897400Z    debug2: userauth_pubkey: valid user runneradmin querying public key rsa-sha2-512 AAAAB3NzaC1yc2EAAAADAQABAAABgQCW072xnTtq8JURfULUtas3misFM27MMiiWB9gIGrtDPygzs+Lsox81QQKw4CuogM8U53ryfjW3kMwxJRnZIb7LyRnqUz5HMa/3Uo6uJ+IBc0QkEuX4Ps+5qs67PlgsaAecZs50wTSKnV41wEv7+RFovxp/+y0ffgG3uj7QMGmlwtiXImYMLvwgyqAvWvdU0DiElDsOAxEGmP2uiMQ+5eOMm580jHG8+4tyBFTBepiRaiLclTpYphn7fJngSZbR28Qe++8XIcGur8om7/FC0Ms4/+ZhxIwIU8qLFDTgG5d76dDBbjivvqiWq1KdSp1rDzJAtGz8E3PiZTmaJA9ooORQFqxbEOS3iaR23W06XOBksufRdN1NnQMf9RIMOvq6yaIuRi/qRoC9j/BzngufZZJi45are/fNY216VItKOQ7S5BsGmY1yELhiay/rFCPeJSwDOAlgEmmGlwNy2Lg/De7D1/76cKb+DAI2ReGF7pQozMRgrp4GV5rSXyE05CJRH98= [preauth]
    2025-03-14T17:04:19.5945606Z    debug1: userauth_pubkey: publickey test pkalg rsa-sha2-512 pkblob RSA SHA256:/5lmYMqmvfzeMm5lYA/bceUSRrG6DOnqAGnTaPRsUNI [preauth]
    2025-03-14T17:04:19.6022738Z    debug1: temporarily_use_uid: 197108/197121 (e=197108/197121)
    2025-03-14T17:04:19.6053359Z    debug1: trying public key file /d/a/curl/curl/bld/tests/log/1/server/curl_client_key.pub
    2025-03-14T17:04:19.6235161Z    debug1: fd 7 clearing O_NONBLOCK
    2025-03-14T17:04:19.6293687Z    debug1: /d/a/curl/curl/bld/tests/log/1/server/curl_client_key.pub:1: matching key found: RSA SHA256:/5lmYMqmvfzeMm5lYA/bceUSRrG6DOnqAGnTaPRsUNI
    2025-03-14T17:04:19.6326646Z    debug1: /d/a/curl/curl/bld/tests/log/1/server/curl_client_key.pub:1: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
    2025-03-14T17:04:19.6331265Z    Accepted key RSA SHA256:/5lmYMqmvfzeMm5lYA/bceUSRrG6DOnqAGnTaPRsUNI found at /d/a/curl/curl/bld/tests/log/1/server/curl_client_key.pub:1
    2025-03-14T17:04:19.6348653Z    debug2: auth_check_authkeys_file: /d/a/curl/curl/bld/tests/log/1/server/curl_client_key.pub: processed 1/1 lines
    2025-03-14T17:04:19.6358905Z    debug1: restore_uid: 197108/197121
    2025-03-14T17:04:19.6420341Z    debug2: userauth_pubkey: authenticated 0 pkalg rsa-sha2-512 [preauth]
    2025-03-14T17:04:19.6427251Z    Postponed publickey for runneradmin from 127.0.0.1 port 63287 ssh2 [preauth]
    2025-03-14T17:04:19.6433985Z    Connection closed by authenticating user runneradmin 127.0.0.1 port 63287 [preauth]
    2025-03-14T17:04:19.6460384Z    debug1: do_cleanup [preauth]
    2025-03-14T17:04:19.6491921Z    debug1: monitor_read_log: child log fd closed
    2025-03-14T17:04:19.6539965Z    debug1: mm_reap: preauth child exited with status 255
    2025-03-14T17:04:19.6578442Z    debug1: do_cleanup
    2025-03-14T17:04:19.6668279Z    debug1: Killing privsep child 4485
    2025-03-14T17:04:19.6706233Z    debug1: child_close: enter
    2025-03-14T17:04:19.6725732Z    debug1: child_reap: preauth child 4481 for connection from 127.0.0.1 to 127.0.0.1 exited after unsuccessful auth attempt 
    2025-03-14T17:04:19.6727822Z    srclimit_penalise: ipv4: new 127.0.0.1/32 deferred penalty of 5 seconds for penalty: failed authentication
    2025-03-14T17:04:19.6729708Z   === End of file ssh_server.log
    2025-03-14T17:04:19.6732201Z   === Start of file stderr582
    2025-03-14T17:04:19.6736009Z    Test: lib582
    2025-03-14T17:04:19.6737455Z    URL: Sftp://127.0.0.1:63150/d/a/curl/curl/bld/tests/log/1/upload582.txt
    2025-03-14T17:04:19.6738833Z    Set to upload 27 bytes
    2025-03-14T17:04:19.6740030Z    * !!! WARNING !!
    2025-03-14T17:04:19.6741262Z    * This is a debug build of libcurl, do not use in production.
    2025-03-14T17:04:19.6741828Z    * Added connection 0. The cache now contains 1 members
    2025-03-14T17:04:19.6742734Z    *   Trying 127.0.0.1:63150...
    2025-03-14T17:04:19.6743083Z    Add socket fd 456 for write
    2025-03-14T17:04:19.6743442Z    * Connected to 127.0.0.1 (127.0.0.1) port 63150
    2025-03-14T17:04:19.6743833Z    * User: 'runneradmin'
    2025-03-14T17:04:19.6744243Z    * SFTP 0x2247ca7d590 state change from SSH_STOP to SSH_INIT
    2025-03-14T17:04:19.6745218Z    * SFTP 0x2247ca7d590 state change from SSH_INIT to SSH_S_STARTUP
    2025-03-14T17:04:19.6745782Z    Add socket fd 456 for read
    2025-03-14T17:04:19.6746544Z    * SFTP 0x2247ca7d590 state change from SSH_S_STARTUP to SSH_HOSTKEY
    2025-03-14T17:04:19.6747522Z    * SSH MD5 public key: NULL
    2025-03-14T17:04:19.6748429Z    * SSH SHA256 public key: NULL
    2025-03-14T17:04:19.6748951Z    * SFTP 0x2247ca7d590 state change from SSH_HOSTKEY to SSH_AUTHLIST
    2025-03-14T17:04:19.6749526Z    * SSH authentication methods available: publickey
    2025-03-14T17:04:19.6750130Z    * SFTP 0x2247ca7d590 state change from SSH_AUTHLIST to SSH_AUTH_PKEY_INIT
    2025-03-14T17:04:19.6750786Z    * Using SSH public key file 'log/1/server/curl_client_key.pub'
    2025-03-14T17:04:19.6751373Z    * Using SSH private key file 'log/1/server/curl_client_key'
    2025-03-14T17:04:19.6752352Z    * SFTP 0x2247ca7d590 state change from SSH_AUTH_PKEY_INIT to SSH_AUTH_PKEY
    2025-03-14T17:04:19.6753510Z    * SSH public key authentication failed: Callback returned error
    2025-03-14T17:04:19.6754220Z    * SFTP 0x2247ca7d590 state change from SSH_AUTH_PKEY to SSH_AUTH_PASS_INIT
    2025-03-14T17:04:19.6755043Z    * SFTP 0x2247ca7d590 state change from SSH_AUTH_PASS_INIT to SSH_AUTH_HOST_INIT
    2025-03-14T17:04:19.6756178Z    * SFTP 0x2247ca7d590 state change from SSH_AUTH_HOST_INIT to SSH_AUTH_AGENT_INIT
    2025-03-14T17:04:19.6756776Z    * Failure connecting to agent
    2025-03-14T17:04:19.6760997Z    * SFTP 0x2247ca7d590 state change from SSH_AUTH_AGENT_INIT to SSH_AUTH_KEY_INIT
    2025-03-14T17:04:19.6761841Z    * SFTP 0x2247ca7d590 state change from SSH_AUTH_KEY_INIT to SSH_AUTH_DONE
    2025-03-14T17:04:19.6762396Z    * Authentication failure
    2025-03-14T17:04:19.6763708Z    * SFTP 0x2247ca7d590 state change from SSH_AUTH_DONE to SSH_SESSION_FREE
    2025-03-14T17:04:19.6764397Z    * SFTP 0x2247ca7d590 state change from SSH_SESSION_FREE to SSH_STOP
    2025-03-14T17:04:19.6764947Z    * Curl_disconnect(conn #0, aborted=1)
    2025-03-14T17:04:19.6765370Z    * closing connection #0
    2025-03-14T17:04:19.6765934Z    Remove socket fd 456
    2025-03-14T17:04:19.6766762Z    Error uploading file.
    2025-03-14T17:04:19.6767115Z    Test ended with result 126
    2025-03-14T17:04:19.6767427Z   === End of file stderr582
    

    Full job run with other similar failures:
    curl-libssh2-wincng.log.txt

    Also reproduced with the MSYS2 libssh2-wincng package:
    curl/curl#16781
    https://github.com/curl/curl/actions/runs/13990239834/job/39172667787

  12. vszakats commented on Mar 21, 2025

    @vszakats
    Member

    After setting up this env locally with curl tests, it seems my WINE version (6.0.2) is missing some crypto features, and thus getting Failure establishing ssh session: -8, Unable to exchange encryption keys. The same I got with libssh2 tests. Meaning I can't replicate it locally.

    0024:fixme:bcrypt:BCryptGenRandom ignoring selected algorithm
    0024:fixme:bcrypt:BCryptGenRandom ignoring selected algorithm
    0024:fixme:bcrypt:BCryptGenRandom ignoring selected algorithm
    0024:fixme:bcrypt:BCryptGenRandom ignoring selected algorithm
    0024:fixme:bcrypt:BCryptEncrypt encryption with asymmetric keys not yet supported
    * Failure establishing ssh session: -8, Unable to exchange encryption keys
    * closing connection #0
    

    edit: Turns out one can just upgrade WINE :) Re-running with 9.0 did not change the outcome much:

    0024:fixme:bcrypt:BCryptGenRandom ignoring selected algorithm
    0024:fixme:bcrypt:BCryptGenRandom ignoring selected algorithm
    0024:fixme:bcrypt:BCryptGenRandom ignoring selected algorithm
    0024:fixme:bcrypt:set_key_property unsupported key property L"DHParameters"
    * Failure establishing ssh session: -8, Unable to exchange encryption keys
    * closing connection #0
    

    It's also curious this doesn't happen in libssh2 CI. Though we have just one job testing this, on an older Windows runner:
    https://ci.appveyor.com/project/libssh2org/libssh2/builds/51737350/job/e8eo9bui5di0pj24

    I guess what may help is adding manual printf()s throughout the codepath to see where it fails and how.

  13. vszakats commented on Mar 21, 2025

    @vszakats
    Member

    After extending tests to Windows, the solution became obvious:
    libssh2 with the WinCNG backend doesn't support the OpenSSH
    aka RFC4716 private key format. This is the default generated by
    ssh-keygen for some time now.

    To make it work with WinCNG the PEM format is necessary, with
    -m PEM.

    Removed the bug label and this is probably rather an enhancement
    aka missing feature.

  14. 19 remaining items

  15. pyscripter commented on Mar 21, 2025

    @pyscripter
    Author

    So you'd use the command sh-keygen -t ecdsa

    [libssh2] 0.092627 Userauth: Publickey authentication successful
    Hurray!

    What about the rsa? Should I use PEM or not?

  16. vszakats commented on Mar 21, 2025

    @vszakats
    Member
    • ssh-keygen -t rsa -m PEM crashed at [libssh2] 0.294330 Userauth: Loading private key file: C:/Temp/id_rsa

    Should have said plain unencrypted.

    I'm guessing it's an encrypted PEM key. It might need libssh2 explicitly
    built with -DLIBSSH2_MD5_ENABLE -DLIBSSH2_MD5_PEM_ENABLE (CPPFLAGS)
    and/or an encyption method understood by WinCNG possibly.

    The curl test suite uses unencrypted PEM RSA keys, those do work.

    • ECDSA with passphrase [libssh2] 0.448838 Failure Event: -34 - Passphrase-protected ECDSA private key files are > unsupported
    • ECDSA without passphrase [libssh2] 0.561452 Failure Event: -16 - Unable to initialize private key from file

    Is this a -DENABLE_ECDSA_WINCNG=ON build?

  17. pyscripter commented on Mar 21, 2025

    @pyscripter
    Author

    Is this a -DENABLE_ECDSA_WINCNG=ON build?

    Yes. It now works with unencrypted ECDSA keys without -m PEP.

  18. willco007 commented on Mar 21, 2025

    @willco007
    Member

    For RSA keys, WinCNG only supports the legacy format, so the flag -m PEM is required.

  19. vszakats commented on Mar 21, 2025

    @vszakats
    Member

    @vszakats Looking closer, mbedtls supports ecdsa keys in the openssh format and that is all. I implemented full support for all key types using the new format in the openssl backend, so that is what you should probably be looking at for guidance.

    For example of how this works, _libssh2_rsa_new_private attempts to first parse the old pem format using the openssl backend, if that fails it will then attempt to parse the new format using _libssh2_rsa_new_openssh_private. That call uses a generic openssh pem parser _libssh2_openssh_pem_parse (you can also use _libssh2_openssh_pem_parse_memory) which all backends should use to parse the new pem format.

    After the data is parsed and decrypted you then need to use the specific backend API to create the key. In the openssl backend that call is gen_publickey_from_rsa_openssh_priv_data but the specifics vary quite a bit based on backends. I'd be happy to give you guidance if you want to try to extend key parsing to other backends.

    Lastly, looking at the WinCNG pem parsing, there are several locations where it can fail and they all return a -1 error so nothing of use bubbles up to the user.

    Thanks @willco007. That's beyond my C skills and free time. I'm not using mbedTLS, or WinCNG. (Also have a bottomless TODO list with other curl (and some libssh2) issues.)

    At this point I wouldn't advise WinCNG for serious uses, because of the unfixed flakiness issue.

    No question all of these could be improved quite a bit.

  20. vszakats commented on Mar 21, 2025

    @vszakats
    Member

    You'd have a better experience if you used a fully supported backend, like OpenSSL for example. :) As you're finding out, the WinCNG support is limited at best.

    I quite like the fact that I don't have to distribute an additional DLL with WinCNG. I guess OpenSSL is not linked statically. libssh2_userauth_publickey_fromfile_ex is the first issue I came across with it. All the other stuff seem to work fine.

    Which are the "fully supported" backends?

    I second OpenSSL, with special mention of its forks. LibreSSL has smaller footprint for example. Recent wolfSSL should also work, it uses pretty much the same codepath as OpenSSL. All can be linked statically. (Can't comment on licensing.)

    As said above WinCNG may not be reliable, depending on unknown factors. It certainly is consistently flaky in CI.

  21. pyscripter commented on Mar 21, 2025

    @pyscripter
    Author

    Could you create a new issue with the RSA key crash and an example key that shows the crash? It should be supported from what I can see

    I can create a new issue if you prefer but here are the details.

    • Synched libssh2 with master
    • Debug built with ENABLE_ECDSA_WINCNG=ON
    • I have created an unencrypted key with: ssh-keygen -t rsa -m PEM as suggested.
    • Added the key to the server
    • Called libssh2_userauth_publickey_fromfile_ex
    • Crashed at the end of the following trace:
    [libssh2] 0.444847 Userauth: Loading public key file: C:/Temp/id_rsa.pub
    [libssh2] 0.444847 Key Ex: Signing using rsa-sha2-512
    [libssh2] 0.444847 Userauth: Attempting publickey authentication
    => libssh2_transport_write plain (471 bytes)
    0000: 32 00 00 00 07 6B 76 6C  61 68 6F 73 00 00 00 0E : 2....******....
    0010: 73 73 68 2D 63 6F 6E 6E  65 63 74 69 6F 6E 00 00 : ssh-connection..
    0020: 00 09 70 75 62 6C 69 63  6B 65 79 00 00 00 00 0C : ..publickey.....
    0030: 72 73 61 2D 73 68 61 32  2D 35 31 32 00 00 01 97 : rsa-sha2-512....
    0040: 00 00 00 07 73 73 68 2D  72 73 61 00 00 00 03 01 : ....ssh-rsa.....
    0050: 00 01 00 00 01 81 00 BE  D7 EA DD 3F 89 93 CB DF : ...........?....
    0060: 41 34 76 EA 54 79 FE C2  7B 52 F1 16 CF A9 8E DC : A4v.Ty..{R......
    0070: B9 1B 79 10 28 B2 1D 06  A5 46 32 26 17 D6 48 DD : ..y.(....F2&..H.
    0080: 34 D1 4D 33 1A 42 9E 07  C2 AF 7B AD E0 57 98 1C : 4.M3.B....{..W..
    0090: D9 49 6C 79 96 76 33 BF  82 7D C4 17 7F 7B 87 09 : .Ily.v3..}...{..
    00a0: 9B D2 AB 9E 7C 34 1A F8  2F 56 4F 80 05 95 DC F6 : ....|4../VO.....
    00b0: D7 8E 9C 53 81 5A A5 75  B6 9A 8D A2 98 03 8F D6 : ...S.Z.u........
    00c0: AA 4C 38 92 93 B7 20 EA  B7 87 7A 3A F0 37 81 40 : .L8... ...z:.7.@
    00d0: 37 1F 50 16 AD 18 03 38  2F D6 5A FD 6D 25 A6 25 : 7.P....8/.Z.m%.%
    00e0: B4 89 6B E1 9B 1C 78 C7  53 8F 59 C0 EC AB 66 EF : ..k...x.S.Y...f.
    00f0: 4B 04 F9 F9 D3 F0 B7 75  D1 89 61 34 15 1D 38 3F : K......u..a4..8?
    0100: 5A 10 BA 4A BC B7 4A 47  B2 4D 12 81 84 EA 42 69 : Z..J..JG.M....Bi
    0110: FA E6 13 0C E9 F9 BD B3  6B 0D 49 A3 52 E2 23 C8 : ........k.I.R.#.
    0120: 7B D2 4B 09 C3 19 A8 97  7B 29 F1 66 F7 CB 95 6D : {.K.....{).f...m
    0130: FB 25 3D C3 D2 5D 83 D4  58 FA 33 6B F2 C9 AD B9 : .%=..]..X.3k....
    0140: 76 F4 D6 96 F6 1F 90 EC  0C CA 05 FA 2C BC 65 AC : v...........,.e.
    0150: CE C4 BD BD 75 9A B1 DC  B2 D9 8C 76 32 92 63 75 : ....u......v2.cu
    0160: 84 8D F6 39 5C 5E ED D9  9A 0F 0C 09 F6 39 CA 90 : ...9\^.......9..
    0170: E4 55 81 6D 3D F8 BB BE  84 2B 92 3E 00 36 95 0B : .U.m=....+.>.6..
    0180: 0A 71 9E 79 C4 05 B9 49  60 67 F0 70 9E 8B 1A E5 : .q.y...I`g.p....
    0190: 77 ED AF 36 16 51 83 A1  B6 4C BE D2 26 78 06 5D : w..6.Q...L..&x.]
    01a0: 50 E4 63 8F 52 6B 76 32  24 84 F8 7A B7 2B 67 19 : P.c.Rkv2$..z.+g.
    01b0: 43 4E 3D 12 4D 5A A9 68  C1 DE 66 A3 44 99 F0 4F : CN=.MZ.h..f.D..O
    01c0: 87 F6 05 A8 67 8C E3 8B  76 1D 6D 94 D4 4D 32 F5 : ....g...v.m..M2.
    01d0: 72 05 26 C9 B0 45 0D                             : r.&..E.
    [libssh2] 0.444847 Socket: Sent 500/500 bytes at 000002725A157CA0
    => libssh2_transport_write send() (500 bytes)
    0000: 25 FE 8D FA 87 E3 E8 36  CE A7 99 F2 87 D8 A2 E0 : %......6........
    0010: FA D7 C5 C2 F7 13 13 2A  C3 84 24 C9 FC 10 25 FE : .......*..$...%.
    0020: 1E 1D 6B ED 0C 87 C4 F2  0C 33 83 44 92 EA 60 AB : ..k......3.D..`.
    0030: 1E 65 D7 83 98 CB 5C FD  2F 50 9F AE AD 4C E9 D8 : .e....\./P...L..
    0040: 7C 06 E6 F9 C7 F9 3F 55  DC DD 4A 69 B4 2F D3 F2 : |.....?U..Ji./..
    0050: 53 D1 12 74 FB 1C C2 DD  74 CD 32 C3 FC 37 47 1E : S..t....t.2..7G.
    0060: 51 24 13 AB F5 63 3C 61  4E 77 47 9A FA 8C 7C 53 : Q$...c<aNwG...|S
    0070: 8D CD F1 CB 0F B0 11 33  D2 40 62 38 F7 0C 29 58 : .......3.@b8..)X
    0080: B0 6F B7 B3 8D 13 20 1B  11 1C BB D5 3F 5C 50 EC : .o.... .....?\P.
    0090: 88 A3 5C 10 40 03 96 A6  A8 A6 4D 4F CC 18 86 AE : ..\[email protected]....
    00a0: 41 5D 18 96 20 9D D8 51  C3 AE B7 DD F2 8D 53 2C : A].. ..Q......S,
    00b0: 64 43 42 E3 BF 3E 60 89  EC A0 CF 29 42 4C F0 76 : dCB..>`....)BL.v
    00c0: DF ED CB A1 FD 3E 96 B1  2C 9C 52 48 9F 34 03 B3 : .....>..,.RH.4..
    00d0: BC 25 E1 E4 7C 66 25 3A  E4 AD EC 85 D2 E1 CD D8 : .%..|f%:........
    00e0: A2 33 50 F4 91 38 BD 1D  1C 32 83 D9 21 AC 7A 89 : .3P..8...2..!.z.
    00f0: D2 E7 04 4C 85 4B 83 28  EF 49 2D 11 39 5B CE 04 : ...L.K.(.I-.9[..
    0100: 6C F9 18 4E 06 C4 90 AD  23 3F 1D 2D FF E2 83 47 : l..N....#?.-...G
    0110: D1 91 94 63 6F 85 6E DB  65 9C B1 1C 39 DB 07 F5 : ...co.n.e...9...
    0120: 57 65 8E 3D B3 50 40 21  63 4B 75 86 D7 F3 41 71 : We.=.P@!cKu...Aq
    0130: 54 D6 34 9D E8 C4 4C 57  F8 59 6A 2B 94 D1 DA 7D : T.4...LW.Yj+...}
    0140: C0 79 66 F6 DD 87 AA 8B  ED 2B 35 DF 76 C7 F4 CE : .yf......+5.v...
    0150: C0 D1 F3 E4 72 00 26 75  2B 0A 20 01 56 98 57 0F : ....r.&u+. .V.W.
    0160: 72 1A 23 7A A4 33 19 6A  03 D3 1B 5E 00 CD 94 15 : r.#z.3.j...^....
    0170: 62 9B 15 A5 EB 5F 61 57  12 27 BF 6F FF E4 10 80 : b...._aW.'.o....
    0180: 4A 92 B2 07 A9 B3 5B 3A  3F DA BE 78 2E 1E EE E6 : J.....[:?..x....
    0190: 00 18 A1 FC 2A FD 44 67  EC 5A 7A A0 AB 69 EB 30 : ....*.Dg.Zz..i.0
    01a0: BD 98 85 40 01 62 6C FC  92 60 DE 29 1E 87 29 91 : [email protected]..`.)..).
    01b0: 15 95 11 8C 7D A5 C4 BC  25 23 A5 CD D8 DA 9E 2B : ....}...%#.....+
    01c0: A4 F4 3C DF 5D 72 26 17  08 DB C7 99 6D D0 46 40 : ..<.]r&.....m.F@
    01d0: BB 5E 15 7F 42 82 BC 4B  27 B7 96 63 29 B8 9E E2 : .^..B..K'..c)...
    01e0: 57 76 3B 84 09 53 66 72  16 50 3F 7B 07 F5 7C D8 : Wv;..Sfr.P?{..|.
    01f0: DD AA CF 98                                      : ....
    [libssh2] 0.444847 Transport: Looking for packet of type: 52
    [libssh2] 0.444847 Transport: Looking for packet of type: 51
    [libssh2] 0.444847 Transport: Looking for packet of type: 60
    [libssh2] 0.444847 Socket: Recved 460/35000 bytes to 000002725A14F3A8+0
    => libssh2_transport_read() raw (460 bytes)
    0000: 6B E9 33 6F D7 54 82 87  63 FE C9 A2 16 F2 18 25 : k.3o.T..c......%
    0010: EE 24 0F E9 89 5E A5 31  88 53 9D EE 0F C0 53 BA : .$...^.1.S....S.
    0020: 57 58 B3 AB 35 7A 35 B7  63 10 A2 BA 43 0D E5 19 : WX..5z5.c...C...
    0030: 59 19 C2 1F 46 99 44 8B  8D 82 89 49 EE D9 11 17 : Y...F.D....I....
    0040: C1 91 DC 23 07 E2 FA AD  1A 46 F3 72 63 A3 B7 E6 : ...#.....F.rc...
    0050: FF C8 E4 F8 4D 58 0E FB  C7 05 48 54 90 A8 12 90 : ....MX....HT....
    0060: 18 7C F6 44 6F A4 C2 2F  D5 05 17 D6 55 6D BB B1 : .|.Do../....Um..
    0070: 2C 15 72 80 93 C2 58 9C  25 27 EC 0F E7 D3 8B A7 : ,.r...X.%'......
    0080: CB EB D7 DA 0E C3 F3 CE  F6 96 0F 8A 34 21 D3 07 : ............4!..
    0090: 24 8D 1B 93 2A 28 41 6F  E4 01 23 A1 97 69 1A 6F : $...*(Ao..#..i.o
    00a0: 5A 38 3A D9 86 25 01 E3  E7 CB 4C B5 E1 41 7A 50 : Z8:..%....L..AzP
    00b0: 4B 69 8E E8 79 DD BB 1D  1C A1 C7 69 63 56 78 10 : Ki..y......icVx.
    00c0: CD D2 4E 6C C6 0F 64 E5  BB 69 C0 A6 45 4B 06 F9 : ..Nl..d..i..EK..
    00d0: 49 4A 71 41 90 77 A5 6E  9E 04 B2 76 7F 9B E3 1A : IJqA.w.n...v....
    00e0: 25 C2 23 47 97 00 38 70  8C 17 CD 02 77 4C 43 1A : %.#G..8p....wLC.
    00f0: 87 52 1D BC EC EA 1A 7E  1E C1 54 B8 42 5B 07 08 : .R.....~..T.B[..
    0100: 47 03 4D 1F D8 25 F5 2A  08 10 28 84 62 B8 D1 0D : G.M..%.*..(.b...
    0110: BB 37 1E 2F 04 C4 50 5B  42 60 86 65 DF 2C F8 78 : .7./..P[B`.e.,.x
    0120: B0 84 C6 B6 5E 64 E0 9F  55 84 5A 74 B4 6F 9B 80 : ....^d..U.Zt.o..
    0130: 98 38 C9 7E 53 C5 29 7E  37 09 A8 85 C3 5D 66 97 : .8.~S.)~7....]f.
    0140: F6 4F FB 3F E0 AC E3 EF  40 C7 21 7E F1 EB 2D 32 : .O.?....@.!~..-2
    0150: B7 70 7E A6 DF F7 BE 38  03 51 1B 6F 60 18 B1 6F : .p~....8.Q.o`..o
    0160: 53 71 41 87 33 70 3C B3  B9 4F 44 53 D9 87 87 1E : SqA.3p<..ODS....
    0170: F9 B0 B9 5B 12 A4 62 39  35 1F 5C 11 18 D1 B4 FC : ...[..b95.\.....
    0180: 40 F4 DF 21 08 0F 71 8D  EC 66 FF 73 33 9E 6D B0 : @..!..q..f.s3.m.
    0190: B3 6D 45 34 17 E2 62 3F  3E 3F 05 3F B6 F7 98 76 : .mE4..b?>?.?...v
    01a0: 23 3E 90 D7 AF 07 C7 01  05 E4 1B 96 4B 15 04 AE : #>..........K...
    01b0: CD 6C 8E 3B 12 FD 77 42  85 43 97 F1 A8 91 5A 19 : .l.;..wB.C....Z.
    01c0: AB 88 4A 9F 57 88 7C B1  23 0A 76 89             : ..J.W.|.#.v.
    => libssh2_transport_read() plain (428 bytes)
    0000: 3C 00 00 00 0C 72 73 61  2D 73 68 61 32 2D 35 31 : <....rsa-sha2-51
    0010: 32 00 00 01 97 00 00 00  07 73 73 68 2D 72 73 61 : 2........ssh-rsa
    0020: 00 00 00 03 01 00 01 00  00 01 81 00 BE D7 EA DD : ................
    0030: 3F 89 93 CB DF 41 34 76  EA 54 79 FE C2 7B 52 F1 : ?....A4v.Ty..{R.
    0040: 16 CF A9 8E DC B9 1B 79  10 28 B2 1D 06 A5 46 32 : .......y.(....F2
    0050: 26 17 D6 48 DD 34 D1 4D  33 1A 42 9E 07 C2 AF 7B : &..H.4.M3.B....{
    0060: AD E0 57 98 1C D9 49 6C  79 96 76 33 BF 82 7D C4 : ..W...Ily.v3..}.
    0070: 17 7F 7B 87 09 9B D2 AB  9E 7C 34 1A F8 2F 56 4F : ..{......|4../VO
    0080: 80 05 95 DC F6 D7 8E 9C  53 81 5A A5 75 B6 9A 8D : ........S.Z.u...
    0090: A2 98 03 8F D6 AA 4C 38  92 93 B7 20 EA B7 87 7A : ......L8... ...z
    00a0: 3A F0 37 81 40 37 1F 50  16 AD 18 03 38 2F D6 5A : :[email protected]/.Z
    00b0: FD 6D 25 A6 25 B4 89 6B  E1 9B 1C 78 C7 53 8F 59 : .m%.%..k...x.S.Y
    00c0: C0 EC AB 66 EF 4B 04 F9  F9 D3 F0 B7 75 D1 89 61 : ...f.K......u..a
    00d0: 34 15 1D 38 3F 5A 10 BA  4A BC B7 4A 47 B2 4D 12 : 4..8?Z..J..JG.M.
    00e0: 81 84 EA 42 69 FA E6 13  0C E9 F9 BD B3 6B 0D 49 : ...Bi........k.I
    00f0: A3 52 E2 23 C8 7B D2 4B  09 C3 19 A8 97 7B 29 F1 : .R.#.{.K.....{).
    0100: 66 F7 CB 95 6D FB 25 3D  C3 D2 5D 83 D4 58 FA 33 : f...m.%=..]..X.3
    0110: 6B F2 C9 AD B9 76 F4 D6  96 F6 1F 90 EC 0C CA 05 : k....v..........
    0120: FA 2C BC 65 AC CE C4 BD  BD 75 9A B1 DC B2 D9 8C : .,.e.....u......
    0130: 76 32 92 63 75 84 8D F6  39 5C 5E ED D9 9A 0F 0C : v2.cu...9\^.....
    0140: 09 F6 39 CA 90 E4 55 81  6D 3D F8 BB BE 84 2B 92 : ..9...U.m=....+.
    0150: 3E 00 36 95 0B 0A 71 9E  79 C4 05 B9 49 60 67 F0 : >.6...q.y...I`g.
    0160: 70 9E 8B 1A E5 77 ED AF  36 16 51 83 A1 B6 4C BE : p....w..6.Q...L.
    0170: D2 26 78 06 5D 50 E4 63  8F 52 6B 76 32 24 84 F8 : .&x.]P.c.Rkv2$..
    0180: 7A B7 2B 67 19 43 4E 3D  12 4D 5A A9 68 C1 DE 66 : z.+g.CN=.MZ.h..f
    0190: A3 44 99 F0 4F 87 F6 05  A8 67 8C E3 8B 76 1D 6D : .D..O....g...v.m
    01a0: 94 D4 4D 32 F5 72 05 26  C9 B0 45 0D             : ..M2.r.&..E.
    [libssh2] 0.444847 Transport: Packet type 60 received, length=428
    [libssh2] 0.444847 Transport: Looking for packet of type: 52
    [libssh2] 0.444847 Transport: Looking for packet of type: 51
    [libssh2] 0.444847 Transport: Looking for packet of type: 60
    [libssh2] 0.444847 Userauth: Loading private key file: C:/Temp/id_rsa
    
  22. pyscripter commented on Mar 21, 2025

    @pyscripter
    Author

    All can be linked statically.

    How do I statically link with OpenSSL or LibreSSL? (I mean, so that there are no external dependencies - single self-contained DLL as with WinCNG).

    I currently use the the following command file for building libssh2:

    Set CurrentDIR=%CD%
    echo -------------  Building zlib  ---------------------
    pushd zlib
    git clean -d -f -x
    cmake -G "Visual Studio 17 2022" -A x64 -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DCMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH=OFF -DCMAKE_INSTALL_PREFIX=./ZlibBin .
    cmake --build . --target install --config "Release"
    cd ZLibBin\lib
    del zlib.lib
    ren zlibstatic.lib zlib.lib
    popd
    echo -----------  Building libssh2  ------------------
    pushd libssh2
    git clean -d -f -x
    cmake -G "Visual Studio 17 2022" -A x64 -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DCMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH=OFF -DBUILD_EXAMPLES=OFF -DBUILD_TESTING=OFF -DENABLE_ZLIB_COMPRESSION=ON -DCRYPTO_BACKEND=WinCNG -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=./WinX64 -DZLIB_LIBRARY=%CurrentDIR%/zlib/ZlibBin/lib/zlib.lib -DZLIB_INCLUDE_DIR=%CurrentDIR%/zlib/ZlibBin/Include" .
    cmake --build . --target install --config "Release"
    popd
    copy libssh2\WinX64\Bin\libssh2.dll ..\Bin\Win64    

    Do I need the -DLIBSSH2_MD5_ENABLE -DLIBSSH2_MD5_PEM_ENABLE flags? What are they used for?

  23. vszakats commented on Mar 22, 2025

    @vszakats
    Member

    All can be linked statically.

    How do I statically link with OpenSSL or LibreSSL? (I mean, so that there are no external dependencies - single self-contained DLL as with WinCNG).

    I currently use the the following command file for building libssh2:

    Set CurrentDIR=%CD%
    echo -------------  Building zlib  ---------------------
    pushd zlib
    git clean -d -f -x
    cmake -G "Visual Studio 17 2022" -A x64 -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DCMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH=OFF -DCMAKE_INSTALL_PREFIX=./ZlibBin .
    cmake --build . --target install --config "Release"
    cd ZLibBin\lib
    del zlib.lib
    ren zlibstatic.lib zlib.lib
    popd
    echo -----------  Building libssh2  ------------------
    pushd libssh2
    git clean -d -f -x
    cmake -G "Visual Studio 17 2022" -A x64 -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DCMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH=OFF -DBUILD_EXAMPLES=OFF -DBUILD_TESTING=OFF -DENABLE_ZLIB_COMPRESSION=ON -DCRYPTO_BACKEND=WinCNG -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=./WinX64 -DZLIB_LIBRARY=%CurrentDIR%/zlib/ZlibBin/lib/zlib.lib -DZLIB_INCLUDE_DIR=%CurrentDIR%/zlib/ZlibBin/Include" .
    cmake --build . --target install --config "Release"
    popd
    copy libssh2\WinX64\Bin\libssh2.dll ..\Bin\Win64    

    You'll need to build the crypto backend and zlib statically first.

    Then point ZLIB_LIBRARY to the static zlib.lib and OPENSSL_CRYPTO_LIBRARY to the static crypto.lib. Setting OPENSSL_USE_STATIC_LIBS=ON may also work.

    Do I need the -DLIBSSH2_MD5_ENABLE -DLIBSSH2_MD5_PEM_ENABLE flags? What are they used for?

    No. Unless you specifically want support for this insecure algo and insecure/obsolete PEM encryption method. These options are on their way out. You most likely don't want them.

  24. added theissue type on May 8, 2025
  25. removed theissue type on May 8, 2025
  26. LarsNordin-LNdata commented on Nov 26, 2025

    @LarsNordin-LNdata
    Contributor

    During my work with issue 1047 I found that without MD5 the whole decryption part in _libssh2_pem_parse() is removed (I added the error-message). The reading of PEM files is done different in libssh2, openssl.c is not using _libssh2_pem_parse(), wuth wincng.c is

    if (method) {
    #if LIBSSH2_MD5_PEM
    /* Set up decryption */
    ......
    #else
    _libssh2_error(session, LIBSSH2_ERROR_ALGO_UNSUPPORTED,
    "Unable to decrypt PEM, MD5 not enabled");
    ret = -1;
    goto out;
    #endif

  27. vszakats commented on Jul 15, 2026

    @vszakats
    Member

    This patch possibly fixes this, though I have not made tests yet:
    #2279

    edit: as for MD5 in libssh2_pem_parse(), that is how the legacy PEM
    format does the encryption. For this ECDSA case the format is OpenSSH,
    which does it securely and through a different function. (To make this
    even more confusing there is a third, PKCS8 format, which is only supported
    by libssh2 for OS/400 via local code and relies on the crypto backends
    elsewhere.)

  28. added a commit that references this issue on Jul 19, 2026
    035d28c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions