Enable path based NoVNC
Author Name: EOLE Team (EOLE Team) Original Redmine Issue: 3538, https://dev.opennebula.org/issues/3538 Original Date: 2015-01-30
Hello,
Actually we have the @websocketproxy.py@ listening on the port @29876@ and the NoVNC client open a WebSocket directly on that port.
I would like the client to only use the port @443@ as I already have a nginx reverse proxy.
I setup a nginx location pointing to @websocketproxy.py@:
1. /etc/nginx/sites-available/opennebula-sunstone
1. Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##
upstream sunstone {
server 127.0.0.1:9869;
}
upstream websocketproxy {
server 127.0.0.1:29876;
}
1. Port 80 redirected to SSL
server {
listen 80;
server_name nebula.example.net;
location / {
return 301 https://$host;
}
}
server {
listen 443 default_server;
listen [::]:443 default_server ipv6only=on;
ssl on;
ssl_certificate /etc/nginx/ssl/server.crt;
ssl_certificate_key /etc/nginx/ssl/server.key;
root /usr/share/nginx/html;
index index.html index.htm;
server_name nebula.example.net;
access_log /var/log/nginx/opennebula-sunstone-access.log;
error_log /var/log/nginx/opennebula-sunstone-error.log;
# To upload ISO files, increase for VMs images
client_max_body_size 1G;
location / {
include proxy_params;
proxy_pass http://sunstone;
}
location /websockify {
proxy_pass http://websocketproxy;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
In NoVNC:
- if the port is not set(1), it use the same as the current connection
- the @path@ parameter(2) is used as the full path of the resource
For what I see, this would require:
- add a @vnc_proxy_path@ to customize the NoVNC @path@ parameter if wanted
- add a @vnc_proxy_listen@ to customize the @websocketproxy.py@ @source_addr@ with default to @0.0.0.0@
- add a flag to disable passing the @vnc_proxy_port@ as @port=@ parameter to NoVNC
Regards.
(1) source:src/sunstone/public/bower_components/no-vnc/vnc_auto.html#L168 (2) source:src/sunstone/public/bower_components/no-vnc/vnc_auto.html#L185
Original Redmine Comment Author Name: Nico Schottelius (Nico Schottelius) Original Date: 2015-03-16T15:45:20Z
We are also very much interested in this feature, as we are running opennebula behind nginx for ssl encryption.
Original Redmine Comment Author Name: Ruben S. Montero (@rsmontero) Original Date: 2015-03-16T16:44:27Z
Moving this to 4.14, thanks for the feedback
Original Redmine Comment Author Name: Roy Keene (Roy Keene) Original Date: 2015-03-30T18:34:13Z
I currently do this with HAProxy.
cat <<\_EOF_ > /etc/haproxy.cfg
global
user nobody
maxconn 4096
ssl-default-bind-options no-sslv3
ssl-default-bind-ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS:!SSLv3:!SSLv2
ssl-default-server-options no-sslv3
ssl-default-server-ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS:!SSLv3:!SSLv2
defaults
mode http
timeout connect 5000ms
timeout client 50000ms
timeout server 50000ms
option http-server-close
frontend sunstone-vnc-in
bind *:80
acl is_websocket hdr(Upgrade) -i WebSocket
use_backend vncwebsockets if is_websocket
default_backend sunstone
frontend sunstone-vnc-tls-in
bind *:443 ssl crt /dashboard/ssl/combined
acl is_websocket hdr(Upgrade) -i WebSocket
use_backend vncwebsockets if is_websocket
default_backend sunstone
frontend oned-tls-in
bind *:2634 ssl crt /dashboard/ssl/combined
default_backend oned
backend sunstone
server localhost-sunstone 127.0.0.1:9869 maxconn 128
backend vncwebsockets
server localhost-vncwebsockets 127.0.0.1:29876
backend oned
server localhost-oned 127.0.0.1:2633
_EOF_
haproxy -f /etc/haproxy.cfg -dM &
Patch attached for using the same port and hostname (always)
Original Redmine Comment Author Name: Nico Schottelius (Nico Schottelius) Original Date: 2015-05-09T20:12:35Z
I've just checked which errors we actually get when trying to use nginx + ssl + sunstone. When pressing the vnc button, chromium shows the following errors:
Mixed Content: The page at 'https://our-hosting-server01.ungleich.ch/' was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint 'ws://localhost:17523/'. This request has been blocked; this endpoint must be available over WSS.
util.js:138 New state 'loaded', was 'disconnected'. Msg: noVNC ready: native WebSockets, canvas rendering
util.js:138 New state 'connect', was 'loaded'.
websock.js:285 Mixed Content: The page at 'https://our-hosting-server01.ungleich.ch/' was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint 'ws://localhost:17523/'. This request has been blocked; this endpoint must be available over WSS.
websock.js:285 Mixed Content: The page at 'https://our-hosting-server01.ungleich.ch/' was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint 'ws://localhost:17523/'. This request has been blocked; this endpoint must be available over WSS.
util.js:139 Skipping unsupported WebSocket binary sub-protocol
websock.js:333 Mixed Content: The page at 'https://our-hosting-server01.ungleich.ch/' was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint 'ws://our-hosting-server01.ungleich.ch:29876/?token=t8opcrssdsoyutpjnh0q'. This request has been blocked; this endpoint must be available over WSS.
websock.js:333 Uncaught SecurityError: Failed to construct 'WebSocket': An insecure WebSocket connection may not be initiated from a page loaded over HTTPS.
Is there any progress on supporting this?
Original Redmine Comment Author Name: Perry Manuk (Perry Manuk) Original Date: 2016-11-22T22:23:13Z
would like to add a +1 to this
Original Redmine Comment Author Name: Arnaud Abélard (Arnaud Abélard) Original Date: 2017-08-17T11:44:14Z
5.4 is out and this still doesn't seem to be possible. We also would like this to be implemented.
Any news?
I'm also very much interested in this feature.
Everybody wants to proxy Sunstone with VNCproxy on a single port I think. +1 for this (please Rubensito don't pospone again ;-P )
This functionality will be present in 5.6 release.
Thanks @le-garff-yoann for your work.