You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2023/10/18 11:53:14 UTC

[camel-quarkus] branch 3.2.x updated: Ftp fails in the FIPS because of the not supported key.

This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch 3.2.x
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git


The following commit(s) were added to refs/heads/3.2.x by this push:
     new 50c52bfd73 Ftp fails in the FIPS because of the not supported key.
50c52bfd73 is described below

commit 50c52bfd735a40bc55efa1e5786a2daa2e2c752b
Author: JiriOndrusek <on...@gmail.com>
AuthorDate: Mon Oct 16 10:35:38 2023 +0200

    Ftp fails in the FIPS because of the not supported key.
---
 .../component/ftps/it/FtpsTestResource.java        |   6 ++---
 .../component/sftp/it/SftpTestResource.java        |   2 +-
 .../ftp/src/test/resources/hostkey.pem             |  15 -----------
 .../ftp/src/test/resources/keystore.p12            | Bin 0 -> 3558 bytes
 .../ftp/src/test/resources/readme.adoc             |  28 +++++++++++++++++++++
 .../ftp/src/test/resources/server.jks              | Bin 2421 -> 0 bytes
 integration-tests/ftp/src/test/resources/test.key  |  27 ++++++++++++++++++++
 7 files changed, 59 insertions(+), 19 deletions(-)

