[TUTORIAL] Proxmox console connection on 3rd party application

berkcekisbas

New Member
Jan 9, 2023
2
0
1
Hello, I would like to share with you a problem that I could not find the answer to, but I solved. I hope it helps someone.
I have developed an application with Laravel so that my clients can manage virtual machines and I don't want to share the proxmox node ip information.I followed the following way for console connection to my customers.

Step 1. I set up one ubuntu 22 virtual server
Step 2 I installed novnc on the ubuntu server by running the command sudo apt-get install novnc on the server.
Step 3. I started listening on a port by starting a websockify with the following command on the ubuntu server.

Code:
websockify -D --web=/usr/share/novnc/ 5900 x.x.x.x:5900

Step 4 Then I made a request to the following endpoint through my application.

Code:
 /api2/json/nodes/{node}/qemu/{vmid}/vncproxy

parameters : ['websocket' => 1,'generate-password' => 1]

Step 5 : proxmox will keep the connection open for a short time. That's why we need to quickly establish the connection.

Here we send the port and password information returned from API to novnc in iframe.

echo '<iframe src=x.x.x.x:'.[vncproxy-port].'/vnc.html?password='.urlencode(['vncproxy-password']).'&autoconnect=true&resize=scale" width="100%" height="100%">';

If you make an iframe connection to the server you have installed, you will see that the console connection is provided.

You can start websockify daemons with an algorithm according to your cluster and node number.

remember, when you set up your ubuntu server and start websockify deam, you should see the novnc screen when you open http://x.x.x.x:5900. Don't go to the next step without catching this.

In this way, I was able to open more than one cluster and more than one node to the management of my customers on the software I designed and arranged the console connections by providing authorization.

I hope this information is useful to someone.
 
Hi,

for thread like these it might be useful to add the "Tutorial" prefix to the subject. You can edit the your existing thread to add it, just choose "Tutorial" in the drop-down before the subject line ;)
 
  • Like
Reactions: berkcekisbas
Firstly thank you for posting.

Did you need to pass the ticket at all? I'm following your steps, websockify server port does show novnc page, however I get an error in novnc (failed to connect to server) and in console:

Failed when connecting: Connection closed (code: 1011, reason: Failed to connect to downstream server)
_fail @ rfb.js:688
(anonymous) @ rfb.js:222
(anonymous) @ websock.js:225


Wondering if you had this issue?
 
Got it to work by updating

/usr/share/perl5/PVE/API2/Qemu.pm ~line 2248 to use 0.0.0.0 as the listen address for vncterm command instead of localhost which is the default

Did you have to do this OP?
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!