1
0
mirror of https://github.com/libssh2/libssh2.git synced 2026-10-24 03:48:58 +03:00
Commit Graph

327 Commits

Author SHA1 Message Date
Viktor Szakats
83284a05a1 GHA: drop Cygwin site: that became the default upstream [ci skip]
Ref: e50bbb7e3e
2026-10-14 12:19:38 +02:00
Viktor Szakats
cdecc43cb8 GHA/curl: drop repeats, allow retries on fail
In an attempt to improve stability / reduce flakiness of these tests.
Especially the ECDSA-enable ones were prone to mass fail.

```
22:49:30.110000 * Failure establishing ssh session: -43, Failed getting banner
```
Ref: https://github.com/libssh2/libssh2/actions/runs/38480041149/job/115580107883#step:11:1034

This is a different failure than the long-chased flaky -8 kex failures,
which was fixed earlier and did not reoccur since then.

Follow-up to 5bfa574460 #2603
Follow-up to f216bbe3aa #2583
Follow-up to bb8e0957b8 #2590

Closes #2666
2026-10-14 01:22:15 +02:00
Viktor Szakats
18aebe0896 GHA: fail early if mport did not complete the install step
MidnightBSD's `mport install` is prone to return a non-zero exit code on
success (hence the need to use `|| true`; also unrelated to the `grep`
filtering, needed to avoid log noise for no built-in option for this).
Work around by verifying success explicitly, so that a truly failed
install command fails in the 'install prereqs' step, instead of raising
a confusing error (e.g. "cmake: not found") in the step after.

Follow-up to b7f4e55c8f #2120
Follow-up to e4f700e934 #1948

Closes #2663
2026-10-07 20:53:34 +02:00
Viktor Szakats
8f80526c49 GHA: bump to LibreSSL 4.3.3, OpenSSL 4.0.3 (from 3.6.x)
Closes #2652
2026-10-05 13:40:23 +02:00
Viktor Szakats
9c731b2de1 kex: drop ML-KEM debug/trace code
With the issue fixed, the debug/trace code is no longer necessary.

Also:
- GHA: drop tracing targeting FreeBSD, those flaky failures were not
  seen since then.
  Follow-up to 13dcd170be #2227

Ref: https://github.com/libssh2/libssh2/pull/1644#issuecomment-4761871304
Follow-up to 4f2692fd81 #2633
Follow-up to ca0e2dcf0a #2259
Follow-up to 3ba252e2a6 #1644

Closes #2651
2026-10-04 20:33:12 +02:00
Viktor Szakats
740c2d33ad GHA: replace diffie-hellman-group-exchange-sha256 with diffie-hellman-group16-sha512
To use a superior fallback KEX.

Refs:
https://datatracker.ietf.org/doc/html/rfc9142
https://github.blog/changelog/2026-09-22-security-improvements-for-ssh/

Follow-up to bb8e0957b8 #2590

Closes #2648
2026-10-03 00:25:20 +02:00
Viktor Szakats
7839760cdc GHA/codeql: switch GHA check to arm64
Identical performance, better efficiency.

Closes #2647
2026-10-02 23:38:33 +02:00
Viktor Szakats
3b3c1cff2e GHA/codeql: switch Linux job to arm64
For slightly shorter runs, better efficiency.

Closes #2646
2026-10-02 22:48:01 +02:00
Viktor Szakats
a95ed7d84a GHA: move some jobs to ubuntu-slim and arm64
For better efficiency.

Closes #2644
2026-10-02 12:20:45 +02:00
Viktor Szakats
bb63c2f52f GHA: run clang-tidy jobs on arm64 Linux
For 30-100% faster build steps, and more efficiency.

Closes #2643
2026-10-02 12:13:09 +02:00
Viktor Szakats
b0028ca522 GHA: bump dependencies
Closes #2641
2026-10-02 11:11:29 +02:00
Viktor Szakats
b3e141ff4d GHA/distcheck: pass unix-style paths in MSYS2 configurations
Closes #2640
2026-10-02 10:42:04 +02:00
Viktor Szakats
244b422835 GHA: set cache-mode: none where missing
Follow-up to 917f38bfe3 #2601

Closes #2639
2026-10-02 09:11:39 +02:00
Viktor Szakats
5fa500d58e GHA: bump msys2/setup-msys2 to v2.33.0, related improvements
Also:
- enable MSYS2 cache for both curl tests.
- inherit pre-installed MSYS2 in the ARM64 curl job.
- bump integration tests from mingw64 to ucrt64 env.
- switch deprecated mingw64 jobs to ucrt64/clang64.
  (Keep one mingw64 and one mingw32 job.)
