ngorkd-ssh客户端错误:key_exchange_identification:连接被远程主机关闭



我正试图在EC2上设置自己的ngrok服务器,并试图在另一台运行ngrok客户端的机器上通过ssh连接。

如何运行自己的ngrokd服务器

https://github.com/Launch-with-1-Click/aws-ngrok

服务器

sudo ngrokd -tlsKey=server.key -tlsCrt=server.crt -domain="example.com" -httpAddr=":8880" 

客户端

server_addr: example.com:4443
trust_host_root_certs: false 
tunnels:
test:
proto:
tcp: 22
$./bin/ngrok -config=cf.yml -log=ngrok.log start test
Tunnel Status                Online
Forwarding                    tcp://example.com:39695 - 127.0.0.1:22 

但是当从另一台机器连接ssh客户端时

ssh  ubuntu@[IP of example.com] -p 39695
kex_exchange_identification: Connection closed by remote host
Connection closed by [IP] port 39695                   

在服务器上登录

[05:55:09 UTC 2022/02/14] [INFO] (ngrok/log.(*PrefixLogger).Info:83) [pub:37dfdd2b] [tcp://example.com:36683] New connection from XXX.XX.127.107:52356
[05:55:09 UTC 2022/02/14] [INFO] (ngrok/log.(*PrefixLogger).Info:83)  Got proxy connection pxy:42de6dda
[05:55:09 UTC 2022/02/14] [DEBG] (ngrok/log.(*PrefixLogger).Debug:79) [pxy:42de6dda] [bdb21c9c9a5c5875a5d7d2e8fb5a930b] [tcp://example.com:36683] Writing message: {"Type":"StartProxy","Payload":{"Url":"tcp://example.com:36683","ClientAddr":"XXX.XX.127.107:52356"}}
[05:55:09 UTC 2022/02/14] [WARN] (ngrok/log.(*PrefixLogger).Warn:87) [pxy:42de6dda] [bdb21c9c9a5c5875a5d7d2e8fb5a930b] [tcp://example.com:36683] Failed to write StartProxyMessage: write tcp 172.31.38.231:4443->XXX.XX.127.107:40774: i/o timeout, attempt 0
[05:55:09 UTC 2022/02/14] [DEBG] (ngrok/log.(*PrefixLogger).Debug:79) [ctl:51136f2e] [bdb21c9c9a5c5875a5d7d2e8fb5a930b] No proxy in pool, requesting proxy from control . . .
[05:55:09 UTC 2022/02/14] [DEBG] (ngrok/log.(*PrefixLogger).Debug:79) [ctl:51136f2e] [bdb21c9c9a5c5875a5d7d2e8fb5a930b] Writing message: {"Type":"ReqProxy","Payload":{}}
[05:55:09 UTC 2022/02/14] [INFO] (ngrok/log.(*PrefixLogger).Info:83) [tun:1a5638bf] New connection from XXX.XX.127.107:40784
[05:55:09 UTC 2022/02/14] [DEBG] (ngrok/log.(*PrefixLogger).Debug:79) [tun:1a5638bf] Waiting to read message
[05:55:09 UTC 2022/02/14] [DEBG] (ngrok/log.(*PrefixLogger).Debug:79) [tun:1a5638bf] Reading message with length: 77
[05:55:09 UTC 2022/02/14] [DEBG] (ngrok/log.(*PrefixLogger).Debug:79) [tun:1a5638bf] Read message {"Type":"RegProxy","Payload":{"ClientId":"bdb21c9c9a5c5875a5d7d2e8fb5a930b"}}
[05:55:09 UTC 2022/02/14] [INFO] (ngrok/log.(*PrefixLogger).Info:83) [pxy:1a5638bf] Renamed connection tun:1a5638bf
[05:55:09 UTC 2022/02/14] [INFO] (ngrok/log.(*PrefixLogger).Info:83) [pxy:1a5638bf] Registering new proxy for bdb21c9c9a5c5875a5d7d2e8fb5a930b
[05:55:09 UTC 2022/02/14] [INFO] (ngrok/log.(*PrefixLogger).Info:83) [pxy:1a5638bf] [bdb21c9c9a5c5875a5d7d2e8fb5a930b] Registered
[05:55:09 UTC 2022/02/14] [INFO] (ngrok/log.(*PrefixLogger).Info:83)  Got proxy connection pxy:1a5638bf
[05:55:09 UTC 2022/02/14] [DEBG] (ngrok/log.(*PrefixLogger).Debug:79) [pxy:1a5638bf] [bdb21c9c9a5c5875a5d7d2e8fb5a930b] [tcp://example.com:36683] Writing message: {"Type":"StartProxy","Payload":{"Url":"tcp://example.com:36683","ClientAddr":"XXX.XX.127.107:52356"}}
[05:55:09 UTC 2022/02/14] [INFO] (ngrok/log.(*PrefixLogger).Info:83) [pub:37dfdd2b] [tcp://example.com:36683] Joined with connection pxy:1a5638bf
[05:55:09 UTC 2022/02/14] [DEBG] (ngrok/log.(*PrefixLogger).Debug:79) [ctl:51136f2e] [bdb21c9c9a5c5875a5d7d2e8fb5a930b] Writing message: {"Type":"ReqProxy","Payload":{}}
[05:55:10 UTC 2022/02/14] [DEBG] (ngrok/log.(*PrefixLogger).Debug:79) [pxy:1a5638bf] [bdb21c9c9a5c5875a5d7d2e8fb5a930b] [tcp://example.com:36683] Copied 0 bytes to pub:37dfdd2b
[05:55:10 UTC 2022/02/14] [DEBG] (ngrok/log.(*PrefixLogger).Debug:79) [pxy:1a5638bf] [bdb21c9c9a5c5875a5d7d2e8fb5a930b] [tcp://example.com:36683] Closing
[05:55:10 UTC 2022/02/14] [WARN] (ngrok/log.(*PrefixLogger).Warn:87) [pub:37dfdd2b] [tcp://example.com:36683] Copied 41 bytes to pxy:1a5638bf before failing with error read tcp 172.31.38.231:36683->XXX.XX.127.107:52356: use of closed network connection
[05:55:10 UTC 2022/02/14] [DEBG] (ngrok/log.(*PrefixLogger).Debug:79) [pub:37dfdd2b] [tcp://example.com:36683] Closing

我错过了什么。需要帮助

在Linux上安装OpenSSH服务器以防止端口22连接失败

sudo apt install openssh-server

最新更新