mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-10 04:06:47 +00:00
feat(console): the VNC console uses the panel's own address
The console pages connect to /novncd/ on the address, scheme and port the page itself was loaded from; nginx proxies it to novncd, which listens on the loopback only. There is nothing to configure: the console works on HTTPS (wss), behind another proxy and on any published port. Before, the page connected to WS_PUBLIC_HOST/PORT/PATH, port 6080 by default: straight to novncd, past nginx and without TLS, so an HTTPS panel and a Docker container published on another port had no console until the public port was set by hand, and novncd listened on every interface. Gone: WS_PUBLIC_PORT, WS_PUBLIC_HOST, WS_PUBLIC_PATH and WS_CERT, the installer's two public console questions and its 6080 firewall rule, the Docker image's WS_PUBLIC_PORT and its init script lines, the manual install's firewall rule for 6080 and nginx's unused /websockify location. WS_HOST defaults to 127.0.0.1. A VM with a QEMU websocket port is still reached on that port of the panel's host name (left for a separate decision).
This commit is contained in:
parent
82af555d45
commit
68b104dfe4
14 changed files with 43 additions and 164 deletions
|
|
@ -307,14 +307,10 @@ install_webvirtcloud () {
|
|||
# settings.py reads data/secret_key, so the key persists across re-runs.
|
||||
tzone_escape="$(echo -n "$tzone"|sed -e 's/[](){}<>=:\!\?\+\|\/\&$*.^[]/\\&/g')"
|
||||
novncd_port_escape="$(echo -n "$novncd_port"|sed -e 's/[](){}<>=:\!\?\+\|\/\&$*.^[]/\\&/g')"
|
||||
novncd_public_port_escape="$(echo -n "$novncd_public_port"|sed -e 's/[](){}<>=:\!\?\+\|\/\&$*.^[]/\\&/g')"
|
||||
novncd_host_escape="$(echo -n "$novncd_host"|sed -e 's/[](){}<>=:\!\?\+\|\/\&$*.^[]/\\&/g')"
|
||||
|
||||
#TODO escape SED delimiter in variables
|
||||
sed -i "s|^\\(TIME_ZONE = \\).*|\\1$tzone_escape|" "$APP_PATH/webvirtcloud/settings.py"
|
||||
sed -i "s|^\\(WS_PORT = \\).*|\\1$novncd_port_escape|" "$APP_PATH/webvirtcloud/settings.py"
|
||||
sed -i "s|^\\(WS_PUBLIC_PORT = \\).*|\\1$novncd_public_port_escape|" "$APP_PATH/webvirtcloud/settings.py"
|
||||
sed -i "s|^\\(WS_HOST = \\).*|\\1\'$novncd_host_escape\'|" "$APP_PATH/webvirtcloud/settings.py"
|
||||
|
||||
# set CSRF TRUSTED ORIGINS
|
||||
host_ip="'http://127.0.0.1', "
|
||||
|
|
@ -362,12 +358,8 @@ install_webvirtcloud () {
|
|||
|
||||
set_firewall () {
|
||||
if test -n "$(command -v firewall-cmd)" && test "$(firewall-cmd --state)" == "running"; then
|
||||
echo "* Configuring firewall to allow HTTP & novnc traffic."
|
||||
echo "* Configuring firewall to allow HTTP traffic."
|
||||
log "firewall-cmd --zone=public --add-port=http/tcp --permanent"
|
||||
log "firewall-cmd --zone=public --add-port=$novncd_port/tcp --permanent"
|
||||
#firewall-cmd --zone=public --add-port=$novncd_port/tcp --permanent
|
||||
log "firewall-cmd --zone=public --add-port=$novncd_public_port/tcp --permanent"
|
||||
#firewall-cmd --zone=public --add-port=$novncd_public_port/tcp --permanent
|
||||
log "firewall-cmd --reload"
|
||||
#firewall-cmd --reload
|
||||
fi
|
||||
|
|
@ -536,22 +528,6 @@ fi
|
|||
echo " Setting novnc service port $novncd_port"
|
||||
echo ""
|
||||
|
||||
echo -n " Q. NOVNC public port number for reverse proxy(e.g: 80 or 443)?(Default: 6080) "
|
||||
read -r novncd_public_port
|
||||
if [ -z "$novncd_public_port" ]; then
|
||||
readonly novncd_public_port=6080
|
||||
fi
|
||||
echo " Setting novnc public port $novncd_public_port"
|
||||
echo ""
|
||||
|
||||
echo -n " Q. NOVNC host listen ip?(Default: 0.0.0.0) "
|
||||
read -r novncd_host
|
||||
if [ -z "$novncd_host" ]; then
|
||||
readonly novncd_host="0.0.0.0"
|
||||
fi
|
||||
echo " Setting novnc host ip $novncd_host"
|
||||
echo ""
|
||||
|
||||
echo "========="
|
||||
echo "distro: ${distro}"
|
||||
echo "========="
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue