Pasquale Congiusti created CAMEL-20811:
------------------------------------------
Summary: Netty Http secure failure
Key: CAMEL-20811
URL: https://issues.apache.org/jira/browse/CAMEL-20811
Project: Camel
Issue Type: Bug
Affects Versions: 4.4.1, 4.2.0
Reporter: Pasquale Congiusti
Hello, I'm reporting here a problem we've noticed in a Camel K route example
using Netty Http component [1]:
The following route:
{code}
@Override
public void configure() throws Exception {
registerSslContextParameter();
from("netty-http:https://0.0.0.0:8443/hello?sslContextParameters=#sslContextParameters&ssl=true")
.transform().constant("Hello Secure World");
}
private void registerSslContextParameter() throws Exception {
KeyStoreParameters ksp = new KeyStoreParameters();
ksp.setResource("/tmp/ssl/keystore.jks");
ksp.setPassword("changeit");
KeyManagersParameters kmp = new KeyManagersParameters();
kmp.setKeyPassword("changeit");
kmp.setKeyStore(ksp);
KeyStoreParameters tsp = new KeyStoreParameters();
tsp.setResource("/tmp/ssl/truststore.jks");
tsp.setPassword("changeit");
TrustManagersParameters tmp = new TrustManagersParameters();
tmp.setKeyStore(tsp);
SSLContextParameters sslContextParameters = new SSLContextParameters();
sslContextParameters.setKeyManagers(kmp);
sslContextParameters.setTrustManagers(tmp);
this.getContext().getRegistry().bind("sslContextParameters",
sslContextParameters);
}
{code}
Is not working with Camel version 4 (tested with Camel 4.2 and 4.4.1), whilst
it is working with Camel 3 (3.20.1). The error reported is:
{code}
[1] Caused by: java.io.IOException: Could not open /etc/ssl/keystore.jks as a
file, class path resource, or URL.
[1] at
org.apache.camel.support.jsse.JsseParameters.resolveResource(JsseParameters.java:120)
[1] at
org.apache.camel.support.jsse.KeyStoreParameters.createKeyStore(KeyStoreParameters.java:192)
[1] at
org.apache.camel.support.jsse.KeyManagersParameters.createKeyManagers(KeyManagersParameters.java:102)
[1] at
org.apache.camel.support.jsse.SSLContextParameters.createSSLContext(SSLContextParameters.java:269)
[1] at
org.apache.camel.component.netty.http.HttpServerInitializerFactory.createSSLContext(HttpServerInitializerFactory.java:148)
[1] at
org.apache.camel.component.netty.http.HttpServerInitializerFactory.<init>(HttpServerInitializerFactory.java:63)
{code}
Mind that the files are available and the error is the same changing the
location of the certificates. It seems that it fails to read those files for
some reason.
[1] https://github.com/apache/camel-k/issues/5546
--
This message was sent by Atlassian Jira
(v8.20.10#820010)