Export to GitHub

phpvirtualbox - issue #33

VNC support in interface


Posted on Aug 8, 2010 by Helpful Lion

What steps will reproduce the problem? 1. Use OSE version of Virtualbox 2. 3.

What is the expected output? What do you see instead? The interface seems to be well integrated with rdp but what about vnc support?

Please provide any additional information below.

Intended use is when running freebsd as host os

Comment #1

Posted on Aug 9, 2010 by Happy Bear

(No comment was entered for this change.)

Comment #2

Posted on Aug 9, 2010 by Happy Bear

The problem is that VirtualBox OSE as a whole is not well integrated with VNC. You can manually start VBoxHeadless and enable VNC, but you cannot do this through the API (and so, phpVirtualBox cannot do this). You can specify RDP ports in each VM's config, but you cannot do this with VNC and OSE. So phpVirtualBox would not be able to programmatically obtain, display, or use the port number on which the VNC server is running. It would not even be able to tell if it is running at all. With these in mind, I have to ask if it's really worth including an integrated VNC client where you would have no control over, or access to VMs' VNC configuration. You would be entering everything by hand. At that point, why not just use a thick VNC client?

I'm not saying I won't ever do it, but it is definitely low on the TODO list. If someone else would like to develop this and submit a patch, I'd be happy to use it.

Comment #3

Posted on Aug 9, 2010 by Happy Bear

(No comment was entered for this change.)

Comment #4

Posted on Aug 9, 2010 by Helpful Lion

Hmm sad to hear then maybe it would be good to make some feature request with vbox devs for its inclusion in the API. PUEL version in all glory but on freebsd only OSE is available. Maybe would be easier for them to make a PUEL version for freebsd instead.

Comment #5

Posted on Oct 23, 2010 by Grumpy Cat

Comment deleted

Comment #6

Posted on Oct 23, 2010 by Grumpy Cat

I made a workaround for it...

Working on: Ubuntu 10.10 x86 64bits server. Virtualbox 3.2.8_OSE from apt-get install

steps:

step 1 - rename VBoxHeadless to VBoxHeadless_bin mv /usr/lib/virtualbox/VBoxHeadless /usr/lib/virtualbox/VBoxHeadless_bin

step 2 - created a bash script named /usr/lib/virtualbox/VBoxHeadless:

!/bin/bash

pos=expr index "$2" ';' argvnc=${2:pos:999} argvnc="--vnc --vncport $argvnc"

exec "/usr/lib/virtualbox/VBoxHeadless_bin" "$@" $argvnc

step 3 - set permissions to execute chmod +x /usr/lib/virtualbox/VBoxHeadless chmod +s /usr/lib/virtualbox/VBoxHeadless

step4 - Machine name need to have ;vncport_number sample: Machinename;5900

Start machine, and connect with your favorite vncviewer.

Done.

Watch out!!! Machine name can have shell injection ;)

Comment #7

Posted on Oct 23, 2010 by Grumpy Cat

A better script:


!/bin/bash

pos=expr index "$2" ';' argvnc="" echo $pos if [ $pos -ne 0 ] then pos=expr $pos - 1 argvnc=${2:pos:999} argvnc=${argvnc/;/ --vnc --vncport } fi

exec "/usr/lib/virtualbox/VBoxHeadless_bin" "$@" $argvnc

Go for it

Comment #8

Posted on Oct 29, 2010 by Swift Hippo

nilzao, great script and greater thought behind integrating it & in VBoxHeadless. Thanks.

Comment #9

Posted on Jan 26, 2011 by Helpful Wombat

Please at this project: https://github.com/kanaka/noVNC/wiki

Comment #10

Posted on Jan 28, 2011 by Happy Bear

VirtualBox no longer supports VNC. Until it does, this issue will be closed.

Comment #11

Posted on Jan 28, 2011 by Happy Bear

(No comment was entered for this change.)

Comment #12

Posted on Feb 4, 2011 by Swift Hippo

VBoxHeadless of VirtualBox V4.0.2 OSE supports VNC just uncomment "VBOX_WITH_VNC = 1" in Config.kmk

Comment #13

Posted on Feb 4, 2011 by Happy Bear

Ah. Good to know. Thank you! .. now off to build OSE...

Comment #14

Posted on Feb 5, 2011 by Happy Bear

But it's still has the same issues it had before :(. I guess it will have to wait until VNC is available as a VRDE extension pack.

Comment #15

Posted on Feb 17, 2011 by Happy Lion

¿What about a workaround?

Imagine, you add to config.php: $imInTheHost = true;

And then you can use that variable over the application. If something isn't available through the API, you can check and do the workaround: if ($imInTheHost && function_exists('exec')) { exec("VBoxHeadless --startvm $machine --vnc --vncport $port &"); }

It's just an idea...

Comment #16

Posted on Feb 17, 2011 by Happy Bear

@yajo - That would require apache (or whatever web server is being used) to run as the same user that runs vboxwebsrv. I think a VNC VRDE extension pack is in the works anyway. i hope it is released soon.

Comment #17

Posted on Feb 17, 2011 by Happy Lion

Humm you're right, but in the config you also have the username and password. I'm sure that with that info, there must be a way to do it.

su -c "command blabla" $user comes to my mind...

Anyway I agree with you, the extension pack would be the best. Like I said before, this is just an idea. ;)

Nice job, by the way.

Comment #18

Posted on May 31, 2011 by Helpful Ox

If you are still interested, I (or someone else) might be able to patch VirtualBox to load the VNC server configuration from the VM ExtraData (VBoxManage getextradata/setextradata) - so that the VNC configuration can be stored with the VM.

The above shellscript wrapper around VBoxHeadless could (should) also have used the VM ExtraData rather than encoding the VNC port in the VM name.

