# VNC Proxy

The VNC proxy is used to hide your PVE environment, which would otherwise need to be opened for users.

The VNC proxy simply proxies - as the name says - the websocket from PVE to the customer/hostware. The Proxy can be installed directly on the hostware VPS or a separate Debian VPS.

## Installation

### 1. Domain

First create a DNS record with the domain you want to use for the VNC proxy and the IP of the proxy server. Nobody will see the domain, however it is necessary for SSL connections.\
Example: vnc-proxy.yourhosting.de

### 2. Installation

#### Install required packages

Execute the following commands to start the semi-automatic installation. This will install nodejs, npm and certbot and will start SSL certificate generation.

```bash
apt -y update && apt -y upgrade
sudo apt install nodejs npm zip unzip screen -y
sudo apt install snapd -y
sudo snap install core
sudo snap refresh core
sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot
```

#### Generate SSL certificate

Execute the following command to request the SSL certificate. Replace YOURDOMAIN with the domain and YOUREMAIL with your email.

The certbot will prompt you to create a TXT record to verify the ownership of the domain. Create the TXT record as shown, wait \~1-5 minutes and press enter to complete the certificate generation.

```bash
sudo certbot certonly -d YOURDOMAIN -m YOURMAIL --manual --preferred-challenges dns --agree-tos --no-eff-email
```

#### Download Software

To download the software, execute the following command. Replace YOURLICENSE with the hostware license key in your dashboard.

```bash
export HW_LICENSE='YOURLICENSE'

mkdir /home/hw-vnc-proxy/
wget https://${HW_LICENSE}:${HW_LICENSE}@hostware.io/api/install/hostware-vnc-proxy.zip -O /home/hw-vnc-proxy/hostware-vnc-proxy.zip
wget https://${HW_LICENSE}:${HW_LICENSE}@hostware.io/api/install/HwProxmoxVncProxy.service -O /etc/systemd/system/HwProxmoxVncProxy.service

cd /home/hw-vnc-proxy && unzip /home/hw-vnc-proxy/hostware-vnc-proxy.zip
rm -f /home/hw-vnc-proxy/hostware-vnc-proxy.zip

cd /home/hw-vnc-proxy && npm install
```

#### Manual actions

Enter your hostware admin dashboard. Navigate to *`Hosting -> Proxmox -> VNC Proxy`* and configure your domain. (The port can be changed, more on that in the next step)\
Also copy the signature key for the next step.

<figure><img src="https://1141670261-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHupRK3qVDTomY8g3pcFA%2Fuploads%2F8OGKmoLx8KGa8Lgl4rBt%2Fimage.png?alt=media&#x26;token=98cc6023-1ed8-4309-9f19-a6e7182311ec" alt=""><figcaption></figcaption></figure>

#### Configure the proxy

Open /home/hw-vnc-proxy/config.json. Here you need to replace YOURDOMAIN with your vnc proxy domain and insert the signature key. This key will be used to encrypt the proxmox details between hostware and the VNC-Proxy software.&#x20;

{% hint style="info" %}
The key will change as soon as you migrate hostware to another server because parts of the laravel app key will be used.
{% endhint %}

If you want, you can also change the port of the VNC-Proxy here. This is not necessary at all.

<figure><img src="https://1141670261-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHupRK3qVDTomY8g3pcFA%2Fuploads%2FuufqFZYNQN2MEoQc5SzV%2Fimage.png?alt=media&#x26;token=de736642-efb5-494b-b991-b26e085ed494" alt=""><figcaption></figcaption></figure>

### 3. Testing the proxy

To start the proxy, navigate to /home/hw-vnc-proxy via SSH. Perform the command "node index.js" to temporarily start the VNC proxy.

If you see an error regarding SSL certificate, the generation of the Cert has not worked or is in another directory than configured in the config.json. Check the SSL Cert!

If everything works, you will see this:

![](https://1141670261-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHupRK3qVDTomY8g3pcFA%2Fuploads%2FLzd0fs9Us2GcVFsrtVg5%2Fimage.png?alt=media\&token=4ceaa84e-5056-41d6-99be-dbc307b49748)![](https://1141670261-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHupRK3qVDTomY8g3pcFA%2Fuploads%2FIMoAidu2VKmhZ1GRoScE%2Fimage.png?alt=media\&token=30b8a6ce-6220-47e8-a662-069582f87898)![](https://1141670261-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHupRK3qVDTomY8g3pcFA%2Fuploads%2FTElrriQ0WourIX4q0hIW%2Fimage.png?alt=media\&token=98029218-3e0e-4e4a-a513-0fac87bdbff1)

Customers should now be able to connect to the VNC proxy.

### 4. Start the proxy

To permanently start the VNC proxy for production usage, please press STRG+C to stop the temporarily started proxy.

Enter the following command to start the vnc proxy using the screen software

```bash
screen -d -m -S hw_proxy bash -c "/usr/bin/node /home/hostware-vnc/index.js"
```

Wait some seconds and check the status of the screen by using "screen -ls" and "screen -r hw\_proxy". \
In the hostware admin dashboard, the proxy should be listed as "online".


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hostware.io/modules/hosting-provisioning/proxmox-vps/vnc-proxy.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
