我需要连接到服务器”[电子邮件保护]“通过跳转服务器”[电子邮件保护]“我已经可以从本地主机访问它。
我努力了,
ssh -L 12345:[email protected]:80 user@[email protected] -i /path/id_rsa
当我现在尝试在不同的终端
curl -I http://localhost:12345/home/value
我明白了
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
我已经可以访问跳转服务器并且执行以下操作,
ssh -i /path/id_rsa user@[email protected]
curl [email protected]/home/value // gives me the required result
PS:我也尝试过和 Jsch 做同样的尝试
String rhost = "[email protected]";
int rport = 80;
url = "http://localhost:";
JSch jsch = new JSch();
jsch.addIdentity("~/.ssh/id_rsa");
String host = "[email protected]";
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);
这也导致 404。