Secure way to communicate between virtualBox host and guest

Discussions related to using the OSE version of VirtualBox.
Post Reply
shivanik
Posts: 3
Joined: 13. Jun 2014, 05:50

Secure way to communicate between virtualBox host and guest

Post by shivanik »

Hi All,
I'm new to VirtualBox and would like to know if there is a way to securely communicate between the guest and the host through a C program. I ideally want a server program running on a linux host and client on VirtualBox guest VM communicating via messages. Ideally the communication mechanism could be some hypercalls between the guest and the host. Is there some API I could use or simple utilities that help with this ?

Thanks
Shivani
noteirak
Site Moderator
Posts: 5229
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: Secure way to communicate between virtualBox host and gu

Post by noteirak »

Moved to Virtualbox OSE since it fits better.

There are several ways indeed, but depends what you define by "secure"?
- In the API, guest properties - reference (more methods bellow)
- In the API, via guest processes - reference
- In the code, HGCM (host-guest Communication Manager) - reference
- In the code, HGSMI (Host-Guest Shared Memory Interface) - reference
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
shivanik
Posts: 3
Joined: 13. Jun 2014, 05:50

Re: Secure way to communicate between virtualBox host and gu

Post by shivanik »

Thanks for the help.
I think I can utilize the guest property store to pass messages between the host and the guest. Are there any simple C code examples to read and write from the store ?

Regards
Shivani
shivanik
Posts: 3
Joined: 13. Jun 2014, 05:50

Re: Secure way to communicate between virtualBox host and gu

Post by shivanik »

I would like to use the VBoxCAPI to write a userland server code running in host and client code running in guest communicating by reading and writing to the guest property store. Any code examples would be very helpful. I tried using the command line utils (VBoxManage guestproperty at the host end and VBoxControl guestproperty at the guest end) and they work well for me.
Also I found VBoxGuest-linux.c kernel module. It seems to be the driver VBoxManage/VBoxControl use for communication. Is my understanding correct. If so, I probably could write simple C utilty to make ioctl calls to the driver. Any info you can provide would be great.

Thanks
noteirak
Site Moderator
Posts: 5229
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: Secure way to communicate between virtualBox host and gu

Post by noteirak »

Do you need to do it in C or can you do it in C++ ? I ask because C is a beast of its own and I wouldn't recommend it. For the C++ part, you can directly see how it is done in vboxmanage per example.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
jchatham
Posts: 19
Joined: 15. Jul 2013, 20:57

Re: Secure way to communicate between virtualBox host and gu

Post by jchatham »

Alternatively, you may want to look in this thread; security wasn't one of my concerns, but response time and throughput were, and the results have been largely satisfactory - at least once I added a 25ms delay into the busy loop that VBoxManage uses.

In my case, I'm using C code to execute VBoxManage as a subsidiary process, and then communicate with its stdin/stdout; it then runs a program in the guest that simply plays relay between its stdin/stdout and a set of named pipes to talk to the actual client in the guest. If you need higher throughput than you can get from guest properties, something like this should work fairly well.
Post Reply