2019-12-31 10:50:02 +00:00
# wayvnc
2019-12-25 11:25:09 +00:00
2023-01-25 11:03:50 +00:00
[![Build and Unit Test ](https://github.com/any1/wayvnc/actions/workflows/build.yml/badge.svg )](https://github.com/any1/wayvnc/actions/workflows/build.yml)
[![builds.sr.ht status ](https://builds.sr.ht/~andri/wayvnc/commits/master.svg )](https://builds.sr.ht/~andri/wayvnc/commits/master?)
2023-01-29 11:38:42 +00:00
[![Packaging status ](https://repology.org/badge/tiny-repos/wayvnc.svg )](https://repology.org/project/wayvnc/versions)
2023-01-25 11:03:50 +00:00
2019-12-25 11:25:09 +00:00
## Introduction
2022-11-03 14:43:36 +00:00
This is a VNC server for wlroots-based Wayland compositors (:no_entry: Gnome,
KDE and Weston are **not** supported). It attaches to a running Wayland session,
2021-12-27 17:04:08 +00:00
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.
2019-12-25 11:25:09 +00:00
2020-02-18 22:16:03 +00:00
Please check the [FAQ ](FAQ.md ) for answers to common questions. For further
2021-05-28 11:09:50 +00:00
support, join the #wayvnc IRC channel on libera.chat, or ask your questions on the
2020-12-31 13:25:07 +00:00
GitHub [discussion forum ](https://github.com/any1/wayvnc/discussions ) for the
project.
2020-01-25 20:40:43 +00:00
2019-12-25 11:25:09 +00:00
## Building
### Runtime Dependencies
2020-03-21 16:56:30 +00:00
* aml
2020-06-25 21:40:04 +00:00
* drm
2020-11-03 23:35:53 +00:00
* gbm (optional)
2019-12-25 11:25:09 +00:00
* libxkbcommon
* neatvnc
2020-11-03 23:35:53 +00:00
* pam (optional)
2019-12-25 11:25:09 +00:00
* pixman
2022-10-17 12:23:40 +00:00
* jansson
2019-12-25 11:25:09 +00:00
### Build Dependencies
* GCC
* meson
* ninja
* pkg-config
2021-11-01 10:33:25 +00:00
#### For Arch Linux
2020-03-21 16:38:34 +00:00
```
2022-10-17 12:23:40 +00:00
pacman -S base-devel libglvnd libxkbcommon pixman gnutls jansson
2020-03-21 16:38:34 +00:00
```
2023-02-09 03:02:03 +00:00
#### For Fedora 37
2020-03-15 18:28:05 +00:00
```
2020-03-21 16:31:55 +00:00
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 \
2023-02-09 03:02:03 +00:00
libxkbcommon-devel libxkbcommon libwayland-client \
pam-devel pixman-devel libgbm-devel libdrm-devel scdoc \
libavcodec-free-devel libavfilter-free-devel libavutil-free-devel \
turbojpeg-devel wayland-devel gnutls-devel jansson-devel
2020-03-15 18:28:05 +00:00
```
2022-02-26 01:03:55 +00:00
#### For Debian (unstable / testing)
```
apt build-dep wayvnc
```
2022-12-08 01:32:35 +00:00
#### 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
2020-03-21 16:56:30 +00:00
The easiest way to satisfy the neatvnc and aml dependencies is to link to them
in the subprojects directory:
2019-12-25 11:25:09 +00:00
```
2020-03-21 16:56:30 +00:00
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 -
2022-12-08 01:32:35 +00:00
```
2019-12-25 11:25:09 +00:00
2022-12-08 01:32:35 +00:00
### Configure and Build
```
2020-04-17 23:30:29 +00:00
meson build
2019-12-25 11:25:09 +00:00
ninja -C build
```
2023-01-02 12:47:47 +00:00
To run the unit tests:
```
meson test -C build
```
2023-03-05 02:24:17 +00:00
To run the [integration tests ](test/integration/README.md ):
2023-01-28 03:59:50 +00:00
```
./test/integration/integration.sh
```
2019-12-31 10:50:02 +00:00
## Running
2019-12-25 11:25:09 +00:00
Wayvnc can be run from the build directory like so:
```
./build/wayvnc
```
2019-12-31 10:50:02 +00:00
:radioactive: 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
```
2020-01-18 20:48:46 +00:00
:warning: 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
2021-11-01 10:33:25 +00:00
authenticated when connecting to wayvnc.
2020-01-18 20:48:46 +00:00
2020-01-29 21:20:14 +00:00
### Encryption & Authentication
2023-09-29 20:00:37 +00:00
#### VeNCrypt (TLS)
For TLS, you'll need a private X509 key and a certificate. A self-signed key
with a certificate can be generated like so:
2020-01-18 20:48:46 +00:00
```
2023-09-29 20:39:30 +00:00
cd ~/.config/wayvnc
2020-01-18 20:48:46 +00:00
openssl req -x509 -newkey rsa:4096 -sha256 -days 3650 -nodes \
2023-09-29 20:39:30 +00:00
-keyout tls_key.pem -out tls_cert.pem -subj /CN=localhost \
2020-01-18 20:48:46 +00:00
-addext subjectAltName=DNS:localhost,DNS:localhost,IP:127.0.0.1
2023-09-29 20:39:30 +00:00
cd -
2020-01-18 20:48:46 +00:00
```
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` .
```
2023-09-29 20:39:30 +00:00
use_relative_paths=true
2020-01-18 20:48:46 +00:00
address=0.0.0.0
enable_auth=true
username=luser
password=p455w0rd
2023-09-29 20:39:30 +00:00
private_key_file=tls_key.pem
certificate_file=tls_cert.pem
2020-01-18 20:48:46 +00:00
```
2022-10-31 07:22:29 +00:00
2023-09-29 20:00:37 +00:00
#### RSA-AES
The RSA-AES security type combines RSA with AES in EAX mode to provide secure
authentication and encryption that's resilient to eavesdropping and MITM. Its
main weakness is that the user has to verify the server's credentials on first
use. Thereafter, the client software should warn the user if the server's
credentials change. It's a Trust on First Use (TOFU) scheme as employed by SSH.
For the RSA-AES to be enabled, you need to generate an RSA key. This can be
achieved like so:
```
ssh-keygen -m pem -f ~/.config/wayvnc/rsa_key.pem -t rsa -N ""
```
You also need to tell wayvnc where this file is located, by setting setting the
`rsa_private_key_file` configuration parameter:
```
2023-09-29 20:39:30 +00:00
use_relative_paths=true
2023-09-29 20:00:37 +00:00
address=0.0.0.0
enable_auth=true
username=luser
password=p455w0rd
2023-09-29 20:39:30 +00:00
rsa_private_key_file=rsa_key.pem
2023-09-29 20:00:37 +00:00
```
You may also add credentials for TLS in combination with RSA. The client will
choose.
2022-10-31 07:22:29 +00:00
### 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.
See the `wayvnc(1)` manpage for an in-depth description of the IPC protocol and
2022-12-08 01:32:35 +00:00
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 ](examples/event-watcher ) for more details.