pkjanbandhu / ganymed-ssh-2

Automatically exported from code.google.com/p/ganymed-ssh-2
Other
0 stars 0 forks source link

Possibility to bind local ip address #35

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
In the same as a Socket has a bind method for the local (source) ip address, 
this would be appreciated if implemented in the ch.ethz.ssh2.Connection class.

Attached is an example implementation of such an bindSourceAddress method.

Original issue reported on code.google.com by tobb...@gmail.com on 4 Feb 2014 at 12:16

Attachments:

GoogleCodeExporter commented 8 years ago
I suppose my problem is related to this reported issue.

When I use the Connection.authenticateWithPublicKey(...) method, it does not 
work for local IP addresses:
Authentication failed.
java.lang.IllegalStateException: Cannot open session, connection is not 
authenticated.
        at ch.ethz.ssh2.Connection.openSession(Connection.java:1095)   // -> without patch
        at ch.ethz.ssh2.Connection.openSession(Connection.java:1120)  // -> with patch
        at trial.main(trial.java:52)

There is no problem with the connections to remote addresses, or when I use the 
Linux ssh command in CLI, or Connection.authenticateWithPassword(...).

I also applied the suggested patch, but did not help. Could it be a different 
issue?

Thanks!

Original comment by levente....@gmail.com on 14 Mar 2014 at 9:17

GoogleCodeExporter commented 8 years ago
Your issue is probably something else. I'm not sure what you mean with local IP 
address in your context, but it sound like you have problems when you connect 
to IP for an interface on your own machine.

In some scenarios with firewalls etc, these will filter out IP packages with 
wrong source addresses. The proposed bindSourceAddress() method is used before 
connect() to bind the local address to the socket before connecting to a 
"remote" address. This to be able to have a allowed source address for these 
firewalls.

Since you can connect "remotely", this is probably not your issue. 

Original comment by tobb...@gmail.com on 14 Mar 2014 at 10:12

GoogleCodeExporter commented 8 years ago

Original comment by dkocher@sudo.ch on 8 Apr 2014 at 11:29