Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a4706d793e | ||
|
|
76061eb3ae |
2 changed files with 34 additions and 17 deletions
|
|
@ -221,12 +221,18 @@ canvas { display: block; cursor: default; }
|
||||||
if (types.indexOf(1) !== -1) prefer = 1; // plain None
|
if (types.indexOf(1) !== -1) prefer = 1; // plain None
|
||||||
else if (types.indexOf(19) !== -1) prefer = 19; // VeNCrypt
|
else if (types.indexOf(19) !== -1) prefer = 19; // VeNCrypt
|
||||||
else prefer = types[0];
|
else prefer = types[0];
|
||||||
|
// Only handle known-safe types; reject everything else.
|
||||||
|
if (prefer !== 1 && prefer !== 19) {
|
||||||
|
dbg('no supported security type in [' + Array.from(types).join(', ') + '] — need 1 (None) or 19 (VeNCrypt)', 'err');
|
||||||
|
setStatus('unsupported security types: [' + Array.from(types).join(', ') + ']', 'error');
|
||||||
|
ws.close();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
dbg('→ choosing security type ' + prefer +
|
dbg('→ choosing security type ' + prefer +
|
||||||
(prefer === 1 ? ' (None)' : prefer === 19 ? ' (VeNCrypt)' : prefer === 2 ? ' (VncAuth)' : ''));
|
(prefer === 1 ? ' (None)' : ' (VeNCrypt)'));
|
||||||
send(new Uint8Array([prefer]));
|
send(new Uint8Array([prefer]));
|
||||||
if (prefer === 1) state = 'security-result';
|
if (prefer === 1) state = 'security-result';
|
||||||
else if (prefer === 19) state = 'vencrypt-version';
|
else state = 'vencrypt-version';
|
||||||
else state = 'security-vnc-challenge';
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case 'security-vnc-challenge': {
|
case 'security-vnc-challenge': {
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,26 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf config.hyperhive.gui.enable {
|
config = lib.mkIf config.hyperhive.gui.enable {
|
||||||
|
# Build weston linked against a neatvnc without auth/crypto support.
|
||||||
|
# neatvnc ≥ 0.9 compiled with gnutls/nettle always advertises RSA-AES
|
||||||
|
# and Apple-DH security types (types 129, 5, 30) regardless of the
|
||||||
|
# weston.ini auth-method setting, causing the in-browser RFB client to
|
||||||
|
# fail with "auth failed" (it has no RSA key to complete the handshake).
|
||||||
|
# Removing gnutls + nettle from neatvnc's buildInputs disables the auth
|
||||||
|
# module at compile time, so nvnc_has_auth() returns false and weston
|
||||||
|
# skips nvnc_enable_auth() — neatvnc then advertises only type 1 (None).
|
||||||
|
nixpkgs.overlays = [
|
||||||
|
(_final: prev: {
|
||||||
|
weston = prev.weston.override {
|
||||||
|
neatvnc = prev.neatvnc.overrideAttrs (old: {
|
||||||
|
buildInputs = builtins.filter
|
||||||
|
(p: (p.pname or p.name or "") != "gnutls")
|
||||||
|
old.buildInputs;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
})
|
||||||
|
];
|
||||||
|
|
||||||
systemd.services.weston = {
|
systemd.services.weston = {
|
||||||
description = "Weston Wayland compositor (VNC backend)";
|
description = "Weston Wayland compositor (VNC backend)";
|
||||||
after = [ "network.target" ];
|
after = [ "network.target" ];
|
||||||
|
|
@ -104,23 +124,14 @@
|
||||||
${pkgs.coreutils}/bin/printf '{"vnc_port":%d,"auth":"none"}\n' \
|
${pkgs.coreutils}/bin/printf '{"vnc_port":%d,"auth":"none"}\n' \
|
||||||
"$VNC_PORT" > /etc/hyperhive/gui.json || true
|
"$VNC_PORT" > /etc/hyperhive/gui.json || true
|
||||||
|
|
||||||
# Write a weston.ini that disables VNC authentication.
|
# neatvnc is built without gnutls (see nixpkgs.overlays above),
|
||||||
# Without this, neatvnc offers VNC password auth (type 2) by default
|
# so nvnc_has_auth() returns false and weston skips auth setup
|
||||||
# which causes the in-browser RFB client to fail with "auth failed".
|
# entirely — neatvnc advertises only security type 1 (None).
|
||||||
# auth-method=none makes neatvnc offer security type 1 (None).
|
# No weston.ini or --disable-transport-layer-security needed.
|
||||||
# --disable-transport-layer-security additionally disables the
|
|
||||||
# VeNCrypt TLS wrapper — VNC is loopback-only via the harness
|
|
||||||
# WebSocket relay so neither TLS nor a password is needed.
|
|
||||||
WESTON_INI=$(${pkgs.coreutils}/bin/mktemp /tmp/weston-XXXXXX.ini)
|
|
||||||
${pkgs.coreutils}/bin/printf '[core]\nbackend=vnc\n\n[vnc]\nauth-method=none\n' \
|
|
||||||
> "$WESTON_INI"
|
|
||||||
|
|
||||||
exec ${pkgs.weston}/bin/weston \
|
exec ${pkgs.weston}/bin/weston \
|
||||||
--config="$WESTON_INI" \
|
|
||||||
--backend=vnc-backend.so \
|
--backend=vnc-backend.so \
|
||||||
--renderer=pixman \
|
--renderer=pixman \
|
||||||
--port="$VNC_PORT" \
|
--port="$VNC_PORT"
|
||||||
--disable-transport-layer-security
|
|
||||||
'';
|
'';
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
RestartSec = "5s";
|
RestartSec = "5s";
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue