tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jlmonte...@apache.org
Subject [3/7] tomee git commit: Fixes issue https://issues.apache.org/jira/browse/TOMEE-1287 - Upgraded to latest 2.1.0 sshd
Date Wed, 02 Jan 2019 09:59:15 GMT
Fixes issue https://issues.apache.org/jira/browse/TOMEE-1287
- Upgraded to latest 2.1.0 sshd


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/6960d284
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/6960d284
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/6960d284

Branch: refs/heads/master
Commit: 6960d284b5925b3ed15f2d1ed1abb555878d08dc
Parents: acd4afb
Author: Doychin Bondzhev <doychin@dsoft-bg.com>
Authored: Tue Jan 1 14:58:13 2019 +0200
Committer: Doychin Bondzhev <doychin@dsoft-bg.com>
Committed: Tue Jan 1 14:58:13 2019 +0200

----------------------------------------------------------------------
 pom.xml                                             |  2 +-
 server/openejb-ssh/pom.xml                          |  7 +++++++
 .../apache/openejb/server/ssh/OpenEJBCommands.java  |  2 +-
 .../ssh/OpenEJBJaasPasswordAuthenticator.java       |  2 +-
 .../openejb/server/ssh/OpenEJBShellFactory.java     |  2 +-
 .../org/apache/openejb/server/ssh/SSHServer.java    | 10 +++++-----
 .../apache/openejb/server/ssh/SSHServerTest.java    | 16 ++++++++++------
 7 files changed, 26 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/6960d284/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 0ae30ac..88fd95d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1520,7 +1520,7 @@
       <dependency>
         <groupId>org.apache.sshd</groupId>
         <artifactId>sshd-core</artifactId>
-        <version>0.14.0</version>
+        <version>2.1.0</version>
       </dependency>
       <dependency>
         <groupId>jline</groupId>

http://git-wip-us.apache.org/repos/asf/tomee/blob/6960d284/server/openejb-ssh/pom.xml
----------------------------------------------------------------------
diff --git a/server/openejb-ssh/pom.xml b/server/openejb-ssh/pom.xml
index f707ba1..84cfab5 100644
--- a/server/openejb-ssh/pom.xml
+++ b/server/openejb-ssh/pom.xml
@@ -66,6 +66,13 @@
       <artifactId>slf4j-api</artifactId>
       <scope>provided</scope>
     </dependency>
+
+    <dependency>
+      <groupId>org.bouncycastle</groupId>
+      <artifactId>bcpkix-jdk15on</artifactId>
+      <version>1.51</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
   <build>

http://git-wip-us.apache.org/repos/asf/tomee/blob/6960d284/server/openejb-ssh/src/main/java/org/apache/openejb/server/ssh/OpenEJBCommands.java
----------------------------------------------------------------------
diff --git a/server/openejb-ssh/src/main/java/org/apache/openejb/server/ssh/OpenEJBCommands.java
b/server/openejb-ssh/src/main/java/org/apache/openejb/server/ssh/OpenEJBCommands.java
index 0ec8302..6c81d0f 100644
--- a/server/openejb-ssh/src/main/java/org/apache/openejb/server/ssh/OpenEJBCommands.java
+++ b/server/openejb-ssh/src/main/java/org/apache/openejb/server/ssh/OpenEJBCommands.java
@@ -17,10 +17,10 @@
 package org.apache.openejb.server.ssh;
 
 import org.apache.openejb.server.cli.CliRunnable;
-import org.apache.sshd.server.Command;
 import org.apache.sshd.server.Environment;
 import org.apache.sshd.server.ExitCallback;
 import org.apache.sshd.server.SessionAware;
+import org.apache.sshd.server.command.Command;
 import org.apache.sshd.server.session.ServerSession;
 
 import javax.security.auth.Subject;

http://git-wip-us.apache.org/repos/asf/tomee/blob/6960d284/server/openejb-ssh/src/main/java/org/apache/openejb/server/ssh/OpenEJBJaasPasswordAuthenticator.java
----------------------------------------------------------------------
diff --git a/server/openejb-ssh/src/main/java/org/apache/openejb/server/ssh/OpenEJBJaasPasswordAuthenticator.java
b/server/openejb-ssh/src/main/java/org/apache/openejb/server/ssh/OpenEJBJaasPasswordAuthenticator.java
index aec883f..bf0818c 100644
--- a/server/openejb-ssh/src/main/java/org/apache/openejb/server/ssh/OpenEJBJaasPasswordAuthenticator.java
+++ b/server/openejb-ssh/src/main/java/org/apache/openejb/server/ssh/OpenEJBJaasPasswordAuthenticator.java
@@ -18,7 +18,7 @@ package org.apache.openejb.server.ssh;
 
 import org.apache.openejb.util.LogCategory;
 import org.apache.openejb.util.Logger;
-import org.apache.sshd.common.Session;
+import org.apache.sshd.common.session.Session;
 import org.apache.sshd.server.jaas.JaasPasswordAuthenticator;
 import org.apache.sshd.server.session.ServerSession;
 

http://git-wip-us.apache.org/repos/asf/tomee/blob/6960d284/server/openejb-ssh/src/main/java/org/apache/openejb/server/ssh/OpenEJBShellFactory.java
----------------------------------------------------------------------
diff --git a/server/openejb-ssh/src/main/java/org/apache/openejb/server/ssh/OpenEJBShellFactory.java
b/server/openejb-ssh/src/main/java/org/apache/openejb/server/ssh/OpenEJBShellFactory.java
index 2e3996f..55b67ad 100644
--- a/server/openejb-ssh/src/main/java/org/apache/openejb/server/ssh/OpenEJBShellFactory.java
+++ b/server/openejb-ssh/src/main/java/org/apache/openejb/server/ssh/OpenEJBShellFactory.java
@@ -17,7 +17,7 @@
 package org.apache.openejb.server.ssh;
 
 import org.apache.sshd.common.Factory;
