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

   JIRA: https://issues.apache.org/jira/browse/CAMEL-27724
   
   ## What was wrong
   
   With `negotiationType=TLS`, `GrpcConsumer.initializeServer()` builds the 
server `SslContext` with
   `SslContextBuilder.forServer(...).clientAuth(ClientAuth.REQUIRE)` and called 
`trustManager(...)` only when
   `trustCertCollectionResource` was set. Without it, Netty 4.2 (JDK and 
OpenSSL providers alike) verifies the client
   certificates with the default trust store of the JVM (`cacerts`, or 
`javax.net.ssl.trustStore`). So the consumer
   accepted a client certificate issued by any CA in that store. The option 
description and the docs only explained the
   producer's fallback.
   
   ## What changed
   
   - `GrpcConsumer.initializeServer()` fails with an `IllegalArgumentException` 
when `negotiationType=TLS` has no
     `trustCertCollectionResource`. The message says the option names the CA 
certificates whose client certificates the
     consumer accepts. The trust manager is then always set. The producer is 
unchanged.
   - The option description and the TLS table of `grpc-component.adoc` say what 
the consumer does with the option.
   
   This touches the same method as #31042 (CAMEL-27721, GOOGLE on a consumer), 
so whichever of the two merges second
   needs a rebase.
   
   ## Tests
   
   - 
`GrpcConsumerConfigurationTest.tlsWithoutTrustCertCollectionResourceFailsToStart`:
 fails without the fix (the
     consumer starts).
   - `GrpcConsumerSecurityTest.testClientCertificateOfOtherCaIsRejected`: 
keytool (from `java.home`) creates a self-signed
     client certificate in a `@TempDir`; the TLS consumer with 
`trustCertCollectionResource=ca.pem` rejects it, and the
     route gets no message. No JVM-wide trust store setting is changed.
   - `GrpcConsumerSecurityTest.testClientCertificateOfOwnCaIsAccepted`: the 
same blocking call with `client.pem` (issued
     by `ca.pem`) succeeds, as a control for the rejection test.
   - The existing TLS consumer test already sets the option. All 93 tests of 
the module pass.
   
   ## Docs and generated files
   
   - Upgrade guide 4.24: `camel-grpc - a TLS consumer requires 
trustCertCollectionResource`.
   - Regenerated the component JSON (and the catalog copy), the catalog copy of 
the doc, and the endpoint DSL.
   
   _Claude Code on behalf of Claus Ibsen_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
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