Skip to content

Commit

Permalink
Ftp fails in the FIPS because of the not supported key.
Browse files Browse the repository at this point in the history
  • Loading branch information
JiriOndrusek authored and jamesnetherton committed Oct 18, 2023
1 parent e95d9dd commit b3691d5
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ public FtpsTestResource() {

@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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public Map<String, String> start() {

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);
Expand Down
15 changes: 0 additions & 15 deletions integration-tests/ftp/src/test/resources/hostkey.pem

This file was deleted.

Binary file not shown.
28 changes: 28 additions & 0 deletions integration-tests/ftp/src/test/resources/readme.adoc
Original file line number Diff line number Diff line change
@@ -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




Binary file removed integration-tests/ftp/src/test/resources/server.jks
Binary file not shown.
27 changes: 27 additions & 0 deletions integration-tests/ftp/src/test/resources/test.key
Original file line number Diff line number Diff line change
@@ -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+t6eGS6y0+WojrXI
mS1Dw8wDkw17084VX80PAPl9AMM/+EzxJvf09nDBj1vn5JJm3TsPC7NhR0Fhe7pz
yNY1CFu1sK6ZcaQdg4ratyRZ0LxBAbPK3fALnqJQqIMAwK9QW1lLQDpavZHKXooe
U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