- silence mingw64/mingw32 deprecation warning.

Closes #2638
2026-10-02 00:32:05 +02:00
Viktor Szakats
805317f6eb GHA/windows: move Linux cross-builds to arm64 runners
For slightly better performance, and better efficiency.
Saving over 1 minute. The clang-tidy build is 2x fast.

Also:
- GHA/windows: fix `windres` command-line for non-intel machines.

Closes #2637
2026-10-01 23:44:49 +02:00
Viktor Szakats
9bf9048bee GHA: drop actionlint, abandoned upstream
No release in 6 months, no commit in 5 months. Lots of debt and a
matching number of local workarounds.

Ref: https://github.com/rhysd/actionlint
Follow-up to f61703cc98 #1740

Closes #2636
2026-10-01 23:44:49 +02:00
dependabot[bot]
788ee6d83a GHA: bump Actions
- update `docker/build-push-action` from 7.3.0 to 7.4.0
- update `github/codeql-action/analyze` from 4.37.8 to 4.38.2
- update `github/codeql-action/init` from 4.37.8 to 4.38.2

Closes #2634
2026-10-01 23:17:57 +02:00
Viktor Szakats
2e1717456b GHA: omit running tests in clang-tidy Linux jobs
To reduce CI runtimes and total CI turnaround time. clang-tidy jobs were
often the longest running ones before this patch.

Closes #2627
2026-09-14 11:54:32 +02:00
Viktor Szakats
c3de8626c1 CI: use --parallel for ctest
Go with 8-10 paralellism, which seems to be stable. If it introduces
flakiness, it possible to settle on ctest defaults, or low manual value.

It makes the test step take 2x-3x less time. Typically from 1m/1m30s to
~30s.

Also enable in AppVeyor, using the the CMake-default parallel value,
subject for refinement if we ever run tests there again.

Before: https://github.com/libssh2/libssh2/actions/runs/34788327227
After: https://github.com/libssh2/libssh2/actions/runs/34825431130?pr=2625

Closes #2625
2026-09-14 11:22:52 +02:00
Viktor Szakats
d702b04352 GHA: reduce parallelism to -j4 in macOS runners
To make builds finish a little bit faster, and to match the value used
in curl and the cores offered by these machines. (Was: `-j5`)

Closes #2626
2026-09-14 10:15:01 +02:00
Viktor Szakats
967a24b3bb tidy-up: miscellaneous
- wincng: add version comments.
  Follow-up to 7a26697ede #397
- wincng: fix two version support comments.
- tests/keys-generate.sh: add comment, newlines.
- mbedtls: casing in comment.
- wording: use `null-terminator` more.
- typos: `ssh-dss`.
- knownhost: drop obsolete comment.
- include/libssh2.h: clarify comments.
- include/libssh2.h: drop empty lines.
- libssh2_knownhost_writeline.md: fix grammar.
- GHA: reorder Cygwin settings, improve package search URL.
- fixup newlines.

Closes #2617
2026-09-13 16:12:32 +02:00
Viktor Szakats
f1572b2888 GHA/openssh_server: drop docker login Action, limit scope
In favor of direct execution or `docker login` and `docker logout`.

Also to limit the logged-in time to the steps the require it, and to
avoid passing a secret via the command-line.

Closes #2616
2026-09-13 14:50:26 +02:00
Viktor Szakats
ff182c52f3 GHA: bump cross-platform-actions, FreeBSD 14.5, enable DragonFly BSD
Try DragonFly BSD again, after upstream fix.

Ref: https://github.com/cross-platform-actions/action/releases/tag/v1.6.0

Follow-up to e4f700e934 #1948

Closes #2610
2026-09-13 11:54:32 +02:00
Viktor Szakats
2ded2f95c5 tidy-up: prefer term 'container' over 'docker'
To reflect the support for multiple container engines, and to make
terminology more consistent and implementation-agnostic.

Also:
- add FIXME for `docker-machine ip` command that has been dropped
  upstream.

Follow-up to 9bd1f16dc2 #2605

Closes #2609
2026-09-13 11:54:32 +02:00
Viktor Szakats
9bd1f16dc2 tests: add support for podman, Apple container
- add `FIXTURE_CONTAINER_CMD` to the container command. Supported:
  `podman`, `container`, `docker` (default).
- deprecate `OPENSSH_NO_DOCKER` env. Replaced by setting
  `FIXTURE_CONTAINER_CMD` to an empty string.
