justvanbloom / phpvirtualbox

Automatically exported from code.google.com/p/phpvirtualbox
0 stars 0 forks source link

VNC support in interface #33

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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

Original issue reported on code.google.com by eriksson.hasse on 8 Aug 2010 at 11:41

GoogleCodeExporter commented 9 years ago

Original comment by imooreya...@gmail.com on 9 Aug 2010 at 2:50

GoogleCodeExporter commented 9 years ago
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.

Original comment by imooreya...@gmail.com on 9 Aug 2010 at 8:09

GoogleCodeExporter commented 9 years ago

Original comment by imooreya...@gmail.com on 9 Aug 2010 at 8:09

GoogleCodeExporter commented 9 years ago
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.

Original comment by eriksson.hasse on 9 Aug 2010 at 8:48

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
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 ;)

Original comment by nil...@gmail.com on 23 Oct 2010 at 8:22

GoogleCodeExporter commented 9 years ago
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

Original comment by nil...@gmail.com on 23 Oct 2010 at 8:38

GoogleCodeExporter commented 9 years ago
nilzao, great script and greater thought behind integrating it & in 
VBoxHeadless. Thanks.

Original comment by virtuo...@gmail.com on 29 Oct 2010 at 6:49

GoogleCodeExporter commented 9 years ago
Please at this project: https://github.com/kanaka/noVNC/wiki

Original comment by dama...@gmail.com on 26 Jan 2011 at 11:12

GoogleCodeExporter commented 9 years ago
VirtualBox no longer supports VNC. Until it does, this issue will be closed.

Original comment by imooreya...@gmail.com on 28 Jan 2011 at 4:44

GoogleCodeExporter commented 9 years ago

Original comment by imooreya...@gmail.com on 28 Jan 2011 at 4:45

GoogleCodeExporter commented 9 years ago
VBoxHeadless of VirtualBox V4.0.2 OSE supports VNC
just uncomment "VBOX_WITH_VNC = 1" in Config.kmk

Original comment by xxre...@googlemail.com on 4 Feb 2011 at 7:24

GoogleCodeExporter commented 9 years ago
Ah. Good to know. Thank you! .. now off to build OSE...

Original comment by imooreya...@gmail.com on 4 Feb 2011 at 7:37

GoogleCodeExporter commented 9 years ago
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.

Original comment by imooreya...@gmail.com on 5 Feb 2011 at 6:12

GoogleCodeExporter commented 9 years ago
¿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...

Original comment by yajo.sk8@gmail.com on 17 Feb 2011 at 4:54

GoogleCodeExporter commented 9 years ago
@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.

Original comment by imooreya...@gmail.com on 17 Feb 2011 at 8:20

GoogleCodeExporter commented 9 years ago
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.

Original comment by yajo.sk8@gmail.com on 17 Feb 2011 at 11:13

GoogleCodeExporter commented 9 years ago
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.

Original comment by ufo...@gmail.com on 31 May 2011 at 1:12

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

Original comment by slawo...@jasinski.us on 26 Oct 2011 at 5:27

GoogleCodeExporter commented 9 years ago
@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.

Original comment by imooreya...@gmail.com on 26 Oct 2011 at 1:33

GoogleCodeExporter commented 9 years ago
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)

Original comment by nil...@gmail.com on 10 Jan 2012 at 10:19

GoogleCodeExporter commented 9 years ago
It looks like VRDE-based VNC support has landed in VirtualBox trunk:

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

Original comment by landon.j.fuller@gmail.com on 4 Apr 2012 at 4:46

GoogleCodeExporter commented 9 years ago
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.

Original comment by landon.j.fuller@gmail.com on 5 Apr 2012 at 5:59

Attachments:

GoogleCodeExporter commented 9 years ago
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.

Original comment by devel...@gmail.com on 2 Jun 2012 at 3:43

GoogleCodeExporter commented 9 years ago
MAKE IT WORK ON MAC OSX AND WINDOWS 7&8 AS IM TESTING ON AS MANY OS'S AS 
POSSIBLE

Original comment by brngat...@gmail.com on 30 Sep 2012 at 2:33

GoogleCodeExporter commented 9 years ago
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.

Original comment by jande...@hotmail.com on 30 Sep 2012 at 3:21

GoogleCodeExporter commented 9 years ago
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"

Original comment by mathias....@googlemail.com on 9 Nov 2012 at 10:09

GoogleCodeExporter commented 9 years ago
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.

Original comment by landon.j.fuller@gmail.com on 8 Dec 2012 at 8:02

GoogleCodeExporter commented 9 years ago
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.

Original comment by landon.j.fuller@gmail.com on 12 Feb 2013 at 6:04

Attachments:

GoogleCodeExporter commented 9 years ago
@ 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

Original comment by jande...@hotmail.com on 18 Mar 2013 at 7:54

GoogleCodeExporter commented 9 years ago
Project moved to Sourceforge.net

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

Original comment by imooreya...@gmail.com on 25 Jul 2013 at 4:54