I need to connect to a server "restricted@server.com" through a jump server "jump@server.com" to which I already have access from localhost.
I have tried,
ssh -L 12345:restricted@server.com:80 user@jump@server.com -i /path/id_rsa
In a different terminal when I now try
curl -I http://localhost:12345/home/value
I get
Server: awselb/2.0
Date: Mon, 28 Sep 2020 13:58:25 GMT
Content-Type: text/plain; charset=utf-8
Content-Length: 0
Connection: keep-alive
I already have access to jump server and the following works ,
ssh -i /path/id_rsa user@jump@server.com
curl restricted@server.com/home/value // gives me the required result
PS: I have also tried the same with Jsch
String rhost = "restricted@server.com";
int rport = 80;
url = "http://localhost:";
JSch jsch = new JSch();
jsch.addIdentity("~/.ssh/id_rsa");
String host = "jump@server.com";
String userJsch = "user";
java.util.Properties config = new java.util.Properties();
config.put("StrictHostKeyChecking", "no");
Session session = jsch.getSession(userJsch, host, 22);
session.setConfig(config);
session.connect();
int assinged_port = session.setPortForwardingL(0, rhost, rport);
url = url + assinged_port + "/";
String endpoint = url + "quote/home/value";
ResponseEntity<String> response = restTemplate.getForEntity(endpointemphasized text, String.class);
This also gives 404.