- GHA: replace Docker with `podman` in a some Linux jobs.
- openssh_fixture: fixup `inspect` commands to be compatible with both
  docker and podman.
- openssh_fixture: add `inspect` fallback for podman, which does not
  support `HostIp` before 6.1.0.
  Ref: https://github.com/podman-container-tools/podman/issues/29164
- openssh_fixture: add Apple container alternatives for `pull` and
  `tag`.
- openssh_fixture: fix `run` command to suppress progress output when
  using Apple container.
- openssh_fixture: if `OPENSSH_SERVER_PORT` is set, omit querying
  the port number via the container tool.

`podman` seems to be a tiny bit slower than Docker in CI.

Requirements for Apple container:
- Apple container 0.8.0+ (2026-01-02). Tested with 1.4.1.
- `jq` installed in PATH.
- setting the sshd port manually on the host via `OPENSSH_SERVER_PORT`
  (`container` cannot automatically assign one).
- physical macOS machine.

Example to run conainerized tests on macOS:
```sh
brew install container jq
container system start --disable-kernel-install
container system kernel set --recommended
export FIXTURE_CONTAINER_CMD=container
export OPENSSH_SERVER_PORT=<free-port-number>
export OPENSSH_SERVER_IMAGE; OPENSSH_SERVER_IMAGE=ghcr.io/libssh2/ci_tests_openssh_server:$(git rev-parse --short=20 HEAD:tests/openssh_server)
ctest -VV
```

Also tried:
- using Apple container in CI. Does not work because nested
  virtualization is not supported in GHA runners.
- installing WSL on Windows. Failed with cryptic error upon
  `wsl --install --distribution Debian`.

Closes #2605
2026-09-13 10:34:14 +02:00
Viktor Szakats
ca8864db09 GHA: switch a Linux job (with tests) to arm64
Follow-up to 667f7cac77
Follow-up to 7d9d0f8db5 #2606

Closes #2607
2026-09-12 22:50:21 +02:00
Viktor Szakats
667f7cac77 GHA/openssh_server: try with qemu-user
Ref: https://packages.ubuntu.com/resolute/qemu-user

Follow-up to 7d9d0f8db5 #2606
2026-09-12 19:51:28 +02:00
Viktor Szakats
7d9d0f8db5 openssh_server: build container for arm64 also, fix Dockerfile for trixie
To enable testing on arm64 Linux and possibly also on macOS, and
possibly possibly on arm64 Windows.

Also:
- switch to debian:testing to trigger a container rebuild.
- Dockerfile: install `adduser` explicitly. Required for debian:forky.
- Dockerfile: stop installing suggested/recommended packages.

Ref: https://github.com/docker/build-push-action

Closes #2606
2026-09-12 19:24:57 +02:00
Viktor Szakats
917f38bfe3 GHA: use cache-mode
Limit cache access to the minimum required.

Refs:
https://github.blog/changelog/2026-09-10-control-github-actions-cache-access-with-cache-mode/
https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#cache-mode
https://docs.github.com/en/actions/reference/workflows-and-actions/dependency-caching#bypassing-the-default-untrusted-trigger-cache-restriction

Closes #2601
2026-09-12 00:27:39 +02:00
Viktor Szakats
1a1e62c548 GHA: drop redundant shellcheck expression filter
GHA expressions are no longer used and no longer allowed in GHA scripts.

Follow-up to d7cf63bb05 #1609

Closes #2602
2026-09-11 23:36:20 +02:00
Viktor Szakats
bb8e0957b8 GHA: test WinCNG SCP/SFTP via curl runtests
The WinCNG backend has been missing runtime tests for a while. To
restore some level of testing, this PR make use of curl's regression
test suite (`runtests`) to run SCP/SFTP-specific tests with the
master/PR libssh2 revision at hand. Some tests need to be disabled when
using the built-in Windows OpenSSH server.

The current CI jobs reproduce the long-running WinCNG flaky failure
reported in #804 reliability.

Note, if these CI jobs make libssh2 CI a pain to use, they will be
removed. This has a reasonably fair chance to happen, based on the
experience with curl CI with Windows.

Also:
- test both ECDH and non-ECDH builds.
- test build on x64 and ARM64.
- test with both Windows built-in OpenSSH port and MSYS2's sshd.
- enable debug logging in libssh2 while running the tests.
- for extra stress, run each of the 56-57 tests 6 times.
  This may be lowered in a future commit to avoid flakiness and reduce
  CI load and job times.

Caveats:
- as seen in curl CI, runtests may result in hangs due to broken pipes
  and error 2304 for undiscovered reasons.
  Discussion: https://github.com/curl/curl/discussions/14854
