You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2021/11/04 13:25:03 UTC

[camel] branch main updated: camel-ftp - Upgrade to SSHD 2.7.x (#6378)

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

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new c9d4093  camel-ftp - Upgrade to SSHD 2.7.x (#6378)
c9d4093 is described below

commit c9d409308e23fde49ad50bbadc39179101ca4acc
Author: JiriOndrusek <on...@gmail.com>
AuthorDate: Thu Nov 4 14:24:35 2021 +0100

    camel-ftp - Upgrade to SSHD 2.7.x (#6378)
---
 components/camel-ftp/pom.xml                         |  3 ---
 .../file/remote/services/SftpEmbeddedService.java    | 20 ++++++++++++++++++--
 2 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/components/camel-ftp/pom.xml b/components/camel-ftp/pom.xml
index aac39a1..cd43779 100644
--- a/components/camel-ftp/pom.xml
+++ b/components/camel-ftp/pom.xml
@@ -40,9 +40,6 @@
         <camel.surefire.forkTimeout>1800</camel.surefire.forkTimeout>
         <camel.surefire.parallel>false</camel.surefire.parallel>
 
-        <!-- testing with SSHD does not work with 2.6.0 or 2.7.0: https://issues.apache.org/jira/browse/CAMEL-17163 -->
-        <sshd-version>2.5.0</sshd-version>
-
         <!-- This one can run in parallel rather safely-->
         <camel.failsafe.forkCount>${camel.surefire.forkCount}</camel.failsafe.forkCount>
         <camel.failsafe.forkTimeout>${camel.surefire.forkTimeout}</camel.failsafe.forkTimeout>
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/services/SftpEmbeddedService.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/services/SftpEmbeddedService.java
index 5cfc106..54b958e 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/services/SftpEmbeddedService.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/services/SftpEmbeddedService.java
@@ -23,19 +23,25 @@ import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.util.Collections;
+import java.util.LinkedList;
 import java.util.List;
 import java.util.function.BiConsumer;
 
 import org.apache.camel.test.infra.common.services.AbstractTestService;
 import org.apache.camel.test.infra.ftp.common.FtpProperties;
 import org.apache.camel.test.infra.ftp.services.FtpService;
+import org.apache.sshd.common.NamedFactory;
+import org.apache.sshd.common.cipher.BuiltinCiphers;
+import org.apache.sshd.common.cipher.Cipher;
 import org.apache.sshd.common.file.virtualfs.VirtualFileSystemFactory;
 import org.apache.sshd.common.keyprovider.FileKeyPairProvider;
 import org.apache.sshd.common.session.helpers.AbstractSession;
+import org.apache.sshd.common.signature.BuiltinSignatures;
+import org.apache.sshd.common.signature.Signature;
+import org.apache.sshd.scp.server.ScpCommandFactory;
 import org.apache.sshd.server.SshServer;
 import org.apache.sshd.server.auth.pubkey.PublickeyAuthenticator;
-import org.apache.sshd.server.scp.ScpCommandFactory;
-import org.apache.sshd.server.subsystem.sftp.SftpSubsystemFactory;
+import org.apache.sshd.sftp.server.SftpSubsystemFactory;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -85,6 +91,16 @@ public class SftpEmbeddedService extends AbstractTestService implements FtpServi
             sshd.setFileSystemFactory(new VirtualFileSystemFactory(testDirectory().resolve("res").toAbsolutePath()));
         }
 
+        //added support of old signature and cipher for the test scope, to allow upgrade of sshd from 2.5.0 (https://issues.apache.org/jira/browse/CAMEL-17163)
+        // (these security options were disabled - https://issues.apache.org/jira/browse/SSHD-1004)
+        List<NamedFactory<Signature>> signatures = new LinkedList<NamedFactory<Signature>>(sshd.getSignatureFactories());
+        signatures.add(BuiltinSignatures.dsa);
+        sshd.setSignatureFactories(signatures);
+
+        List<NamedFactory<Cipher>> ciphers = sshd.getCipherFactories();
+        ciphers.add(BuiltinCiphers.blowfishcbc);
+        sshd.setCipherFactories(ciphers);
+
         sshd.start();
 
         port = ((InetSocketAddress) sshd.getBoundAddresses().iterator().next()).getPort();