Comment #19

Posted on Oct 26, 2011 by Swift Elephant

I'm interested with working solution for auto start VNC via phpVirtualBox GUI, as long is Extension pack is not available for FreeBSD :(

Comment #20

Posted on Oct 26, 2011 by Happy Bear

@sla.. someone needs to alter the VNC code in VirtualBox itself so that it tells virtualbox its port / ip info. ufo... has the right idea. Someone just needs to implement this. If you are interested, you should go over to virtualbox.org and join the development mailing list there.

Comment #21

Posted on Jan 10, 2012 by Grumpy Cat

Done again the vnc bash script workaround.

Running on: ArchLinux 3.1.8-1-ARCH i686 VirtualBox 4.1.8_OSE (from pacman -S virtualbox) phpVirtualBox 4.1-6.1 / VirtualBox 4.1.x compatible (not from pacman)

Comment #22

Posted on Apr 4, 2012 by Quick Rabbit

It looks like VRDE-based VNC support has landed in VirtualBox trunk:

https://www.virtualbox.org/browser/vbox/trunk/src/VBox/ExtPacks/VNC

Comment #23

Posted on Apr 5, 2012 by Quick Rabbit

Attached is an initial patch to add support for configuring VNC via the VRDE interface. I've tested it out with the VNC extpak from trunk, and am able to connect to the virtual machine's VNC service. Setting the VNC password, listen address, port bindings, etc, works as expected.

This patch doesn't include actual console support -- I'm not sure of the right solution to use there -- and not sure I'll have time to work on it) -- but here's my current thinking on the matter, for whatever it's worth:

Encryption for the console connection would be required for my use, and I'd imagine a lot of other users, but I could be wrong. Libvncserver as used by virtualbox doesn't support SSL (something that might warrant an upstream patch), which makes this tougher.

NoVNC (as referenced above) is one option -- it supports websockets over SSL, so it could piggyback on an SSL connection that is used to serve up the phpvirtualbox console -- but PHP doesn't seem as well suited to supporting websockets directly (I'm no PHP expert, so I may be wrong here). Assuming this could be used, there's still the problem of encryption between phpvirtualbox and the actual virtual machine's VNC server.

As alternative to NoVNC, there are flash VNC clients, but they'd connect directly over the network, rather than via the web server, and so would not benefit from phpvirtualbox being served up over SSL as described above. Not supporting encryption for those connections would be a non-starter for my use, but I may be in the minority.

I'm personally tempted to go the route of something like: - NoVNC - https://github.com/kumina/wsproxy/ - inetd + stunnel + wsproxy

... but maybe someone else has a better idea.

Attachments

Comment #24

Posted on Jun 2, 2012 by Helpful Rabbit

Hi. Sorry if this is completely off-base. I'm not an expert in there things.

When you are talking about encryption and security on VNC, if you SSH into the VirtualBox server and use port-forwarding (maybe I should say tunneling?) for RDP to provide security, could you not do the same thing with VNC? I never got the RDP authentication to work in VirtualBox so I closed it off from the outside and use SSH for my RDP connections. Luckily my iPad RDP client supports SSH, so between phpvirtualbox and my RDP client I can manage everything on my iOS device. However, I like my VNC client better, so VNC would be preferable for me if everything else was the same.

Comment #25

Posted on Sep 30, 2012 by Happy Ox

MAKE IT WORK ON MAC OSX AND WINDOWS 7&8 AS IM TESTING ON AS MANY OS'S AS POSSIBLE

Comment #26

Posted on Sep 30, 2012 by Swift Rabbit

Hi, this issue seems to be solving itself with virtualbox-ose 4.2.0 + VNC extpack + phpVirtualbox 4.2.0 beta. VM can be started with phpVirtualBox, we only need to start a vnc viewer manually. Tested on FreeBSD 9.0 Who would ask for more ? THX for all the work.

Comment #27

Posted on Nov 9, 2012 by Grumpy Bear

As in comment 26 said, it works this way with phpVirtualbox and vnc. What is crucialy needed is to provide a way to set the password of the vm's vnc viewer. It can be done by VBoxManage modifyvm testmachine --vrdeproperty VNCPassword="myPass" but you have to switch to ssh to do so. This setting should be available under the remote display tab, maybe there should be switches in the config file to enable/disable vnc related fileds.

And as it seems to be possible to install both vnc extpack and oracle extpack, you may even switch between the vrde types on the fly (haven't tried this, as on freebsd there is no oracle extpack available): to select VNC VBoxManage setproperty vrdeextpack VNC

to select the Oracle VRDE VBoxManage setproperty vrdeextpack "Oracle VM VirtualBox Extension Pack"

Comment #28

Posted on Dec 8, 2012 by Quick Rabbit

My patch still works with the latest phpvirtualbox, and adds support for configuring the VNC password (and ports). You can launch a VNC viewer manually, although it would certainly be preferable to provide that through the Web UI, too.

Comment #29

Posted on Feb 12, 2013 by Quick Rabbit

Attached is an updated version of my patch that applies cleanly against phpvirtualbox 4.2.4. This allows for setting and retrieving the VNC password, port, and listen address.

Attachments

Comment #30

Posted on Mar 18, 2013 by Swift Rabbit

@ landon from comment 29 : I applied your patch to phpvirtualbox 4.2.5 (from trunk), and I confirm I can set a password for the VNC connection. Tested on FreeBSD 9.1 and VirtualBox-ose 4.2.10 thanks

Comment #31

Posted on Jul 25, 2013 by Happy Bear

Project moved to Sourceforge.net

https://sourceforge.net/projects/phpvirtualbox/

Status: Done

Labels:
Type-Enhancement Priority-Low