fix(engine): use OpenSSL-backed libssh2 on Windows so SSH remotes work - #29
Closed
alcalaperez wants to merge 0 commit into
Closed
alcalaperez wants to merge 0 commit into
alcalaperez wants to merge 0 commit into
Conversation
cheat2001
force-pushed
the
fix/windows-ssh-libssh2-openssl
branch
from
September 16, 2026 14:31
2b6faac to
c91772e
Compare
cheat2001
approved these changes
Sep 16, 2026
cheat2001
left a comment
Owner
There was a problem hiding this comment.
Thanks, this checks out. I confirmed the WinCNG backend has ed25519 and ECDSA compiled out, so OpenSSL is the right call. One correction to the write up: libgit2-sys only pulls OpenSSL on unix, Windows uses WinHTTP, so this adds an OpenSSL build to the Windows compile rather than reusing one. The Windows CI job went from under 3 minutes to 23 on a cold cache. I'm fine with that. I rebased the branch to move the changelog bullet under the existing Fixed section.
cheat2001
added a commit
that referenced
this pull request
Sep 16, 2026
cheat2001
force-pushed
the
fix/windows-ssh-libssh2-openssl
branch
from
September 16, 2026 14:42
c91772e to
b1d0f9b
Compare
Owner
|
Landed on main as b1d0f9b and it ships in 0.15.0. GitHub shows the PR as closed rather than merged because I fast-forwarded main past your commit, but it is your commit, author and all. Thanks. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On Windows, any SSH remote operation (clone/fetch/pull/push) against a server whose host key is
ssh-ed25519or ECDSA — GitLab instances by default — fails before authentication is even attempted with:Root cause chain:
known_hostsentries for the host and hands it tolibssh2_session_method_pref().libssh2-syscompiles libssh2 with the WinCNG crypto backend, which cannot negotiatessh-ed25519or ECDSA host keys at all (RSA-SHA2 only since libssh2 1.11.0).In practice: OpenSSH stores the ed25519 key on first connect (its default preference), so a Windows user with a normal
known_hostssimply cannot use SSH remotes at all. With an RSA-only entry the error changes to a certificate failure once the server stops offeringssh-rsa.Fix
Add a Windows-only direct dependency on
libssh2-syswithopenssl-on-win32+vendored-openssl. Cargo feature unification applies it to the transitivegit2 → libgit2-sys → libssh2-syschain, so the vendored libssh2 builds against the vendored OpenSSL (which the release pipeline already compiles for libgit2's HTTPS side) instead of WinCNG, and negotiates ed25519 / ECDSA / RSA-SHA2 like the git CLI. macOS/Linux resolution is untouched (Cargo.lockgains exactly one dependency edge).Trade-offs:
PATH(e.g. Strawberry Perl) for the vendored OpenSSLConfigurestep. Release CI onwindows-latestalready ships Strawberry Perl. Documented indocs/Development.md.Verification
cargo checkand a full debugcargo buildpass on Windows 11 / MSVC; the build log confirms the new chainopenssl-src→libssh2-sys→git2→ app link with the OpenSSL backend active.ssh://git@…:2222/…presenting anssh-ed25519host key. Before: the error above. After: clone completes and public-key authentication proceeds normally.CHANGELOG.mdcarries the user-facing entry.