Update README.md

This commit is contained in:
Simon Stürz 2025-11-14 17:03:50 +01:00
parent 94112c0c11
commit 3f683faea6

186
README.md
View File

@ -1,129 +1,139 @@
# nymea remote proxy server # nymea remote proxy server
----------------------------------------------
The nymea remote proxy server is the meeting point of nymea servers and nymea clients in order to establishing a secure remote connection. The nymea remote proxy server acts as the rendezvous point between nymea servers and nymea clients and provides a secure tunnel to reach devices that sit behind NAT or firewalled networks.
# Build ## Features
In order to build the proxy server you need to install the qt default package. - Secure TLS-protected tunnels between nymea instances.
- JSON-RPC based control plane with optional monitoring interface.
- Usable as system service or launched from a build tree for development.
apt install qtbase5-dev qtbase5-dev-tools libqt5websockets5-dev libncurses5-dev dpkg-dev debhelper ## Requirements
To build the proxy from source, install the Qt development packages and the helper tools that produce the Debian packages:
```
sudo apt install debhelper dpkg-dev pkg-config qt6-base-dev qt6-base-dev-tools \
qt6-websockets-dev libncurses5-dev
```
## Build from source ## Build from source
Change into the source directory and run following commands
$ cd nymea-remoteproxy ```
$ mkdir build cd nymea-remoteproxy
$ cd build mkdir -p build && cd build
$ qmake ../ qmake ../
$ make -j$(nproc) make -j$(nproc)
```
In the build directory you can find the resulting library and binary files. The resulting binaries and libraries will be available in the `build` directory. When running directly from there, the helper libraries must be discoverable:
If you want to start the proxy server from the build directory, you need to export the library path before starting the application: ```
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/libnymea-remoteproxy:$(pwd)/libnymea-remoteproxyclient
./server/nymea-remoteproxy -c ../nymea-remoteproxy/nymea-remoteproxy.conf
```
$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/libnymea-remoteproxy:$(pwd)/libnymea-remoteproxyclient ## Install
$ ./server/nymea-remoteproxy -c ../nymea-remoteproxy/nymea-remoteproxy.conf
### From repository
# Install Official nymea packages are available:
## From repository ```
There is a public version available in the nymea repository. sudo apt install nymea-remoteproxy nymea-remoteproxy-tunnelclient nymea-remoteproxy-monitor
```
$ apt install nymea-remoteproxy nymea-remoteproxy-tunnelclient nymea-remoteproxy-monitor The installation starts the `nymea-remoteproxy.service` systemd unit and also installs a test client.
This will install a systemd service called `nymea-remoteproxy.service` and the client application for testing. ### From build directory
## From build directory ```
sudo make install
```
Simply run following command in the build dir: ## Configuration
$ sudo make install The package ships `/etc/nymea/nymea-remoteproxy.conf` which can be used verbatim or as a template:
# Configure ```
[ProxyServer]
name=nymea-remoteproxy
writeLogs=false
logFile=/var/log/nymea-remoteproxy.log
logEngineEnabled=false
monitorSocket=/tmp/nymea-remoteproxy-monitor.sock
jsonRpcTimeout=10000
inactiveTimeout=8000
The package will deliver a default configuration file with following content (`/etc/nymea/nymea-remoteproxy.conf`): [SSL]
enabled=false
certificate=/etc/ssl/certs/ssl-cert-snakeoil.pem
certificateKey=/etc/ssl/private/ssl-cert-snakeoil.key
certificateChain=
[ProxyServer] [UnixSocketServerTunnelProxy]
name=nymea-remoteproxy unixSocketFileName=/run/nymea-remoteproxy.socket
writeLogs=false
logFile=/var/log/nymea-remoteproxy.log
logEngineEnabled=false
monitorSocket=/tmp/nymea-remoteproxy-monitor.sock
jsonRpcTimeout=10000
inactiveTimeout=8000
[SSL] [WebSocketServerTunnelProxy]
enabled=false host=127.0.0.1
certificate=/etc/ssl/certs/ssl-cert-snakeoil.pem port=2212
certificateKey=/etc/ssl/private/ssl-cert-snakeoil.key
certificateChain=
[UnixSocketServerTunnelProxy] [TcpServerTunnelProxy]
unixSocketFileName=/run/nymea-remoteproxy.socket host=127.0.0.1
port=2213
```
[WebSocketServerTunnelProxy] ## Test coverage
host=127.0.0.1
port=2212
[TcpServerTunnelProxy] To generate a line coverage report:
host=127.0.0.1
port=2213
- Run `qmake CONFIG+=coverage` and execute the tests to produce the `.gcno`/`.gcda` data.
- Install tooling and generate the HTML report:
## Test coverage report ```
sudo apt install lcov gcovr
./create-coverage-html.sh
```
If you want to create a line coverage report from the tests simply run following command in the source directory: The HTML output lives in `coverage-html/`.
> Note: run `qmake` with the argument `CONFIG+=converage` in order to generate coverage data for the tests. Then run the tests before creating the coverage report. ## Testing a local server
$ apt install lcov gcovr You can experiment with a local instance by issuing a self-signed certificate and pointing the proxy to it.
$ ./create-coverage-html.sh
The resulting coverage report will be place in the `coverage-html` directory. ```
sudo apt update
sudo apt install nymea-remoteproxy nymea-remoteproxy-tunnelclient
```
# Testing a local server After installation the daemon starts automatically using `/etc/nymea/nymea-remoteproxy.conf`, which you can adapt for local testing. Create a throwaway certificate:
With following steps you can test a local instance with a self signed certificate. ```
cd /tmp
openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
-keyout test-proxy-certificate.key \
-out test-proxy-certificate.crt
sudo cp test-proxy-certificate.crt /etc/ssl/certs/
sudo cp test-proxy-certificate.key /etc/ssl/private/
```
## Start the server Adjust the config:
In order to test a connection and play with the server API, you can install the proxy server on your machine and try to connect to it. ```
certificate=/etc/ssl/certs/test-proxy-certificate.crt
certificateKey=/etc/ssl/private/test-proxy-certificate.key
```
$ sudo apt update Restart manually for verbose output:
$ sudo apt install nymea-remoteproxy nymea-remoteproxy-tunnelclient
Once installed, the `nymea-remoteproxy` will start automatically using the default configurations shipped in `/etc/nymea/nymea-remoteproxy.conf`. ```
Using this file allowes you to configure the server for your test purposes. sudo systemctl stop nymea-remoteproxy.service
sudo nymea-remoteproxy -c /etc/nymea/nymea-remoteproxy.conf --verbose
```
The only thing you need is a certificate, which can be loaded from the server. The server does not support insecure connection for now. If you don't have any certificate, you can create one for testing. ## License
> *Note:* you can enter whatever you like for the certificate. The nymea-remoteproxy server, monitoring tools, and tunnel client are distributed under the terms of the GNU General Public License version 3.
$ cd /tmp/
$ openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout test-proxy-certificate.key -out test-proxy-certificate.crt
Now place the certificate and the key where they belong:
$ sudo cp /tmp/test-proxy-certificate.crt /etc/ssl/certs/
$ sudo cp /tmp/test-proxy-certificate.key /etc/ssl/private/
Change following configuration in the `/etc/nymea/nymea-remoteproxy.conf`:
...
certificate=/etc/ssl/certs/test-proxy-certificate.crt
certificateKey=/etc/ssl/private/test-proxy-certificate.key
...
Now stop the proxy server and start it manually:
$ sudo systemctl stop nymea-remoteproxy.service
$ sudo nymea-remoteproxy -c /etc/nymea/nymea-remoteproxy --verbose
# License
This is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License.
The reusable libraries located in `libnymea-remoteproxy` and `libnymea-remoteproxyclient` are provided under the GNU Lesser General Public License version 3 (or later).
See `LICENSE.GPL3` and `LICENSE.LGPL3` for the full texts.