KasmVNC icon indicating copy to clipboard operation
KasmVNC copied to clipboard

Failed to connect from Kasm workspace

Open sjtuross opened this issue 3 years ago • 11 comments

I'm trying Kasm workspace fixed Infrastructure connecting to a remote Ubuntu 20.04 with KasmVNC installed, but it stuck on "Creating a secure connection..." along with the below KasmVNC log (the same repeating) from the remote Ubuntu. I can open KasmVNC web interface directly and it works fine.

Basically all default settings (both KasmVNC and Kasm Workspaces). Kasm Workspaces documentation doesn't mention any special setting needed. I can't figure out what's wrong or how to troubleshoot further. Could you help?

2022-12-23 18:30:00,827 [INFO] websocket 18: got client connection from 192.168.1.134
2022-12-23 18:30:00,829 [DEBUG] websocket 18: using SSL socket
2022-12-23 18:30:00,830 [DEBUG] websocket 18: X-Forwarded-For ip '192.168.1.138'
2022-12-23 18:30:00,833 [DEBUG] websocket 18: BasicAuth matched
2022-12-23 18:30:00,833 [INFO] websocket 18: /websockify request failed websocket checks, not a GET request, or missing Upgrade header
2022-12-23 18:30:00,833 [DEBUG] websocket 18: Invalid WS request, maybe a HTTP one
2022-12-23 18:30:00,833 [DEBUG] websocket 18: Requested file '///vnc.html'
2022-12-23 18:30:00,833 [DEBUG] websocket 18: file not found or insufficient permissions
2022-12-23 18:30:00,833 [INFO] websocket 18: 192.168.1.134 192.168.1.138 sjtuross "GET ///vnc.html HTTP/1.1" 404 180
2022-12-23 18:30:00,833 [DEBUG] websocket 18: No connection after handshake
2022-12-23 18:30:00,833 [DEBUG] websocket 18: handler exit

sjtuross avatar Dec 24 '22 05:12 sjtuross

After a long tedious search I found a working solution for using Nginx Proxy Manager, following settings need to set in advance tab of the NPM host file, I'm working on to get varaible or hostname support direct, but unable to fixed, Meanwhile you can use the below Settings which should be set in NPM host advance tab, make sure to enable SSl, websocket in settings.

location / { proxy_pass https://<container-ip>:6901/; proxy_http_version 1.1; proxy_set_header Authorization $http_authorization; proxy_pass_header Authorization; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; proxy_set_header Host $host; }

mddanish avatar Dec 30 '22 15:12 mddanish

@mddanish What is the container of the container-ip and port for the proxy_pass? Is it the KasmWeb Agent container?

double0cinco avatar Jan 13 '23 22:01 double0cinco

Experiencing exactly the same issue when trying to connect from Kasm Workspaces to a remote server running KasmVNC.

Everything is set up fine on the KasmVNC server side (I've even got real cert/key set up, not self-signed) and when I connect directly to the server on port 8444 (:1 is my display) everything works fine.

However when I set the same server up on Kasm Workspaces as a KasmVNC Server and add a workspace for it I get the above errors (exactly) as detailed by @sjtuross and no connection happens.

Ironic that RDP to windows servers works fine but connecting to Kasm's own remoting solution doesn't work within Kasm Workspaces - I'd have thought this would be a core use-case?

Kasm Workspaces version: 1.12.0 Kasm VNC version: 1.0.1

joevaughan avatar Mar 24 '23 22:03 joevaughan

Indeed, you did find a bug/documentation issue. We did not run into this in our testing because we were using auto-scaling and as you can see from our auto scale installation, we create a symlink https://github.com/kasmtech/workspaces-autoscale-startup-scripts/blob/d18f76b5738d6b4e1ad09013433ca15fab5ad8ae/1.12.0/linux_vms/ubuntu.sh#L33

To fix this for static servers with KasmVNC installed, just run the following command. sudo ln -s /usr/share/kasmvnc/www/index.html /usr/share/kasmvnc/www/vnc.html

We are getting ready to create a new release, we will see if we can make this symlink part of the kasmvnc installation.

mmcclaskey avatar Mar 29 '23 13:03 mmcclaskey

I was pulling my hair out with this a few weeks back and just got everything working with the above workaround. Thank you!

cwilliams001 avatar Apr 07 '23 18:04 cwilliams001

why kasmweb/ubuntu-jammy-desktop:1.13.0 still has this problem?

tony1016 avatar Apr 15 '23 13:04 tony1016

Interesting.It's conflict with Bitwarden extension

tony1016 avatar Apr 15 '23 13:04 tony1016

I think it's something wrong with the basic auth.If I use https://user:password@site pattern,then everything is ok.

tony1016 avatar Apr 15 '23 13:04 tony1016

I've upgraded to Kasm Workspaces 1.14 and I still had to create the symlink above to connect to a fixed KasmVNC server.

luc-vocab avatar Sep 02 '23 00:09 luc-vocab

@mddanish What is the container of the container-ip and port for the proxy_pass? Is it the KasmWeb Agent container?

Sorry for late reply, lost keys to account got it recovered.

The above help provided is for running direct instance images of KASM specific, not the KASM WORKSPACE as whole. So according to KASM VNC PORT needs to added, and container IP of the container.

Sorry to say I have been using Static IP for Containers, due to DHCP servers, Reverse Proxy and DNS managers.

mddanish avatar Dec 01 '23 15:12 mddanish

After a long tedious search I found a working solution for using Nginx Proxy Manager, following settings need to set in advance tab of the NPM host file, I'm working on to get varaible or hostname support direct, but unable to fixed, Meanwhile you can use the below Settings which should be set in NPM host advance tab, make sure to enable SSl, websocket in settings.

location / { proxy_pass https://<container-ip>:6901/; proxy_http_version 1.1; proxy_set_header Authorization $http_authorization; proxy_pass_header Authorization; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; proxy_set_header Host $host; }

For me, your configuration worked for me, I added additional things and with that it worked perfectly.

location / { 
  proxy_pass https://kasmweb:6901/; 
  
  proxy_http_version 1.1; 
  
  proxy_buffering off;
  proxy_set_header Authorization $http_authorization; 
  proxy_pass_header Authorization; 
    
  # WebSocket Support
  proxy_set_header Upgrade $http_upgrade; 
  proxy_set_header Connection "Upgrade"; 
  
  # Host and X headers
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header X-Forwarded-Proto $scheme;
  proxy_set_header Host $host; 
  
  # Allow large requests to support file uploads to sessions
  client_max_body_size 10M;
}

imagen

CrisPirat avatar Mar 18 '24 16:03 CrisPirat