rkvm/README.md

102 lines
4.5 KiB
Markdown
Raw Normal View History

2020-10-29 22:19:44 +01:00
# rkvm
2023-04-18 22:03:20 +02:00
rkvm is a tool for sharing keyboard and mouse across multiple Linux machines.
2020-10-29 22:19:44 +01:00
It is based on a client/server architecture, where server is the machine controlling mouse and keyboard and relays events (mouse move, key presses, ...) to clients.
Switching between different clients is done by a configurable keyboard shortcut.
## Features
2023-04-18 20:41:58 +02:00
- TLS encrypted by default, backed by [rustls](https://github.com/rustls/rustls)
2020-10-29 22:19:44 +01:00
- Display server agnostic
- Low overhead
2020-10-30 19:48:33 +01:00
## Requirements
2020-11-14 13:23:37 +01:00
- Rust 1.48 and higher
## Linux requirements
- The uinput Linux kernel module, enabled by default in most distros. You can confirm that it's enabled in your distro by checking that `/dev/uinput` exists.
2021-01-31 13:43:04 +01:00
- libevdev development files (`sudo apt install libevdev-dev` on Debian/Ubuntu)
2021-01-17 13:53:42 +01:00
- OpenSSL
2021-01-31 14:03:27 +01:00
- Clang/LLVM (`sudo apt install clang` on Debian/Ubuntu)
2020-10-30 19:48:33 +01:00
## Installation
1. First, build the project.
2020-10-29 22:19:44 +01:00
$ cargo build --release
2020-10-29 22:19:44 +01:00
Note that you need to have libevdev installed on your system, otherwise the build will fail.
2020-10-29 22:19:44 +01:00
2023-04-18 20:41:58 +02:00
2. Generate server certificates. The repo contains a simple Rust program, `rkvm-certificate-gen`, to aid certificate generation. To see usage, run:
2023-04-18 20:41:58 +02:00
$ cargo run --bin rkvm-certificate-gen -- --help
For example, where your server is *my-server-name* and your local network is *example.lan*, you might generate certificates with:
$ mkdir cert/
2023-04-18 20:41:58 +02:00
$ target/release/rkvm-certificate-gen cert/my-server-name_cert.pem \
cert/my-server-name_key.pem \
--dns-names my-server-name.example.lan
3. Install the release to its destination directory. `/opt/rkvm` is a good choice for Linux:
$ sudo cp -r target/release /opt/rkvm
4. On Linux, you either need to run the programs as root or make `/dev/uinput` accessible by the user it runs as. For example, if the user belongs to the *rkvm* group, you could set `/dev/uinput` writeable by it:
$ sudo chgrp rkvm /dev/uinput
$ sudo chmod g+rw /dev/uinput
5. Create config files. By default, the program reads their config files from /etc/rkvm/{server,client}.toml on Linux and C:/rkvm/{server,client}.toml on Windows. This can be changed by passing the path as the first command line parameter.
The [example](example) directory contains example configurations and systemd service files. If you are going to save your certificates in the same directory as the configuration, you will need to specify their full path in the config files.
6. Put the certificates in place. For example, on the server:
$ sudo cp cert/* /etc/rkvm/
Make sure the identify file is readable by the user that the server is running as.
On a client:
$ scp cert/my-server-name_cert.pem my-client1-name.example.lan:/etc/rkvm/
7. You are ready to go! Start the server with:
$ /opt/rkvm/server
Start the client with:
$ /opt/rkvm/client
Info-level logging is logged to the console.
8. If you want to start rkvm automatically, you can place the relevant systemd service file in /etc/systemd/system/. For example, on the server:
$ sudo cp example/rkvm-server.service /etc/systemd/system/
$ sudo chmod +x /etc/systemd/system/rkvm-server.service
2020-10-31 17:12:09 +01:00
2020-10-29 22:19:44 +01:00
## Why rkvm and not Barrier/Synergy?
The author of this program had a lot of problems with said programs, namely his keyboard layout (Czech) not being supported properly, which stems from the fact that the programs send characters which it then attempts to translate back into keycodes. rkvm takes a different approach to solving this problem and doesn't assume anything about your keyboard layout -- it sends raw keycodes only.
Additionally, rkvm doesn't even know or care about X, Wayland or any display server that might be in use, because it uses the uinput API with libevdev to read and generate input events.
Regardless, if you want a working and stable solution for crossplatform keyboard and mouse sharing, you should probably use either of the above mentioned programs for the time being.
## Limitations
- Only keyboard and relative mouse events work (that is, can be forwarded to clients)
2020-11-04 22:04:21 +01:00
## Project structure
2023-04-18 20:41:58 +02:00
- `rkvm-server` - server application code
- `rkvm-client` - client application code
- `rkvm-input` - handles reading from and writing to input devices
- `rkvm-net` - network protocol encoding and decoding
- `rkvm-certificate-gen` - certificate generation tool
2020-11-09 19:26:54 +01:00
2020-11-04 22:04:21 +01:00
[Bincode](https://github.com/servo/bincode) is used for encoding of messages on the network and [Tokio](https://tokio.rs) as an asynchronous runtime.
## Contributions
All contributions, that includes both PRs and issues, are very welcome.
2020-10-29 22:19:44 +01:00
## License
[MIT](LICENSE)