Repository navigation
Support RSA certificate authentication - #710
Conversation
|
@willco007 do you mind taking a look at this. I am not sure if the test failure is a code issue. does rerun fix it or not |
|
It seems like the tests are broken on Windows. You can re-run by doing an amend and force-push. |
|
@mback2k just to clarify by tests are broken you mean this seems to be a flaky test? |
|
No, in that case the tests themselves are not flaky, just the CI platform is sometimes. |
|
got it thanks for the clarification. Running the tests again. |
|
Can someone please review and if there is a follow up please let me know. |
|
@willco007 Can you please take a look and let me know if there is anything more required on this. Thanks |
|
@willco007 Checking if you can take a look at this. |
Replace incorrect `MD5_DIGEST_LENGTH` with `SHA1_DIGEST_LENGTH` for these hostkey algos: - ssh-rsa and ssh-dss Ref: 7a5ffc8 (2004-12-07 Initial) - [email protected] Ref: 4b21e49 (2022-07-28) Ref: libssh2#710 Reported-by: Markus-Schmidt on github Fixes libssh2#919 Closes #xxx
Replace incorrect `MD5_DIGEST_LENGTH` with `SHA1_DIGEST_LENGTH` for these hostkey algos: - ssh-rsa and ssh-dss Ref: 7a5ffc8 (2004-12-07 Initial) - [email protected] Ref: 4b21e49 (2022-07-28) Ref: libssh2#710 Reported-by: Markus-Schmidt on github Fixes libssh2#919 Closes #xxx
Replace incorrect `MD5_DIGEST_LENGTH` with `SHA1_DIGEST_LENGTH` for these hostkey algos: - ssh-rsa and ssh-dss Ref: 7a5ffc8 (2004-12-07 Initial) - [email protected] Ref: 4b21e49 (2022-07-28) Ref: libssh2#710 Reported-by: Markus-Schmidt on github Fixes libssh2#919 Closes #xxx
Replace incorrect `MD5_DIGEST_LENGTH` with `SHA1_DIGEST_LENGTH` for these hostkey algos: - `ssh-rsa` and `ssh-dss` Ref: 7a5ffc8 (2004-12-07 Initial) - `[email protected]` Ref: 4b21e49 (2022-07-28) Ref: libssh2#710 Also delete local fall-back definition of `MD5_DIGEST_LENGTH` (added in 9af7eb4). Macro is no longer used. Reported-by: Markus-Schmidt on github Fixes libssh2#919 Closes libssh2#926
Replace incorrect `MD5_DIGEST_LENGTH` with `SHA_DIGEST_LENGTH` for these hostkey algos: - `ssh-rsa` and `ssh-dss` Ref: 7a5ffc8 (2004-12-07 Initial) - `[email protected]` Ref: 4b21e49 (2022-07-28) Ref: libssh2#710 Also delete local fall-back definition of `MD5_DIGEST_LENGTH` (added in 9af7eb4). Macro is no longer used. Reported-by: Markus-Schmidt on github Fixes libssh2#919 Closes libssh2#926
Replace incorrect `MD5_DIGEST_LENGTH` with `SHA_DIGEST_LENGTH` for these hostkey algos: - `ssh-rsa` and `ssh-dss` Ref: 7a5ffc8 (2004-12-07 Initial) - `[email protected]` Ref: 4b21e49 (2022-07-28) Ref: #710 Also delete local fall-back definition of `MD5_DIGEST_LENGTH` (added in 9af7eb4). Macro is no longer used. Reported-by: Markus-Schmidt on github Fixes #919 Closes #926
Replace incorrect `MD5_DIGEST_LENGTH` with `SHA_DIGEST_LENGTH` for these hostkey algos: - `ssh-rsa` and `ssh-dss` Ref: 7a5ffc8 (2004-12-07 Initial) - `[email protected]` Ref: 4b21e49 (2022-07-28) Ref: libssh2#710 Also delete local fall-back definition of `MD5_DIGEST_LENGTH` (added in 9af7eb4). Macro is no longer used. Reported-by: Markus-Schmidt on github Fixes libssh2#919 Closes libssh2#926
There was a problem hiding this comment.
🟡 Not ready to approve
The newly added RSA test and fixture files are not reflected in the Autotools tests/Makefile.am distribution list, which can break make dist packaging for non-CMake consumers.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Pull request overview
This PR extends libssh2’s publickey authentication support to handle RSA user certificates ([email protected]) and adds/updates OpenSSH integration test assets to validate the behavior in CI.
Changes:
- Add RSA certificate hostkey method registration and ensure the “plain” method name is used in the phase-2 publickey auth request for RSA certs.
- Add a new integration test plus RSA signed key fixtures, and update the OpenSSH test container to trust both ECDSA and RSA user CAs.
- Minor test infrastructure housekeeping (Docker base image refresh,
.gitignoreupdate, formatting fix).
File summaries
| File | Description |
|---|---|
| tests/test_public_key_auth_succeeds_with_correct_signed_rsa_key.c | New integration test for RSA certificate-based publickey authentication. |
| tests/signed_key_rsa | Test RSA private key fixture (OpenSSH format). |
| tests/signed_key_rsa.pub | Test RSA public key fixture. |
| tests/signed_key_rsa-cert.pub | Test RSA certificate public key fixture. |
| tests/openssh_server/Dockerfile | Updates OpenSSH server image, trusts both ECDSA and RSA CAs for user certificates, and adjusts accepted key types. |
| tests/openssh_server/ca_rsa | RSA CA private key fixture for the OpenSSH test server environment. |
| tests/openssh_server/ca_rsa.pub | RSA CA public key fixture used by TrustedUserCAKeys. |
| tests/openssh_fixture.c | Trivial formatting fix. |
| tests/CMakeLists.txt | Registers the new RSA cert auth test in the CMake test suite. |
| src/userauth.c | Adds RSA cert handling to the “plain method length” logic used in phase-2 publickey auth. |
| src/hostkey.c | Registers [email protected] hostkey method mapping to RSA signing backend. |
| .gitignore | Ignores build directory. |
Review details
- Files reviewed: 10/12 changed files
- Comments generated: 1
- Review effort level: Lite
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
| if(OPENSSL_VERSION VERSION_GREATER "1.1.0") | ||
| list(APPEND TESTS | ||
| public_key_auth_succeeds_with_correct_ed25519_key | ||
| public_key_auth_succeeds_with_correct_encrypted_ed25519_key | ||
| public_key_auth_succeeds_with_correct_ed25519_key_from_mem | ||
| public_key_auth_succeeds_with_correct_ecdsa_key | ||
| public_key_auth_succeeds_with_correct_signed_ecdsa_key | ||
| public_key_auth_succeeds_with_correct_signed_rsa_key | ||
| ) | ||
| endif() |
…ig` to accept it 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: - update `sshd_config` to actually allow using an obsolete/insecure certificate signature `ssh-rsa`, by adding it to `CASignatureAlgorithms`. - delete recently added entry from `HostKeyAlgorithms`, it was not necessary. Follow-up to 5b494b0 #2478 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 Closes #2474
This PR is based of https://github.com/libssh2/libssh2/pull/570/files and just the tests were fixed to make sure everything works smoothly.