1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-08 19:26:48 +00:00
Commit graph

11 commits

Author SHA1 Message Date
catborise
1cb1f8ac6a refactor(console): the console pages on Bootstrap classes instead of their own style blocks
The console pages carried style blocks for what Bootstrap 5.3 has:
- the page's column (flex, no padding, a #494949 background) is
  d-flex flex-column p-0 bg-dark; its height stays 100dvh inline, as
  vh-100 would run under a phone browser's bar;
- the VNC screen and the serial terminal fill the rest with
  flex-grow-1, the screen overflow-hidden, the terminal bg-black; their
  min-height: 0 stays inline (Bootstrap has no class for it);
- the rule centring the VNC canvas goes: noVNC centres its own canvas
  and draws its own background.
The unused main_container id goes with its style block.
2026-10-27 19:56:39 +03:00
catborise
2b54198965 feat(console): the serial console page on the panel's bar; a taken-over user learns by whom
The serial page had a white strip of inline styles with an untranslated
status and a browser-default button above the terminal, sent input while
disconnected, sized the terminal only on window load and resize, and left
the keyboard elsewhere after the key menu. When a superuser opened a
console open in another window, its user saw "[An administrator opened
this console]" and a plain "disconnected".

- console-xterm.html shares the VNC page's bar: status badge (Connecting,
  Connected, Disconnected, the server's refusal), Disconnect, then
  Reconnect (a new page for a new token). The script is
  static/js/console_serial.js; the token reaches it as json_script data.
- The terminal takes the keyboard on connect and after the key menu; input
  is sent only while connected; it fits its box on connect and whenever
  the box changes size (ResizeObserver).
- A console that writes nothing yet gets a dim local hint: press Enter.
- socketiod sends the displaced client "taken_over" with the superuser's
  username; the page shows "Taken over by <name>" in the bar and the
  terminal. The superuser is not asked first (owner's decision).
- Fullscreen uses the shared console_keys.js handler (keyboard lock).
2026-10-27 08:12:33 +03:00
catborise
3a560e9f85 fix(console): a console that cannot open says why and starts no client
A stopped VM, an unreachable or unsupported console and a disabled serial
console rendered the lite VNC page under the error: it connected to novncd
anyway, showed "Something went wrong" and offered keys, Scale and Send
CtrlAltDel for a console that was not there. A refused console was a bare
text 403 inside the popup.

- console-error.html: the console shell with the VM's name and the reason,
  no menu and no script; a refused or unknown VM gets it with 403 and
  without the VM's name, as before for everyone (no superuser exception).
- The view signs the console token only for a page that connects.
- console-menu.html: the Send key(s) menu and Fullscreen, included by the
  console pages; the serial page lists only the keys it sends (the VNC
  groups did nothing there).
- Every console window is titled "<VM> - Console".
- The lite page no longer takes a VNC password from its link.
- The shell lost its 850px x 600px corner radius (a grey arc on the
  serial and error pages) and spans the window (container-fluid).
2026-10-27 07:58:51 +03:00
catborise
1fac3de23c fix(console): serial sessions start under a lock and say why they are refused
- socketiod's handlers run on their own threads. A connection is now
  admitted under a lock, so two at once can no longer both open a VM's
  console or pass the session cap. A session's terminal is used and closed
  only under its own lock while it is open: a closed descriptor's number,
  taken again by a new session, never receives another session's input
  or gives it the other's output.
- A refused connection says why: serial console off, the link expired,
  the VM's console open in another window, too many consoles. The page
  shows it instead of "refused".
- The page no longer retries on its own with a token that has expired
  after two minutes; Reconnect loads a new page. Input the browser cannot
  encode no longer raises in the daemon.
2026-10-26 19:46:41 +03:00
catborise
abc6f2063d fix(console): console pages render in standards mode and fit the window
console-base.html had no doctype, so the noVNC and serial console pages
rendered in quirks mode, where body and #main_container got their height
from the viewport. The console area overflowed the window: the full noVNC
page scrolled by the navbar height, the lite page's canvas and the serial
terminal ran below the bottom edge, hiding the last rows.

With the doctype, #main_container is a viewport-high flex column and the
console area (the noVNC container or the terminal) takes the space below
the navbar. Without that, the lite page's canvas collapsed to 0x0.
2026-10-19 09:31:37 +03:00
catborise
d37aa42392 feat(console): a working serial console
The xterm console never connected: socketiod expected a different token
format, its worker had no compute credentials, one global console was
shared by every client and its output broadcast to all of them, and the
Docker image did not run socketiod at all.

- console/tokens.py: one authorize() for noVNC and socketiod; the signed
  token is the only credential, checked at connect time.
- socketiod: one pty worker per client (consolecallback with the
  instance id), one session per VM, a session cap, input and resize
  checked; the parent never opens libvirt. The engine.io same-origin
  check is on.
- consolecallback: opens the console with the compute's credentials and
  exits with a message when it cannot.
- Docker runs socketiod as a runit service; nginx proxies /socket.io/
  with Host and the scheme for the origin check. Supervisor and systemd
  start it as well; WEBVIRTCLOUD_SERIAL_CONSOLE=1 enables it.
- Tests: token and session unit tests, socketiod as a process, and a
  live test that reads SeaBIOS from a wvc-test VM on the TCP and SSH
  hosts.
2026-10-17 19:43:09 +03:00
catborise
9b0c6e2d8e build: xterm 6.0.0 for the serial console
@xterm/xterm 6.0.0 and @xterm/addon-fit 0.11.0 replace xterm 3.6.0; the page reads typed and pasted input with onData, and no longer writes every key and all terminal output to the browser console. The unused fullscreen addon goes.
2026-10-17 16:09:50 +03:00
catborise
f19c30840e fix(console): prevent DOM-based XSS in console views and escape JS strings
- Validate and coerce console query parameters (view_only, scale, resize_session, clip_viewport) to strict booleans via to_bool in console/views.py
- Sanitize view parameter to strictly 'lite' or 'full'
- Apply escapejs filter to all JS string interpolations in console-vnc-full.html, console-vnc-lite.html, console-spice-lite.html, and console-xterm.html
- Replace unsafe '| safe' filter in console-spice-lite.html with escapejs
- Add unit tests for XSS query param mitigation and escapejs character encoding
2026-09-26 19:28:22 +03:00
catborise
591429b0c9 feat(console): add comprehensive test suite and expand send keys menu
- Add 23 unit and integration tests covering console views, authorization, URL/path normalization, and novncd daemon token extraction
- Refactor console/novncd arg parsing into __main__ block for clean test imports
- Expand Send Key(s) menu into categorized sections (System, Navigation/Desktop, Terminal Control, Virtual Consoles)
- Implement non-destructive LIFO sendKeyCombo using public rfb.sendKey API, eliminating vendor debt
- Wire Send Key actions across Lite, Full, and PTY (xterm) console templates
- Add modern navigator.keyboard.lock support during fullscreen sessions
2026-09-26 12:10:35 +03:00
catborise
0680f02240 remove css urls, add missing socketio requirements, fix cookie import, and rearrange socketiod connetion 2022-07-21 13:31:37 +03:00
Gaëtan Ferez
65dce10ce1 Implement Libvirt Serial Console as Console on WebVirtCloud 2022-07-17 13:25:47 +02:00