Skip to content

tests: regenerate id_rsa_signed.pub to match intent, fix sshd_config to accept it - #2474

Closed
vszakats wants to merge 3 commits into
libssh2:masterfrom
vszakats:dedupekey
Closed

vszakats wants to merge 3 commits into
libssh2:masterfrom
vszakats:dedupekey

Conversation

@vszakats

@vszakats vszakats commented Aug 1, 2026 •

Copy link
Copy Markdown
Member

Explicitly use -t ssh-rsa (signature algorithm) to generate
id_rsa_signed.pub to match the purpose of the patch it came with. Also
to differenciate this key (and test) from the subsequently merged
id_rsa_sha2_512_signed-cert.pub, which used the exact same keys (-t rsa-sha2-512, the default) before this patch, and made these tests
duplicates.

Also:

Testing obsolete/insecure algs is not time best spent in CI and for
maintainers, so maybe in a next step it'd useful to disable the RSA
SHA1-based ones by default.

Ref: https://superuser.com/questions/1556852/how-to-check-if-your-ssh-keys-are-in-the-ssh-rsa2-format
Ref: 7392dc9 #2479
Follow-up to 4b21e49 #710


Trying to untangle this, some info:
id_rsa_signed-cert.pub was rsa-sha2-512 without the original patch mentioning this, and the test_auth_pubkey_ok_rsa_signed tests breaks when switching it to ssh-rsa.
id_rsa_sha2_256_signed-cert.pub is also sha2, but contrary to its name, it is
rsa-sha2-512. (rsa-sha2-512 is the default in ssh-keygen).
This is visible in the base64-decoded content of these files.

@vszakats
vszakats marked this pull request as draft August 1, 2026 16:01
@vszakats vszakats changed the title tests: drop duplicate keys and test, fix guard in tests: fix test RSA key types Aug 1, 2026
@vszakats
vszakats marked this pull request as ready for review August 1, 2026 16:14
@vszakats
vszakats requested a review from Copilot August 1, 2026 16:22

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the test-key regeneration script to distinguish “legacy” RSA keys (ssh-rsa) from “modern” RSA-SHA2 (rsa-sha2-256) so the integration test assets can be regenerated with the intended algorithm identifiers (follow-up to #1314’s RSA-SHA2 cert behavior work).

Changes:

  • Switch RSA-related ssh-keygen invocations in tests/keys-generate.sh from generic rsa to explicit ssh-rsa for legacy keys.
  • Add a distinct generator command intended to produce an RSA-SHA2-256 variant (-t rsa-sha2-256) for the “sha2_256” signed key.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/keys-generate.sh Resolved
@vszakats
vszakats marked this pull request as draft August 1, 2026 21:35
vszakats added a commit that referenced this pull request Aug 2, 2026
I'm not sure this is required, but I think it's worth a try to untangle
RSA tests. Ref: #2474.

Also add a comment about a config name change.

Closes #2478
vszakats added a commit that referenced this pull request Aug 2, 2026
The committed key was in reality `rsa-sha2-512`, not `rsa-sha2-256`, as
the filenames suggested.

Also set the type explicitly to `rsa-sha2-512`, to avoid relying on
ssh-keygen's default (`rsa-sha2-512`).

```shell
$ grep -E -o ' .+ ' id_rsa_sha2_512_signed-cert.pub | base64 -d | strings | grep -i rsa
```

Bug: #2474
Follow-up to 3a6ab70 #1314

Closes #2479
@vszakats

vszakats commented Aug 2, 2026 •

Copy link
Copy Markdown
Member Author

Slightly related observation: it'd be immensly helpful if the test log
included the sshd log output for failed tests. perhaps also successful
ones, with an option.

Another observation: the cert-based keys have the username libssh2
hardcoded, which effectively prevents testing them outside of the
Docker env. It'd probably help testing if the hard-wired usernames
could be minimized, in this case perhaps by always generating these
files afresh, with the actual username used. Another option would be
if sshd could somehow be configured to accept a test username/pw
combo (this doesn't seem possible without patching OpenSSH and
building from source.)

@vszakats vszakats changed the title tests: fix test RSA key types tests: regenerate a test to match its intended purpose Aug 2, 2026
@vszakats vszakats changed the title tests: regenerate a test to match its intended purpose tests: regenerate a test key to match its intended purpose Aug 2, 2026
@vszakats
vszakats marked this pull request as ready for review August 2, 2026 13:06
@vszakats
vszakats requested a review from Copilot August 2, 2026 13:07
@vszakats vszakats changed the title tests: regenerate a test key to match its intended purpose tests: regenerate test key id_rsa_signed.pub to match its intended purpose Aug 2, 2026
@vszakats vszakats changed the title tests: regenerate test key id_rsa_signed.pub to match its intended purpose tests: regenerate test key id_rsa_signed.pub to match intent, fix sshd_config to accept it Aug 2, 2026
@vszakats vszakats changed the title tests: regenerate test key id_rsa_signed.pub to match intent, fix sshd_config to accept it tests: regenerate id_rsa_signed.pub to match intent, fix sshd_config to accept it Aug 2, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

@vszakats vszakats closed this in 41d5efc Aug 2, 2026
@vszakats
vszakats deleted the dedupekey branch August 2, 2026 13:24
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