2.19. Starting the Oracle VM VirtualBox Web Service Automatically

The Oracle VM VirtualBox web service, vboxwebsrv, is used for controlling Oracle VM VirtualBox remotely. It is documented in detail in the Oracle VM VirtualBox Software Development Kit (SDK). See Chapter 4, Oracle VM VirtualBox Programming Interfaces. Web service start scripts are available for supported host operating systems. The following sections describe how to use the scripts. The Oracle VM VirtualBox web service is never started automatically as a result of a standard installation.

2.19.1. Linux: Starting the Web Service With init

On Linux, the web service can be automatically started during host boot by adding appropriate parameters to the file /etc/default/virtualbox. There is one mandatory parameter, VBOXWEB_USER, which must be set to the user which will later start the VMs. The parameters in the following table all start with the VBOXWEB_ prefix string. For example: VBOXWEB_HOST and VBOXWEB_PORT.

Table 2.2 Web Service Configuration Parameters

Parameter

Description

Default

USER

The user which the web service runs as

HOST

The host to bind the web service to

localhost

PORT

The port to bind the web service to

18083

SSL_KEYFILE

Server key and certificate file, in PEM format

SSL_PASSWORDFILE

File name for password to server key

SSL_CACERT

CA certificate file, in PEM format

SSL_CAPATH

CA certificate path

SSL_DHFILE

DH file name or DH key length in bits

SSL_RANDFILE

File containing seed for random number generator

TIMEOUT

Session timeout in seconds, 0 disables timeouts

300

CHECK_INTERVAL

Frequency of timeout checks in seconds

5

THREADS

Maximum number of worker threads to run in parallel

100

KEEPALIVE

Maximum number of requests before a socket will be closed

100

ROTATE

Number of log files, 0 disables log rotation

10

LOGSIZE

Maximum log file size to trigger rotation, in bytes

1MB

LOGINTERVAL

Maximum time interval to trigger log rotation, in seconds

1 day


Setting the parameter SSL_KEYFILE enables the SSL/TLS support. Using encryption is strongly encouraged, as otherwise everything, including passwords, is transferred in clear text.

2.19.2. Oracle Solaris: Starting the Web Service With SMF

On Oracle Solaris hosts, the Oracle VM VirtualBox web service daemon is integrated into the SMF framework. You can change the parameters, but do not have to if the defaults below already match your needs:

svccfg -s svc:/application/virtualbox/webservice:default setprop config/host=localhost
svccfg -s svc:/application/virtualbox/webservice:default setprop config/port=18083
svccfg -s svc:/application/virtualbox/webservice:default setprop config/user=root

The table in Section 2.19.1, “Linux: Starting the Web Service With init” showing the parameter names and defaults also applies for Oracle Solaris. The parameter names must be changed to lowercase and a prefix of config/ has to be added. For example: config/user or config/ssl_keyfile. If you make any change, do not forget to run the following command to put the changes into effect immediately:

svcadm refresh svc:/application/virtualbox/webservice:default

If you forget the above command then the previous settings are used when enabling the service. Check the current property settings as follows:

svcprop -p config svc:/application/virtualbox/webservice:default

When everything is configured correctly you can start the Oracle VM VirtualBox web service with the following command:

svcadm enable svc:/application/virtualbox/webservice:default

For more information about SMF, please refer to the Oracle Solaris documentation.

2.19.3. Mac OS X: Starting the Web Service With launchd

On Mac OS X, launchd is used to start the Oracle VM VirtualBox webservice. An example configuration file can be found in $HOME/Library/LaunchAgents/org.virtualbox.vboxwebsrv.plist. It can be enabled by changing the Disabled key from true to false. To manually start the service use the following command:

launchctl load ~/Library/LaunchAgents/org.virtualbox.vboxwebsrv.plist

For additional information on how launchd services could be configured see:

https://developer.apple.com/library/mac/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLaunchdJobs.html.