-import org.apache.sshd.server.Command;
+import org.apache.sshd.server.command.Command;
 
 public class OpenEJBShellFactory implements Factory<Command> {
     private String bind;

http://git-wip-us.apache.org/repos/asf/tomee/blob/6960d284/server/openejb-ssh/src/main/java/org/apache/openejb/server/ssh/SSHServer.java
----------------------------------------------------------------------
diff --git a/server/openejb-ssh/src/main/java/org/apache/openejb/server/ssh/SSHServer.java
b/server/openejb-ssh/src/main/java/org/apache/openejb/server/ssh/SSHServer.java
index 6cbab2e..1f2c33a 100644
--- a/server/openejb-ssh/src/main/java/org/apache/openejb/server/ssh/SSHServer.java
+++ b/server/openejb-ssh/src/main/java/org/apache/openejb/server/ssh/SSHServer.java
@@ -20,10 +20,10 @@ import org.apache.openejb.loader.SystemInstance;
 import org.apache.openejb.server.SelfManaging;
 import org.apache.openejb.server.ServerService;
 import org.apache.openejb.server.ServiceException;
-import org.apache.sshd.SshServer;
-import org.apache.sshd.common.util.SecurityUtils;
+import org.apache.sshd.common.util.security.SecurityUtils;
+import org.apache.sshd.common.util.security.bouncycastle.BouncyCastleGeneratorHostKeyProvider;
+import org.apache.sshd.server.SshServer;
 import org.apache.sshd.server.jaas.JaasPasswordAuthenticator;
-import org.apache.sshd.server.keyprovider.PEMGeneratorHostKeyProvider;
 import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider;
 
 import java.io.File;
@@ -49,9 +49,9 @@ public class SSHServer implements ServerService, SelfManaging {
 
         final String basePath = SystemInstance.get().getBase().getDirectory().getAbsolutePath();
         if (SecurityUtils.isBouncyCastleRegistered()) {
-            sshServer.setKeyPairProvider(new PEMGeneratorHostKeyProvider(new File(basePath,
KEY_NAME + ".pem").getPath()));
+            sshServer.setKeyPairProvider(new BouncyCastleGeneratorHostKeyProvider(new File(basePath,
KEY_NAME + ".pem").toPath()));
         } else {
-            sshServer.setKeyPairProvider(new SimpleGeneratorHostKeyProvider(new File(basePath,
KEY_NAME + ".ser").getPath()));
+            sshServer.setKeyPairProvider(new SimpleGeneratorHostKeyProvider(new File(basePath,
KEY_NAME + ".ser").toPath()));
         }
 
         final OpenEJBShellFactory sf = new OpenEJBShellFactory(bind, port);

http://git-wip-us.apache.org/repos/asf/tomee/blob/6960d284/server/openejb-ssh/src/test/java/org/apache/openejb/server/ssh/SSHServerTest.java
----------------------------------------------------------------------
diff --git a/server/openejb-ssh/src/test/java/org/apache/openejb/server/ssh/SSHServerTest.java
b/server/openejb-ssh/src/test/java/org/apache/openejb/server/ssh/SSHServerTest.java
index 6eaae9d..6b66deb 100644
--- a/server/openejb-ssh/src/test/java/org/apache/openejb/server/ssh/SSHServerTest.java
+++ b/server/openejb-ssh/src/test/java/org/apache/openejb/server/ssh/SSHServerTest.java
@@ -18,9 +18,11 @@ package org.apache.openejb.server.ssh;
 
 import org.apache.openejb.OpenEjbContainer;
 import org.apache.openejb.config.DeploymentFilterable;
-import org.apache.sshd.ClientChannel;
-import org.apache.sshd.ClientSession;
-import org.apache.sshd.SshClient;
+import org.apache.sshd.client.SshClient;
+import org.apache.sshd.client.channel.ClientChannel;
+import org.apache.sshd.client.channel.ClientChannelEvent;
+import org.apache.sshd.client.session.ClientSession;
+import org.apache.sshd.common.FactoryManager;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -31,6 +33,7 @@ import java.io.IOException;
 import java.io.OutputStream;
 import java.io.PipedInputStream;
 import java.io.PipedOutputStream;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.concurrent.CountDownLatch;
 
@@ -62,8 +65,9 @@ public class SSHServerTest {
         final SshClient client = SshClient.setUpDefaultClient();
         client.start();
         try {
-            final ClientSession session = client.connect("localhost", 4222).await().getSession();
-            session.authPassword("jonathan", "secret");
+            final ClientSession session = client.connect("jonathan", "localhost", 4222).verify().getSession();
+            session.addPasswordIdentity("secret");
+            session.auth().verify(FactoryManager.DEFAULT_AUTH_TIMEOUT);
 
             final ClientChannel channel = session.createChannel("shell");
             ByteArrayOutputStream sent = new ByteArrayOutputStream();
@@ -81,7 +85,7 @@ public class SSHServerTest {
             pipedIn.write("exit\r\n".getBytes());
             pipedIn.flush();
 
-            channel.waitFor(ClientChannel.CLOSED, 0);
+            channel.waitFor(Collections.singleton(ClientChannelEvent.CLOSED), 0);
             channel.close(false);
             client.stop();
 


Mime
View raw message