I know that VB offers many things to control it : SDK, API, COM, web server etc
What I'd like to do is have a GUI to simply create VM connected through networks but I have to know: what is the best solution use Frontends [1], webserver, COM* or API ? elsewhere libvirt ?
A an example a use case could be : I put 3 VMs on my GUI, choose their respective OS , create 1 or more network connection(s) for each and connect these VM to create network(s).
Python, C++, etc, implementation language doesn't matter.
[1] http://www.virtualbox.org/manual/ch01.html#frontends
My qualifications for answering this being that I created and have maintained Vagrant since early 2010. Here are my general opinions of each of the available frontends for scripting VirtualBox:
vboxwebsrv is the VirtualBox web service which provides an API to control VirtualBox. The pro of this is that web services are easy to program for nowadays. The main con is that you must handle startting and stopping this web service manually (or check to make sure it is already running). Historically, the web service has not been fully up-to-date with the latest APIs available in each version of VirtualBox, but I'm not sure what the status of that is today.
COM or C API. VirtualBox provides an XPCOM based API on non-Windows platforms and an MSCOM based API on Windows. If you can't use C++, you can also use the C API on Linux (but it is not available/exported on Windows). I used this API for over a year. Pros: Fast and complete. Since it is a C API it is very fast, communicating with the VirtualBox process directly. It is also complete, since this is the same API that VirtualBox GUI is using as well as using internally. The main con is that XPCOM is not easy, and the C API is not available on Windows, meaning you either have to pain through XPCOM, or you need to handle both C and MSCOM. I chose the latter and it turned out to be a nightmare of compatibility. Almost every minor release of VirtualBox (3.1, 3.2, etc.) will change the API in a backwards incompatible way (slightly) and a major release and you can completely forget about (3.0, 4.0, etc.). This makes handling older versions of VirtualBox... tricky. This is definitely an advanced use case.
VBoxManage is the CLI based frontend for VirtualBox. Under the covers VBoxManage is of course just using the COM-based API, but provides a much more user-friendly cover on top of it. I've found that for 99% of use cases, VBoxManage can cover it. VBoxManage also handles all error handling, does proper exit status (0 for success, non-zero for everything else), etc. After 1.5 years of the C API I've switched back to VBoxManage because its simply easier to use and does what I need to do. The downside is you must use a subprocess to talk to VBoxManage. The upside is VBoxManage changes relatively infrequently, and as such it makes it very easy to support many versions of VirtualBox.
I hope this helps!
Related
I have a C++ program which I want to use on my clients machines. However, some of my clients are behind proxies. Therefore, I want my program to automatically detect these proxies.
I have tried many solutions, such as reading the registry for the proxy settings, trying the Windows API's, etc.
However none of them have worked out well. E.g. the registry sometimes holds the url for the PAC-file and sometimes the actual proxy-address itself. Besides that, I haven't been able to find any username and password related to the proxy if it is set on the client machine (which some users say they have).
So, basically my question is:
How can I automatically determine the proxy settings of my clients in C++ so I can use the proxy-settings in my LibCurl requests later on regarding:
Proxy-address
Proxy-port
Proxy-User
Proxy-Password
I can't get it to work and I have been trying it for two weeks now without any improvement...
You can not read proxy setting in a generic way, since every application is free to store it in any way it wants. You should be able to read Internet Explorer proxy by using WinHttpGetIEProxyConfigForCurrentUser function, and it would also work for users browsers which use this setting, like Google Chrome.
How can I automatically determine the proxy settings of my clients in C++ so I can use the proxy-settings in my LibCurl requests?
libproxy is the answer!
Libproxy home page on GitHub
Libproxy repo on GitHub
It has these features according to the home page:
support for all major platforms: Windows, Mac and Linux/UNIX (see upcoming 0.4 release)
extremely small core footprint
no external dependencies within libproxy core (libproxy plugins may have dependencies)
only 3 functions in the stable-ish external API (1.0 will offer full stability)
dynamic adjustment to changing network topology
a standard way of dealing with proxy settings across all scenarios
a sublime sense of joy and accomplishment
I have 2 application running on the same machine.
Editor, is a Windows 8 application developed with WinRT and is sand-boxed. (Client)
Integrator is a C++ application for reading hardware devices over serial COM ports. (Server)
I have done a lot of searches about how to get client/server communication to work on Windows 8,
and can only find posts that say it is not possible using standard WinRT classes, etc.
What I need is a solution where by the Windows 8 application works as a client, and the standalone
executable works as a server.
Can someone please suggest a mechanism that can be used to do client/server communication.
If we cannot find a good solution for this, then we will have to resort to using files, which
I would rather not have to do.
Clarification: I am aware of the many mechanism that can be used to do client/server communication.
What I am looking for is a workaround to the problem, where the these techniques will not work on
a Windows 8 application, developed with WinRT. As the sand-boxing explicitly prohibits the client
and server being on the same host machine.
Well, the posts stating that such communication is not possible, are mostly right. There are 2 reasons, why this is prevented:
Being able to communicate to an application outside the sandbox effectively breaks the sandbox. The Windows Store app is now suddenly able to do everything the desktop application can do: access file system, registry... Windows Store apps live in a sandbox for reason - to be safe for the user.
The Windows Store app won't work after it is installed from the the store or from a package. It needs to have a desktop application installed and set up correctly as well.
I would suggest you try to move your server part to a different machine and make it a proper server. If for some reason you really can't do that, you still have the following options available:
You can use TCP/IP to connect local network resources if you remove the isolation for your Windows Store app. You will need to use CheckNetIsolation.exe, but since you already need to separately install the desktop application, this shouldn't be that much of a problem.
You can create files with a specific extension. Then register the desktop app for one extension and the Windows Store app for another extension. You can now shell execute files with these extensions to use them as a message for the other app.
Does anyone have a good way to set up multiple CFML engines, and versions of them, together in a suitable environment for cross testing a CFML based application.
Ideally, I'd like this to be Ubuntu Server based as I'm using it with VirtualBox (under Windows 7). Plus it'd be helpful if it was possible to switch between, so my laptop can cope with one at a time rather than all running at once. I'm thinking of the following:
Adobe ColdFusion 9
Adobe ColdFusion 10
Railo 3.3.x
Railo 4.x
OpenBD 2.x
I'd also like to get them serving from the same shared directory, so I don't have to have a copy of the code for each engine. Cheers
You mentioned being able to "switch between, so my laptop can cope with one at a time rather than all running at once", I'm guessing that you are thinking that each one will run on a different VM, or that they might require a huge amount of memory. I don't think you need to worry about that. Unless you require that they be on different machines, I think you could do this all on one VM and with one instance of a servlet container (like Tomcat).
From a high-level view, here is how I would do it.
Install Tomcat
Create or download .wars for each of the engines.
Deploy said .wars to that one instance of Tomcat
Set up Tomcat to use each of those servlets from a different host name (server.xml)
Create a code directory outside of Tomcat for your one copy of the code
Set up a Symbolic link in each webapp to link the code folder into the servlet
You should then be able to hit the same source from each engine by visiting the different host names in the browser.
I may be missing something. It has been a long time since I set something like this up. You'll likely need to make a bunch of tweaks (JVM settings, switching to Sun/ORACLE JVM vs. OpenJDK, etc).
I don't think running this many engines will cause you great trouble. In my experiences, for development, I have had 3 instances of CF9 running on Tomcat using only 189mb of RAM. And each additional instance did not increase that number by 1/3. Far less. It would not surprise me if you could run all of those handily with less than 512md of RAM. Possibly even 256mb if you are really hurting on memory.
I hope this helps.
For ColdFusion 10, Railo and OpenBD you would be looking at deploying with standalone installations of Tomcat, Jetty or JBoss.
ColdFusion 9, probably the easiest solution is "Enterprise Multiserver configuration" setup.
With these kinds of installation they are pretty much platform agnostic.
The things to be aware of are the web server, proxy and jndi ports that are used by each installation, but only if you want to run more than one server at a time.
After that it's whether you are bothered about proxying from apache or Nginx to the server instances and the connector you want to use.
No idea if this helps...
Since you've mentioned the VirtualBox, I'll share my personal approach to this task. It includes few fairly simple steps:
Install Ubuntu Server as VirtualBox guest (host is also Ubuntu).
Set up only basic software like JVM and updates. Set up virtual
machine networking as bridged adapter to use my Wi-Fi connection.
Configure my Wi-Fi router DHCP to assign static IP for MAC address of the virtual machine.
Add entry to my (host) system hosts: ip_assigned_to_vm virtual.ubuntu
Set up guest additions and mount my ~/www directory inside the machine to access web applications.
Now, when I need another machine for experiments, or some other configuration of software (I've tested ACF 10 and Railo 4 this way) I do two things:
Clone existing clean machine.
Make sure it is using the same MAC address with bridged interface.
That's it.
It doesn't matter which of the machines I run, they all can be accessed as http://virtual.ubuntu (of course, it requires proper web-server configuration on the guest). Same time they are independent and it is completely safe to make anything I wish and test anything that runs on Ubuntu.
Obvious downsides are that I can run just one machine at a time, plus much more disk space is used. Not a problem to me.
I've tried approach with Tomcat and multiple WARs, but it has couple of issues: I can't use different JVM and Tomcat settings, also if I screw the setup -- all the Tomcat hosts are down.
Hope this helps.
What would be the simplest way for an application I'm writing to block all Internet access on a Windows machine?
More details:
Windows: XP or higher
Application: A basic Win32 app written in C/C++.
Blocking: It needs to be able to block and unblock at will, ideally in a way that the user can't easily reverse. (By, say, right clicking on a network connection icon in the system tray.) Also, ideally, I'd like the method it uses to allow access to be restored should the user restart Windows or reset the machine, though I'd also be willing to have the app auto launch with Windows and unblock access upon startup if the machine was reset while in a blocked state.
Internet access: Primarily, I'd like to block conventional browsers from hitting conventional http/https sites. Secondarily, it would be nice to block IM clients and client-side social networking apps. It would also be nice, but not required, to still allow local networking for file sharing, etc. (Note that only the first requirement is absolute.)
Final notes: This is not meant to be a security utility, nor will its relationship to the user be adversarial (as, for example, with a parental control utility) so it's not important for it to use a scheme that can't be worked around by a determined user. (Consider that I intend for a reboot or reset to clear the blocking. This means that any workaround a user might discover that would take more effort than this is okay.)
Thanks!
p.s. I suspect that the Windows Firewall API won't work for me because this needs to work for users that haven't enabled the firewall or don't have admin privileges, but I'll be thrilled if I'm corrected on this.
It sounds like you're intending to run applications that you don't want to access the internet. Perhaps you could run them inside a virtual machine such as VirtualBox with networking disabled.
You could do it with a Winsock SPI. The Windows SDK has a sample (under Samples\netds\winsock\lsp) which implements what is called a layered service provider which allows you to hook all the user mode functions provided by Winsock and reject/modify the calls to block network access or redirect traffic to different locations. All installed winsock applications will be affected, so in your code you could have policys for what applications can go out and the like and disabled/enable on the fly. Now a determined person could find ways around this but it would be a pain.
That said this isn't trivial to do but the sample should get you most of the way there.
You cannot effectively or practically write your tool with only a user mode application.
What you need to write is a network I/O stack filter driver. This done by writing a Windows Driver. This is different from a Windows Win32 application. Drivers run in kernel mode and applications run in user mode.
On Windows Vista and later, the kernel mode Network Programming Interface (NPI) is designed for this. This is the same API that Windows Firewalls use. These are sometimes called the Winsock kernel (WSK) APIs.
In effect, you are writing a network firewall (more or less)
here are some links
Introduction to Winsock Kernel (WSK)
Windows Core Networking Blog
The Network Programming Interface Docs on MSDN
Note, your will likely need at least two components
Your driver
A Graphical application that a person can use to control your tool
If you want to do any monitoring, you will likely need a user mode service that collects data from your driver. This works better than trying to do this in the driver. In general, you should do the minimal amount of work in the driver.
A few notes:
You need to be very conscious of security when writing this kind of software. This is very much non trivial. Software that is network facing has the highest security requirements.
Be cognizant of performance.
Your driver and/or service must be aware of the context of a calling application. This is also a security boundary. For example, an application not running as administrator should not be able to control your driver.
take a look at firewall sourcecodes
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
Background:
I'm running a full-time job and a part-time job in the weekends, and both my employers have supplied a laptop for me to work on. Of course I also have my powerful workstation at home to work from, and sometimes when I'm at the office at my weekend job (it's in another city) I'm working from yet another workstation.
Problem:
That makes a full 4 PC's I'm maintaining (software versions, licences and settings) just to do my work, and believe me, my list of prefered software is way too big.
I want to setup a Virtual Desktop on my VMware server, so I can work from the same installation and same session no matter which PC I'm working from.
Now I don't have the time and money to go through a full test of each setup, so I'd like to hear your experiences on the subject.
Question:
Should I use a VMware virtual workstation with some remote logon software (like realVNC, teamviewer, logmein, whatever...) or should I invest in a full VDI system like Sun or VMware provide?
Edit:
I'm programming in Adobe Dreamweaver on Windows XP - but I run my servers on Debian and sometimes do quick edits in VIM too. First I intend to virtualize a WinXP with base installation, to see how it runs.
I am a consultant and tend to work in a variety of environments. I carry a Thinkpad running VMWare Server over Ubuntu64 with 4GB of RAM. I've got a 320GB secondary hard drive that I use just for VM's and have 25 or so different virtual machines that I boot up as the circumstances demand.
They're a mix of Linux servers and workstations, Vista workstations and XP Workstations. I rarely use the VMWare server console. I access every one of them via one of the remote access methods.
For Linux, I usually install FreeNX or NXServer for desktop access and just SSH for commandline. On Windows, I always use Remote Desktop (RDP), but, on XP, that only works on the "Pro" versions, not the "Home" versions. If all else fails, I install VNC and use that. VNC is at the bottom of my list because it really is a last resort. The only thing it's better than is not actually being able to use the machine.
However, NX on Linux and RDP on Windows work WAY better than VNC. Other than little things like font smoothing and fancy desktop effects, the only big glitch would be if you are doing much with video or audio or DirectX-based stuff. Things like YouTube or other video do NOT like to work with any remote desktop protocol that I know of.
As far as performance, using Linux as a host for VMWare provides really good management of system resources. The Windows-based VM's aren't able to just gobble up memory, but still get it when they need to.
I do C# development all day in a virtual Vista workstation on Visual Studio 2008 and have absolutely no problems having 3-4 different solutions all open at once along with the normal stuff alongside over RDP on another machine, connected via wireless VPN.
I can flip over to the host OS and it won't even be touching swap space at all. As far as I'm concerned, it's a great way to work.
If you want to work with the same installation, you should seriously consider the Remote Desktop Server/Client solution, bundled into every windows OS from XP. Basically, this app displays the view from your remote desktop to your local one, using highly compressed images; this works even via low-bandwidth internet connections
While the XP version can only handle one user simultaneously, the one in Windows Server 2003 (and in Windows Server 2008, I presume) can handle multiple users (up to a certain limit).
Disadvantages, and side-effects include:
virtual pc via RDC is slow
anything using the 3d acceleration will be slow (at least using XP/2003)
Personally, I would go down the route of using a virtual workstation with some remote logon software. The network performance of VMWare has always been good in my experience, and depending on the OS, there may be a decent remote logon provided.
I guess you can live with Logmein Free. [Or Pro if u want those features]
Well, you don't say what OSs are involved, so.....
For windows, I find that Remote Desktop works as well or better than anything else, although if you pay for the RealVNC version with the mirror driver, that's supposed to be as good.
For off site access for windows, www.logmein.com (the free version) works very well.
If Unixes are involved, then VNC is definitely the way to go, there are various solutions for doing this remotely. Everything from redirection servers, to just forwarding a port in your firewall to an ssh server and setting up the various tunnels.
Performance of VMWare is very good, and I can run a SQL Server slice, a web server slice and develop on my laptop simultaneously. The VM slices reside on a USB 2 portable drive and make it easy to port between my laptop and desktop.
VM Console works well for accessing each environment, and depending on the configuration you set up with NAT vs. Bridging you can UNC to shares on slice.
The nice by-product of this is that should you host machine take a nose dive you can quickly recover your development environment.