I'm trying to implement a way in java to do SCP operations on a remote server via java through an http-proxy. To do that, I use JGit (as suggested by the apache mina developer due to the implementation of a proxy function). To get to the remote host, I need a proxy tunnel, which I already use. When I'm trying to do scp that way via "ProxyCommand" in a shell it works as intended:
Now I need to find a way to give JGit a ProxyCommand (Proxy is running locally on port 7084):
proxytunnel -p localhost:7084 -d host_ip:22 -v
I already tried adding it to the ".ssh/config" file like this:
Host host_ip
HostName host_ip
ProxyCommand proxytunnel -p localhost:7084 -d host_ip -v
but it seems like JGit ignores that.
here is my code for more context:
JGitSshClient client = (JGitSshClient) ClientBuilder.builder().factory(JGitSshClient::new).build();
System.out.println("");
System.out.println("==================Starten client==================");
client.start();
System.out.println("");
System.out.println("==================Proxy einbinden==================");
client.setProxyDatabase(remote -> new ProxyData(new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyHost, proxyPort)), proxyUser, proxyPass));
System.out.println("");
System.out.println("==================Verbindung==================");
HostConfigEntry host = new HostConfigEntry("", hostname, 22, username);
try (ClientSession session = client.connect(host).verify().getSession()){
//SCP Operations
}
does anyone else have an idea?