Skip to content

Commit 9172763

Browse files
Merge pull request #47 from embulk/support_open_ssh
support for openssh
2 parents 67800c6 + 54bc0dc commit 9172763

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 0.3.5 - 2021-02-02
2+
* [maintenance] Support OpenSsh key
3+
14
## 0.3.4 - 2020-10-09
25
* [maintenance] Update commons vfs2 latest version (2.6.0) to fix timeout setting not working
36

build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ repositories {
1313
}
1414

1515
group = "org.embulk.input.sftp"
16-
version = "0.3.3"
16+
version = "0.3.5"
1717
description = "Reads files stored on remote server using SFTP."
1818

1919
sourceCompatibility = 1.8
@@ -27,7 +27,7 @@ dependencies {
2727
compileOnly "org.embulk:embulk-core:0.9.23"
2828
compile "org.apache.commons:commons-vfs2:2.2"
2929
compile "commons-io:commons-io:2.6"
30-
compile "com.jcraft:jsch:0.1.55"
30+
compile "com.github.mwiede:jsch:0.1.60"
3131

3232
testCompile "junit:junit:4.13"
3333
testCompile "org.embulk:embulk-core:0.9.23:tests"
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This is a Gradle generated file for dependency locking.
22
# Manual edits can break the build and are not advised.
33
# This file is expected to be part of source control.
4-
com.jcraft:jsch:0.1.55
4+
com.github.mwiede:jsch:0.1.60
55
commons-io:commons-io:2.6
66
commons-logging:commons-logging:1.2
77
org.apache.commons:commons-vfs2:2.2

src/test/java/org/embulk/input/sftp/TestSftpFileInputPlugin.java

+7-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import org.apache.sshd.server.SshServer;
1818
import org.apache.sshd.server.auth.password.PasswordAuthenticator;
1919
import org.apache.sshd.server.auth.pubkey.PublickeyAuthenticator;
20+
import org.apache.sshd.server.keyprovider.AbstractGeneratorHostKeyProvider;
2021
import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider;
2122
import org.apache.sshd.server.scp.ScpCommandFactory;
2223
import org.apache.sshd.server.session.ServerSession;
@@ -46,8 +47,10 @@
4647
import org.littleshoot.proxy.impl.DefaultHttpProxyServer;
4748
import org.slf4j.Logger;
4849

50+
import java.io.File;
4951
import java.io.IOException;
5052
import java.lang.reflect.Method;
53+
import java.nio.file.Paths;
5154
import java.security.PublicKey;
5255
import java.util.ArrayList;
5356
import java.util.Arrays;
@@ -514,7 +517,10 @@ private SshServer createSshServer(String host, int port, final String sshUsernam
514517
sshServer.setPort(port);
515518
sshServer.setSubsystemFactories(Collections.<NamedFactory<Command>>singletonList(new SftpSubsystemFactory()));
516519
sshServer.setCommandFactory(new ScpCommandFactory());
517-
sshServer.setKeyPairProvider(new SimpleGeneratorHostKeyProvider());
520+
File file = new File(SECRET_KEY_FILE);
521+
AbstractGeneratorHostKeyProvider hostKeyProvider = new SimpleGeneratorHostKeyProvider(file);
522+
hostKeyProvider.setAlgorithm("RSA");
523+
sshServer.setKeyPairProvider(hostKeyProvider);
518524
sshServer.setPasswordAuthenticator(new PasswordAuthenticator()
519525
{
520526
@Override

0 commit comments

Comments
 (0)