A VNC server for wlroots based Wayland compositors
 
 
 
 
Go to file
Andri Yngvason 6556d893a8 Implement custom option parser 2023-01-01 09:10:31 +00:00
.github/workflows Add more libraries to the build CI environment 2022-11-28 20:44:44 +00:00
examples Add single-output-sway helper script 2022-12-25 21:43:55 -05:00
include Implement custom option parser 2023-01-01 09:10:31 +00:00
protocols Add power management state to the output object 2022-12-01 19:11:32 +00:00
src Implement custom option parser 2023-01-01 09:10:31 +00:00
test Implement custom option parser 2023-01-01 09:10:31 +00:00
util util: trace.sh: Fix chown and event serialisation 2022-08-27 10:54:35 +00:00
.gitignore Git: ignore .cache/ 2022-11-18 09:24:31 +00:00
CONTRIBUTING.md CONTRIBUTING: Fix markdown for links 2020-11-03 23:27:14 +00:00
COPYING COPYING: It's 2020 now 2020-01-14 19:03:38 +00:00
FAQ.md FAQ: Mention WAYLAND_DISPLAY 2022-01-18 11:45:54 +00:00
FUNDING.yml Display Patreon account on GitHub page 2021-01-31 12:17:00 +00:00
README.md Refresh and cleanup README.md 2022-12-07 21:27:04 -05:00
meson.build Implement custom option parser 2023-01-01 09:10:31 +00:00
meson_options.txt Implement custom option parser 2023-01-01 09:10:31 +00:00
wayvnc.pam Add PAM authentication 2020-11-03 22:18:46 +00:00
wayvnc.scd Add wayvncctl wayvnc-exit command 2022-11-26 19:57:53 +00:00
wayvncctl.scd Handle all wayvncctl help commands locally 2022-12-07 19:56:06 -05:00

README.md

wayvnc

Introduction

This is a VNC server for wlroots-based Wayland compositors ( Gnome, KDE and Weston are not supported). It attaches to a running Wayland session, creates virtual input devices, and exposes a single display via the RFB protocol. The Wayland session may be a headless one, so it is also possible to run wayvnc without a physical display attached.

Please check the FAQ for answers to common questions. For further support, join the #wayvnc IRC channel on libera.chat, or ask your questions on the GitHub discussion forum for the project.

Installing

# Arch Linux
pacman -S wayvnc

# FreeBSD
pkg install wayvnc

# Fedora
dnf install wayvnc

# Debian (unstable / testing)
apt install wayvnc

# openSUSE Tumbleweed
zypper install wayvnc

# Void Linux
xbps-install wayvnc

Building

Runtime Dependencies

  • aml
  • drm
  • gbm (optional)
  • libxkbcommon
  • neatvnc
  • pam (optional)
  • pixman
  • jansson

Build Dependencies

  • GCC
  • meson
  • ninja
  • pkg-config

For Arch Linux

pacman -S base-devel libglvnd libxkbcommon pixman gnutls jansson

For Fedora 31

dnf install -y meson gcc ninja-build pkg-config egl-wayland egl-wayland-devel \
	mesa-libEGL-devel mesa-libEGL libwayland-egl libglvnd-devel \
	libglvnd-core-devel libglvnd mesa-libGLES-devel mesa-libGLES \
	libxkbcommon-devel libxkbcommon libwayland-client libwayland \
	wayland-devel gnutls-devel jansson-devel

For Debian (unstable / testing)

apt build-dep wayvnc

For Ubuntu

apt install meson libdrm-dev libxkbcommon-dev libwlroots-dev libjansson-dev \
	libpam0g-dev libgnutls28-dev libavfilter-dev libavcodec-dev \
	libavutil-dev libturbojpeg0-dev scdoc

Additional build-time dependencies

The easiest way to satisfy the neatvnc and aml dependencies is to link to them in the subprojects directory:

git clone https://github.com/any1/wayvnc.git
git clone https://github.com/any1/neatvnc.git
git clone https://github.com/any1/aml.git

mkdir wayvnc/subprojects
cd wayvnc/subprojects
ln -s ../../neatvnc .
ln -s ../../aml .
cd -

mkdir neatvnc/subprojects
cd neatvnc/subprojects
ln -s ../../aml .
cd -

Configure and Build

meson build
ninja -C build

Running

Wayvnc can be run from the build directory like so:

./build/wayvnc

☢️ The server only accepts connections from localhost by default. To accept connections via any interface, set the address to 0.0.0.0 like this:

./build/wayvnc 0.0.0.0

⚠️ Do not do this on a public network or the internet without user authentication enabled. The best way to protect your VNC connection is to use SSH tunneling while listening on localhost, but users can also be authenticated when connecting to wayvnc.

Encryption & Authentication

You'll need a private X509 key and a certificate. A self-signed key with a certificate can be generated like so:

openssl req -x509 -newkey rsa:4096 -sha256 -days 3650 -nodes \
	-keyout key.pem -out cert.pem -subj /CN=localhost \
	-addext subjectAltName=DNS:localhost,DNS:localhost,IP:127.0.0.1

Replace localhost and 127.0.0.1 in the command above with your public facing host name and IP address, respectively, or just keep them as is if you're testing locally.

Create a config with the authentication info and load it using the --config command line option or place it at the default location $HOME/.config/wayvnc/config.

address=0.0.0.0
enable_auth=true
username=luser
password=p455w0rd
private_key_file=/path/to/key.pem
certificate_file=/path/to/cert.pem

wayvncctl control socket

To facilitate runtime interaction and control, wayvnc opens a unix domain socket at $XDG_RUNTIME_DIR/wayvncctl (or a fallback of /tmp/wayvncctl-$UID). A client can connect and exchange json-formatted IPC messages to query and control the running wayvnc instance.

Use the wayvncctl utility to interact with this control socket from the command line.

The help command can interactively query the available IPC commands:

$ wayvncctl help
Commands:
    - help
    - version
    - event-receive
    - set-output
    - get-clients
    - get-outputs
    - disconnect-client
    - wayvnc-exit

Run 'wayvncctl command-name --help' for command-specific details.

Events:
    - client-connected
    - client-disconnected
    - capture-changed

Run 'wayvncctl help --event=event-name' for event-specific details.

And give descriptions and usage for specific commands:

$ wayvncctl set-output --help
Usage: wayvncctl [options] set-output [params]

Switch the actively captured output

Parameters:
  --switch-to=...
    The specific output name to capture

  --cycle=...
    Either "next" or "prev"

Run 'wayvncctl --help' for allowed options

See the wayvnc(1) manpage for an in-depth description of the IPC protocol and the available commands, and wayvncctl(1) for more on the command line interface.

There is also a handy event-loop mode that can be used to run commands when various events occur in wayvnc. See examples/event-watcher for more details.