ssh-proxy

Pure Java implementation to tunnel to TCP endpoints through SSH

License

License

GroupId

GroupId

de.cronn
ArtifactId

ArtifactId

ssh-proxy
Last Version

Last Version

1.6
Release Date

Release Date

Type

Type

jar
Description

Description

ssh-proxy
Pure Java implementation to tunnel to TCP endpoints through SSH
Project URL

Project URL

https://github.com/cronn/ssh-proxy
Source Code Management

Source Code Management

https://github.com/cronn/ssh-proxy

Download ssh-proxy

How to add to project

<!-- https://jarcasting.com/artifacts/de.cronn/ssh-proxy/ -->
<dependency>
    <groupId>de.cronn</groupId>
    <artifactId>ssh-proxy</artifactId>
    <version>1.6</version>
</dependency>
// https://jarcasting.com/artifacts/de.cronn/ssh-proxy/
implementation 'de.cronn:ssh-proxy:1.6'
// https://jarcasting.com/artifacts/de.cronn/ssh-proxy/
implementation ("de.cronn:ssh-proxy:1.6")
'de.cronn:ssh-proxy:jar:1.6'
<dependency org="de.cronn" name="ssh-proxy" rev="1.6">
  <artifact name="ssh-proxy" type="jar" />
</dependency>
@Grapes(
@Grab(group='de.cronn', module='ssh-proxy', version='1.6')
)
libraryDependencies += "de.cronn" % "ssh-proxy" % "1.6"
[de.cronn/ssh-proxy "1.6"]

Dependencies

runtime (3)

Group / Artifact Type Version
org.slf4j : slf4j-api jar 1.7.30
com.jcraft : jsch jar 0.1.55
com.jcraft : jzlib jar 1.1.3

Project Modules

There are no modules declared in this project.

Build Status Maven Central Apache 2.0 Coverage Status

SSH Proxy

A pure Java implementation for SSH port tunneling that is able to understand OpenSSH configurations which involve multiple hops to reach a target host. This library essentially combines JSch with the ability to understand ProxyJump or ProxyCommand configurations in your local ~/.ssh/config file.

Usage

Add the following Maven dependency to your project:

<dependency>
    <groupId>de.cronn</groupId>
    <artifactId>ssh-proxy</artifactId>
    <version>1.6</version>
</dependency>

Example

# cat ~/.ssh/config

Host jumpHost1
    User my-user
    HostName jumphost1.my.domain

Host jumpHost2
    User other-user
    ProxyJump jumpHost1

Host targetHost
    ProxyCommand ssh -q -W %h:%p jumpHost2
try (SshProxy sshProxy = new SshProxy()) {
    int targetPort = 1234;
    int port = sshProxy.connect("jumpHost2", "targetHost", targetPort);
    try (Socket s = new Socket(SshProxy.LOCALHOST, port)) {
        OutputStream out = s.getOutputStream();
        InputStream in = s.getInputStream();
        // ...
    }
}

Dependencies

de.cronn

cronn GmbH

wir entwickeln software_

Versions

Version
1.6
1.5
1.4
1.3
1.2