Skip to content

Conversation

@nedithgar
Copy link
Owner

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.

- 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.
Copilot AI review requested due to automatic review settings July 31, 2025 11:11

This comment was marked as outdated.

@nedithgar nedithgar requested a review from Copilot July 31, 2025 11:23
Copy link

Copilot AI left a 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")

@nedithgar nedithgar merged commit ab9c6b7 into citadel2 Jul 31, 2025
@nedithgar nedithgar deleted the feat/certificate-authentication-method branch July 31, 2025 11:32
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