- MSBuild has an undisablable "smart" feature that sometimes marks a
  successful run a failure.
  Refs:
  a477789c43
  https://github.com/curl/curl/pull/18301
- these tests are different in scope than libssh2's own.
- tests sometime fail flaky with:
  ```
  Failure Event: -43 - Failed getting banner
  ```
  Ref: https://github.com/libssh2/libssh2/actions/runs/34134974899/job/101783681252?pr=2590
- running on modern runner machines, the Win10-introduced DH algo is
  always enabled.

Ref: https://github.com/libssh2/libssh2/discussions/2049
Ref: #2583

Closes #2590
2026-09-08 20:42:06 +02:00
Viktor Szakats
c5434649ce GHA/codeql: build C++ (fuzzer) code
Closes #2572
2026-09-01 23:52:17 +02:00
Viktor Szakats
d7e461a081 GHA: restore building examples in CodeQL jobs
Follow-up to 6bf392f627 #2276

Closes #2571
2026-09-01 23:40:15 +02:00
dependabot[bot]
1f35fe4335 GHA: bump GitHub Actions
- update `docker/login-action` from 4.5.1 to 4.6.0
- update `github/codeql-action/analyze` from 4.37.3 to 4.37.8
- update `github/codeql-action/init` from 4.37.3 to 4.37.8

Closes #2570
2026-09-01 20:06:41 +02:00
Viktor Szakats
99f17f4fe8 GHA: bump cross-build-actions to 1.5.0
Also adjust BSD job descriptions to sort them in one group.

Ref: https://github.com/cross-platform-actions/action/releases/tag/v1.5.0

Closes #2567
2026-08-31 11:22:08 +02:00
Viktor Szakats
a2ac6bd4e8 src: propagate session to replace bare allocators with SSH2 ones
Also:
- GHA: build test WinCNG with legacy options enabled with both mingw-w64
  and MSVC.
- add `ssh2_zero_free()` to clear memory and free using `SSH2_FREE()`.
- openssl, wincng: use `ssh2_zero_free()`.
- replace bare allocators with SSH2 ones in places where `session` was
  already available.

Closes #2544
2026-08-27 19:52:26 +02:00
Viktor Szakats
bbb84be704 GHA: bump cross-build-actions, test NetBSD 11.0
Ref: https://github.com/cross-platform-actions/action/releases/tag/v1.4.0

Closes #2528
2026-08-15 11:33:23 +02:00
Viktor Szakats
33a1df3088 openssl: fix compiler warning with AWS-LC/BoringSSL with debug logging enabled
This API returns `uint32_t` with these two forks, and `unsigned long`
elsewhere.

```
src/openssl.c: In function ‘ssh2_ed25519_verify’:
src/openssl.c:3291:19: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 5 has type ‘uint32_t’ {aka ‘unsigned int’} [-Werror=format=]
 3291 |                   "ssh2_ed25519_verify(): EVP_DigestVerify()->%d (ossl: %lu)",
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 3292 |                   ret, ret ? ERR_peek_last_error() : 0));
      |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                    |
      |                                                    uint32_t {aka unsigned int}
src/libssh2_priv.h:1112:34: note: in definition of macro ‘ssh2_deb’
```
Ref: https://github.com/libssh2/libssh2/actions/runs/30837337514/job/91765629453?pr=2503#step:24:105

Also:
- GHA: test the build combination in CI, with BoringSSL.

Closes #2503
2026-08-03 20:11:49 +02:00
Viktor Szakats
079eeb852b src: disable SHA1-based hostkey methods and signatures by default, fix fallouts
They are `ssh-rsa` and `ssh-rsa-cert-v01@openssh.com`, and insecure due
to their reliance on SHA1 hashes.

Also:
- hostkey: fix to accept all RSA hostkey methods in common
  `hostkey_method_ssh_rsa_init()`.
- mbedtls: add missing RSA SHA1/SHA2 guards.
- mbedtls: cleanup on error in `mbed_pub_priv_key()`.
- os400qc3: add missing RSA SHA1/SHA2 guards. (untested)
- wincng: add missing RSA SHA1/SHA2 guards.
- crypto.h: add missing `#endif` comments.
- GHA: move stray `-DLIBSSH2_DSA_ENABLE` to its place.
  Follow-up to b7ab0faa70 #1435
- tests: fix to guard RSA tests with `LIBSSH2_RSA`, replacing
  `LIBSSH2_RSA_SHA1` to keep test coverage. Keep using the latter for
  testing SHA1-based signatures in `test_auth_pubkey_ok_rsa_signed`.

