CAMEL-6757 support the StrictHostKeyChecking option with thanks to Guy

Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/16230cbb
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/16230cbb
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/16230cbb

Branch: refs/heads/camel-2.12.x
Commit: 16230cbb25eb496f979a8dc5de637db4e417a3d4
Parents: 31cc970
Author: Willem Jiang <ningji...@apache.org>
Authored: Tue Sep 17 11:30:02 2013 +0800
Committer: Willem Jiang <ningji...@apache.org>
Committed: Tue Sep 17 11:35:42 2013 +0800

----------------------------------------------------------------------
 .../java/org/apache/camel/component/jsch/ScpConfiguration.java  | 2 +-
 .../java/org/apache/camel/component/jsch/ScpOperations.java     | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/16230cbb/components/camel-jsch/src/main/java/org/apache/camel/component/jsch/ScpConfiguration.java
----------------------------------------------------------------------
diff --git 
a/components/camel-jsch/src/main/java/org/apache/camel/component/jsch/ScpConfiguration.java
 
b/components/camel-jsch/src/main/java/org/apache/camel/component/jsch/ScpConfiguration.java
index 86fc170..9bcb2d2 100644
--- 
a/components/camel-jsch/src/main/java/org/apache/camel/component/jsch/ScpConfiguration.java
+++ 
b/components/camel-jsch/src/main/java/org/apache/camel/component/jsch/ScpConfiguration.java
@@ -30,7 +30,7 @@ public class ScpConfiguration extends RemoteFileConfiguration 
{
     private String knownHostsFile;
     private String privateKeyFile;
     private String privateKeyFilePassphrase;
-    private String strictHostKeyChecking = "no";
+    private String strictHostKeyChecking;
     private int serverAliveInterval;
     private int serverAliveCountMax = 1;
     private String chmod = DEFAULT_MOD;

http://git-wip-us.apache.org/repos/asf/camel/blob/16230cbb/components/camel-jsch/src/main/java/org/apache/camel/component/jsch/ScpOperations.java
----------------------------------------------------------------------
diff --git 
a/components/camel-jsch/src/main/java/org/apache/camel/component/jsch/ScpOperations.java
 
b/components/camel-jsch/src/main/java/org/apache/camel/component/jsch/ScpOperations.java
index a34cb28..5759c55 100644
--- 
a/components/camel-jsch/src/main/java/org/apache/camel/component/jsch/ScpOperations.java
+++ 
b/components/camel-jsch/src/main/java/org/apache/camel/component/jsch/ScpOperations.java
@@ -236,6 +236,11 @@ public class ScpOperations implements 
RemoteFileOperations<ScpFile> {
             session = jsch.getSession(config.getUsername(), config.getHost(), 
config.getPort());
             session.setTimeout(config.getTimeout());
             session.setUserInfo(new SessionUserInfo(config));
+            
+            if (ObjectHelper.isNotEmpty(config.getStrictHostKeyChecking())) {
+                LOG.debug("Using StrickHostKeyChecking: {}", 
config.getStrictHostKeyChecking());
+                session.setConfig("StrictHostKeyChecking", 
config.getStrictHostKeyChecking());
+            }
 
             int timeout = config.getConnectTimeout();
             LOG.debug("Connecting to {} with {} timeout...", 
config.remoteServerInformation(),

Reply via email to