Automatically Start VirtualBox Web Service on Oracle Solaris 11
Per Oracle VM VirtualBox Administrator's Guide for Release 6.0: 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.
You can learn more about how to interact with the VirtualBox Web Service through the SDK Programming Guide (API Reference).
The official documentation (VirtualBox Documentation: Chapter 9. Advanced Topics: 9.18.2. Oracle Solaris: Starting the Web Service With SMF) is somewhat convoluted. Here I will try to straighten it out, for my purposes - your mileage may vary.
First, configure the parameters. They are provided in the documentation as a table of Linux environment variables to be loaded in /etc/defaults/virtualbox; on Solaris we must provide these to svccfg on the command line both lower-cased and prefixed with config/.
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 |
For example:
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=user
The documentation provides the example for config/user as root. I could not more strongly advise against running any sort of network-exposed daemon as root and instead encourage you to configure a local user account with sufficient permissions to both administrate your virtual machines and run the web service.
After making any changes via svcconfig while the service is running you must run the following to make the changes live:
svcadm refresh svc:/application/virtualbox/webservice:default
To view the current configuration run:
# svcprop -p config svc:/application/virtualbox/webservice:default
config/host astring localhost
config/keyfile astring ""
config/port integer 18083
config/user astring user
When your configuration is satisfactorily complete run:
svcadm enable svc:/application/virtualbox/webservice:default
To shut down a currently running instance of the service supply disable instead:
svcadm disable svc:/application/virtualbox/webservice:default