Skip to content

WinCNG test failures: do more detailed logs - #979

Closed
vszakats wants to merge 28 commits into
libssh2:masterfrom
vszakats:log-msgs
Closed

vszakats wants to merge 28 commits into
libssh2:masterfrom
vszakats:log-msgs

Conversation

@vszakats

Copy link
Copy Markdown
Member

No description provided.

@vszakats
vszakats force-pushed the log-msgs branch 12 times, most recently from 309b636 to 4b58441 Compare April 19, 2023 12:38
vszakats added a commit that referenced this pull request Apr 19, 2023
`CONFIGURATION` was never passed to the cmake command, so it had
never enabled logging when set to `Debug`.

Also `CONFIGURATION` is ambiguous depending on the "generator" used
by CMake. In case of Visual Studio, this is a build/ctest-time
setting, not a cmake-config parameter.

So set this permanently to `Release` and enable logging via our
dedicated CMake option `ENABLE_DEBUG_LOGGING`.

Tested in #979
vszakats added a commit that referenced this pull request Apr 19, 2023
Works like the `FIXTURE_TRACE_ALL` envvar, but enables full trace for
the connection phase only.

Also fix a possible NULL deref with `FIXTURE_TRACE_ALL` and a failed
`libssh2_session_init_ex()`.

Tested in #979
vszakats added a commit that referenced this pull request Apr 19, 2023
To hopefully help finding the WinCNG hostkey verification
intermittent failure #804.

Tested in #979
vszakats added a commit that referenced this pull request Apr 19, 2023
vszakats added a commit that referenced this pull request Apr 19, 2023
vszakats added a commit that referenced this pull request Apr 19, 2023
@vszakats vszakats changed the title small logging improvements WinCNG test failures: do more detailed logs Apr 19, 2023
@mback2k

mback2k commented Apr 19, 2023

Copy link
Copy Markdown
Member

hasAlgDHwithKDF is actually the more interesting variable to log, because the raw KDF support is the important part here.

@vszakats

Copy link
Copy Markdown
Member Author

In this test (no. 24): https://ci.appveyor.com/project/libssh2org/libssh2/builds/46833132/job/8d8jm0893ntwnvk8

called from kex.c / diffie_hellman_sha_algo() in this order:
_libssh2_dh_key_pair() → _libssh2_wincng.hasAlgDHwithKDF=0
_libssh2_dh_secret() → status=0, _libssh2_wincng.hasAlgDHwithKDF=1

@vszakats
vszakats marked this pull request as draft April 20, 2023 17:37
@vszakats
vszakats force-pushed the log-msgs branch 5 times, most recently from e1ee1f8 to 19af6d7 Compare April 21, 2023 12:49
@vszakats

Copy link
Copy Markdown
Member Author

@mback2k: According to the logs, hasAlgDHwithKDF is 0 while _libssh2_dh_key_pair() is running, even on Server 2019. This value is set in a subsequent call in libssh2_dh_secret(), to 1, which is the correct value for this OS, AFAIU. But, by then it's too late to help generating the key pair.

I force bumped this value to 1 in _libssh2_dh_key_pair(), and it seems to make Server 2019 tests go green. And even Server 2016.

Do you think hasAlgDHwithKDF=0 is correct in _libssh2_dh_key_pair()?

@vszakats

Copy link
Copy Markdown
Member Author

Putting this aside. Might merge the kex error message patch in a separate commit.

@vszakats vszakats closed this Apr 25, 2023
vszakats added a commit to vszakats/libssh2 that referenced this pull request Apr 25, 2023
vszakats added a commit to vszakats/libssh2 that referenced this pull request Apr 27, 2023
WinCNG builds have been flaky for a while. It breaks most CI tests.

Ref: libssh2#804
Ref: libssh2#979

Closes #xxxx
vszakats added a commit to vszakats/libssh2 that referenced this pull request Apr 27, 2023
WinCNG builds have been flaky for a while. It breaks most CI tests.

Ref: libssh2#804
Ref: libssh2#979

Closes #xxxx
vszakats added a commit that referenced this pull request May 3, 2023
Twice. This tests are flaky and we haven't figured out why. In the
meantime use this workaround to test and log these issues, but also
ensure that CI run aren't flagged red because of it.

Also:
- kex: add debug message when hostkey `sig_verify` fails,
  to help tracking WinCNG KEX failures.
- test_ssh2: also add retry logic.
  I'm not quite sure this is correct. Please let me know.
- session_fixture: bump up `src_path` slots to fit retries and show
  message when hitting the limit.
- session_fixture: clear `kbd_password` static variable after use.
- session_fixture: close and deinit socket after use.
- session_fixture: deinit libssh2 after use.

Ref: #804 #846 #979 #1012 #1015

Cherry-picked from #1017
Closes #1023
agreppin pushed a commit to agreppin/libssh2 that referenced this pull request Jul 14, 2024
`CONFIGURATION` was never passed to the cmake command, so it had
never enabled logging when set to `Debug`.

Also `CONFIGURATION` is ambiguous depending on the "generator" used
by CMake. In case of Visual Studio, this is a build/ctest-time
setting, not a cmake-config parameter.

So set this permanently to `Release` and enable logging via our
dedicated CMake option `ENABLE_DEBUG_LOGGING`.

Tested in libssh2#979
agreppin pushed a commit to agreppin/libssh2 that referenced this pull request Jul 14, 2024
Works like the `FIXTURE_TRACE_ALL` envvar, but enables full trace for
the connection phase only.

Also fix a possible NULL deref with `FIXTURE_TRACE_ALL` and a failed
`libssh2_session_init_ex()`.

Tested in libssh2#979
agreppin pushed a commit to agreppin/libssh2 that referenced this pull request Jul 14, 2024
To hopefully help finding the WinCNG hostkey verification
intermittent failure libssh2#804.

Tested in libssh2#979
agreppin pushed a commit to agreppin/libssh2 that referenced this pull request Jul 14, 2024
agreppin pushed a commit to agreppin/libssh2 that referenced this pull request Jul 14, 2024
agreppin pushed a commit to agreppin/libssh2 that referenced this pull request Jul 14, 2024
agreppin pushed a commit to agreppin/libssh2 that referenced this pull request Jul 14, 2024
Twice. This tests are flaky and we haven't figured out why. In the
meantime use this workaround to test and log these issues, but also
ensure that CI run aren't flagged red because of it.

Also:
- kex: add debug message when hostkey `sig_verify` fails,
  to help tracking WinCNG KEX failures.
- test_ssh2: also add retry logic.
  I'm not quite sure this is correct. Please let me know.
- session_fixture: bump up `src_path` slots to fit retries and show
  message when hitting the limit.
- session_fixture: clear `kbd_password` static variable after use.
- session_fixture: close and deinit socket after use.
- session_fixture: deinit libssh2 after use.

Ref: libssh2#804 libssh2#846 libssh2#979 libssh2#1012 libssh2#1015

Cherry-picked from libssh2#1017
Closes libssh2#1023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants