Created
October 28, 2011 05:59
-
-
Save krmahadevan/1321719 to your computer and use it in GitHub Desktop.
Steps to recreate the sshj issue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. create a ‘~/.ssh/config’ file with the following content; | |
# | |
# All hosts defaults | |
# | |
Host * | |
Protocol 1,2 | |
FallBackToRsh no | |
ForwardAgent yes | |
ForwardX11 yes | |
PasswordAuthentication yes | |
RhostsAuthentication no | |
RhostsRSAAuthentication no | |
RSAAuthentication yes | |
NoHostAuthenticationForLocalhost yes | |
StrictHostKeyChecking no | |
KeepAlive yes | |
2. now for this user id, connect to a remote UNIX machine. The moment you connect to a UNIX remote machine, you will see the RSA1 come up. | |
3. Verify that the key got added up to your ~/.ssh/known_hosts file. | |
4. Create a SSHv1 compatible key pair using the command "ssh-keygen -t rsa1". | |
This command will create identity(private key) and identity.pub (public key) and save it under ~/.ssh folder. | |
5. Verify that the public key looks like a sshv1 key by running cat ~/.ssh/identity.pub | |
6. Now try to do a passwordless setup to a remote machine, so that no password is asked by running scp ~/.ssh/identity.pub <username>@<machinename>:~/.ssh/ | |
7. Now append it to the authorized keys by running cat ~/.ssh/identity.pub > ~/.ssh/authorized_keys on the remote machine. | |
8. Verify that the passwordless setup was indeed completed by running ssh <userName>@<machineName> from your local machine, and you shouldn't be prompted for a password. | |
9. Now try to run the following sample program to simulate the problem from your local machine. | |
SSHClient client = new SSHClient(); | |
client.loadKnownHosts(); | |
client.connect(REMOTE_MACHINE); | |
client.authPassword(USERNAME, PASSWORD); | |
Session session = client.startSession(); | |
Command command = session.exec("who am i"); | |
String output = command.getOutputAsString(); | |
System.out.println(output); | |
session.close(); | |
client.close(); |
Hi Krishan,
I know enough, somehow the SSH client on your CI machine is forcing SSHv1. However SSHv1 support is not yet built, and far as I know this is not supported in any of the open source SSH libraries. If you can find one, I'd be very grateful and will have an easier time building it in in SSHJ. For now I will continue on implementing SSHv1 support.
Regards,
Jeroen
Jeroen,
I found this : http://quietcoffee.sourceforge.net/
They claim to support sshv1 and sshv2 protocol.
And then I found this : http://www.pitman.co.za/projects/jssh/index.html
I wasnt able to get this to build though because of some weird error. Just
thought of keeping you in the loop about what I found.
I also learnt that both ganymed and JSch support only sshv2 alone and they
dont support sshv1.
On the commercial products side, I found that Java SSH supports both the
versions of ssh (http://www.javassh.com/products/j2ssh-maverick)
but this is commercial and I need to buy licenses for making use of this.
Hope that is of some use.
Thanks & Regards
Krishnan Mahadevan
"All the desirable things in life are either illegal, expensive, fattening
or in love with someone else!"
…On Thu, Jan 19, 2012 at 7:53 PM, Jeroen van Erp < ***@***.*** > wrote:
Hi Krishan,
I know enough, somehow the SSH client on your CI machine is forcing SSHv1.
However SSHv1 support is not yet built, and far as I know this is not
supported in any of the open source SSH libraries. If you can find one, I'd
be very grateful and will have an easier time building it in in SSHJ. For
now I will continue on implementing SSHv1 support.
Regards,
Jeroen
---
Reply to this email directly or view it on GitHub:
https://gist.github.com/1321719
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Jeroen,
Please let me know incase you require any further information from me on this.