[jira] [Commented] (SSHD-922) CD - change directory is not working. clientSession.executeRemoteCommand("cd " + directory)

2019-07-15 Thread Goldstein Lyor (JIRA)


[ 
https://issues.apache.org/jira/browse/SSHD-922?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16885362#comment-16885362
 ] 

Goldstein Lyor commented on SSHD-922:
-

See 
https://github.com/apache/mina-sshd/blob/master/docs/client-setup.md#running-a-command-or-opening-a-shell

> CD - change directory is not working. clientSession.executeRemoteCommand("cd 
> " + directory)
> ---
>
> Key: SSHD-922
> URL: https://issues.apache.org/jira/browse/SSHD-922
> Project: MINA SSHD
>  Issue Type: Bug
>Affects Versions: 2.2.0
> Environment: Trying to connect to a Linux VM from Windows OS
>Reporter: Zabee Ulla
>Assignee: Goldstein Lyor
>Priority: Blocker
>
> I am writing an SSHD client to execute BASH commands on a remove Linux VM. My 
> functionality requires to change directories at several points. 
> I have written and using below code and not finding change directory working. 
> I tried a few other Linux commands and am able to execute them perfectly 
> except change directory. 
> This is a blocker for me to embed and implement Apache SSHD client for my 
> application. 
> Please note that "pwd" output is same before and after 
> _+*session.executeRemoteCommand("cd " + argDirectory);*+_'s execution.
> /**
>  * An implementation of an SFTP client that uses the Apache Mina library.
>  */
>  public class MinaSftp {
> _public void changeRemoteDirectory(String argDirectory)_
>  _throws IOException {_
>  _try {_
>  _System.out.println("Present working direcotry :\n " + 
> _session.executeRemoteCommand("pwd"));_
> _+*String output = _session.executeRemoteCommand("cd " + argDirectory);*+_
> _System.out.println("Present working direcotry :\n " + 
> _session.executeRemoteCommand("pwd"));_
>  _System.out.println("Change directory output: " + output);_
>  _}_
>  _catch (IOException ex) {_
>  _handleException(ex, action);_
>  _}_
>  _}_
> private static Collection ccEvents = 
> Arrays.asList(ClientChannelEvent.CLOSED);
> private String _username = "userName";
>  private String _password = "password";
>  private String _host = "aValidHostName";
>  private ClientSession _session;
>  private ClientChannel shellChannel;
>  private SshClient _client;
> // Some valid port number
>  private int portNumber = 8999;
>  
> public void connect()
>  throws IOException {
> _client = SshClient.setUpDefaultClient();
>  _client.start();
> ConnectFuture connectFuture = _client.connect(_username, _host, portNumber);
>  connectFuture.await();
>  _session = connectFuture.getSession();
> shellChannel = _session.createShellChannel();
>  _session.addPasswordIdentity(_password);
> // TODO : fix timeout
>  _session.auth().verify(Integer.MAX_VALUE);
> if (_session.isAuthenticated())
> { System.out.println("Authentication successful"); }
> else
> { System.out.println("Authentication failed"); }
> _channel.waitFor(ccEvents, 200);
>  }
> public void disconnect() {
>  LOG.debug("Disconnecting from the SFTP host.");
> // Disconnecting the session disconnects all of the connected channels as 
> well.
>  if (_channel != null) {
>  try
> { _channel.close(); }
> catch (Exception e)
> { // Do nothing. This is okay. }
> }
>  if (_session != null)
> { _session.close(false); }
> if (_client != null)
> { _client.stop(); }
> }
> private void handleException(Exception argEx, String argAction)
>  throws IOException
> { throw LOG.throwing(new IOException(argAction + " on the SFTP host threw an 
> exception.", argEx)); }
> }



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



[jira] [Comment Edited] (SSHD-932) Mina client to connect remote Linux host and get few tasks done

2019-07-15 Thread Thomas Wolf (JIRA)


[ 
https://issues.apache.org/jira/browse/SSHD-932?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16885344#comment-16885344
 ] 

Thomas Wolf edited comment on SSHD-932 at 7/15/19 3:55 PM:
---

See [the 
documentation|https://github.com/apache/mina-sshd/blob/master/docs/sftp.md]. 
Basically, once you have a {{ClientSession}}, use 
{{SftpClientFactory.instance().createSftpClient()}} to create an 
{{SftpClient}}, then use the operations provided there. Note that you'll have 
to handle the "current directory" on the _client_ side; likewise any other 
state. You'll need the sshd-sftp bundle, too.

Unclear what your question (2) means. Do you mean connecting with an SSH 
public/private key pair (like {{~/.ssh/id_rsa}})? Yes, you can.


was (Author: wolft):
See [the 
documentation|https://github.com/apache/mina-sshd/blob/master/docs/sftp.md]. 
Basically, one you have a {{ClientSession}}, use 
{{SftpClientFactory.instance().createSftpClient()}} to create an 
{{SftpClient}}, then use the operations provided there. Note that you'll have 
to handle the "current directory" on the _client_ side; likewise any other 
state. You'll need the sshd-sftp bundle, too.

Unclear what your question (2) means. Do you mean connecting with an SSH 
public/private key pair (like {{~/.ssh/id_rsa}})? Yes, you can.

> Mina client to connect remote Linux host and get few tasks done
> ---
>
> Key: SSHD-932
> URL: https://issues.apache.org/jira/browse/SSHD-932
> Project: MINA SSHD
>  Issue Type: Question
>Affects Versions: 2.2.0
>Reporter: Zabee Ulla
>Priority: Major
>
> We are switching from Jsch to Apache MINA to connect and get a few tasks done 
> from remote hosts.
> I need to achieve the following features, 
> * List files of a remote host
> * Change directory of a remote host
> * Get file contents as bytes from a remote host
> * Put a file into the remote host
> I have the following questions,
> # How can I send a ZIP file to a remote host much easily in API level (not 
> the Shell commands level)? And all other operations in API level.
> # Can I secure a connection between my localhost and remote through a 
> certificate?
> # As of now, I am using SSHD-CORE and SSHD-COMMON version 2.2.0. Are these 
> libraries enough or do I need to include any other libraries?
> # executeRemoteCommand() is stateless how can I maintain a state?
> Sorry, if the questions sound naive.
> Looking at this at an earlier opportunity will definitely help.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



[jira] [Commented] (SSHD-932) Mina client to connect remote Linux host and get few tasks done

2019-07-15 Thread Thomas Wolf (JIRA)


[ 
https://issues.apache.org/jira/browse/SSHD-932?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16885344#comment-16885344
 ] 

Thomas Wolf commented on SSHD-932:
--

See [the 
documentation|https://github.com/apache/mina-sshd/blob/master/docs/sftp.md]. 
Basically, one you have a {{ClientSession}}, use 
{{SftpClientFactory.instance().createSftpClient()}} to create an 
{{SftpClient}}, then use the operations provided there. Note that you'll have 
to handle the "current directory" on the _client_ side; likewise any other 
state. You'll need the sshd-sftp bundle, too.

Unclear what your question (2) means. Do you mean connecting with an SSH 
public/private key pair (like {{~/.ssh/id_rsa}})? Yes, you can.

> Mina client to connect remote Linux host and get few tasks done
> ---
>
> Key: SSHD-932
> URL: https://issues.apache.org/jira/browse/SSHD-932
> Project: MINA SSHD
>  Issue Type: Question
>Affects Versions: 2.2.0
>Reporter: Zabee Ulla
>Priority: Major
>
> We are switching from Jsch to Apache MINA to connect and get a few tasks done 
> from remote hosts.
> I need to achieve the following features, 
> * List files of a remote host
> * Change directory of a remote host
> * Get file contents as bytes from a remote host
> * Put a file into the remote host
> I have the following questions,
> # How can I send a ZIP file to a remote host much easily in API level (not 
> the Shell commands level)? And all other operations in API level.
> # Can I secure a connection between my localhost and remote through a 
> certificate?
> # As of now, I am using SSHD-CORE and SSHD-COMMON version 2.2.0. Are these 
> libraries enough or do I need to include any other libraries?
> # executeRemoteCommand() is stateless how can I maintain a state?
> Sorry, if the questions sound naive.
> Looking at this at an earlier opportunity will definitely help.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



[jira] [Work logged] (SSHD-930) Send the client version string after receiving the version string of the server

2019-07-15 Thread ASF GitHub Bot (JIRA)


 [ 
https://issues.apache.org/jira/browse/SSHD-930?focusedWorklogId=276771&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-276771
 ]

ASF GitHub Bot logged work on SSHD-930:
---

Author: ASF GitHub Bot
Created on: 15/Jul/19 15:13
Start Date: 15/Jul/19 15:13
Worklog Time Spent: 10m 
  Work Description: tomaswolf commented on pull request #105: SSHD-930 Send 
the client version string after receiving the version string of the server
URL: https://github.com/apache/mina-sshd/pull/105#discussion_r303484675
 
 

 ##
 File path: 
sshd-core/src/main/java/org/apache/sshd/client/session/ClientProxyConnector.java
 ##
 @@ -31,12 +31,13 @@
 @FunctionalInterface
 public interface ClientProxyConnector {
 /**
- * Invoked just before the client identification is sent so that the
- * proxy can send the meta-data to its peer. Upon successful return
- * the SSH identification line is sent and the protocol proceeds as usual.
+ * Invoked just before the client identification is about to be sent so 
that
 
 Review comment:
   This comment is not true anymore. It's called just before the SSH protocol 
starts.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 276771)
Time Spent: 40m  (was: 0.5h)

> Send the client version string after receiving the version string of the 
> server
> ---
>
> Key: SSHD-930
> URL: https://issues.apache.org/jira/browse/SSHD-930
> Project: MINA SSHD
>  Issue Type: Improvement
>Affects Versions: 2.2.0
>Reporter: Zhenliang Su
>Assignee: Goldstein Lyor
>Priority: Major
> Fix For: 2.3.1
>
>  Time Spent: 40m
>  Remaining Estimate: 0h
>
> The rfc4253 does not indicate whether the ssh client must send its own 
> version number right after receiving the version number of the server.
> I have encountered a situation where mina-sshd is used to connect to cisco's 
> sshd service, sometimes it can be connected, sometimes not connected.
> Some rules are found by capturing packets. If the client sends its own 
> version number after receiving the version number of the server, it can be 
> connected. If the client sends its own version number before receiving the 
> version number of the server, then it will not be connected.
> I think, a better way is to change the SshClient code to send the version 
> number of the client right after receiving the version number of the server.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



[jira] [Work logged] (SSHD-930) Send the client version string after receiving the version string of the server

2019-07-15 Thread ASF GitHub Bot (JIRA)


 [ 
https://issues.apache.org/jira/browse/SSHD-930?focusedWorklogId=276773&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-276773
 ]

ASF GitHub Bot logged work on SSHD-930:
---

Author: ASF GitHub Bot
Created on: 15/Jul/19 15:13
Start Date: 15/Jul/19 15:13
Worklog Time Spent: 10m 
  Work Description: tomaswolf commented on pull request #105: SSHD-930 Send 
the client version string after receiving the version string of the server
URL: https://github.com/apache/mina-sshd/pull/105#discussion_r303487154
 
 

 ##
 File path: 
sshd-core/src/main/java/org/apache/sshd/client/session/ClientSessionImpl.java
 ##
 @@ -90,16 +88,9 @@ public ClientSessionImpl(ClientFactoryManager client, 
IoSession ioSession) throw
 authFuture.setAuthed(false);
 
 signalSessionCreated(ioSession);
-sendClientIdentification();
 
-KexExtensionHandler extHandler = getKexExtensionHandler();
-if ((extHandler == null) || 
(!extHandler.isKexExtensionsAvailable(this, AvailabilityPhase.PREKEX))) {
-kexState.set(KexState.INIT);
-sendKexInit();
-} else {
-if (log.isDebugEnabled()) {
-log.debug("({}) delay KEX-INIT until server-side one 
received", this);
-}
+if (sendImmediateIdentification) {
+initializeKexPhase();
 
 Review comment:
   That would work.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 276773)
Time Spent: 50m  (was: 40m)

> Send the client version string after receiving the version string of the 
> server
> ---
>
> Key: SSHD-930
> URL: https://issues.apache.org/jira/browse/SSHD-930
> Project: MINA SSHD
>  Issue Type: Improvement
>Affects Versions: 2.2.0
>Reporter: Zhenliang Su
>Assignee: Goldstein Lyor
>Priority: Major
> Fix For: 2.3.1
>
>  Time Spent: 50m
>  Remaining Estimate: 0h
>
> The rfc4253 does not indicate whether the ssh client must send its own 
> version number right after receiving the version number of the server.
> I have encountered a situation where mina-sshd is used to connect to cisco's 
> sshd service, sometimes it can be connected, sometimes not connected.
> Some rules are found by capturing packets. If the client sends its own 
> version number after receiving the version number of the server, it can be 
> connected. If the client sends its own version number before receiving the 
> version number of the server, then it will not be connected.
> I think, a better way is to change the SshClient code to send the version 
> number of the client right after receiving the version number of the server.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



[jira] [Work logged] (SSHD-930) Send the client version string after receiving the version string of the server

2019-07-15 Thread ASF GitHub Bot (JIRA)


 [ 
https://issues.apache.org/jira/browse/SSHD-930?focusedWorklogId=276774&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-276774
 ]

ASF GitHub Bot logged work on SSHD-930:
---

Author: ASF GitHub Bot
Created on: 15/Jul/19 15:13
Start Date: 15/Jul/19 15:13
Worklog Time Spent: 10m 
  Work Description: tomaswolf commented on pull request #105: SSHD-930 Send 
the client version string after receiving the version string of the server
URL: https://github.com/apache/mina-sshd/pull/105#discussion_r303488490
 
 

 ##
 File path: 
sshd-core/src/main/java/org/apache/sshd/client/session/ClientSessionImpl.java
 ##
 @@ -90,16 +88,17 @@ public ClientSessionImpl(ClientFactoryManager client, 
IoSession ioSession) throw
 authFuture.setAuthed(false);
 
 signalSessionCreated(ioSession);
-sendClientIdentification();
 
-KexExtensionHandler extHandler = getKexExtensionHandler();
-if ((extHandler == null) || 
(!extHandler.isKexExtensionsAvailable(this, AvailabilityPhase.PREKEX))) {
-kexState.set(KexState.INIT);
-sendKexInit();
-} else {
-if (log.isDebugEnabled()) {
-log.debug("({}) delay KEX-INIT until server-side one 
received", this);
-}
+/*
+ * Must be called regardless of whether the client identification
+ * is sent or not immediately in order to allow opening any underlying
+ * proxy protocol - e.g., SOCKS or HTTP CONNECT - otherwise the 
server's
+ * identification will never arrive
+ */
+initializeProxyConnector();
+
+if (sendImmediateIdentification) {
 
 Review comment:
   A tiny bit ugly that `if (sendImmediateIdentification)` is here in 
ClientSessionImpl, but the corresponding `if (!sendImmediateIdentification)` is 
in the super class AbstractClientSession.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 276774)
Time Spent: 1h  (was: 50m)

> Send the client version string after receiving the version string of the 
> server
> ---
>
> Key: SSHD-930
> URL: https://issues.apache.org/jira/browse/SSHD-930
> Project: MINA SSHD
>  Issue Type: Improvement
>Affects Versions: 2.2.0
>Reporter: Zhenliang Su
>Assignee: Goldstein Lyor
>Priority: Major
> Fix For: 2.3.1
>
>  Time Spent: 1h
>  Remaining Estimate: 0h
>
> The rfc4253 does not indicate whether the ssh client must send its own 
> version number right after receiving the version number of the server.
> I have encountered a situation where mina-sshd is used to connect to cisco's 
> sshd service, sometimes it can be connected, sometimes not connected.
> Some rules are found by capturing packets. If the client sends its own 
> version number after receiving the version number of the server, it can be 
> connected. If the client sends its own version number before receiving the 
> version number of the server, then it will not be connected.
> I think, a better way is to change the SshClient code to send the version 
> number of the client right after receiving the version number of the server.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



[jira] [Work logged] (SSHD-930) Send the client version string after receiving the version string of the server

2019-07-15 Thread ASF GitHub Bot (JIRA)


 [ 
https://issues.apache.org/jira/browse/SSHD-930?focusedWorklogId=276772&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-276772
 ]

ASF GitHub Bot logged work on SSHD-930:
---

Author: ASF GitHub Bot
Created on: 15/Jul/19 15:13
Start Date: 15/Jul/19 15:13
Worklog Time Spent: 10m 
  Work Description: tomaswolf commented on pull request #105: SSHD-930 Send 
the client version string after receiving the version string of the server
URL: https://github.com/apache/mina-sshd/pull/105#discussion_r303486677
 
 

 ##
 File path: 
sshd-core/src/main/java/org/apache/sshd/client/session/AbstractClientSession.java
 ##
 @@ -231,37 +240,55 @@ public KeyPair removePublicKeyIdentity(KeyPair kp) {
 return null;
 }
 
-int index = AuthenticationIdentitiesProvider.findIdentityIndex(
-identities, 
AuthenticationIdentitiesProvider.KEYPAIR_IDENTITY_COMPARATOR, kp);
+int index = 
AuthenticationIdentitiesProvider.findIdentityIndex(identities,
+AuthenticationIdentitiesProvider.KEYPAIR_IDENTITY_COMPARATOR, 
kp);
 if (index >= 0) {
 return (KeyPair) identities.remove(index);
 } else {
 return null;
 }
 }
 
-protected IoWriteFuture sendClientIdentification() throws Exception {
-clientVersion = 
resolveIdentificationString(ClientFactoryManager.CLIENT_IDENTIFICATION);
+protected void initializeKexPhase() throws Exception {
+sendClientIdentification();
+
+KexExtensionHandler extHandler = getKexExtensionHandler();
+if ((extHandler == null) || 
(!extHandler.isKexExtensionsAvailable(this, AvailabilityPhase.PREKEX))) {
+kexState.set(KexState.INIT);
+sendKexInit();
+} else {
+if (log.isDebugEnabled()) {
+log.debug("initializeKexPhase({}) delay KEX-INIT until 
server-side one received", this);
+}
+}
+}
 
+protected ClientProxyConnector initializeProxyConnector() throws Exception 
{
 
 Review comment:
   Why return the ClientProxyConnector here? The only place it's called the 
return value is ignored, and subclasses could get it via 
`getClientProxyConnector()` anyway. 
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 276772)
Time Spent: 40m  (was: 0.5h)

> Send the client version string after receiving the version string of the 
> server
> ---
>
> Key: SSHD-930
> URL: https://issues.apache.org/jira/browse/SSHD-930
> Project: MINA SSHD
>  Issue Type: Improvement
>Affects Versions: 2.2.0
>Reporter: Zhenliang Su
>Assignee: Goldstein Lyor
>Priority: Major
> Fix For: 2.3.1
>
>  Time Spent: 40m
>  Remaining Estimate: 0h
>
> The rfc4253 does not indicate whether the ssh client must send its own 
> version number right after receiving the version number of the server.
> I have encountered a situation where mina-sshd is used to connect to cisco's 
> sshd service, sometimes it can be connected, sometimes not connected.
> Some rules are found by capturing packets. If the client sends its own 
> version number after receiving the version number of the server, it can be 
> connected. If the client sends its own version number before receiving the 
> version number of the server, then it will not be connected.
> I think, a better way is to change the SshClient code to send the version 
> number of the client right after receiving the version number of the server.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



[GitHub] [mina-sshd] tomaswolf commented on a change in pull request #105: SSHD-930 Send the client version string after receiving the version string of the server

2019-07-15 Thread GitBox
tomaswolf commented on a change in pull request #105: SSHD-930 Send the client 
version string after receiving the version string of the server
URL: https://github.com/apache/mina-sshd/pull/105#discussion_r303487154
 
 

 ##
 File path: 
sshd-core/src/main/java/org/apache/sshd/client/session/ClientSessionImpl.java
 ##
 @@ -90,16 +88,9 @@ public ClientSessionImpl(ClientFactoryManager client, 
IoSession ioSession) throw
 authFuture.setAuthed(false);
 
 signalSessionCreated(ioSession);
-sendClientIdentification();
 
-KexExtensionHandler extHandler = getKexExtensionHandler();
-if ((extHandler == null) || 
(!extHandler.isKexExtensionsAvailable(this, AvailabilityPhase.PREKEX))) {
-kexState.set(KexState.INIT);
-sendKexInit();
-} else {
-if (log.isDebugEnabled()) {
-log.debug("({}) delay KEX-INIT until server-side one 
received", this);
-}
+if (sendImmediateIdentification) {
+initializeKexPhase();
 
 Review comment:
   That would work.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



[GitHub] [mina-sshd] tomaswolf commented on a change in pull request #105: SSHD-930 Send the client version string after receiving the version string of the server

2019-07-15 Thread GitBox
tomaswolf commented on a change in pull request #105: SSHD-930 Send the client 
version string after receiving the version string of the server
URL: https://github.com/apache/mina-sshd/pull/105#discussion_r303484675
 
 

 ##
 File path: 
sshd-core/src/main/java/org/apache/sshd/client/session/ClientProxyConnector.java
 ##
 @@ -31,12 +31,13 @@
 @FunctionalInterface
 public interface ClientProxyConnector {
 /**
- * Invoked just before the client identification is sent so that the
- * proxy can send the meta-data to its peer. Upon successful return
- * the SSH identification line is sent and the protocol proceeds as usual.
+ * Invoked just before the client identification is about to be sent so 
that
 
 Review comment:
   This comment is not true anymore. It's called just before the SSH protocol 
starts.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



[GitHub] [mina-sshd] tomaswolf commented on a change in pull request #105: SSHD-930 Send the client version string after receiving the version string of the server

2019-07-15 Thread GitBox
tomaswolf commented on a change in pull request #105: SSHD-930 Send the client 
version string after receiving the version string of the server
URL: https://github.com/apache/mina-sshd/pull/105#discussion_r303486677
 
 

 ##
 File path: 
sshd-core/src/main/java/org/apache/sshd/client/session/AbstractClientSession.java
 ##
 @@ -231,37 +240,55 @@ public KeyPair removePublicKeyIdentity(KeyPair kp) {
 return null;
 }
 
-int index = AuthenticationIdentitiesProvider.findIdentityIndex(
-identities, 
AuthenticationIdentitiesProvider.KEYPAIR_IDENTITY_COMPARATOR, kp);
+int index = 
AuthenticationIdentitiesProvider.findIdentityIndex(identities,
+AuthenticationIdentitiesProvider.KEYPAIR_IDENTITY_COMPARATOR, 
kp);
 if (index >= 0) {
 return (KeyPair) identities.remove(index);
 } else {
 return null;
 }
 }
 
-protected IoWriteFuture sendClientIdentification() throws Exception {
-clientVersion = 
resolveIdentificationString(ClientFactoryManager.CLIENT_IDENTIFICATION);
+protected void initializeKexPhase() throws Exception {
+sendClientIdentification();
+
+KexExtensionHandler extHandler = getKexExtensionHandler();
+if ((extHandler == null) || 
(!extHandler.isKexExtensionsAvailable(this, AvailabilityPhase.PREKEX))) {
+kexState.set(KexState.INIT);
+sendKexInit();
+} else {
+if (log.isDebugEnabled()) {
+log.debug("initializeKexPhase({}) delay KEX-INIT until 
server-side one received", this);
+}
+}
+}
 
+protected ClientProxyConnector initializeProxyConnector() throws Exception 
{
 
 Review comment:
   Why return the ClientProxyConnector here? The only place it's called the 
return value is ignored, and subclasses could get it via 
`getClientProxyConnector()` anyway. 


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



[GitHub] [mina-sshd] tomaswolf commented on a change in pull request #105: SSHD-930 Send the client version string after receiving the version string of the server

2019-07-15 Thread GitBox
tomaswolf commented on a change in pull request #105: SSHD-930 Send the client 
version string after receiving the version string of the server
URL: https://github.com/apache/mina-sshd/pull/105#discussion_r303488490
 
 

 ##
 File path: 
sshd-core/src/main/java/org/apache/sshd/client/session/ClientSessionImpl.java
 ##
 @@ -90,16 +88,17 @@ public ClientSessionImpl(ClientFactoryManager client, 
IoSession ioSession) throw
 authFuture.setAuthed(false);
 
 signalSessionCreated(ioSession);
-sendClientIdentification();
 
-KexExtensionHandler extHandler = getKexExtensionHandler();
-if ((extHandler == null) || 
(!extHandler.isKexExtensionsAvailable(this, AvailabilityPhase.PREKEX))) {
-kexState.set(KexState.INIT);
-sendKexInit();
-} else {
-if (log.isDebugEnabled()) {
-log.debug("({}) delay KEX-INIT until server-side one 
received", this);
-}
+/*
+ * Must be called regardless of whether the client identification
+ * is sent or not immediately in order to allow opening any underlying
+ * proxy protocol - e.g., SOCKS or HTTP CONNECT - otherwise the 
server's
+ * identification will never arrive
+ */
+initializeProxyConnector();
+
+if (sendImmediateIdentification) {
 
 Review comment:
   A tiny bit ugly that `if (sendImmediateIdentification)` is here in 
ClientSessionImpl, but the corresponding `if (!sendImmediateIdentification)` is 
in the super class AbstractClientSession.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



[jira] [Updated] (SSHD-932) Mina client to connect remote Linux host and get few tasks done

2019-07-15 Thread Zabee Ulla (JIRA)


 [ 
https://issues.apache.org/jira/browse/SSHD-932?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Zabee Ulla updated SSHD-932:

Summary: Mina client to connect remote Linux host and get few tasks done  
(was: File transfer to a remote Linux machine)

> Mina client to connect remote Linux host and get few tasks done
> ---
>
> Key: SSHD-932
> URL: https://issues.apache.org/jira/browse/SSHD-932
> Project: MINA SSHD
>  Issue Type: Question
>Affects Versions: 2.2.0
>Reporter: Zabee Ulla
>Priority: Major
>
> We are switching from Jsch to Apache MINA to connect and get a few tasks done 
> from remote hosts.
> I need to achieve the following features, 
> * List files of a remote host
> * Change directory of a remote host
> * Get file contents as bytes from a remote host
> * Put a file into the remote host
> I have the following questions,
> # How can I send a ZIP file to a remote host much easily in API level (not 
> the Shell commands level)? And all other operations in API level.
> # Can I secure a connection between my localhost and remote through a 
> certificate?
> # As of now, I am using SSHD-CORE and SSHD-COMMON version 2.2.0. Are these 
> libraries enough or do I need to include any other libraries?
> # executeRemoteCommand() is stateless how can I maintain a state?
> Sorry, if the questions sound naive.
> Looking at this at an earlier opportunity will definitely help.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



[jira] [Updated] (SSHD-932) File transfer to a remote Linux machine

2019-07-15 Thread Zabee Ulla (JIRA)


 [ 
https://issues.apache.org/jira/browse/SSHD-932?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Zabee Ulla updated SSHD-932:

Description: 
We are switching from Jsch to Apache MINA to connect and get a few tasks done 
from remote hosts.

I need to achieve the following features, 
* List files of a remote host
* Change directory of a remote host
* Get file contents as bytes from a remote host
* Put a file into the remote host

I have the following questions,
# How can I send a ZIP file to a remote host much easily in API level (not the 
Shell commands level)? And all other operations in API level.
# Can I secure a connection between my localhost and remote through a 
certificate?
# As of now, I am using SSHD-CORE and SSHD-COMMON version 2.2.0. Are these 
libraries enough or do I need to include any other libraries?
# executeRemoteCommand() is stateless how can I maintain a state?

Sorry, if the questions sound naive.
Looking at this at an earlier opportunity will definitely help.


  was:
We were using Jsch to SSH remote hosts and to get the tasks done. Now, we want 
to switch to Apache Mina. I tried a few things like connecting and executing a 
few Shell commands. 

I need to achieve the following features, 
* List files of a remote host
* Change directory of a remote host
* Get file contents as bytes from a remote host
* Put a file into the remote host

I have the following questions,
# Can Apache Mina comes with all those features that I need?
# I am so far successful in using session.executeRemoteCommand() to send Shell 
commands to get the list files and get file contents. How can I write a ZIP 
file to a remote host much easily in API level (not the Shell commands level)?
# Can I secure a connection between my localhost and remote through a 
certificate?
# As of now, I am using SSHD-CORE and SSHD-COMMON version 2.2.0. Are these 
libraries are enough or do I need to include any other libraries?

Sorry, if the questions sound naive.
Looking at this at an earlier opportunity will definitely help.



> File transfer to a remote Linux machine
> ---
>
> Key: SSHD-932
> URL: https://issues.apache.org/jira/browse/SSHD-932
> Project: MINA SSHD
>  Issue Type: Question
>Affects Versions: 2.2.0
>Reporter: Zabee Ulla
>Priority: Major
>
> We are switching from Jsch to Apache MINA to connect and get a few tasks done 
> from remote hosts.
> I need to achieve the following features, 
> * List files of a remote host
> * Change directory of a remote host
> * Get file contents as bytes from a remote host
> * Put a file into the remote host
> I have the following questions,
> # How can I send a ZIP file to a remote host much easily in API level (not 
> the Shell commands level)? And all other operations in API level.
> # Can I secure a connection between my localhost and remote through a 
> certificate?
> # As of now, I am using SSHD-CORE and SSHD-COMMON version 2.2.0. Are these 
> libraries enough or do I need to include any other libraries?
> # executeRemoteCommand() is stateless how can I maintain a state?
> Sorry, if the questions sound naive.
> Looking at this at an earlier opportunity will definitely help.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



[jira] [Updated] (SSHD-932) File transfer to a remote Linux machine

2019-07-15 Thread Zabee Ulla (JIRA)


 [ 
https://issues.apache.org/jira/browse/SSHD-932?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Zabee Ulla updated SSHD-932:

Description: 
We were using Jsch to SSH remote hosts and to get the tasks done. Now, we want 
to switch to Apache Mina. I tried a few things like connecting and executing a 
few Shell commands. 

I need to achieve the following features, 
* List files of a remote host
* Change directory of a remote host
* Get file contents as bytes from a remote host
* Put a file into the remote host

I have the following questions,
# Can Apache Mina comes with all those features that I need?
# I am so far successful in using session.executeRemoteCommand() to send Shell 
commands to get the list files and get file contents. How can I write a ZIP 
file to a remote host much easily in API level (not the Shell commands level)?
# Can I secure a connection between my localhost and remote through a 
certificate?
# As of now, I am using SSHD-CORE and SSHD-COMMON version 2.2.0. Are these 
libraries are enough or do I need to include any other libraries?

Sorry, if the questions sound naive.
Looking at this at an earlier opportunity will definitely help.


  was:
We were using Jsch to SSH remote hosts and to get the tasks done. Now, we want 
to switch to Apache Mina. I tried a few things like connecting and executing a 
few Shell commands. 

I need to achieve the following features, 
* List files of a remote host
* Change directory of a remote host
* Get file contents as bytes from a remote host
* Put a file into the remote host

I have the following questions,
# Can Apache Mina comes with all those features that I need?
# I am so far successful in doing (a) and (c) using 
session.executeRemoteCommand() how can I write a ZIP file to a remote host?
# Can I secure a connection between my localhost and remote through a 
certificate?
# As of now, I am using SSHD-CORE and SSHD-COMMON version 2.2.0. Are these 
libraries are enough or do I need to include any other libraries?

Sorry, if the questions sound naive.
Looking at this at an earlier opportunity will definitely help.



> File transfer to a remote Linux machine
> ---
>
> Key: SSHD-932
> URL: https://issues.apache.org/jira/browse/SSHD-932
> Project: MINA SSHD
>  Issue Type: Question
>Affects Versions: 2.2.0
>Reporter: Zabee Ulla
>Priority: Major
>
> We were using Jsch to SSH remote hosts and to get the tasks done. Now, we 
> want to switch to Apache Mina. I tried a few things like connecting and 
> executing a few Shell commands. 
> I need to achieve the following features, 
> * List files of a remote host
> * Change directory of a remote host
> * Get file contents as bytes from a remote host
> * Put a file into the remote host
> I have the following questions,
> # Can Apache Mina comes with all those features that I need?
> # I am so far successful in using session.executeRemoteCommand() to send 
> Shell commands to get the list files and get file contents. How can I write a 
> ZIP file to a remote host much easily in API level (not the Shell commands 
> level)?
> # Can I secure a connection between my localhost and remote through a 
> certificate?
> # As of now, I am using SSHD-CORE and SSHD-COMMON version 2.2.0. Are these 
> libraries are enough or do I need to include any other libraries?
> Sorry, if the questions sound naive.
> Looking at this at an earlier opportunity will definitely help.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



[jira] [Updated] (SSHD-932) File transfer to a remote Linux machine

2019-07-15 Thread Zabee Ulla (JIRA)


 [ 
https://issues.apache.org/jira/browse/SSHD-932?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Zabee Ulla updated SSHD-932:

Description: 
We were using Jsch to SSH remote hosts and to get the tasks done. Now, we want 
to switch to Apache Mina. I tried a few things like connecting and executing a 
few Shell commands. 

I need to achieve the following features, 
* List files of a remote host
* Change directory of a remote host
* Get file contents as bytes from a remote host
* Put a file into the remote host

I have the following questions,
# Can Apache Mina comes with all those features that I need?
# I am so far successful in doing (a) and (c) using 
session.executeRemoteCommand() how can I write a ZIP file to a remote host?
# Can I secure a connection between my localhost and remote through a 
certificate?
# As of now, I am using SSHD-CORE and SSHD-COMMON version 2.2.0. Are these 
libraries are enough or do I need to include any other libraries?

Sorry, if the questions sound naive.
Looking at this at an earlier opportunity will definitely help.


  was:
We were using Jsch to SSH remote hosts and to get the tasks done. Now, we want 
to switch to Apache Mina. I tried a few things like connecting and executing a 
few Shell commands. 

I need to achieve the following features, * List files of a remote host
* Change directory of a remote host
* Get file contents as bytes from a remote host
* Put a file into the remote host
I have the following questions,
# Can Apache Mina comes with all those features that I need?
# I am so far successful in doing (a) and (c) using 
session.executeRemoteCommand() how can I write a ZIP file to a remote host?
# Can I secure a connection between my localhost and remote through a 
certificate?
# As of now, I am using SSHD-CORE and SSHD-COMMON version 2.2.0. Are these 
libraries are enough or do I need to include any other libraries?

Sorry, if the questions sound naive.
Looking at this at an earlier opportunity will definitely help.



> File transfer to a remote Linux machine
> ---
>
> Key: SSHD-932
> URL: https://issues.apache.org/jira/browse/SSHD-932
> Project: MINA SSHD
>  Issue Type: Question
>Affects Versions: 2.2.0
>Reporter: Zabee Ulla
>Priority: Major
>
> We were using Jsch to SSH remote hosts and to get the tasks done. Now, we 
> want to switch to Apache Mina. I tried a few things like connecting and 
> executing a few Shell commands. 
> I need to achieve the following features, 
> * List files of a remote host
> * Change directory of a remote host
> * Get file contents as bytes from a remote host
> * Put a file into the remote host
> I have the following questions,
> # Can Apache Mina comes with all those features that I need?
> # I am so far successful in doing (a) and (c) using 
> session.executeRemoteCommand() how can I write a ZIP file to a remote host?
> # Can I secure a connection between my localhost and remote through a 
> certificate?
> # As of now, I am using SSHD-CORE and SSHD-COMMON version 2.2.0. Are these 
> libraries are enough or do I need to include any other libraries?
> Sorry, if the questions sound naive.
> Looking at this at an earlier opportunity will definitely help.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



[jira] [Updated] (SSHD-932) File transfer to a remote Linux machine

2019-07-15 Thread Zabee Ulla (JIRA)


 [ 
https://issues.apache.org/jira/browse/SSHD-932?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Zabee Ulla updated SSHD-932:

Description: 
We were using Jsch to SSH remote hosts and to get the tasks done. Now, we want 
to switch to Apache Mina. I tried a few things like connecting and executing a 
few Shell commands. 
I need to achieve the following features,
* List files of a remote host
* Change directory of a remote host
* Get file contents as bytes from a remote host
* Put a file into the remote host
I have the following questions,
# Can Apache Mina comes with all those features that I need?
# I am so far successful in doing (a) and (c) using 
session.executeRemoteCommand() how can I write a ZIP file to a remote host?
# Can I secure a connection between my localhost and remote through a 
certificate?
# As of now, I am using SSHD-CORE and SSHD-COMMON version 2.2.0. Are these 
libraries are enough or do I need to include any other libraries?

Sorry, if the questions sound naive.
Looking at this at an earlier opportunity will definitely help.


  was:
We were using Jsch to SSH remote hosts and to get the tasks done. Now, we want 
to switch to Apache Mina. I tried a few things like connecting and executing a 
few Shell commands. 
I need to achieve the following features,
* List files of a remote host
* Change directory of a remote host
* Get file contents as bytes from a remote host
* Put a file into the remote host
I have the following questions,
# Can Apache Mina comes with all those features that I need?
# I am so far successful in doing (a) and (c) using 
session.executeRemoteCommand() how can I write a ZIP file to a remote host?
# Can I secure a connection between my localhost and remote through a 
certificate?
# As of now, I am using SSHD-CORE and SSHD-COMMON version 2.2.0. Are these 
libraries are enough or do I need to include any other libraries?
Sorry, if the questions sound naive.
Looking at this at an earlier opportunity will definitely help.



> File transfer to a remote Linux machine
> ---
>
> Key: SSHD-932
> URL: https://issues.apache.org/jira/browse/SSHD-932
> Project: MINA SSHD
>  Issue Type: Question
>Affects Versions: 2.2.0
>Reporter: Zabee Ulla
>Priority: Major
>
> We were using Jsch to SSH remote hosts and to get the tasks done. Now, we 
> want to switch to Apache Mina. I tried a few things like connecting and 
> executing a few Shell commands. 
> I need to achieve the following features,
> * List files of a remote host
> * Change directory of a remote host
> * Get file contents as bytes from a remote host
> * Put a file into the remote host
> I have the following questions,
> # Can Apache Mina comes with all those features that I need?
> # I am so far successful in doing (a) and (c) using 
> session.executeRemoteCommand() how can I write a ZIP file to a remote host?
> # Can I secure a connection between my localhost and remote through a 
> certificate?
> # As of now, I am using SSHD-CORE and SSHD-COMMON version 2.2.0. Are these 
> libraries are enough or do I need to include any other libraries?
> Sorry, if the questions sound naive.
> Looking at this at an earlier opportunity will definitely help.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



[jira] [Updated] (SSHD-932) File transfer to a remote Linux machine

2019-07-15 Thread Zabee Ulla (JIRA)


 [ 
https://issues.apache.org/jira/browse/SSHD-932?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Zabee Ulla updated SSHD-932:

Description: 
We were using Jsch to SSH remote hosts and to get the tasks done. Now, we want 
to switch to Apache Mina. I tried a few things like connecting and executing a 
few Shell commands. 

I need to achieve the following features, * List files of a remote host
* Change directory of a remote host
* Get file contents as bytes from a remote host
* Put a file into the remote host
I have the following questions,
# Can Apache Mina comes with all those features that I need?
# I am so far successful in doing (a) and (c) using 
session.executeRemoteCommand() how can I write a ZIP file to a remote host?
# Can I secure a connection between my localhost and remote through a 
certificate?
# As of now, I am using SSHD-CORE and SSHD-COMMON version 2.2.0. Are these 
libraries are enough or do I need to include any other libraries?

Sorry, if the questions sound naive.
Looking at this at an earlier opportunity will definitely help.


  was:
We were using Jsch to SSH remote hosts and to get the tasks done. Now, we want 
to switch to Apache Mina. I tried a few things like connecting and executing a 
few Shell commands. 
I need to achieve the following features,* List files of a remote host
* Change directory of a remote host
* Get file contents as bytes from a remote host
* Put a file into the remote host
I have the following questions,
# Can Apache Mina comes with all those features that I need?
# I am so far successful in doing (a) and (c) using 
session.executeRemoteCommand() how can I write a ZIP file to a remote host?
# Can I secure a connection between my localhost and remote through a 
certificate?
# As of now, I am using SSHD-CORE and SSHD-COMMON version 2.2.0. Are these 
libraries are enough or do I need to include any other libraries?

Sorry, if the questions sound naive.
Looking at this at an earlier opportunity will definitely help.



> File transfer to a remote Linux machine
> ---
>
> Key: SSHD-932
> URL: https://issues.apache.org/jira/browse/SSHD-932
> Project: MINA SSHD
>  Issue Type: Question
>Affects Versions: 2.2.0
>Reporter: Zabee Ulla
>Priority: Major
>
> We were using Jsch to SSH remote hosts and to get the tasks done. Now, we 
> want to switch to Apache Mina. I tried a few things like connecting and 
> executing a few Shell commands. 
> I need to achieve the following features, * List files of a remote host
> * Change directory of a remote host
> * Get file contents as bytes from a remote host
> * Put a file into the remote host
> I have the following questions,
> # Can Apache Mina comes with all those features that I need?
> # I am so far successful in doing (a) and (c) using 
> session.executeRemoteCommand() how can I write a ZIP file to a remote host?
> # Can I secure a connection between my localhost and remote through a 
> certificate?
> # As of now, I am using SSHD-CORE and SSHD-COMMON version 2.2.0. Are these 
> libraries are enough or do I need to include any other libraries?
> Sorry, if the questions sound naive.
> Looking at this at an earlier opportunity will definitely help.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



[jira] [Updated] (SSHD-932) File transfer to a remote Linux machine

2019-07-15 Thread Zabee Ulla (JIRA)


 [ 
https://issues.apache.org/jira/browse/SSHD-932?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Zabee Ulla updated SSHD-932:

Description: 
We were using Jsch to SSH remote hosts and to get the tasks done. Now, we want 
to switch to Apache Mina. I tried a few things like connecting and executing a 
few Shell commands. 
I need to achieve the following features,
* List files of a remote host
* Change directory of a remote host
* Get file contents as bytes from a remote host
* Put a file into the remote host
I have the following questions,
# Can Apache Mina comes with all those features that I need?
# I am so far successful in doing (a) and (c) using 
session.executeRemoteCommand() how can I write a ZIP file to a remote host?
# Can I secure a connection between my localhost and remote through a 
certificate?
# As of now, I am using SSHD-CORE and SSHD-COMMON version 2.2.0. Are these 
libraries are enough or do I need to include any other libraries?
Sorry, if the questions sound naive.
Looking at this at an earlier opportunity will definitely help.


  was:
We were using Jsch to SSH remote hosts and to get the tasks done. Now, we want 
to switch to Apache Mina. I tried a few things like connecting and executing a 
few Shell commands. 
I need to achieve the following features,
(a) List files of a remote host
(b) Change directory of a remote host
(c) Get file contents as bytes from a remote host
(d) Put a file into the remote host
I have the following questions,
(1) Can Apache Mina comes with all those features that I need?
(2) I am so far successful in doing (a) and (c) using 
session.executeRemoteCommand() how can I write a ZIP file to a remote host?
(3) Can I secure a connection between my localhost and remote through a 
certificate?
(4) As of now, I am using SSHD-CORE and SSHD-COMMON version 2.2.0. Are these 
libraries are enough or do I need to include any other libraries?
Sorry, if the questions sound naive.
Looking at this at an earlier opportunity will definitely help.



> File transfer to a remote Linux machine
> ---
>
> Key: SSHD-932
> URL: https://issues.apache.org/jira/browse/SSHD-932
> Project: MINA SSHD
>  Issue Type: Question
>Affects Versions: 2.2.0
>Reporter: Zabee Ulla
>Priority: Major
>
> We were using Jsch to SSH remote hosts and to get the tasks done. Now, we 
> want to switch to Apache Mina. I tried a few things like connecting and 
> executing a few Shell commands. 
> I need to achieve the following features,
> * List files of a remote host
> * Change directory of a remote host
> * Get file contents as bytes from a remote host
> * Put a file into the remote host
> I have the following questions,
> # Can Apache Mina comes with all those features that I need?
> # I am so far successful in doing (a) and (c) using 
> session.executeRemoteCommand() how can I write a ZIP file to a remote host?
> # Can I secure a connection between my localhost and remote through a 
> certificate?
> # As of now, I am using SSHD-CORE and SSHD-COMMON version 2.2.0. Are these 
> libraries are enough or do I need to include any other libraries?
> Sorry, if the questions sound naive.
> Looking at this at an earlier opportunity will definitely help.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



[jira] [Updated] (SSHD-932) File transfer to a remote Linux machine

2019-07-15 Thread Zabee Ulla (JIRA)


 [ 
https://issues.apache.org/jira/browse/SSHD-932?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Zabee Ulla updated SSHD-932:

Description: 
We were using Jsch to SSH remote hosts and to get the tasks done. Now, we want 
to switch to Apache Mina. I tried a few things like connecting and executing a 
few Shell commands. 
I need to achieve the following features,* List files of a remote host
* Change directory of a remote host
* Get file contents as bytes from a remote host
* Put a file into the remote host
I have the following questions,
# Can Apache Mina comes with all those features that I need?
# I am so far successful in doing (a) and (c) using 
session.executeRemoteCommand() how can I write a ZIP file to a remote host?
# Can I secure a connection between my localhost and remote through a 
certificate?
# As of now, I am using SSHD-CORE and SSHD-COMMON version 2.2.0. Are these 
libraries are enough or do I need to include any other libraries?

Sorry, if the questions sound naive.
Looking at this at an earlier opportunity will definitely help.


  was:
We were using Jsch to SSH remote hosts and to get the tasks done. Now, we want 
to switch to Apache Mina. I tried a few things like connecting and executing a 
few Shell commands. 
I need to achieve the following features,
* List files of a remote host
* Change directory of a remote host
* Get file contents as bytes from a remote host
* Put a file into the remote host
I have the following questions,
# Can Apache Mina comes with all those features that I need?
# I am so far successful in doing (a) and (c) using 
session.executeRemoteCommand() how can I write a ZIP file to a remote host?
# Can I secure a connection between my localhost and remote through a 
certificate?
# As of now, I am using SSHD-CORE and SSHD-COMMON version 2.2.0. Are these 
libraries are enough or do I need to include any other libraries?

Sorry, if the questions sound naive.
Looking at this at an earlier opportunity will definitely help.



> File transfer to a remote Linux machine
> ---
>
> Key: SSHD-932
> URL: https://issues.apache.org/jira/browse/SSHD-932
> Project: MINA SSHD
>  Issue Type: Question
>Affects Versions: 2.2.0
>Reporter: Zabee Ulla
>Priority: Major
>
> We were using Jsch to SSH remote hosts and to get the tasks done. Now, we 
> want to switch to Apache Mina. I tried a few things like connecting and 
> executing a few Shell commands. 
> I need to achieve the following features,* List files of a remote host
> * Change directory of a remote host
> * Get file contents as bytes from a remote host
> * Put a file into the remote host
> I have the following questions,
> # Can Apache Mina comes with all those features that I need?
> # I am so far successful in doing (a) and (c) using 
> session.executeRemoteCommand() how can I write a ZIP file to a remote host?
> # Can I secure a connection between my localhost and remote through a 
> certificate?
> # As of now, I am using SSHD-CORE and SSHD-COMMON version 2.2.0. Are these 
> libraries are enough or do I need to include any other libraries?
> Sorry, if the questions sound naive.
> Looking at this at an earlier opportunity will definitely help.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



[jira] [Updated] (SSHD-932) File transfer to a remote Linux machine

2019-07-15 Thread Zabee Ulla (JIRA)


 [ 
https://issues.apache.org/jira/browse/SSHD-932?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Zabee Ulla updated SSHD-932:

Description: 
We were using Jsch to SSH remote hosts and to get the tasks done. Now, we want 
to switch to Apache Mina. I tried a few things like connecting and executing a 
few Shell commands. 
I need to achieve the following features,
(a) List files of a remote host
(b) Change directory of a remote host
(c) Get file contents as bytes from a remote host
(d) Put a file into the remote host
I have the following questions,
(1) Can Apache Mina comes with all those features that I need?
(2) I am so far successful in doing (a) and (c) using 
session.executeRemoteCommand() how can I write a ZIP file to a remote host?
(3) Can I secure a connection between my localhost and remote through a 
certificate?
(4) As of now, I am using SSHD-CORE and SSHD-COMMON version 2.2.0. Are these 
libraries are enough or do I need to include any other libraries?
Sorry, if the questions sound naive.
Looking at this at an earlier opportunity will definitely help.


  was:
We were using Jsch to SSH remote hosts and to get the tasks done. Now, we want 
to switch to Apache Mina. I tried a few things like connecting and executing a 
few Shell commands. 
I need to achieve the following features,
(a) List files of a remote host
(b) Change directory of a remote host
(c) Get file contents as bytes from a remote host
(d) Put a file into the remote host
I have the following questions,
(1) Can Apache Mina comes with all those features that I need?
(2) I am so far successful in doing (a) and (c) using 
session.executeRemoteCommand() how can I write a ZIP file to a remote host?
(3) Can I secure a connection between my localhost and remote through a 
certificate?
(4) As of now, I am using SSHD-CORE and SSHD-COMMON version 2.2.0. Are these 
libraries are enough or do I need to include any other libraries?
Sorry, if the questions sound naive.
Looking at this at an earlier opportunity will definitely help.
Thanks,
Zabee


> File transfer to a remote Linux machine
> ---
>
> Key: SSHD-932
> URL: https://issues.apache.org/jira/browse/SSHD-932
> Project: MINA SSHD
>  Issue Type: Question
>Affects Versions: 2.2.0
>Reporter: Zabee Ulla
>Priority: Major
>
> We were using Jsch to SSH remote hosts and to get the tasks done. Now, we 
> want to switch to Apache Mina. I tried a few things like connecting and 
> executing a few Shell commands. 
> I need to achieve the following features,
> (a) List files of a remote host
> (b) Change directory of a remote host
> (c) Get file contents as bytes from a remote host
> (d) Put a file into the remote host
> I have the following questions,
> (1) Can Apache Mina comes with all those features that I need?
> (2) I am so far successful in doing (a) and (c) using 
> session.executeRemoteCommand() how can I write a ZIP file to a remote host?
> (3) Can I secure a connection between my localhost and remote through a 
> certificate?
> (4) As of now, I am using SSHD-CORE and SSHD-COMMON version 2.2.0. Are these 
> libraries are enough or do I need to include any other libraries?
> Sorry, if the questions sound naive.
> Looking at this at an earlier opportunity will definitely help.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



[jira] [Created] (SSHD-932) File transfer to a remote Linux machine

2019-07-15 Thread Zabee Ulla (JIRA)
Zabee Ulla created SSHD-932:
---

 Summary: File transfer to a remote Linux machine
 Key: SSHD-932
 URL: https://issues.apache.org/jira/browse/SSHD-932
 Project: MINA SSHD
  Issue Type: Question
Affects Versions: 2.2.0
Reporter: Zabee Ulla


We were using Jsch to SSH remote hosts and to get the tasks done. Now, we want 
to switch to Apache Mina. I tried a few things like connecting and executing a 
few Shell commands. 
I need to achieve the following features,
(a) List files of a remote host
(b) Change directory of a remote host
(c) Get file contents as bytes from a remote host
(d) Put a file into the remote host
I have the following questions,
(1) Can Apache Mina comes with all those features that I need?
(2) I am so far successful in doing (a) and (c) using 
session.executeRemoteCommand() how can I write a ZIP file to a remote host?
(3) Can I secure a connection between my localhost and remote through a 
certificate?
(4) As of now, I am using SSHD-CORE and SSHD-COMMON version 2.2.0. Are these 
libraries are enough or do I need to include any other libraries?
Sorry, if the questions sound naive.
Looking at this at an earlier opportunity will definitely help.
Thanks,
Zabee



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



Re: Fwd: [VOTE] Release Apache Mina SSHD 2.3.0

2019-07-15 Thread Emmanuel Lécharny

Missed this one ! Thanks for having forwarded it !

On 15/07/2019 13:45, Guillaume Nodet wrote:

-- Forwarded message -
De : Jeff Genender 
Date: mer. 10 juil. 2019 à 16:51
Subject: Re: [VOTE] Release Apache Mina SSHD 2.3.0
To: Guillaume Nodet 


+1

Jeff


On Jul 9, 2019, at 3:22 AM, Guillaume Nodet  wrote:

I've staged a release candidate:
  * Repo:
https://repository.apache.org/content/repositories/orgapachemina-1046
  * Distributions:


https://repository.apache.org/content/repositories/orgapachemina-1046/org/apache/sshd/apache-sshd/2.3.0/

  * Git Tag: https://github.com/apache/mina-sshd/releases/tag/sshd-2.3.0
  * Changelog:


https://github.com/apache/mina-sshd/blob/4f83fff0e6b8f8ab2ec18c04621381606f01d585/CHANGES.md

Please review and vote !

Cheers,
Guillaume Nodet





-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



Fwd: [VOTE] Release Apache Mina SSHD 2.3.0

2019-07-15 Thread Guillaume Nodet
-- Forwarded message -
De : Jeff Genender 
Date: mer. 10 juil. 2019 à 16:51
Subject: Re: [VOTE] Release Apache Mina SSHD 2.3.0
To: Guillaume Nodet 


+1

Jeff

> On Jul 9, 2019, at 3:22 AM, Guillaume Nodet  wrote:
>
> I've staged a release candidate:
>  * Repo:
> https://repository.apache.org/content/repositories/orgapachemina-1046
>  * Distributions:
>
https://repository.apache.org/content/repositories/orgapachemina-1046/org/apache/sshd/apache-sshd/2.3.0/
>  * Git Tag: https://github.com/apache/mina-sshd/releases/tag/sshd-2.3.0
>  * Changelog:
>
https://github.com/apache/mina-sshd/blob/4f83fff0e6b8f8ab2ec18c04621381606f01d585/CHANGES.md
>
> Please review and vote !
>
> Cheers,
> Guillaume Nodet



-- 

Guillaume Nodet


[GitHub] [mina-sshd] lgoldstein commented on a change in pull request #105: SSHD-930 Send the client version string after receiving the version string of the server

2019-07-15 Thread GitBox
lgoldstein commented on a change in pull request #105: SSHD-930 Send the client 
version string after receiving the version string of the server
URL: https://github.com/apache/mina-sshd/pull/105#discussion_r303380572
 
 

 ##
 File path: 
sshd-core/src/main/java/org/apache/sshd/client/session/ClientSessionImpl.java
 ##
 @@ -90,16 +88,9 @@ public ClientSessionImpl(ClientFactoryManager client, 
IoSession ioSession) throw
 authFuture.setAuthed(false);
 
 signalSessionCreated(ioSession);
-sendClientIdentification();
 
-KexExtensionHandler extHandler = getKexExtensionHandler();
-if ((extHandler == null) || 
(!extHandler.isKexExtensionsAvailable(this, AvailabilityPhase.PREKEX))) {
-kexState.set(KexState.INIT);
-sendKexInit();
-} else {
-if (log.isDebugEnabled()) {
-log.debug("({}) delay KEX-INIT until server-side one 
received", this);
-}
+if (sendImmediateIdentification) {
+initializeKexPhase();
 
 Review comment:
   Please see the updated code that initializes the proxy connector regardless 
of whether immediate send is enabled or not.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



[jira] [Work logged] (SSHD-930) Send the client version string after receiving the version string of the server

2019-07-15 Thread ASF GitHub Bot (JIRA)


 [ 
https://issues.apache.org/jira/browse/SSHD-930?focusedWorklogId=276616&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-276616
 ]

ASF GitHub Bot logged work on SSHD-930:
---

Author: ASF GitHub Bot
Created on: 15/Jul/19 10:57
Start Date: 15/Jul/19 10:57
Worklog Time Spent: 10m 
  Work Description: lgoldstein commented on pull request #105: SSHD-930 
Send the client version string after receiving the version string of the server
URL: https://github.com/apache/mina-sshd/pull/105#discussion_r303380572
 
 

 ##
 File path: 
sshd-core/src/main/java/org/apache/sshd/client/session/ClientSessionImpl.java
 ##
 @@ -90,16 +88,9 @@ public ClientSessionImpl(ClientFactoryManager client, 
IoSession ioSession) throw
 authFuture.setAuthed(false);
 
 signalSessionCreated(ioSession);
-sendClientIdentification();
 
-KexExtensionHandler extHandler = getKexExtensionHandler();
-if ((extHandler == null) || 
(!extHandler.isKexExtensionsAvailable(this, AvailabilityPhase.PREKEX))) {
-kexState.set(KexState.INIT);
-sendKexInit();
-} else {
-if (log.isDebugEnabled()) {
-log.debug("({}) delay KEX-INIT until server-side one 
received", this);
-}
+if (sendImmediateIdentification) {
+initializeKexPhase();
 
 Review comment:
   Please see the updated code that initializes the proxy connector regardless 
of whether immediate send is enabled or not.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 276616)
Time Spent: 0.5h  (was: 20m)

> Send the client version string after receiving the version string of the 
> server
> ---
>
> Key: SSHD-930
> URL: https://issues.apache.org/jira/browse/SSHD-930
> Project: MINA SSHD
>  Issue Type: Improvement
>Affects Versions: 2.2.0
>Reporter: Zhenliang Su
>Assignee: Goldstein Lyor
>Priority: Major
> Fix For: 2.3.1
>
>  Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> The rfc4253 does not indicate whether the ssh client must send its own 
> version number right after receiving the version number of the server.
> I have encountered a situation where mina-sshd is used to connect to cisco's 
> sshd service, sometimes it can be connected, sometimes not connected.
> Some rules are found by capturing packets. If the client sends its own 
> version number after receiving the version number of the server, it can be 
> connected. If the client sends its own version number before receiving the 
> version number of the server, then it will not be connected.
> I think, a better way is to change the SshClient code to send the version 
> number of the client right after receiving the version number of the server.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



[jira] [Commented] (SSHD-922) CD - change directory is not working. clientSession.executeRemoteCommand("cd " + directory)

2019-07-15 Thread Zabee Ulla (JIRA)


[ 
https://issues.apache.org/jira/browse/SSHD-922?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16885078#comment-16885078
 ] 

Zabee Ulla commented on SSHD-922:
-

Thank you all. I am sorry, I don't get it. [~lgoldstein] I tried creating the 
shell channel (also, updated the code in the description) but it is the same. 
[~gnt] I tried getting the input and output streams but not don't know how and 
what to do after that. When I get the channels using getIn() and getOut() they 
are NULL. Is there another way of executing Linux commands on the remote host? 
Guidance on this (details or pointer to any documentation or APIs) will really 
help to implement Mina into our project.
Thanks,
Zabee

> CD - change directory is not working. clientSession.executeRemoteCommand("cd 
> " + directory)
> ---
>
> Key: SSHD-922
> URL: https://issues.apache.org/jira/browse/SSHD-922
> Project: MINA SSHD
>  Issue Type: Bug
>Affects Versions: 2.2.0
> Environment: Trying to connect to a Linux VM from Windows OS
>Reporter: Zabee Ulla
>Assignee: Goldstein Lyor
>Priority: Blocker
>
> I am writing an SSHD client to execute BASH commands on a remove Linux VM. My 
> functionality requires to change directories at several points. 
> I have written and using below code and not finding change directory working. 
> I tried a few other Linux commands and am able to execute them perfectly 
> except change directory. 
> This is a blocker for me to embed and implement Apache SSHD client for my 
> application. 
> Please note that "pwd" output is same before and after 
> _+*session.executeRemoteCommand("cd " + argDirectory);*+_'s execution.
> /**
>  * An implementation of an SFTP client that uses the Apache Mina library.
>  */
>  public class MinaSftp {
> _public void changeRemoteDirectory(String argDirectory)_
>  _throws IOException {_
>  _try {_
>  _System.out.println("Present working direcotry :\n " + 
> _session.executeRemoteCommand("pwd"));_
> _+*String output = _session.executeRemoteCommand("cd " + argDirectory);*+_
> _System.out.println("Present working direcotry :\n " + 
> _session.executeRemoteCommand("pwd"));_
>  _System.out.println("Change directory output: " + output);_
>  _}_
>  _catch (IOException ex) {_
>  _handleException(ex, action);_
>  _}_
>  _}_
> private static Collection ccEvents = 
> Arrays.asList(ClientChannelEvent.CLOSED);
> private String _username = "userName";
>  private String _password = "password";
>  private String _host = "aValidHostName";
>  private ClientSession _session;
>  private ClientChannel shellChannel;
>  private SshClient _client;
> // Some valid port number
>  private int portNumber = 8999;
>  
> public void connect()
>  throws IOException {
> _client = SshClient.setUpDefaultClient();
>  _client.start();
> ConnectFuture connectFuture = _client.connect(_username, _host, portNumber);
>  connectFuture.await();
>  _session = connectFuture.getSession();
> shellChannel = _session.createShellChannel();
>  _session.addPasswordIdentity(_password);
> // TODO : fix timeout
>  _session.auth().verify(Integer.MAX_VALUE);
> if (_session.isAuthenticated())
> { System.out.println("Authentication successful"); }
> else
> { System.out.println("Authentication failed"); }
> _channel.waitFor(ccEvents, 200);
>  }
> public void disconnect() {
>  LOG.debug("Disconnecting from the SFTP host.");
> // Disconnecting the session disconnects all of the connected channels as 
> well.
>  if (_channel != null) {
>  try
> { _channel.close(); }
> catch (Exception e)
> { // Do nothing. This is okay. }
> }
>  if (_session != null)
> { _session.close(false); }
> if (_client != null)
> { _client.stop(); }
> }
> private void handleException(Exception argEx, String argAction)
>  throws IOException
> { throw LOG.throwing(new IOException(argAction + " on the SFTP host threw an 
> exception.", argEx)); }
> }



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



[jira] [Updated] (SSHD-922) CD - change directory is not working. clientSession.executeRemoteCommand("cd " + directory)

2019-07-15 Thread Zabee Ulla (JIRA)


 [ 
https://issues.apache.org/jira/browse/SSHD-922?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Zabee Ulla updated SSHD-922:

Description: 
I am writing an SSHD client to execute BASH commands on a remove Linux VM. My 
functionality requires to change directories at several points. 

I have written and using below code and not finding change directory working. I 
tried a few other Linux commands and am able to execute them perfectly except 
change directory. 

This is a blocker for me to embed and implement Apache SSHD client for my 
application. 

Please note that "pwd" output is same before and after 
_+*session.executeRemoteCommand("cd " + argDirectory);*+_'s execution.

/**
 * An implementation of an SFTP client that uses the Apache Mina library.
 */
 public class MinaSftp {

_public void changeRemoteDirectory(String argDirectory)_
 _throws IOException {_
 _try {_
 _System.out.println("Present working direcotry :\n " + 
_session.executeRemoteCommand("pwd"));_

_+*String output = _session.executeRemoteCommand("cd " + argDirectory);*+_

_System.out.println("Present working direcotry :\n " + 
_session.executeRemoteCommand("pwd"));_
 _System.out.println("Change directory output: " + output);_
 _}_
 _catch (IOException ex) {_
 _handleException(ex, action);_
 _}_
 _}_

private static Collection ccEvents = 
Arrays.asList(ClientChannelEvent.CLOSED);

private String _username = "userName";
 private String _password = "password";
 private String _host = "aValidHostName";
 private ClientSession _session;
 private ClientChannel shellChannel;
 private SshClient _client;

// Some valid port number
 private int portNumber = 8999;

 

public void connect()
 throws IOException {

_client = SshClient.setUpDefaultClient();
 _client.start();

ConnectFuture connectFuture = _client.connect(_username, _host, portNumber);
 connectFuture.await();
 _session = connectFuture.getSession();
shellChannel = _session.createShellChannel();
 _session.addPasswordIdentity(_password);

// TODO : fix timeout
 _session.auth().verify(Integer.MAX_VALUE);

if (_session.isAuthenticated())

{ System.out.println("Authentication successful"); }

else

{ System.out.println("Authentication failed"); }

_channel.waitFor(ccEvents, 200);
 }

public void disconnect() {
 LOG.debug("Disconnecting from the SFTP host.");

// Disconnecting the session disconnects all of the connected channels as well.
 if (_channel != null) {
 try

{ _channel.close(); }

catch (Exception e)

{ // Do nothing. This is okay. }

}
 if (_session != null)

{ _session.close(false); }

if (_client != null)

{ _client.stop(); }

}

private void handleException(Exception argEx, String argAction)
 throws IOException

{ throw LOG.throwing(new IOException(argAction + " on the SFTP host threw an 
exception.", argEx)); }

}

  was:
I am writing an SSHD client to execute BASH commands on a remove Linux VM. My 
functionality requires to change directories at several points. 

I have written and using below code and not finding change directory working. I 
tried a few other Linux commands and am able to execute them perfectly except 
change directory. 

This is a blocker for me to embed and implement Apache SSHD client for my 
application. 

Please note that "pwd" output is same before and after 
_+*session.executeRemoteCommand("cd " + argDirectory);*+_'s execution.

/**
 * An implementation of an SFTP client that uses the Apache Mina library.
 */
 public class MinaSftp {

_public void changeRemoteDirectory(String argDirectory)_
 _throws IOException {_
 _try {_
 _System.out.println("Present working direcotry :\n " + 
_session.executeRemoteCommand("pwd"));_

_+*String output = _session.executeRemoteCommand("cd " + argDirectory);*+_

_System.out.println("Present working direcotry :\n " + 
_session.executeRemoteCommand("pwd"));_
 _System.out.println("Change directory output: " + output);_
 _}_
 _catch (IOException ex) {_
 _handleException(ex, action);_
 _}_
 _}_

private static Collection ccEvents = 
Arrays.asList(ClientChannelEvent.CLOSED);

private String _username = "userName";
 private String _password = "password";
 private String _host = "aValidHostName";
 private ClientSession _session;
 private ClientChannel _channel;
 private SshClient _client;

// Some valid port number
 private int portNumber = 8999;

 

public void connect()
 throws IOException {

_client = SshClient.setUpDefaultClient();
 _client.start();

ConnectFuture connectFuture = _client.connect(_username, _host, portNumber);
 connectFuture.await();
 _session = connectFuture.getSession();
shellChannel = _session.createShellChannel();
 _session.addPasswordIdentity(_password);

// TODO : fix timeout
 _session.auth().verify(Integer.MAX_VALUE);

if (_session.isAuthenticated())

{ System.out.println("Authentication successful"); }

else

{ System.out.println("Authentication failed"); }

_channel.waitFor(ccEvents, 200);
 }

public void disconnect() {
 LOG.debug("Disconnec

[jira] [Updated] (SSHD-922) CD - change directory is not working. clientSession.executeRemoteCommand("cd " + directory)

2019-07-15 Thread Zabee Ulla (JIRA)


 [ 
https://issues.apache.org/jira/browse/SSHD-922?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Zabee Ulla updated SSHD-922:

Description: 
I am writing an SSHD client to execute BASH commands on a remove Linux VM. My 
functionality requires to change directories at several points. 

I have written and using below code and not finding change directory working. I 
tried a few other Linux commands and am able to execute them perfectly except 
change directory. 

This is a blocker for me to embed and implement Apache SSHD client for my 
application. 

Please note that "pwd" output is same before and after 
_+*session.executeRemoteCommand("cd " + argDirectory);*+_'s execution.

/**
 * An implementation of an SFTP client that uses the Apache Mina library.
 */
 public class MinaSftp {

_public void changeRemoteDirectory(String argDirectory)_
 _throws IOException {_
 _try {_
 _System.out.println("Present working direcotry :\n " + 
_session.executeRemoteCommand("pwd"));_

_+*String output = _session.executeRemoteCommand("cd " + argDirectory);*+_

_System.out.println("Present working direcotry :\n " + 
_session.executeRemoteCommand("pwd"));_
 _System.out.println("Change directory output: " + output);_
 _}_
 _catch (IOException ex) {_
 _handleException(ex, action);_
 _}_
 _}_

private static Collection ccEvents = 
Arrays.asList(ClientChannelEvent.CLOSED);

private String _username = "userName";
 private String _password = "password";
 private String _host = "aValidHostName";
 private ClientSession _session;
 private ClientChannel _channel;
 private SshClient _client;

// Some valid port number
 private int portNumber = 8999;

 

public void connect()
 throws IOException {

_client = SshClient.setUpDefaultClient();
 _client.start();

ConnectFuture connectFuture = _client.connect(_username, _host, portNumber);
 connectFuture.await();
 _session = connectFuture.getSession();
shellChannel = _session.createShellChannel();
 _session.addPasswordIdentity(_password);

// TODO : fix timeout
 _session.auth().verify(Integer.MAX_VALUE);

if (_session.isAuthenticated())

{ System.out.println("Authentication successful"); }

else

{ System.out.println("Authentication failed"); }

_channel.waitFor(ccEvents, 200);
 }

public void disconnect() {
 LOG.debug("Disconnecting from the SFTP host.");

// Disconnecting the session disconnects all of the connected channels as well.
 if (_channel != null) {
 try

{ _channel.close(); }

catch (Exception e)

{ // Do nothing. This is okay. }

}
 if (_session != null)

{ _session.close(false); }

if (_client != null)

{ _client.stop(); }

}

private void handleException(Exception argEx, String argAction)
 throws IOException

{ throw LOG.throwing(new IOException(argAction + " on the SFTP host threw an 
exception.", argEx)); }

}

  was:
I am writing an SSHD client to execute BASH commands on a remove Linux VM. My 
functionality requires to change directories at several points. 

I have written and using below code and not finding change directory working. I 
tried a few other Linux commands and am able to execute them perfectly except 
change directory. 

This is a blocker for me to embed and implement Apache SSHD client for my 
application. 

Please note that "pwd" output is same before and after 
_+*session.executeRemoteCommand("cd " + argDirectory);*+_'s execution.

/**
 * An implementation of an SFTP client that uses the Apache Mina library.
 */
 public class MinaSftp {

_public void changeRemoteDirectory(String argDirectory)_
 _throws IOException {_
 _try {_
 _System.out.println("Present working direcotry :\n " + 
_session.executeRemoteCommand("pwd"));_

_+*String output = _session.executeRemoteCommand("cd " + argDirectory);*+_

_System.out.println("Present working direcotry :\n " + 
_session.executeRemoteCommand("pwd"));_
 _System.out.println("Change directory output: " + output);_
 _}_
 _catch (IOException ex) {_
 _handleException(ex, action);_
 _}_
 _}_

private static Collection ccEvents = 
Arrays.asList(ClientChannelEvent.CLOSED);

private String _username = "userName";
 private String _password = "password";
 private String _host = "aValidHostName";
 private ClientSession _session;
 private ClientChannel _channel;
 private SshClient _client;

// Some valid port number
 private int portNumber = 8999;

 

public void connect()
 throws IOException {

_client = SshClient.setUpDefaultClient();
 _client.start();

ConnectFuture connectFuture = _client.connect(_username, _host, portNumber);
 connectFuture.await();
 _session = connectFuture.getSession();
 _channel = _session.createChannel(ClientChannel.CHANNEL_SHELL);
 _session.addPasswordIdentity(_password);

// TODO : fix timeout
 _session.auth().verify(Integer.MAX_VALUE);

if (_session.isAuthenticated())

{ System.out.println("Authentication successful"); }

else

{ System.out.println("Authentication failed"); }

_channel.waitFor(ccEvents, 200);
 }

public void disconnect() {
 LOG.d

Re: [RESULT] [VOTE] Release Apache Mina SSHD 2.3.0

2019-07-15 Thread Emmanuel Lécharny

Hi Guillaume,

sorry to bother you with that, but I count only 2 +1 binding votes :/

I tried the build this morning, but I still have the same 8 errors when. 
doing so:



[INFO] Running org.apache.sshd.common.forward.PortForwardingTest
[ERROR] Tests run: 10, Failures: 0, Errors: 8, Skipped: 0, Time elapsed: 
5.155 s <<< FAILURE! - in org.apache.sshd.common.forward.PortForwardingTest
[ERROR] 
testLocalForwarding(org.apache.sshd.common.forward.PortForwardingTest) 
Time elapsed: 0.004 s  <<< ERROR!

com.jcraft.jsch.JSchException: java.net.SocketException: Socket closed
    at 
org.apache.sshd.common.forward.PortForwardingTest.createSession(PortForwardingTest.java:802)
    at 
org.apache.sshd.common.forward.PortForwardingTest.testLocalForwarding(PortForwardingTest.java:467)

Caused by: java.net.SocketException: Socket closed
    at 
org.apache.sshd.common.forward.PortForwardingTest.createSession(PortForwardingTest.java:802)
    at 
org.apache.sshd.common.forward.PortForwardingTest.testLocalForwarding(PortForwardingTest.java:467)


[ERROR] 
testLocalForwardingNative(org.apache.sshd.common.forward.PortForwardingTest) 
Time elapsed: 0.031 s  <<< ERROR!

java.net.SocketException: Socket closed
    at 
org.apache.sshd.common.forward.PortForwardingTest.testLocalForwardingNative(PortForwardingTest.java:573)


[ERROR] 
testLocalForwardingNativeBigPayload(org.apache.sshd.common.forward.PortForwardingTest) 
Time elapsed: 0.022 s  <<< ERROR!

java.net.SocketException: Socket closed
    at 
org.apache.sshd.common.forward.PortForwardingTest.testLocalForwardingNativeBigPayload(PortForwardingTest.java:626)


[ERROR] 
testRemoteForwarding(org.apache.sshd.common.forward.PortForwardingTest) 
Time elapsed: 0 s  <<< ERROR!

com.jcraft.jsch.JSchException: java.net.SocketException: Socket closed
    at 
org.apache.sshd.common.forward.PortForwardingTest.createSession(PortForwardingTest.java:802)
    at 
org.apache.sshd.common.forward.PortForwardingTest.testRemoteForwarding(PortForwardingTest.java:264)

Caused by: java.net.SocketException: Socket closed
    at 
org.apache.sshd.common.forward.PortForwardingTest.createSession(PortForwardingTest.java:802)
    at 
org.apache.sshd.common.forward.PortForwardingTest.testRemoteForwarding(PortForwardingTest.java:264)


[ERROR] 
testRemoteForwardingNative(org.apache.sshd.common.forward.PortForwardingTest) 
Time elapsed: 0.024 s  <<< ERROR!

java.net.SocketException: Socket closed
    at 
org.apache.sshd.common.forward.PortForwardingTest.testRemoteForwardingNative(PortForwardingTest.java:337)


[ERROR] 
testRemoteForwardingNativeBigPayload(org.apache.sshd.common.forward.PortForwardingTest) 
Time elapsed: 0.022 s  <<< ERROR!

java.net.SocketException: Socket closed
    at 
org.apache.sshd.common.forward.PortForwardingTest.testRemoteForwardingNativeBigPayload(PortForwardingTest.java:434)


[ERROR] 
testRemoteForwardingSecondTimeInSameSession(org.apache.sshd.common.forward.PortForwardingTest) 
Time elapsed: 0.001 s  <<< ERROR!

com.jcraft.jsch.JSchException: java.net.SocketException: Socket closed
    at 
org.apache.sshd.common.forward.PortForwardingTest.createSession(PortForwardingTest.java:802)
    at 
org.apache.sshd.common.forward.PortForwardingTest.testRemoteForwardingSecondTimeInSameSession(PortForwardingTest.java:295)

Caused by: java.net.SocketException: Socket closed
    at 
org.apache.sshd.common.forward.PortForwardingTest.createSession(PortForwardingTest.java:802)
    at 
org.apache.sshd.common.forward.PortForwardingTest.testRemoteForwardingSecondTimeInSameSession(PortForwardingTest.java:295)


[ERROR] 
testRemoteForwardingWithDisconnect(org.apache.sshd.common.forward.PortForwardingTest) 
Time elapsed: 0.001 s  <<< ERROR!

com.jcraft.jsch.JSchException: java.net.SocketException: Socket closed
    at 
org.apache.sshd.common.forward.PortForwardingTest.createSession(PortForwardingTest.java:802)
    at 
org.apache.sshd.common.forward.PortForwardingTest.testRemoteForwardingWithDisconnect(PortForwardingTest.java:675)

Caused by: java.net.SocketException: Socket closed
    at 
org.apache.sshd.common.forward.PortForwardingTest.createSession(PortForwardingTest.java:802)
    at 
org.apache.sshd.common.forward.PortForwardingTest.testRemoteForwardingWithDisconnect(PortForwardingTest.java:675)


Lyor wanted to have a look at those errors last time I mentionned it (it 
was for SSHD-2.2.0).


I don't want to block a release because of those errors, which might 
well be MAC OSx related though.



Can we postpone the release one day so that I can check it on another 
environment ?



Thanks !

On 15/07/2019 11:31, Guillaume Nodet wrote:

Closing this vote with 3 +1 and no other votes.
I'll publish the release asap.

Le mar. 9 juil. 2019 à 11:22, Guillaume Nodet  a écrit :


I've staged a release candidate:
   * Repo:
https://repository.apache.org/content/repositories/orgapachemina-1046
   * Distributions:
https://repository.apache.org/content/repositories/orgapachemina-1046/org/apache/sshd/apache-ssh

[RESULT] [VOTE] Release Apache Mina SSHD 2.3.0

2019-07-15 Thread Guillaume Nodet
Closing this vote with 3 +1 and no other votes.
I'll publish the release asap.

Le mar. 9 juil. 2019 à 11:22, Guillaume Nodet  a écrit :

> I've staged a release candidate:
>   * Repo:
> https://repository.apache.org/content/repositories/orgapachemina-1046
>   * Distributions:
> https://repository.apache.org/content/repositories/orgapachemina-1046/org/apache/sshd/apache-sshd/2.3.0/
>   * Git Tag: https://github.com/apache/mina-sshd/releases/tag/sshd-2.3.0
>   * Changelog:
> https://github.com/apache/mina-sshd/blob/4f83fff0e6b8f8ab2ec18c04621381606f01d585/CHANGES.md
>
> Please review and vote !
>
> Cheers,
> Guillaume Nodet
>
>
>

-- 

Guillaume Nodet


Re: [VOTE] Release Apache Mina SSHD 2.3.0

2019-07-15 Thread Guillaume Nodet
+1

Le mar. 9 juil. 2019 à 11:22, Guillaume Nodet  a écrit :

> I've staged a release candidate:
>   * Repo:
> https://repository.apache.org/content/repositories/orgapachemina-1046
>   * Distributions:
> https://repository.apache.org/content/repositories/orgapachemina-1046/org/apache/sshd/apache-sshd/2.3.0/
>   * Git Tag: https://github.com/apache/mina-sshd/releases/tag/sshd-2.3.0
>   * Changelog:
> https://github.com/apache/mina-sshd/blob/4f83fff0e6b8f8ab2ec18c04621381606f01d585/CHANGES.md
>
> Please review and vote !
>
> Cheers,
> Guillaume Nodet
>
>
>

-- 

Guillaume Nodet