This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| computing:rustdesk [2024/11/02 16:42] – created oemb1905 | computing:rustdesk [2026/01/02 04:26] (current) – oemb1905 | ||
|---|---|---|---|
| Line 3: | Line 3: | ||
| * **Jonathan Haack** | * **Jonathan Haack** | ||
| * **Haack' | * **Haack' | ||
| - | * **netcmnd@jonathanhaack.com** | + | * **webmaster@haacksnetworking.org** |
| ------------------------------------------- | ------------------------------------------- | ||
| Line 10: | Line 10: | ||
| ------------------------------------------- | ------------------------------------------- | ||
| - | This tutorial is for users of Debian GNU/ | + | This tutorial is for Debian |
| - | --- //[[webmaster@haacksnetworking.org|oemb1905]] | + | sudo ufw allow 22/tcp |
| + | sudo ufw allow 80/tcp | ||
| + | sudo ufw allow 443/tcp | ||
| + | sudo ufw allow 21114: | ||
| + | sudo ufw allow 21116/udp | ||
| + | sudo ufw enable | ||
| + | |||
| + | Let's now download the latest version of rustdesk, unzip it, and then copy the binaries into the standard location inside ''/ | ||
| + | |||
| + | cd /tmp | ||
| + | wget https:// | ||
| + | unzip rustdesk-server-linux-amd64.zip | ||
| + | sudo mkdir -p / | ||
| + | sudo cp amd64/hbbs amd64/hbbr amd64/ | ||
| + | sudo chmod +x / | ||
| + | |||
| + | After the relay and signaling servers are installed and copied to the standard locations, we can download and install the gohttp server: | ||
| + | |||
| + | sudo mkdir -p /opt/gohttp / | ||
| + | cd /tmp | ||
| + | wget https:// | ||
| + | tar -xzf gohttpserver_1.3.0_linux_amd64.tar.gz | ||
| + | sudo cp gohttpserver / | ||
| + | sudo chmod +x / | ||
| + | |||
| + | We can now navigate to our dedicated rustdesk directory and generate our keypair: | ||
| + | |||
| + | cd / | ||
| + | sudo ./ | ||
| + | sudo chmod 600 id_ed25519 | ||
| + | cat / | ||
| + | |||
| + | Make a note of the public key somewhere in your secure notes. That's your API key for configuring clients to use your self-hosted relay. We now need to create our systemd units for each of the three services. Let's start with hbbs, or the signaling server. Open up '' | ||
| + | |||
| + | <code bash> | ||
| + | [Unit] | ||
| + | Description=Rustdesk Signal Server | ||
| + | |||
| + | [Service] | ||
| + | Type=simple | ||
| + | LimitNOFILE=1000000 | ||
| + | ExecStart=/ | ||
| + | WorkingDirectory=/ | ||
| + | User=root | ||
| + | Group=root | ||
| + | Restart=always | ||
| + | StandardOutput=append:/ | ||
| + | StandardError=append:/ | ||
| + | RestartSec=10 | ||
| + | |||
| + | [Install] | ||
| + | WantedBy=multi-user.target | ||
| + | </ | ||
| + | |||
| + | Next, let's configure the relay server, or hbbr. To do that, open up '' | ||
| + | |||
| + | <code bash> | ||
| + | [Unit] | ||
| + | Description=Rustdesk Relay Server | ||
| + | |||
| + | [Service] | ||
| + | Type=simple | ||
| + | LimitNOFILE=1000000 | ||
| + | ExecStart=/ | ||
| + | WorkingDirectory=/ | ||
| + | User=root | ||
| + | Group=root | ||
| + | Restart=always | ||
| + | StandardOutput=append:/ | ||
| + | StandardError=append:/ | ||
| + | RestartSec=10 | ||
| + | |||
| + | [Install] | ||
| + | WantedBy=multi-user.target | ||
| + | </ | ||
| + | |||
| + | Finally, let's create the systemd unit for the gohttp server. Please note that the unit contains a section to password protect the webroot so only authorized staff can access the client configs in the gohttp server. Adjust that to a secure value. Let's open up '' | ||
| + | |||
| + | <code bash> | ||
| + | [Unit] | ||
| + | Description=Go HTTP Server | ||
| + | |||
| + | [Service] | ||
| + | Type=simple | ||
| + | LimitNOFILE=1000000 | ||
| + | ExecStart=/ | ||
| + | WorkingDirectory=/ | ||
| + | User=root | ||
| + | Group=root | ||
| + | Restart=always | ||
| + | StandardOutput=append:/ | ||
| + | StandardError=append:/ | ||
| + | RestartSec=10 | ||
| + | |||
| + | [Install] | ||
| + | WantedBy=multi-user.target | ||
| + | </ | ||
| + | |||
| + | We can now enable all the units and start the services: | ||
| + | |||
| + | sudo systemctl daemon-reload | ||
| + | sudo systemctl enable rustdesksignal rustdeskrelay gohttpserver | ||
| + | sudo systemctl start rustdesksignal rustdeskrelay gohttpserver | ||
| + | sudo systemctl status rustdesksignal rustdeskrelay gohttpserver | ||
| + | |||
| + | We can now drop the gohttp server behind an apache reverse proxy. To do that, let's install certbot, cut a certificate, | ||
| + | |||
| + | sudo apt install certbot letsencrypt python3-certbot-apache | ||
| + | sudo certbot --authenticator standalone --installer apache -d domain.com --pre-hook " | ||
| + | sudo a2enmod proxy proxy_http proxy_wstunnel rewrite headers ssl | ||
| + | |||
| + | You will now have to enabled vhosts in apache, namely, '' | ||
| + | |||
| + | <code bash> | ||
| + | < | ||
| + | ServerName hackingclub.org | ||
| + | ServerSignature Off | ||
| + | ProxyPreserveHost On | ||
| + | AllowEncodedSlashes NoDecode | ||
| + | |||
| + | < | ||
| + | Require all granted | ||
| + | ProxyPassReverse http:// | ||
| + | ProxyPassReverse http:// | ||
| + | </ | ||
| + | |||
| + | RewriteEngine on | ||
| + | RewriteCond %{DOCUMENT_ROOT}/ | ||
| + | RewriteCond %{REQUEST_URI} ^/ | ||
| + | RewriteRule .* http:// | ||
| + | |||
| + | ErrorDocument 404 /404.html | ||
| + | ErrorDocument 422 /422.html | ||
| + | ErrorDocument 500 /500.html | ||
| + | ErrorDocument 502 /502.html | ||
| + | ErrorDocument 503 /503.html | ||
| + | |||
| + | LogFormat " | ||
| + | ErrorLog / | ||
| + | CustomLog / | ||
| + | CustomLog / | ||
| + | CustomLog / | ||
| + | |||
| + | RewriteCond %{SERVER_NAME} =hackingclub.org | ||
| + | RewriteRule ^ https:// | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | For the https virtual host, use something like: | ||
| + | |||
| + | <code bash> | ||
| + | < | ||
| + | SSLEngine on | ||
| + | SSLProtocol all -SSLv2 | ||
| + | SSLHonorCipherOrder on | ||
| + | SSLCipherSuite " | ||
| + | Header add Strict-Transport-Security: | ||
| + | SSLCompression Off | ||
| + | |||
| + | ServerName hackingclub.org | ||
| + | ServerSignature Off | ||
| + | ProxyPreserveHost On | ||
| + | |||
| + | < | ||
| + | SetHandler " | ||
| + | </ | ||
| + | |||
| + | AllowEncodedSlashes NoDecode | ||
| + | |||
| + | < | ||
| + | Require all granted | ||
| + | ProxyPassReverse http:// | ||
| + | ProxyPassReverse http:// | ||
| + | </ | ||
| + | |||
| + | RewriteEngine on | ||
| + | RewriteCond %{DOCUMENT_ROOT}/ | ||
| + | RewriteCond %{REQUEST_URI} ^/ | ||
| + | RewriteRule .* http:// | ||
| + | |||
| + | RequestHeader set X_FORWARDED_PROTO ' | ||
| + | RequestHeader set X-Forwarded-Ssl on | ||
| + | |||
| + | ErrorDocument 404 /404.html | ||
| + | ErrorDocument 422 /422.html | ||
| + | ErrorDocument 500 /500.html | ||
| + | ErrorDocument 502 /502.html | ||
| + | ErrorDocument 503 /503.html | ||
| + | |||
| + | LogFormat " | ||
| + | ErrorLog / | ||
| + | CustomLog / | ||
| + | CustomLog / | ||
| + | CustomLog / | ||
| + | |||
| + | Include / | ||
| + | SSLCertificateFile / | ||
| + | SSLCertificateKeyFile / | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | Check your configs with '' | ||
| + | |||
| + | * **ID Server**: hackingclub.org | ||
| + | * **Relay Server**: hackingclub.org | ||
| + | * **API Server**: https:// | ||
| + | * **Key**: API Key from above | ||
| + | |||
| + | Here's an example of what this section looks like. Note that entering a value in API Server is moot - that's only supported by the premium/ | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | Enter the same values on your primary workstation. Once that's done for your workstation and at least one client, you can then specify the ID your " | ||
| + | |||
| + | sudo systemctl stop rustdesksignal rustdeskrelay gohttpserver | ||
| + | cd /tmp | ||
| + | wget https:// | ||
| + | unzip -o rustdesk-server-linux-amd64.zip | ||
| + | sudo cp amd64/hbbs amd64/hbbr / | ||
| + | sudo chmod +x / | ||
| + | sudo systemctl start rustdesksignal rustdeskrelay gohttpserver | ||
| + | sudo systemctl status rustdesksignal rustdeskrelay gohttpserver | ||
| + | |||
| + | That's basically it. The new binaries are executed and controlled by the pre-established systemd units, so you merely replace the binaries and make them executable and you are good to go. If the gohttp server has been updated, similarly: | ||
| + | |||
| + | sudo systemctl stop gohttpserver | ||
| + | cd /tmp | ||
| + | wget https:// | ||
| + | tar -xzf gohttpserver_NEW_VERSION_linux_amd64.tar.gz | ||
| + | sudo cp gohttpserver / | ||
| + | sudo chmod +x / | ||
| + | sudo systemctl start gohttpserver | ||
| + | sudo systemctl status gohttpserver | ||
| + | |||
| + | The password is specified in the systemd unit, which remains unchanged. Just make sure to restart the service as directed above and it will invoke that same value, but on the updated go server. You should now be fully up to date. Hope this helps others wanting to avoid using the automated script / understand all the moving parts of the instance. Happy hacking! | ||
| + | |||
| + | --- //[[alerts@haacksnetworking.org|oemb1905]] | ||