huashengdun / webssh

:seedling: Web based ssh client
https://webssh.huashengdun.org/
MIT License
4.48k stars 1.26k forks source link

Problem when used on remote server : Recycling/closing worker #235

Open rv2931 opened 3 years ago

rv2931 commented 3 years ago

Hello I'm trying to deploy webssh in docker-compose instance. When I try it locally, everything is working (I'm on Windows/Docker desktop) but when I deploy the same docker-compose file on a remote serveur (Linux, there is a proxy configured on the host, ...) webssh displays correctly the login page but when I enter user/password and connect nothing happens. there is no error message At the beginning, even on localhost I had this behaviour but I solved it by adding "--policy=autoadd" options (I'm only using user/password authentification). But adding the same option on my remote server didn't solve the problem So I changed run.py options to add info : CMD ["python", "run.py", "--policy=autoadd", "--logging=debug", "--log-file-prefix=main.log"]

I think that my docker-compose file is useless to investigate

the only thing that coulb be tricky is the fact that my host needs a proxy but in docker-compose environment, between 2 docker services, I don't see why there would be a problem... I don't really see what could cause the problem. authentification is OK and then connexion is closed

Thank you in advance RV

Here you can find the logs :

[D 210825 11:32:42 handler:223] netloc: myserver.domain [D 210825 11:32:42 handler:226] host: myserver.domain [D 210825 11:32:42 handler:409] ('mydockerservice', 22, 'user', 'password', None) [I 210825 11:32:42 handler:446] Connecting to mydockerservice:22 [D 210825 11:32:42 transport:1819] starting thread (client mode): 0x7f8ebb50 [D 210825 11:32:42 transport:1819] Local version/idstring: SSH-2.0-paramiko_2.7.2 [D 210825 11:32:42 transport:1819] Remote version/idstring: SSH-2.0-OpenSSH_7.9p1 Debian-10+deb10u2 [I 210825 11:32:42 transport:1819] Connected (version 2.0, client OpenSSH_7.9p1) [D 210825 11:32:42 transport:1819] kex algos:['curve25519-sha256', 'curve25519-sha256@libssh.org', 'ecdh-sha2-nistp256', 'ecdh-sha2-nistp384', 'ecdh-sha2-nistp521', 'diffie-hellman-group-exchange-sha256', 'diffie-hellman-group16-sha512', 'diffie-hellman-group18-sha512', 'diffie-hellman-group14-sha256', 'diffie-hellman-group14-sha1'] server key:['rsa-sha2-512', 'rsa-sha2-256', 'ssh-rsa', 'ecdsa-sha2-nistp256', 'ssh-ed25519'] client encrypt:['chacha20-poly1305@openssh.com', 'aes128-ctr', 'aes192-ctr', 'aes256-ctr', 'aes128-gcm@openssh.com', 'aes256-gcm@openssh.com'] server encrypt:['chacha20-poly1305@openssh.com', 'aes128-ctr', 'aes192-ctr', 'aes256-ctr', 'aes128-gcm@openssh.com', 'aes256-gcm@openssh.com'] client mac:['umac-64-etm@openssh.com', 'umac-128-etm@openssh.com', 'hmac-sha2-256-etm@openssh.com', 'hmac-sha2-512-etm@openssh.com', 'hmac-sha1-etm@openssh.com', 'umac-64@openssh.com', 'umac-128@openssh.com', 'hmac-sha2-256', 'hmac-sha2-512', 'hmac-sha1'] server mac:['umac-64-etm@openssh.com', 'umac-128-etm@openssh.com', 'hmac-sha2-256-etm@openssh.com', 'hmac-sha2-512-etm@openssh.com', 'hmac-sha1-etm@openssh.com', 'umac-64@openssh.com', 'umac-128@openssh.com', 'hmac-sha2-256', 'hmac-sha2-512', 'hmac-sha1'] client compress:['none', 'zlib@openssh.com'] server compress:['none', 'zlib@openssh.com'] client lang:[''] server lang:[''] kex follows?False [D 210825 11:32:42 transport:1819] Kex agreed: curve25519-sha256@libssh.org [D 210825 11:32:42 transport:1819] HostKey agreed: ssh-ed25519 [D 210825 11:32:42 transport:1819] Cipher agreed: aes128-ctr [D 210825 11:32:42 transport:1819] MAC agreed: hmac-sha2-256 [D 210825 11:32:42 transport:1819] Compression agreed: none [D 210825 11:32:42 transport:1819] kex engine KexCurve25519 specified hash_algo [D 210825 11:32:42 transport:1819] Switch to new keys ... [I 210825 11:32:42 handler:86] Trying password authentication [D 210825 11:32:42 transport:1819] userauth is OK [I 210825 11:32:42 transport:1819] Authentication (password) successful! [D 210825 11:32:42 channel:1212] [chan 0] Max packet in: 32768 bytes [D 210825 11:32:42 transport:1819] Received global request "hostkeys-00@openssh.com" [D 210825 11:32:42 transport:1819] Rejecting "hostkeys-00@openssh.com" global request from server. [D 210825 11:32:42 channel:1212] [chan 0] Max packet out: 32768 bytes [D 210825 11:32:42 transport:1819] Secsh channel 0 opened. [D 210825 11:32:42 channel:1212] [chan 0] Sesch channel 0 request ok [D 210825 11:32:42 channel:1212] [chan 0] Sesch channel 0 request ok [D 210825 11:32:42 channel:1212] [chan 1] Max packet in: 32768 bytes [D 210825 11:32:42 channel:1212] [chan 1] Max packet out: 32768 bytes [D 210825 11:32:42 transport:1819] Secsh channel 1 opened. [D 210825 11:32:42 channel:1212] [chan 1] Sesch channel 1 request ok [D 210825 11:32:42 channel:1212] [chan 1] Sesch channel 1 request ok [D 210825 11:32:42 channel:1212] [chan 1] EOF sent (1) [D 210825 11:32:42 channel:1212] [chan 1] EOF received (1) [D 210825 11:32:42 handler:435] '$SHELL -ilc "locale charmap"' => b'ANSI_X3.4-1968\r\n' [I 210825 11:32:42 web:2250] 200 POST / (172.16.84.54) 204.91ms [W 210825 11:32:42 web:2250] 400 GET /ws?id=140391744658640 (172.16.84.54) 0.36ms [D 210825 11:32:42 websocket:240] Can "Upgrade" only to "WebSocket". [W 210825 11:32:45 worker:28] Recycling worker 140391744658640 [I 210825 11:32:45 worker:115] Closing worker 140391744658640 with reason: worker recycled [D 210825 11:32:45 channel:1212] [chan 0] EOF sent (0) [I 210825 11:32:45 worker:122] Connection to siam:22 lost [D 210825 11:32:45 worker:125] {} [D 210825 11:32:45 transport:1819] EOF in transport thread

huashengdun commented 3 years ago

[W 210825 11:32:42 web:2250] 400 GET /ws?id=140391744658640 (172.16.84.54) 0.36ms [D 210825 11:32:42 websocket:240] Can "Upgrade" only to "WebSocket".

The tornado server did not receive the "Upgrade" header, so the websocket connection was failed. It is probably a proxy problem.

rv2931 commented 3 years ago

Hello Me again. What could be the proxy problem ? something to configure in webssh config ? My serveur has a proxy configured in /etc/environment http_proxy and HTTP_PROXY for compliance I had to configured Docker in addition via /etc/systemd/system/docker.service with Environment Is there something equivalent for webssh ?