[ 
https://issues.apache.org/jira/browse/CAMEL-27930?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Work on CAMEL-27930 started by Andrea Cosentino.
------------------------------------------------
> camel-huaweicloud-obs - enable host name verification for TLS connections
> -------------------------------------------------------------------------
>
>                 Key: CAMEL-27930
>                 URL: https://issues.apache.org/jira/browse/CAMEL-27930
>             Project: Camel
>          Issue Type: Improvement
>            Reporter: Andrea Cosentino
>            Assignee: Andrea Cosentino
>            Priority: Major
>             Fix For: 4.25.0
>
>
> *Current behaviour*
> {{OBSEndpoint.initClient()}} builds the {{com.obs.services.ObsClient}} from a 
> {{com.obs.services.ObsConfiguration}}. For the transport it configures only 
> the certificate-chain check:
> {code:java}
> obsConfiguration.setValidateCertificate(!isIgnoreSslVerification());
> {code}
> It does not configure the endpoint host name check. The esdk-obs-java SDK 
> leaves that check off by default (its internal {{HostnameVerifier}} accepts 
> every host unless {{httpclient.strict-hostname-verification}} is set). So 
> with the default {{ignoreSslVerification=false}} the client validates the 
> server certificate chain against the JVM trust store but does not check that 
> the certificate matches the OBS endpoint host name.
> *Behaviour after the change*
> {{ignoreSslVerification}} stays the single switch and now governs both checks:
> * {{false}} (default): the certificate chain and the endpoint host name are 
> both checked.
> * {{true}}: neither the certificate chain nor the host name is checked 
> (unchanged from today).
> *Classes involved*
> * {{org.apache.camel.component.huaweicloud.obs.OBSEndpoint}} - method 
> {{initClient()}}, which builds the {{ObsConfiguration}} and the {{ObsClient}} 
> (used by both the consumer and the producer).
> * {{com.obs.services.ObsConfiguration}} (esdk-obs-java) - exposes 
> {{setValidateCertificate(boolean)}} and 
> {{setIsStrictHostnameVerification(boolean)}}.
> *Code-level change*
> In {{initClient()}}, alongside the existing call, derive the host name check 
> from the same flag:
> {code:java}
> obsConfiguration.setValidateCertificate(!isIgnoreSslVerification());
> obsConfiguration.setIsStrictHostnameVerification(!isIgnoreSslVerification());
> {code}
> The SDK maps {{isStrictHostnameVerification()}} to 
> {{httpclient.strict-hostname-verification}} and then checks the server 
> certificate against the configured OBS endpoint host, so a correctly named 
> endpoint keeps working unchanged.
> {{ObsClient}}/{{AbstractClient}} expose no getter for the configuration, so 
> extract the {{ObsConfiguration}} construction into a package-private method 
> (for example {{ObsConfiguration buildObsConfiguration()}}) that 
> {{initClient()}} passes to {{new ObsClient(...)}}. This lets a unit test 
> assert the flags without opening a network connection.
> *Tests*
> Add a unit test (JUnit, matching the module's existing test style; no 
> network) that asserts the {{ObsConfiguration}} built by the endpoint has 
> strict host name verification enabled by default and disabled when 
> {{ignoreSslVerification=true}}.
> *Documentation*
> The change alters a default, so add an upgrade-guide note (functional 
> wording): camel-huaweicloud-obs now checks the TLS host name of the OBS 
> endpoint by default; to connect to an endpoint whose certificate does not 
> match its host name, set {{ignoreSslVerification=true}} (which skips both the 
> certificate and the host name check).



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to