Ayush0612005 opened a new pull request, #31221:
URL: https://github.com/apache/camel/pull/31221

   # Description
   
   [CAMEL-28013](https://issues.apache.org/jira/browse/CAMEL-28013): follow-up 
of #31066 ([CAMEL-25650](https://issues.apache.org/jira/browse/CAMEL-25650)). 
`SSLContextClientParameters#setEndpointIdentificationAlgorithm` is applied to 
`SSLSocket`s only, because an `SSLEngine` starts in server mode; a component 
that uses an engine applies it once the engine is in client mode. This does 
that for the netty components:
   
   - the camel-netty producer,
   - a camel-netty consumer in `clientMode` (which connects to a server),
   - the camel-netty-http producer.
   
   The algorithm for their client engine comes from a new 
`SSLEngineFactory#getClientEndpointIdentificationAlgorithm`: `HTTPS` when 
`hostnameVerification=true`, as today, otherwise the 
`endpointIdentificationAlgorithm` of the client parameters of the 
`sslContextParameters` (with property placeholders resolved), otherwise none. 
When there is one, the camel-netty engine is created with the host and port, as 
it already is for `hostnameVerification`, since the JDK needs the peer host to 
check the certificate. Server engines are not changed.
   
   Without client parameters with an algorithm, nothing changes.
   
   # Tests
   
   - `NettySSLEndpointIdentificationAlgorithmTest` (camel-netty) and 
`NettyHttpSSLEndpointIdentificationAlgorithmTest` (camel-netty-http): a real 
handshake against a consumer whose certificate lists only `localhost`, with 
client parameters set to `HTTPS` and no `hostnameVerification`: connecting to 
`localhost` succeeds, connecting to `127.0.0.1` fails with a host name error, 
and the same without the algorithm succeeds. The consumer uses the same 
parameters, so the server side is unaffected. The camel-netty test sets the 
algorithm with a property placeholder.
   - `SSLEngineFactoryEndpointIdentificationTest`: the resolution used by the 
producer and by a consumer in client mode (none by default, `HTTPS` with 
`hostnameVerification`, which takes precedence, the client parameters' 
algorithm, a placeholder).
   
   With the main changes reverted, the `127.0.0.1` tests fail. The SSL tests of 
camel-netty (20) and camel-netty-http (10) pass.
   
   # Target
   
   - [x] I checked that the commit is targeting the correct branch (Camel 4 
uses the `main` branch)
   
   # Tracking
   
   - [x] If this is a large change, bug fix, or code improvement, I checked 
there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for 
the change (usually before you start working on it).
   
   # Apache Camel coding standards and style
   
   - [x] I checked that each commit in the pull request has a meaningful 
subject line and body.
   - [x] I built camel-netty and camel-netty-http with `install` (including 
`formatter:format` and `impsort:sort`).
   
   _Claude Code on behalf of Ayush0612005_
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to