External VNCViewer Applet

Adnan

Active Member
Oct 4, 2012
22
1
41
Paris, France
Hello Proxmox !

I have some VPS (PV2 2.1) and I'm making some APIs (Proxy API) to allow my customers building their own app/website to manage their VPS.

Today, I'm making a test script to show the VNCViewer (vncproxy) from my computer, and I'm trying to make it LIKE the proxmox VNCViewer. I'm ok with the headers, the tokens, the ticket and the info about the VNC (PORT/Cert/User/Pass). My problem is embedding proxmox (tigervnc) java applet in an external HTML Page.

Here is my code:
HTML:
<!-- PHP Code to get all the necessary data -->
<html>
<head>
    <title><?php echo $vmTitle; ?></title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body>
    <script>
    PVE_vnc_console_event = function(appletid, action, err) {
    }
    </script>
    <applet id='pveKVMConsole-1018-vncapp' border='false' code='com.tigervnc.vncviewer.VncViewer' archive='https://MY_HOST:8006/vncterm/VncViewer.jar' width='100%' height='100%' style='width: 640px; height: 506px; '>
            <param name='id' value='pveKVMConsole-1018-vncapp'>
            <param name='PVECert' value='<?php echo str_replace("\n", '|', $res->data->cert); ?>'>
            <param name='PORT' value='<?php echo $res->data->port; ?>'>
            <param name='USERNAME' value='<?php echo $res->data->user; ?>'>
            <param name='PASSWORD' value='<?php echo $res->data->ticket; ?>'>
            <param name='Show Controls' value='No'>
            <param name='Offer Relogin' value='No'>
    </applet>
</body>
</html>

I've checked the 'param's, they're good (I put them correctly), and I also have a valid certificate on proxmox (pve-ssl.key & pve-ssl.pem).
So, when I try to load the page, the applet shows blackscreen for less than 1 sec then "Error: Server did not offer supported security type".

I know that there is a thing with authentication not supported by the new VNC servers, but I'm strictly using the same applet that on my proxmox server, but maybe I'm using it badly.

Do you have a idea ?

Env: Proxmox 2.1. Mac OSX Mountain Lion + Safari + Firefox. Script tested from localhost:80.

-- Edit --
I've noticed that the applet is trying to connect to the current webpage hostname, not the hostname of the server where the .jar is (Because of an error like "Could not connect to localhost:5901" when spamming "Reconnect". So... I've read tigerVNC sources a little, and I found a "Server" parameter. So I tried to add it in the arg list
Code:
<param name='Server' value='<?php echo "MY_HOST::".$res->data->port; ?>'>
but, now it says the same error about security type, and no more "localhost" appearing.

Maybe, the VNC server in proxmox is made to accept localhost connection?
 
Last edited:

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!