Follow-up to 3e14d67d26 #2444
Follow-up to 99f935358d #2443

Closes #2501
2026-08-03 16:44:03 +02:00
Viktor Szakats
2a38092caf tests: add support to disable hex debug dumps
via new env `FIXTURE_TRACE_NO_DEBUGDUMP`.

Also:
- CI: set `FIXTURE_TRACE_NO_DEBUGDUMP` to make detailed logs (much)
  shorter and more readable for the common debug use-case.

- GHA: enable debug trace for clang-tidy OpenSSL jobs and simplify
  configuration.

Cherry-picked from #2485

Closes #2487
2026-08-02 22:19:50 +02:00
Viktor Szakats
1d0b86ac84 sshd_config: enable legacy KEXs for Libgcrypt and WinCNG, drop workarounds
Turns out this was the root cause of CI failures seen earlier, and then
worked around by reverting to older versions Docker and runner machines.

Replace/revert those workarounds by enabling the necessary legacy bits
in the test OpenSSH server configuration.

Follow-up to 8be5716437 #2174
Follow-up to 51f6259d18 #1720

Closes #2484
2026-08-02 17:46:25 +02:00
dependabot[bot]
234835876e GHA: bump GitHub Actions
- update `actions/checkout` from 7.0.0 to 7.0.1
- update `docker/build-push-action` from 7.2.0 to 7.3.0
- update `docker/login-action` from 4.2.0 to 4.5.1
- update `docker/metadata-action` from 6.1.0 to 6.2.0
- update `github/codeql-action/analyze` from 4.36.2 to 4.37.3
- update `github/codeql-action/init` from 4.36.2 to 4.37.3

Closes #2477
2026-08-01 23:54:28 +02:00
dependabot[bot]
fdbd6ffc40 GHA: bump codespell from 2.4.2 to 2.4.3
Closes #2475
2026-08-01 23:54:28 +02:00
Viktor Szakats
6097d16b7d GHA: set HOMEBREW_NO_INSTALL_CLEANUP=1
To avoid unnecessary work in CI context, and log noise.

Closes #2462
2026-07-31 22:15:32 +02:00
Viktor Szakats
4834015071 autotools: fix memset_s() detection
To also check for the prototype, avoiding mis-detection e.g. in C89
(non-GNU) mode with Apple targets, and syncing this detection with
CMake.

Also: test C89 macOS builds in CI with both autotools and cmake.

Follow-up to 833b48519c #2456
Ref: 6f0dcc3e66 #2455

Closes #2457
2026-07-31 21:58:23 +02:00
Viktor Szakats
cf107fb756 version: reflect KEX-SHA1, MAC-SHA1, deprecated APIs in libssh2_build_options()
Follow-up to 3e14d67d26 #2444
Follow-up to 99f935358d #2443
Follow-up to 2673970d2a #2178

Closes #2453
2026-07-30 14:08:19 +02:00
Viktor Szakats
3e14d67d26 mac: disable SHA1-based MACs by default
Also:
- RELEASE-NOTES: announce removal after next release.
- allow build-time macro to enable in the meantime.
- skip in tests if disabled.
- keep testing in CI with other legacy options.
- workaround oss-fuzzer hang and timeout after 10 minutes by keeping
  SHA1-based MACs enabled in the fuzzer build.
  Ref: https://github.com/libssh2/libssh2/pull/2444#issuecomment-5110853610

Follow-up to 99f935358d #2443

Closes #2444
2026-07-29 02:53:01 +02:00
Viktor Szakats
99f935358d kex: disable SHA1-based methods by default
Also:
- RELEASE-NOTES: announce removal after next release.
- allow build-time macro to enable in the meantime.
- keep testing in CI with other legacy options.

Closes #2443
2026-07-29 01:09:39 +02:00
Viktor Szakats
29af30a994 GHA: add tests with legacy options enabled
Also:
- reflow an `include` section to be more compact and readable.
- enable verbose build for Linux jobs to confirm build options.
- keep DSA disabled because it fails test `test_auth_pubkey_ok_dsa`, due
  to lack of server support.

Follow-up to b89858b83d #1531

Closes #2439
2026-07-28 12:35:43 +02:00
Viktor Szakats
49738e7e09 build: add option to enable Unicode mode (Windows)
autotools: `--enable-windows-unicode`.
cmake: `-DENABLE_UNICODE=ON`.

Also:
- automatically enable in UWP builds.
- test in CI, with both autotools and cmake and both mingw-w64 and MSVC.

Closes #2321
2026-07-15 16:39:30 +02:00