Giter VIP home page Giter VIP logo

ganymed-ssh-2's Introduction

This repository is forked from one of the automatic exports of code.google.com/p/ganymed-ssh-2 and contains updates on top of the ganymed-ssh2-262 tag. The ganymed-ssh2-262 tag was used to produce the latest public build in Maven Central, which is version 262, so builds from this repository should be version 263. The latest public build in Maven Central is available at https://search.maven.org/artifact/ch.ethz.ganymed/ganymed-ssh2/262/jar
The following features were added in version 263:
- Gradle build support.
- OSGi support.
- Message authentication: support for hmac-sha2-256 and hmac-sha2-512.
- Key exchange: support for diffie-hellman-group14-sha256, diffie-hellman-group16-sha512, and diffie-hellman-group18-sha512.

The code from this repository is used in Software AG Command Central and tested using the Command Central continuous integration. However, this code is not officially supported by Software AG. 


**********************************

This software is provided as-is and without warranty or support. It does not constitute part of the Software AG product suite. Users are free to use, fork and modify it, subject to the license agreement. While Software AG welcomes contributions, we cannot guarantee to include every contribution in the master project.

**********************************




Original content:




Ganymed SSH-2 for Java - build 261
==================================

https://code.google.com/p/ganymed-ssh-2/

Ganymed SSH-2 for Java is a library which implements the SSH-2 protocol in pure Java
(tested on J2SE 5 and 6). It allows one to connect to SSH servers from within
Java programs. It supports SSH sessions (remote command execution and shell access),
local and remote port forwarding, local stream forwarding, X11 forwarding, SCP and SFTP.
There are no dependencies on any JCE provider, as all crypto functionality is included.

There is also a basic (preliminary) SSH server implementation included.

Ganymed SSH-2 for Java was originally developed by Christian Plattner for the Ganymed
replication project and a couple of other projects at the IKS group at ETH Zurich (Switzerland).

These days, the code is maintained by Dr. Christian Plattner and David Kocher.

This distribution contains the source code, examples, javadoc and the FAQ.
It also includes a pre-compiled jar version of the library which is ready to use.

- Please read the included LICENCE.txt
- Latest changes can be found in HISTORY.txt
- The FAQ can be found in the FAQ.html

Switzerland, August 2013

ganymed-ssh-2's People

Contributors

dkocher avatar mario-pavlov avatar techcommunity avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

ganymed-ssh-2's Issues

Endless wait at KexManager

Good day!
We use ganymed-ssh-2 for Netconf protocol. In some conditions KexManager.getOrWaitForConnectionInfo fall in endless wait (3 days for example).
Why don't you use wait with sshtimeout at KexManager?

ganymed-ssh2-263 compilation issue

I downloaded the source code from https://github.com/SoftwareAG/ganymed-ssh-2/archive/refs/tags/ganymed-ssh2-263.zip and tried to compile. I am getting following error. Please help me in resolving.

[ERROR] E:\workspace-Akka-1\ganymed-ssh-2-ganymed-ssh2-263\src\main\java\ch\ethz\ssh2\Connection.java:34: error: self-closing element not allowed
[ERROR] *


[ERROR] ^
[ERROR] E:\workspace-Akka-1\ganymed-ssh-2-ganymed-ssh2-263\src\main\java\ch\ethz\ssh2\HTTPProxyData.java:11: error: reference not found
[ERROR] * @see Connection#setProxyData(ProxyData)
[ERROR] ^

java.io.IOException: Key exchange was not finished, connection is closed

I am using ganymed-ssh-2 to establish SSH2 connection. I have GIT cloned it for code browsing specifying the HEAD tag and debugging (GIT location is E:\git-clone\ganymed-ssh-2).

When I use ganymed-ssh2 ver 262, I am getting an error "Key exchange was not finished, connection is closed". I have added the following dependency in my Maven pom.xml. Why is this error reported?
<dependency> <groupId>ch.ethz.ganymed</groupId> <artifactId>ganymed-ssh2</artifactId> <version>262</version> </dependency>

In order to debug, when I specified E:\git-clone\ganymed-ssh-2\target\classes in the classpath and run it as a Java application, the issue is not seen. Note that

ganymed-ssh2-263.jar issue: Key exchange was not finished, connection is closed

Hi,
I'm facing this issue when i'm trying to connect to the host(Isilon version 9.4) was working fine with previous versions.
below attached from the server
KEX algorithms: curve25519-sha256,[email protected] ,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,ext-info-c.

Auth.log says "Unable to negotiate with x.x.x.x port 53564: no matching host key type found. Their offer: ssh-rsa,ssh-dss [preauth]"

Uploaded file is empty and with wrong name

I want to upload file from windows to Unix. File created, but it's empty.

This code creates empty 'C:\Users\myuser\test\mydir\my_test_file.sql' file in /tmp directory insted of my_test_file.sql.
Tried to move "my_test_file.sql" to working dir to use file without full path, but it creates empty "my_test_file.sql" file.
There is no any error message.

