Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

登录本地端口时出错 #397

Open
islercn opened this issue Oct 29, 2024 · 0 comments
Open

登录本地端口时出错 #397

islercn opened this issue Oct 29, 2024 · 0 comments

Comments

@islercn
Copy link

islercn commented Oct 29, 2024

服务器是ubuntu 22.04.5,webssh 1.6.2,python 3.10.12

服务器上还有个frp服务端转发内网服务器的ssh,比如1234号端口指向服务器A,为了安全,我想屏蔽外部对1234端口的访问,然后让webssh通过访问localhost:1234这样的形式访问服务器A,访问是可以访问,但是经常会先提示几次Websocket authentication failed.才能成功连接,次数不固定,极个别情况下一次成功,不用localhost似乎没有这个问题,出错时服务器会提示:

[I 241029 15:36:58 handler:452] Connecting to localhost:1234
[I 241029 15:36:58 transport:1893] Connected (version 2.0, client OpenSSH_8.9p1)
/usr/local/lib/python3.10/dist-packages/paramiko/client.py:889: UserWarning: Unknown ssh-ed25519 host key for [localhost]:1234: b'86322bb70dee802d142188aa94952bf7'
warnings.warn(
[I 241029 15:36:58 handler:86] Trying password authentication
[I 241029 15:36:58 transport:1893] Authentication (password) successful!
[I 241029 15:36:58 web:2344] 200 POST / (ClientIP) 411.10ms
[I 241029 15:36:58 web:2344] 101 GET /ws?id=4nLBpLinQMnXioKS19j6Dzyj7k_0poDkkNV6sgKnj34 (ClientIP2) 0.71ms
[I 241029 15:36:58 handler:537] Connected from ClientIP2:65535
[I 241029 15:36:58 handler:597] Disconnected from ClientIP2:65535
[W 241029 15:37:01 worker:33] Recycling worker 4nLBpLinQMnXioKS19j6Dzyj7k_0poDkkNV6sgKnj34
[I 241029 15:37:01 worker:123] Closing worker 4nLBpLinQMnXioKS19j6Dzyj7k_0poDkkNV6sgKnj34 with reason: worker recycled
[I 241029 15:37:01 worker:131] Connection to localhost:1234 lost

如果成功登录服务器会提示:

[I 241029 15:37:51 handler:452] Connecting to localhost:1234
[I 241029 15:37:51 transport:1893] Connected (version 2.0, client OpenSSH_8.9p1)
[I 241029 15:37:51 handler:86] Trying password authentication
[I 241029 15:37:51 transport:1893] Authentication (password) successful!
[I 241029 15:37:51 web:2344] 200 POST / (ClientIP) 373.33ms
[I 241029 15:37:51 web:2344] 101 GET /ws?id=UGm0XuHcwXRrPhcavS7-dCZQ8BoZ17bcqlC7gJ4vTeE (ClientIP) 0.76ms
[I 241029 15:37:51 handler:537] Connected from ClientIP:65535

同时,如果指定一个错误端口,服务器会报错:

[I 241029 15:35:05 handler:452] Connecting to localhost:55555
[E 241029 15:35:05 handler:516] Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/webssh/handler.py", line 455, in ssh_connect
ssh.connect(*args, timeout=options.timeout)
File "/usr/local/lib/python3.10/dist-packages/paramiko/client.py", line 409, in connect
raise NoValidConnectionsError(errors)
paramiko.ssh_exception.NoValidConnectionsError: [Errno None] Unable to connect to port 55555 on 127.0.0.1
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/webssh/handler.py", line 514, in post
worker = yield future
File "/usr/local/lib/python3.10/dist-packages/tornado/gen.py", line 767, in run
value = future.result()
File "/usr/lib/python3.10/concurrent/futures/_base.py", line 451, in result
return self.__get_result()
File "/usr/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
raise self._exception
File "/usr/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.10/dist-packages/webssh/handler.py", line 457, in ssh_connect
raise ValueError('Unable to connect to {}:{}'.format(*dst_addr))
ValueError: Unable to connect to localhost:55555

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant