We've created a very simple VNC bouncer, using C++ to allow multi-tenancy and split load balancing across hundreds of workers identified by a forwarding key (also known as a password) https://lab.picymru.org.uk

Matthew Gall a74961bc54 Bump version to 0.0.4 1 year ago
.gitignore 3276609994 Initial port from sqlite3 to postgresql (untested) and improve C++ code by removing using and converting db connection string to std::string 1 year ago
Dockerfile 15c67123af Added Docker support to vncproxy 1 year ago
EndPoint.cc 5acf6787a8 Seperate out some classes and improve code readability in a bit. 1 year ago
EndPoint.hpp 5acf6787a8 Seperate out some classes and improve code readability in a bit. 1 year ago
LICENSE 3276609994 Initial port from sqlite3 to postgresql (untested) and improve C++ code by removing using and converting db connection string to std::string 1 year ago
Makefile a74961bc54 Bump version to 0.0.4 1 year ago
README 3276609994 Initial port from sqlite3 to postgresql (untested) and improve C++ code by removing using and converting db connection string to std::string 1 year ago
VncOperator.cc 5acf6787a8 Seperate out some classes and improve code readability in a bit. 1 year ago
VncOperator.hpp 5acf6787a8 Seperate out some classes and improve code readability in a bit. 1 year ago
d3des.c 3276609994 Initial port from sqlite3 to postgresql (untested) and improve C++ code by removing using and converting db connection string to std::string 1 year ago
d3des.h 3276609994 Initial port from sqlite3 to postgresql (untested) and improve C++ code by removing using and converting db connection string to std::string 1 year ago
marshal.cc 3276609994 Initial port from sqlite3 to postgresql (untested) and improve C++ code by removing using and converting db connection string to std::string 1 year ago
marshal.h 3276609994 Initial port from sqlite3 to postgresql (untested) and improve C++ code by removing using and converting db connection string to std::string 1 year ago
polling.cc 3276609994 Initial port from sqlite3 to postgresql (untested) and improve C++ code by removing using and converting db connection string to std::string 1 year ago
polling.h 3276609994 Initial port from sqlite3 to postgresql (untested) and improve C++ code by removing using and converting db connection string to std::string 1 year ago
run.sh 15c67123af Added Docker support to vncproxy 1 year ago
utils.cc 3276609994 Initial port from sqlite3 to postgresql (untested) and improve C++ code by removing using and converting db connection string to std::string 1 year ago
utils.h 3276609994 Initial port from sqlite3 to postgresql (untested) and improve C++ code by removing using and converting db connection string to std::string 1 year ago
vncproxy.cc 2c9c38d9d3 Typo in postgresql conversion resulted in row count and not row index being used in the collect_forward_key_callback function resulting in segfault when more than one row present. 1 year ago
waf 2813da34cb Restored waf-light to waf 1 year ago
wscript 3276609994 Initial port from sqlite3 to postgresql (untested) and improve C++ code by removing using and converting db connection string to std::string 1 year ago

README

vncproxy
A VNC proxy that redirects to different VNC servers on different passwords

Author: Santa Zhang ([email protected])

This utility works as a gateway proxy to multiple VNC servers, and redirects
client connection by password to servers according to routing configuration.

The routing configuration is stored in a sqlite3 database, which should have
the following schema:

vncproxy(forward_key varchar(8) primary key,
dest_addr text not null,
dest_passwd varchar(8))

The `forward_key` serves as a password to clients. When client connection
provides the correct `forward_key`, vncproxy will forward this connection
to the VNC server at `dest_addr` (host:port). If the target VNC server
requires authentication, then `dest_passwd` should be the password, otherwise
it should be null.

The sqlite3 database could be modified while vncproxy is running. Connections
will be closed if the routing configuration is deleted. For example, consider
the following situation:

1. new record ('1', 'lab-node1:5901', 'pass123') is added to database
2. client A is forwarded to lab-node1:5901 according to the new record
3. record ('1', 'lab-node1:5901', 'pass123') is deleted from database
4. client A's connection will be closed by vncproxy

This is done by periodically checking the database records, and close those
connections with invalid routing record. The checking interval is 1 second.

NOTE: If the record is modified but not deleted, then the connections will NOT
be closed. So, if we modify the record to ('1', 'lab-node2:5901', null),
then A's connection will NOT be closed. Modification should be done by
first removing the record, then inserting a new version after a while.
Since vncproxy checks record deletion every 1 second, wait a little
longer (like 5 seconds) before insertion would be a good choice.

Currently, only RFB protocol version 3.8 is supported. And for authentication,
only the basic DES based VNC authentication is supported.

Build it by:

./waf configure
./waf

And you will find the binary at `build/vncproxy`. You can install by:

./waf install

The binary will be installed to `/usr/local/bin/vncproxy`.