diff --git a/integration-tests/ftp/src/test/java/org/apache/camel/quarkus/component/ftps/it/FtpsTestResource.java b/integration-tests/ftp/src/test/java/org/apache/camel/quarkus/component/ftps/it/FtpsTestResource.java
index d009f5229c..8859cc572b 100644
--- a/integration-tests/ftp/src/test/java/org/apache/camel/quarkus/component/ftps/it/FtpsTestResource.java
+++ b/integration-tests/ftp/src/test/java/org/apache/camel/quarkus/component/ftps/it/FtpsTestResource.java
@@ -37,9 +37,9 @@ public class FtpsTestResource extends FtpTestResource {
 
     @Override
     public Map<String, String> start() {
-        try (InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream("server.jks")) {
-            Objects.requireNonNull(stream, "FTP keystore file server.jks could not be loaded");
-            keystoreFilePath = Files.createTempFile("camel-ftps-keystore", "jks");
+        try (InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream("keystore.p12")) {
+            Objects.requireNonNull(stream, "FTP keystore file keystore.p12 could not be loaded");
+            keystoreFilePath = Files.createTempFile("camel-ftps-keystore", "p12");
             Files.write(keystoreFilePath, stream.readAllBytes());
         } catch (IOException e) {
             throw new RuntimeException(e);
diff --git a/integration-tests/ftp/src/test/java/org/apache/camel/quarkus/component/sftp/it/SftpTestResource.java b/integration-tests/ftp/src/test/java/org/apache/camel/quarkus/component/sftp/it/SftpTestResource.java
index a98764d4db..7d6d0efb80 100644
--- a/integration-tests/ftp/src/test/java/org/apache/camel/quarkus/component/sftp/it/SftpTestResource.java
+++ b/integration-tests/ftp/src/test/java/org/apache/camel/quarkus/component/sftp/it/SftpTestResource.java
@@ -64,7 +64,7 @@ public class SftpTestResource implements QuarkusTestResourceLifecycleManager {
 
             sshServer = SshServer.setUpDefaultServer();
             sshServer.setPort(port);
-            sshServer.setKeyPairProvider(new ClassLoadableResourceKeyPairProvider("hostkey.pem"));
+            sshServer.setKeyPairProvider(new ClassLoadableResourceKeyPairProvider("test.key"));
             sshServer.setSubsystemFactories(Collections.singletonList(new SftpSubsystemFactory()));
             sshServer.setCommandFactory(new ScpCommandFactory());
             sshServer.setPasswordAuthenticator((username, password, session) -> true);
diff --git a/integration-tests/ftp/src/test/resources/hostkey.pem b/integration-tests/ftp/src/test/resources/hostkey.pem
deleted file mode 100644
index 9b215f45bb..0000000000
--- a/integration-tests/ftp/src/test/resources/hostkey.pem
+++ /dev/null
@@ -1,15 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-MIICXAIBAAKBgQDdfIWeSV4o68dRrKSzFd/Bk51E65UTmmSrmW0O1ohtzi6HzsDP
-jXgCtlTt3FqTcfFfI92IlTr4JWqC9UK1QT1ZTeng0MkPQmv68hDANHbt5CpETZHj
-W5q4OOgWhVvj5IyOC2NZHtKlJBkdsMAa15ouOOJLzBvAvbqOR/yUROsEiQIDAQAB
-AoGBANG3JDW6NoP8rF/zXoeLgLCj+tfVUPSczhGFVrQkAk4mWfyRkhN0WlwHFOec
-K89MpkV1ij/XPVzU4MNbQ2yod1KiDylzvweYv+EaEhASCmYNs6LS03punml42SL9
-97tOmWfVJXxlQoLiY6jHPU97vTc65k8gL+gmmrpchsW0aqmZAkEA/c8zfmKvY37T
-cxcLLwzwsqqH7g2KZGTf9aRmx2ebdW+QKviJJhbdluDgl1TNNFj5vCLznFDRHiqJ
-wq0wkZ39cwJBAN9l5v3kdXj21UrurNPdlV0n2GZBt2vblooQC37XHF97r2zM7Ou+
-Lg6MyfJClyguhWL9dxnGbf3btQ0l3KDstxMCQCRaiEqjAfIjWVATzeNIXDWLHXso
-b1kf5cA+cwY+vdKdTy4IeUR+Y/DXdvPWDqpf0C11aCVMohdLCn5a5ikFUycCQDhV
-K/BuAallJNfmY7JxN87r00fF3ojWMJnT/fIYMFFrkQrwifXQWTDWE76BSDibsosJ
-u1TGksnm8zrDh2UVC/0CQFrHTiSl/3DHvWAbOJawGKg46cnlDcAhSyV8Frs8/dlP
-7YGG3eqkw++lsghqmFO6mRUTKsBmiiB2wgLGhL5pyYY=
------END RSA PRIVATE KEY-----
\ No newline at end of file
diff --git a/integration-tests/ftp/src/test/resources/keystore.p12 b/integration-tests/ftp/src/test/resources/keystore.p12
new file mode 100644
index 0000000000..86b2c168b5
Binary files /dev/null and b/integration-tests/ftp/src/test/resources/keystore.p12 differ
diff --git a/integration-tests/ftp/src/test/resources/readme.adoc b/integration-tests/ftp/src/test/resources/readme.adoc
new file mode 100644
index 0000000000..53830efac7
--- /dev/null
+++ b/integration-tests/ftp/src/test/resources/readme.adoc
@@ -0,0 +1,28 @@
+=== How to generate test.key
+
+1. Generate private certificate for client.
+[source]
+openssl genrsa -out test.key 2048
+
+=== How to generate keystore.p12
+
+[start=2]
+. Generate certificate signing request
+[source]
+openssl req -new -subj '/C=CA/L=camel-ftp/O=camel-ftp/CN=localhost' -key test.key -out test.csr
+. Generate a key for the cert. authority
+[source]
+openssl genrsa -out ca.key 2048
+. Generate a self-signed certificate for cert. authority
+[source]
+openssl req -new -subj '/C=CA/L=camel-ftp/O=camel-ftp/CN=localhost' -x509 -key ca.key -out ca.crt
+. Very easy way to sign a certificate
+[source]
+openssl x509 -req -in test.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out test.crt
+. Create a kyestore
+[source]
+openssl pkcs12 -export -in test.crt -inkey test.key -certfile ca.crt -name "serverftp" -out keystore.p12 -passout pass:password -keypbe aes-256-cbc -certpbe aes-256-cbc
+
+
+
+
diff --git a/integration-tests/ftp/src/test/resources/server.jks b/integration-tests/ftp/src/test/resources/server.jks
deleted file mode 100644
index 8063722089..0000000000
Binary files a/integration-tests/ftp/src/test/resources/server.jks and /dev/null differ
diff --git a/integration-tests/ftp/src/test/resources/test.key b/integration-tests/ftp/src/test/resources/test.key
new file mode 100644
index 0000000000..a93579893c
--- /dev/null
+++ b/integration-tests/ftp/src/test/resources/test.key
@@ -0,0 +1,27 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIEogIBAAKCAQEAxuhZr4YA7l0S/yij3IXXf9jcLxgHdenjRGrF8tGbYp5n7IQb
+msbXcfBeUcsmtrBx02TB45nQ5Nox2Lqch5OyKbVo8FzO5m5RGmmHPUokgJGwBtgH
+SwxlX/dJ3X/T0Hk7s9X04t4wfbopWRPFIf+tUMp65XxgAdOpfM/yO4MjoRB3zL3X
+wI2KDecpwg10SMLiLXSuHZrMnYDMIie3WSBXur5OHQrNfLDLIvZQxAvgO0O3MaKn
+Pcq3XgtXonagYniwtUSi0VqUYUjDUTjwr5pc0v+UIJap610Mx8fiT1B63+YBUbQe
+C+Ol82FMUKGKM8igDm9xRBD1LFVYg1YLrdBCGwIDAQABAoIBAB8f1oDXuCeUWteg
+dVuZeeogdfvMh8ZUreJTztu7HtRksyBYX7VtbeL/WNL1tf4aSAVrG8fQltZoqioe
+sUWpv9Q09dG+xAVct8YpQyc9Bc80fNXlUebVbruAh4dobC2P+t6eGS6y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