Tried for both 262 and 263 versions.

Note: At the end need to use 263 version to include key-exchange algorithms related changes.

public void test() {
    String hostName = "my-IP";
    String userName = "user";
    String password = "pass";

    try {

        Connection conn = getSSHConnection(hostName, userName, password);

        String myFile = "C:\\Users\\myuser\\test\\mydir\\my_test_file.sql";
       
        SCPClient client = conn.createSCPClient();

        client.put(myFile, new File(myFile).length(), "/tmp", "0777");
    } catch (Exception e) {
        System.out.println("ERROR: " + e.getMessage());
    }
}

Connection getSSHConnection(String hostName, String userName, final String password) throws IOException, Exception {
    Connection conn = new Connection(hostName);
    conn.connect();

    String[] strArray;
    try {
        strArray = conn.getRemainingAuthMethods(userName);
    } catch (IOException var7) {
        throw new Exception("Getting Remaining AuthMethods failed with IOException: " + var7.getMessage());
    }

    if (strArray == null) {
        System.out.println("conn.getRemainingAuthMethods returns null");

        try {
            conn.authenticateWithPassword(userName, password);
        } catch (Exception var8) {
            String warning = "";
            if (password.equals("")) {
                warning = warning + " : Warning: Implementation of this package does not allow empty passwords for authentication";
            }

            throw new Exception("Authentication with password failed: " + var8.getMessage() + warning);
        }
    } else {
        List<String> authMethods = Arrays.asList(strArray);
        if (authMethods.contains("password")) {
            if (!conn.authenticateWithPassword(userName, password)) {
                throw new Exception("Password based authentication failed.");
            }
        } else {
            if (!authMethods.contains("keyboard-interactive")) {
                throw new Exception("SSH Server doesnt support password or keyboard-interactive logins");
            }

            InteractiveCallback cb = new InteractiveCallback() {
                public String[] replyToChallenge(String name, String instruction, int numPrompts, String[] prompt, boolean[] echo) throws Exception {
                    String[] response = new String[numPrompts];

                    for (int i = 0; i < response.length; ++i) {
                        response[i] = password;
                    }

                    return response;
                }
            };
            if (!conn.authenticateWithKeyboardInteractive(userName, cb)) {
                throw new Exception("Keyboard-interactive based authentication failed.");
            }
        }
    }
    return conn;
}

openssh 8.8p1 have problem

hello, we met a problem,we upgrade our openssh server to 8.8p1,then display this error message

java.io.IOException: There was a problem while connecting to 192.168.110.171:22
ch.ethz.ssh2.Connection.connect(Connection.java:699)
com.tianque.datagroup.dataplatform.odps.util.LinuxSshUtil.callShellCommand(LinuxSshUtil.java:70)
com.tianque.datagroup.dataplatform.odps.taskflowengine.work.impl.ShellWorkNodeAction.execute(ShellWorkNodeAction.java:81)
com.tianque.datagroup.dataplatform.odps.taskflowengine.work.impl.AbstractWorkNodeAction.doAction(AbstractWorkNodeAction.java:86)
com.tianque.datagroup.dataplatform.odps.taskflowengine.service.impl.CodeWorkNodeServiceImpl.lambda$executeDebugAndGenerateLog$54(CodeWorkNodeServiceImpl.java:182)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
java.lang.Thread.run(Thread.java:748)

    at com.tianque.datagroup.dataplatform.odps.util.LinuxSshUtil.callShellCommand(LinuxSshUtil.java:93)
    at com.tianque.datagroup.dataplatform.odps.taskflowengine.work.impl.ShellWorkNodeAction.execute(ShellWorkNodeAction.java:81)
    ... 5 more

Caused by: java.io.IOException: There was a problem while connecting to 192.168.110.171:22
at ch.ethz.ssh2.Connection.connect(Connection.java:699)
at com.tianque.datagroup.dataplatform.odps.util.LinuxSshUtil.callShellCommand(LinuxSshUtil.java:70)
... 6 more
Caused by: java.io.IOException: Key exchange was not finished, connection is closed.
at ch.ethz.ssh2.transport.KexManager.getOrWaitForConnectionInfo(KexManager.java:91)
at ch.ethz.ssh2.transport.TransportManager.getConnectionInfo(TransportManager.java:229)
at ch.ethz.ssh2.Connection.connect(Connection.java:655)
... 7 more
Caused by: java.io.IOException: Cannot negotiate, proposals do not match.
at ch.ethz.ssh2.transport.KexManager.handleMessage(KexManager.java:412)
at ch.ethz.ssh2.transport.TransportManager.receiveLoop(TransportManager.java:753)
at ch.ethz.ssh2.transport.TransportManager$1.run(TransportManager.java:468)
... 1 more

no matching host key type found. Their offer: ssh-rsa
i checked the openssh website (https://www.openssh.com/legacy.html)
and change the config file,still can not work. hope check and fix.

many thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.