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

   **Stacked on #3284: merge it after #3284.** This branch is based on 
`quick-fix/ftps-test-tls12`, because both change the FTPS test files. Until 
#3284 is merged, the diff here also shows its commits; the change of this PR is 
the last commit.
   
   ## Why
   
   Today the only way to trust an FTPS server with a self-signed or private-CA 
certificate is the JVM-wide `javax.net.ssl.trustStore`. That replaces the trust 
of every HTTPS connection of the integration, including camel run's dependency 
downloads, which is what made the FTPS Citrus tests flaky (#3284). The ftps 
component already has a per-endpoint trust store, the multi-value option 
`ftpClient.trustStore.*` (`FtpsEndpoint` in camel-ftp). This PR exposes it.
   
   ## What
   
   `ftps-source` and `ftps-sink` get three new optional properties, with no 
`default:` values:
   
   | Property | Passed as |
   |---|---|
   | `trustStoreFile` | `ftpClient.trustStore.file={{?trustStoreFile}}` |
   | `trustStorePassword` (`format: password`, credentials group) | 
`ftpClient.trustStore.password=RAW({{?trustStorePassword}})` |
   | `trustStoreType` | `ftpClient.trustStore.type={{?trustStoreType}}` |
   
   When none of them is set, the endpoint gets no `ftpClient.trustStore` option 
and the Kamelets behave exactly as before. "Good to know:" now says that the 
server certificate must be signed by a CA that Java trusts. It explains how to 
trust another certificate for this connection only, and why 
`javax.net.ssl.trustStore` is the wrong tool.
   
   ## Verified behaviour of each combination
   
   `FtpsEndpoint.createFtpClient` reads the file and calls 
`password.toCharArray()` whenever any `ftpClient.trustStore.*` key is set. I 
checked every combination with `camel run` and the local Kamelets against an 
Apache FtpServer speaking explicit TLS with a self-signed certificate, on Camel 
4.24.0-SNAPSHOT (which has CAMEL-27229):
   
   | Set | Result |
   |---|---|
   | none | no trustStore option on the endpoint; the JVM trust store is used, 
so a self-signed server fails with `PKIX path building failed` (the route 
starts, each poll fails) |
   | file + password | works |
   | file + password + type `PKCS12` | works |
   | JKS file + password, no type | works |
   | JKS file + password + type `PKCS12`, or PKCS12 file + type `JKS` | works 
(the JDK reads both formats with either type) |
   | password with `&`, `+`, `%` | works (RAW) |
   | file only, or file + type | `NullPointerException` ("password" is null) |
   | password only, type only, or password + type | `NullPointerException` (no 
file) |
   | file + wrong password | `IOException: keystore password was incorrect` |
   | file that does not exist | `FileNotFoundException` |
   
   For `ftps-source` a failing combination stops the route from starting. For 
`ftps-sink` the integration starts and every message fails, which I checked 
with the file-only combination. The option descriptions state which options 
must be set together, with the failure each Kamelet shows.
   
   ## Tests
   
   - `ftps-source-route` and `ftps-sink-route` set `trustStoreFile`, 
`trustStorePassword` and `trustStoreType` on the Kamelet instead of the 
`javax.net.ssl.trustStore*` system properties.
   - `ftpServer.groovy` makes a trust store with only the test certificate 
again, since the JVM trust store is no longer replaced. Its comment is updated.
   - `./mvnw -o verify -pl tests/camel-kamelets-itest -Dit.test='FileIT#ftp'` 
passes 4/4: ftp-source, ftp-sink, ftps-source and ftps-sink.
   - `./mvnw clean install` was run twice and is green.
   
   _Claude Code on behalf of Claus Ibsen_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   https://claude.ai/code/session_016Y4dDmBDsSWV117kccuNf9
   


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