-
Notifications
You must be signed in to change notification settings - Fork 0
Implement SSH certificate authentication and enhance documentation #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Introduced SSHConfigurationCertificateTests to validate client and server configurations with trusted host and user CA keys. - Implemented tests for adding, clearing, and validating trusted CA keys in SSHClientConfiguration and SSHServerConfiguration. - Added tests to ensure proper interaction between client and server configurations, including handling multiple certificate types and empty configurations. - Created SSHKeyExchangeCertificateTests to validate host certificate handling during key exchange, including validation with correct and incorrect CAs, critical options, and delegate interactions. - Included test fixtures for certificate validation scenarios.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces SSH certificate authentication support to NIOSSH, allowing users to authenticate using certificates signed by trusted certificate authorities instead of plain public keys. The implementation adds comprehensive test coverage for certificate handling and extends documentation to explain the new authentication method.
- Add certificate authentication support for both client (host certificates) and server (user certificates) configurations
- Implement certificate validation logic in user authentication and key exchange state machines
- Extend authentication delegates to handle certificate-specific validation scenarios
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| Tests/NIOSSHTests/SSHKeyExchangeCertificateTests.swift | New comprehensive test suite for host certificate validation during key exchange |
| Tests/NIOSSHTests/SSHConfigurationCertificateTests.swift | Tests for client/server configuration certificate-related properties and behaviors |
| Tests/NIOSSHTests/CertifiedKeyTests.swift | Extended existing certificate tests with authentication flow integration tests |
| Tests/NIOSSHTests/CertificateAuthenticationIntegrationTests.swift | Integration tests focusing on component interaction for certificate authentication |
| Sources/NIOSSH/User Authentication/UserAuthenticationStateMachine.swift | Modified to validate user certificates against trusted CAs and pass certificate info to delegates |
| Sources/NIOSSH/User Authentication/UserAuthenticationMethod.swift | Enhanced authentication structures to include certificate information |
| Sources/NIOSSH/SSHServerConfiguration.swift | Added trusted user CA keys and acceptable critical options properties |
| Sources/NIOSSH/SSHClientConfiguration.swift | Added trusted host CA keys and hostname properties for certificate validation |
| Sources/NIOSSH/Keys And Signatures/ClientServerAuthenticationDelegate.swift | Extended delegate protocol with certificate validation method |
| Sources/NIOSSH/Key Exchange/SSHKeyExchangeStateMachine.swift | Modified to validate host certificates during key exchange |
| Sources/NIOSSH/Docs.docc/index.md | Updated documentation to reflect SSH certificate authentication support |
Comments suppressed due to low confidence (2)
Sources/NIOSSH/User Authentication/UserAuthenticationMethod.swift:132
- [nitpick] The error message should be 'Host-based authentication is currently unimplemented' to match SSH terminology and be consistent with the similar message on line 197.
fatalError("HostBased authentication is currently unimplemented")
Sources/NIOSSH/User Authentication/UserAuthenticationMethod.swift:197
- [nitpick] The error message should be 'Host-based authentication is currently unimplemented' to match SSH terminology and be consistent with what was suggested for line 132.
fatalError("HostBased authentication is currently unimplemented")
Introduce certificate authentication for SSH, allowing users to authenticate using certificates signed by trusted certificate authorities. Add comprehensive tests for SSH configuration related to certificate handling and update documentation to reflect the new authentication method.