Changeset 40130 in vbox
- Timestamp:
- Feb 14, 2012 3:17:35 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Config.kmk
r39955 r40130 8 8 9 9 # 10 # Copyright (C) 2006-201 1Oracle Corporation10 # Copyright (C) 2006-2012 Oracle Corporation 11 11 # 12 12 # This file is part of VirtualBox Open Source Edition (OSE), as … … 483 483 # The webservices api. 484 484 VBOX_WITH_WEBSERVICES = 1 485 VBOX_WITH_WEBSERVICES_SSL = 1 485 486 # The Qt 4 GUI. 486 487 VBOX_WITH_QTGUI = 1 -
trunk/doc/manual/docbook2latex.xsl
r37524 r40130 19 19 by this XSLT (see below). 20 20 21 Copyright (C) 2006-201 0Oracle Corporation21 Copyright (C) 2006-2012 Oracle Corporation 22 22 23 23 This file is part of VirtualBox Open Source Edition (OSE), as … … 585 585 <xsl:with-param name="text" select="$subst6" /> 586 586 <xsl:with-param name="replace" select="'~'" /> 587 <xsl:with-param name="with" select="'\ ~'" />587 <xsl:with-param name="with" select="'\textasciitilde '" /> 588 588 <xsl:with-param name="disable-output-escaping" select="no" /> 589 589 </xsl:call-template> … … 676 676 <xsl:with-param name="text" select="$subst8" /> 677 677 <xsl:with-param name="replace" select="'~'" /> 678 <xsl:with-param name="with" select="'\ ~'" />678 <xsl:with-param name="with" select="'\textasciitilde '" /> 679 679 <xsl:with-param name="disable-output-escaping" select="no" /> 680 680 </xsl:call-template> -
trunk/doc/manual/en_US/SDKRef.xml
r39852 r40130 293 293 binary package for your specific platform. Since the SDK contains 294 294 only platform-independent text files and documentation, the binaries 295 are instead shipped with the platform-specific packages.</para> 295 are instead shipped with the platform-specific packages. For this 296 reason the information how to run it as a service is included in the 297 VirtualBox documentation.</para> 296 298 </note></para> 297 299 … … 340 342 <computeroutput>-p</computeroutput>): This specifies which port to 341 343 bind to on the host and defaults to 18083.</para> 344 </listitem> 345 346 <listitem> 347 <para><computeroutput>--ssl</computeroutput> (or 348 <computeroutput>-s</computeroutput>): This enables SSL support.</para> 349 </listitem> 350 351 <listitem> 352 <para><computeroutput>--keyfile</computeroutput> (or 353 <computeroutput>-K</computeroutput>): This specifies the file name 354 containing the server private key and the certificate. This is a 355 mandatory parameter if SSL is enabled.</para> 356 </listitem> 357 358 <listitem> 359 <para><computeroutput>--passwordfile</computeroutput> (or 360 <computeroutput>-a</computeroutput>): This specifies the file name 361 containing the password for the server private key. If unspecified 362 or an empty string is specified this is interpreted as an empty 363 password (i.e. the private key is not protected by a password). If 364 the file name <computeroutput>-</computeroutput> is specified then 365 then the password is read from the standard input stream, otherwise 366 from the specified file. The user is responsible for appropriate 367 access rights to protect the confidential password.</para> 368 </listitem> 369 370 <listitem> 371 <para><computeroutput>--cacert</computeroutput> (or 372 <computeroutput>-c</computeroutput>): This specifies the file name 373 containing the CA certificate appropriate for the server 374 certificate.</para> 375 </listitem> 376 377 <listitem> 378 <para><computeroutput>--capath</computeroutput> (or 379 <computeroutput>-C</computeroutput>): This specifies the directory 380 containing several CA certificates appropriate for the server 381 certificate.</para> 382 </listitem> 383 384 <listitem> 385 <para><computeroutput>--dhfile</computeroutput> (or 386 <computeroutput>-D</computeroutput>): This specifies the file name 387 containing the DH key. Alternatively it can contain the number of 388 bits of the DH key to generate. If left empty, RSA is used.</para> 389 </listitem> 390 391 <listitem> 392 <para><computeroutput>--randfile</computeroutput> (or 393 <computeroutput>-r</computeroutput>): This specifies the file name 394 containing the seed for the random number generator. If left empty, 395 an operating system specific source of the seed.</para> 342 396 </listitem> 343 397 … … 370 424 371 425 <listitem> 426 <para><computeroutput>--threads</computeroutput> (or 427 <computeroutput>-T</computeroutput>): This specifies the maximum 428 number or worker threads, and defaults to 100. This normally does 429 not need to be changed.</para> 430 </listitem> 431 432 <listitem> 433 <para><computeroutput>--keepalive</computeroutput> (or 434 <computeroutput>-k</computeroutput>): This specifies the maximum 435 number of requests which can be sent in one web service connection, 436 and defaults to 100. This normally does not need to be changed.</para> 437 </listitem> 438 439 <listitem> 440 <para><computeroutput>--authentication</computeroutput> (or 441 <computeroutput>-A</computeroutput>): This specifies the desired 442 web service authentication method. If the parameter is not 443 specified or the empty string is specified it does not change the 444 authentication method, otherwise it is set to the specified value. 445 Using this parameter is a good measure against accidental 446 misconfiguration, as the web service ensures periodically that it 447 isn't changed.</para> 448 </listitem> 449 450 <listitem> 372 451 <para><computeroutput>--verbose</computeroutput> (or 373 452 <computeroutput>-v</computeroutput>): Normally, the web service … … 377 456 are mapped to internally, which can be useful for debugging client 378 457 programs.</para> 458 </listitem> 459 460 <listitem> 461 <para><computeroutput>--pidfile</computeroutput> (or 462 <computeroutput>-P</computeroutput>): Name of the PID file which is 463 created when the daemon was started.</para> 379 464 </listitem> 380 465 … … 389 474 unattended and need to debug problems after they have 390 475 occurred.</para> 476 </listitem> 477 478 <listitem> 479 <para><computeroutput>--logrotate</computeroutput> (or 480 <computeroutput>-R</computeroutput>): Number of old log files to 481 keep, defaults to 10. Log rotation is disabled if set to 0.</para> 482 </listitem> 483 484 <listitem> 485 <para><computeroutput>--logsize</computeroutput> (or 486 <computeroutput>-S</computeroutput>): Maximum size of log file in 487 bytes, defaults to 100MB. Log rotation is triggered if the file 488 grows beyond this limit.</para> 489 </listitem> 490 491 <listitem> 492 <para><computeroutput>--loginterval</computeroutput> (or 493 <computeroutput>-I</computeroutput>): Maximum time interval to be 494 put in a log file before rotation is triggered, in seconds, and 495 defaults to one day.</para> 391 496 </listitem> 392 497 </itemizedlist> … … 445 550 use this variable carefully, and only if you fully understand what 446 551 you're doing.</para> 447 </sect2>448 449 <sect2>450 <title>Solaris host: starting the web service via SMF</title>451 452 <para>On Solaris hosts, the VirtualBox web service daemon is453 integrated into the SMF framework. You can change the parameters, but454 don't have to if the defaults below already match your needs:<screen>svccfg -s svc:/application/virtualbox/webservice:default setprop config/host=localhost455 svccfg -s svc:/application/virtualbox/webservice:default setprop config/port=18083456 svccfg -s svc:/application/virtualbox/webservice:default setprop config/user=root</screen></para>457 458 <para>If you made any change, don't forget to run the following459 command to put the changes into effect immediately:<screen>svcadm refresh svc:/application/virtualbox/webservice:default</screen></para>460 461 <para>If you forget the above command then the previous settings will462 be used when enabling the service. Check the current property settings463 with:<screen>svcprop -p config svc:/application/virtualbox/webservice:default</screen></para>464 465 <para>When everything is configured correctly you can start the466 VirtualBox web service with the following command:<screen>svcadm enable svc:/application/virtualbox/webservice:default</screen></para>467 468 <para>For more information about SMF, please refer to the Solaris469 documentation.</para>470 552 </sect2> 471 553 </sect1> -
trunk/doc/manual/en_US/user_AdvancedTopics.xml
r40019 r40130 860 860 device. Read/write access is also later needed when using the image 861 861 from a virtual machine. On some host platforms (e.g. Windows Vista 862 863 862 and later), raw disk access may be restricted and not permitted by 863 the host OS in some situations.</para> 864 864 865 865 <para>Just like with regular disk images, this does not automatically … … 1877 1877 Development Kit (SDK); please see <xref linkend="VirtualBoxAPI" />. As the 1878 1878 client base using this interface is growing, we added start scripts for 1879 the various operation systems we support. The following describes how to 1880 use them. Please be aware that the web service is never started automatically 1881 as a result of a standard installation.<itemizedlist> 1882 <listitem> 1883 <para>On Mac OS X, launchd is used. An example configuration file 1884 can be found in 1885 <computeroutput>$HOME/Library/LaunchAgents/org.virtualbox.vboxwebsrv.plist</computeroutput>. 1886 It can be enabled by changing the 1887 <computeroutput>Disabled</computeroutput> key from 1888 <computeroutput>true</computeroutput> to 1889 <computeroutput>false</computeroutput>. To manually start the 1890 service use the following command: <screen>launchctl load ~/Library/LaunchAgents/org.virtualbox.vboxwebsrv.plist</screen> 1891 For additional information on how launchd services could be 1892 configured see <literal><ulink 1893 url="http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/BPSystemStartup/BPSystemStartup.html">http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/BPSystemStartup/BPSystemStartup.html</ulink></literal>.</para> 1894 </listitem> 1895 <listitem> 1896 <para>On Linux, the web service can be automatically started during 1897 host boot by adding appropriate parameters to the file /etc/default/virtualbox. 1898 There is one mandatory parameter, VBOXWEB_USER which must be set to 1899 the user which will later start the VMs. 1900 <table> 1901 <title>ignored</title> 1902 <tgroup cols="2"> 1903 <tbody> 1904 <row> 1905 <entry><emphasis role="bold">Parameter</emphasis></entry> 1906 <entry><emphasis role="bold">Description</emphasis></entry> 1907 <entry><emphasis role="bold">Default</emphasis></entry> 1908 </row> 1909 <row> 1910 <entry>VBOXWEB_HOST</entry> 1911 <entry>The host to bind the web service to</entry> 1912 <entry>localhost</entry> 1913 </row> 1914 <row> 1915 <entry>VBOXWEB_PORT</entry> 1916 <entry>The port to bind the web service to</entry> 1917 <entry>18083</entry> 1918 </row> 1919 <row> 1920 <entry>VBOXWEB_TIMEOUT</entry> 1921 <entry>Session timeout in seconds; 0 disables timeouts</entry> 1922 <entry>300</entry> 1923 </row> 1924 <row> 1925 <entry>VBOXWEB_ CHECK_INTERVAL</entry> 1926 <entry>Frequency of timeout checks in seconds</entry> 1927 <entry>5</entry> 1928 </row> 1929 <row> 1930 <entry>VBOXWEB_THREADS</entry> 1931 <entry>Maximum number of worker threads to run in parallel</entry> 1932 <entry>100</entry> 1933 </row> 1934 <row> 1935 <entry>VBOXWEB_KEEPALIVE</entry> 1936 <entry>Maximum number of requests before a socket will be closed</entry> 1937 <entry>100</entry> 1938 </row> 1939 <row> 1940 <entry>VBOXWEB_LOGFILE</entry> 1941 <entry>Name of file to write log to</entry> 1942 <entry><emphasis>no file</emphasis></entry> 1943 </row> 1944 <row> 1945 <entry>VBOXWEB_ROTATE</entry> 1946 <entry>Number of log files; 0 disables log rotation</entry> 1947 <entry>10</entry> 1948 </row> 1949 <row> 1950 <entry>VBOXWEB_LOGSIZE</entry> 1951 <entry>Maximum size of a log file in bytes to trigger rotation</entry> 1952 <entry>1MB</entry> 1953 </row> 1954 <row> 1955 <entry>VBOXWEB_LOGINTERVAL</entry> 1956 <entry>Maximum time interval in seconds to trigger log rotation</entry> 1957 <entry>1 day</entry> 1958 </row> 1959 </tbody> 1960 </tgroup> 1961 </table> 1962 </para> 1963 </listitem> 1964 </itemizedlist></para> 1879 the various operation systems we support. The following sections describe 1880 how to use them. The VirtualBox web service is never started automatically 1881 as a result of a standard installation.</para> 1882 1883 <sect2 id="vboxwebsrv-linux"> 1884 <title>Linux: starting the webservice via <computeroutput>init</computeroutput></title> 1885 1886 <para>On Linux, the web service can be automatically started during 1887 host boot by adding appropriate parameters to the file 1888 <computeroutput>/etc/default/virtualbox</computeroutput>. 1889 There is one mandatory parameter, <computeroutput>VBOXWEB_USER</computeroutput>, 1890 which must be set to the user which will later start the VMs. The 1891 paramters in the table below all start with <computeroutput>VBOXWEB_</computeroutput> 1892 (<computeroutput>VBOXWEB_HOST</computeroutput>, 1893 <computeroutput>VBOXWEB_PORT</computeroutput> etc.): 1894 <table> 1895 <title>ignored</title> 1896 <tgroup cols="3"> 1897 <tbody> 1898 <row> 1899 <entry><emphasis role="bold">Parameter</emphasis></entry> 1900 <entry><emphasis role="bold">Description</emphasis></entry> 1901 <entry><emphasis role="bold">Default</emphasis></entry> 1902 </row> 1903 <row> 1904 <entry>USER</entry> 1905 <entry>The user as which the web service runs</entry> 1906 <entry></entry> 1907 </row> 1908 <row> 1909 <entry>HOST</entry> 1910 <entry>The host to bind the web service to</entry> 1911 <entry>localhost</entry> 1912 </row> 1913 <row> 1914 <entry>PORT</entry> 1915 <entry>The port to bind the web service to</entry> 1916 <entry>18083</entry> 1917 </row> 1918 <row> 1919 <entry>SSL_KEYFILE</entry> 1920 <entry>Server key and certificate file, PEM format</entry> 1921 <entry></entry> 1922 </row> 1923 <row> 1924 <entry>SSL_PASSWORDFILE</entry> 1925 <entry>File name for password to server key</entry> 1926 <entry></entry> 1927 </row> 1928 <row> 1929 <entry>SSL_CACERT</entry> 1930 <entry>CA certificate file, PEM format</entry> 1931 <entry></entry> 1932 </row> 1933 <row> 1934 <entry>SSL_CAPATH</entry> 1935 <entry>CA certificate path</entry> 1936 <entry></entry> 1937 </row> 1938 <row> 1939 <entry>SSL_DHFILE</entry> 1940 <entry>DH file name or DH key length in bits</entry> 1941 <entry></entry> 1942 </row> 1943 <row> 1944 <entry>SSL_RANDFILE</entry> 1945 <entry>File containing seed for random number generator</entry> 1946 <entry></entry> 1947 </row> 1948 <row> 1949 <entry>TIMEOUT</entry> 1950 <entry>Session timeout in seconds; 0 disables timeouts</entry> 1951 <entry>300</entry> 1952 </row> 1953 <row> 1954 <entry>CHECK_INTERVAL</entry> 1955 <entry>Frequency of timeout checks in seconds</entry> 1956 <entry>5</entry> 1957 </row> 1958 <row> 1959 <entry>THREADS</entry> 1960 <entry>Maximum number of worker threads to run in parallel</entry> 1961 <entry>100</entry> 1962 </row> 1963 <row> 1964 <entry>KEEPALIVE</entry> 1965 <entry>Maximum number of requests before a socket will be closed</entry> 1966 <entry>100</entry> 1967 </row> 1968 <row> 1969 <entry>LOGFILE</entry> 1970 <entry>Name of file to write log to</entry> 1971 <entry></entry> 1972 </row> 1973 <row> 1974 <entry>ROTATE</entry> 1975 <entry>Number of log files; 0 disables log rotation</entry> 1976 <entry>10</entry> 1977 </row> 1978 <row> 1979 <entry>LOGSIZE</entry> 1980 <entry>Maximum size of a log file in bytes to trigger rotation</entry> 1981 <entry>1MB</entry> 1982 </row> 1983 <row> 1984 <entry>LOGINTERVAL</entry> 1985 <entry>Maximum time interval in seconds to trigger log rotation</entry> 1986 <entry>1 day</entry> 1987 </row> 1988 </tbody> 1989 </tgroup> 1990 </table> 1991 </para> 1992 1993 <para>Setting the parameter <computeroutput>SSL_KEYFILE</computeroutput> 1994 enables the SSL/TLS support. Using encryption is strongly encouraged, as 1995 otherwise everything (including passwords) is transferred in clear 1996 text.</para> 1997 </sect2> 1998 1999 <sect2 id="vboxwebsrv-solaris"> 2000 <title>Solaris: starting the web service via SMF</title> 2001 2002 <para>On Solaris hosts, the VirtualBox web service daemon is 2003 integrated into the SMF framework. You can change the parameters, but 2004 don't have to if the defaults below already match your needs:<screen>svccfg -s svc:/application/virtualbox/webservice:default setprop config/host=localhost 2005 svccfg -s svc:/application/virtualbox/webservice:default setprop config/port=18083 2006 svccfg -s svc:/application/virtualbox/webservice:default setprop config/user=root</screen></para> 2007 2008 <para>The table in the previous section showing the parameter names and 2009 defaults also applies to Solaris. The parameter names must be changed 2010 to lowercase and a prefix of <computeroutput>config/</computeroutput> 2011 has to be added, e.g. <computeroutput>config/user</computeroutput> or 2012 <computeroutput>config/ssl_keyfile</computeroutput>. If you made any 2013 change, don't forget to run the following command to put the changes into 2014 effect immediately:<screen>svcadm refresh svc:/application/virtualbox/webservice:default</screen></para> 2015 2016 <para>If you forget the above command then the previous settings will 2017 be used when enabling the service. Check the current property settings 2018 with:<screen>svcprop -p config svc:/application/virtualbox/webservice:default</screen></para> 2019 2020 <para>When everything is configured correctly you can start the 2021 VirtualBox web service with the following command:<screen>svcadm enable svc:/application/virtualbox/webservice:default</screen></para> 2022 2023 <para>For more information about SMF, please refer to the Solaris 2024 documentation.</para> 2025 </sect2> 2026 2027 <sect2 id="vboxwebsrv-osx"> 2028 <title>Mac OS X: starting the webservice via launchd</title> 2029 2030 <para>On Mac OS X, launchd is used to start the VirtualBox webservice. An 2031 example configuration file can be found in 2032 <computeroutput>$HOME/Library/LaunchAgents/org.virtualbox.vboxwebsrv.plist</computeroutput>. 2033 It can be enabled by changing the 2034 <computeroutput>Disabled</computeroutput> key from 2035 <computeroutput>true</computeroutput> to 2036 <computeroutput>false</computeroutput>. To manually start the 2037 service use the following command: <screen>launchctl load ~/Library/LaunchAgents/org.virtualbox.vboxwebsrv.plist</screen> 2038 For additional information on how launchd services could be 2039 configured see <literal><ulink 2040 url="http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/BPSystemStartup/BPSystemStartup.html">http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/BPSystemStartup/BPSystemStartup.html</ulink></literal>.</para> 2041 </sect2> 1965 2042 </sect1> 1966 2043 -
trunk/src/VBox/Installer/linux/vboxweb-service.sh.in
r36480 r40130 3 3 # VirtualBox web service API daemon init script. 4 4 # 5 # Copyright (C) 2006-201 1Oracle Corporation5 # Copyright (C) 2006-2012 Oracle Corporation 6 6 # 7 7 # This file is part of VirtualBox Open Source Edition (OSE), as … … 293 293 [ -n "$VBOXWEB_HOST" ] && PARAMS="$PARAMS -H $VBOXWEB_HOST" 294 294 [ -n "$VBOXWEB_PORT" ] && PARAMS="$PARAMS -p $VBOXWEB_PORT" 295 [ -n "$VBOXWEB_SSL_KEYFILE" ] && PARAMS="$PARAMS -s -K $VBOXWEB_SSL_KEYFILE" 296 [ -n "$VBOXWEB_SSL_PASSWORDFILE" ] && PARAMS="$PARAMS -a $VBOXWEB_SSL_PASSWORDFILE" 297 [ -n "$VBOXWEB_SSL_CACERT" ] && PARAMS="$PARAMS -c $VBOXWEB_SSL_CACERT" 298 [ -n "$VBOXWEB_SSL_CAPATH" ] && PARAMS="$PARAMS -C $VBOXWEB_SSL_CAPATH" 299 [ -n "$VBOXWEB_SSL_DHFILE" ] && PARAMS="$PARAMS -D $VBOXWEB_SSL_DHFILE" 300 [ -n "$VBOXWEB_SSL_RANDFILE" ] && PARAMS="$PARAMS -r $VBOXWEB_SSL_RANDFILE" 295 301 [ -n "$VBOXWEB_TIMEOUT" ] && PARAMS="$PARAMS -t $VBOXWEB_TIMEOUT" 296 302 [ -n "$VBOXWEB_CHECK_INTERVAL" ] && PARAMS="$PARAMS -i $VBOXWEB_CHECK_INTERVAL" 297 303 [ -n "$VBOXWEB_THREADS" ] && PARAMS="$PARAMS -T $VBOXWEB_THREADS" 298 304 [ -n "$VBOXWEB_KEEPALIVE" ] && PARAMS="$PARAMS -k $VBOXWEB_KEEPALIVE" 305 [ -n "$VBOXWEB_AUTHENTICATION" ] && PARAMS="$PARAMS -A $VBOXWEB_AUTHENTICATION" 299 306 [ -n "$VBOXWEB_LOGFILE" ] && PARAMS="$PARAMS -F $VBOXWEB_LOGFILE" 300 307 [ -n "$VBOXWEB_ROTATE" ] && PARAMS="$PARAMS -R $VBOXWEB_ROTATE" -
trunk/src/VBox/Installer/solaris/smf-vboxwebsrv.sh
r36748 r40130 2 2 # $Id$ 3 3 4 # Copyright (C) 2008-201 1Oracle Corporation4 # Copyright (C) 2008-2012 Oracle Corporation 5 5 # 6 6 # This file is part of VirtualBox Open Source Edition (OSE), as … … 42 42 VW_PORT=`/usr/bin/svcprop -p config/port $SMF_FMRI 2>/dev/null` 43 43 [ $? != 0 ] && VW_PORT= 44 VW_SSL_KEYFILE=`/usr/bin/svcprop -p config/ssl_keyfile $SMF_FMRI 2>/dev/null` 45 [ $? != 0 ] && VW_SSL_KEYFILE= 46 VW_SSL_PASSWORDFILE=`/usr/bin/svcprop -p config/ssl_passwordfile $SMF_FMRI 2>/dev/null` 47 [ $? != 0 ] && VW_SSL_PASSWORDFILE= 48 VW_SSL_CACERT=`/usr/bin/svcprop -p config/ssl_cacert $SMF_FMRI 2>/dev/null` 49 [ $? != 0 ] && VW_SSL_CACERT= 50 VW_SSL_CAPATH=`/usr/bin/svcprop -p config/ssl_capath $SMF_FMRI 2>/dev/null` 51 [ $? != 0 ] && VW_SSL_CAPATH= 52 VW_SSL_DHFILE=`/usr/bin/svcprop -p config/ssl_dhfile $SMF_FMRI 2>/dev/null` 53 [ $? != 0 ] && VW_SSL_DHFILE= 54 VW_SSL_RANDFILE=`/usr/bin/svcprop -p config/ssl_randfile $SMF_FMRI 2>/dev/null` 55 [ $? != 0 ] && VW_SSL_RANDFILE= 44 56 VW_TIMEOUT=`/usr/bin/svcprop -p config/timeout $SMF_FMRI 2>/dev/null` 45 57 [ $? != 0 ] && VW_TIMEOUT= 46 58 VW_CHECK_INTERVAL=`/usr/bin/svcprop -p config/checkinterval $SMF_FMRI 2>/dev/null` 47 59 [ $? != 0 ] && VW_CHECK_INTERVAL= 60 VW_THREADS=`/usr/bin/svcprop -p config/threads $SMF_FMRI 2>/dev/null` 61 [ $? != 0 ] && VW_THREADS= 48 62 VW_KEEPALIVE=`/usr/bin/svcprop -p config/keepalive $SMF_FMRI 2>/dev/null` 49 63 [ $? != 0 ] && VW_KEEPALIVE= 64 VW_AUTHENTICATION=`/usr/bin/svcprop -p config/authentication $SMF_FMRI 2>/dev/null` 65 [ $? != 0 ] && VW_AUTHENTICATION= 66 VW_LOGFILE=`/usr/bin/svcprop -p config/logfile $SMF_FMRI 2>/dev/null` 67 [ $? != 0 ] && VW_LOGFILE= 50 68 VW_ROTATE=`/usr/bin/svcprop -p config/logrotate $SMF_FMRI 2>/dev/null` 51 69 [ $? != 0 ] && VW_ROTATE= … … 61 79 [ -z "$VW_TIMEOUT" ] && VW_TIMEOUT=20 62 80 [ -z "$VW_CHECK_INTERVAL" ] && VW_CHECK_INTERVAL=5 81 [ -z "$VW_THREADS" ] && VW_THREADS=100 63 82 [ -z "$VW_KEEPALIVE" ] && VW_KEEPALIVE=100 64 83 [ -z "$VW_ROTATE" ] && VW_ROTATE=10 65 84 [ -z "$VW_LOGSIZE" ] && VW_LOGSIZE=104857600 66 85 [ -z "$VW_LOGINTERVAL" ] && VW_LOGINTERVAL=86400 67 exec su - "$VW_USER" -c "/opt/VirtualBox/vboxwebsrv --background --host \"$VW_HOST\" --port \"$VW_PORT\" --timeout \"$VW_TIMEOUT\" --check-interval \"$VW_CHECK_INTERVAL\" --keepalive \"$VW_KEEPALIVE\" --logrotate \"$VW_ROTATE\" --logsize \"$VW_LOGSIZE\" --loginterval \"$VW_LOGINTERVAL\"" 86 87 # Derived and optional settings 88 VW_SSL= 89 [ -n "$VW_SSL_KEYFILE" ] && VW_SSL=--ssl 90 [ -n "$VW_SSL_KEYFILE" ] && VW_SSL_KEYFILE="--keyfile $VW_SSL_KEYFILE" 91 [ -n "$VW_SSL_PASSWORDFILE" ] && VW_SSL_PASSWORDFILE="--passwordfile $VW_SSL_PASSWORDFILE" 92 [ -n "$VW_SSL_CACERT" ] && VW_SSL_CACERT="--cacert $VW_SSL_CACERT" 93 [ -n "$VW_SSL_CAPATH" ] && VW_SSL_CAPATH="--capath $VW_SSL_CAPATH" 94 [ -n "$VW_SSL_DHFILE" ] && VW_SSL_DHFILE="--dhfile $VW_SSL_DHFILE" 95 [ -n "$VW_SSL_RANDFILE" ] && VW_SSL_RANDFILE="--randfile $VW_SSL_RANDFILE" 96 [ -n "$VW_LOGFILE" ] && VW_LOGFILE="--logfile $VW_LOGFILE" 97 98 exec su - "$VW_USER" -c "/opt/VirtualBox/vboxwebsrv --background --host \"$VW_HOST\" --port \"$VW_PORT\" $VW_SSL $VW_SSL_KEYFILE $VW_SSL_PASSWORDFILE $VW_SSL_CACERT $VW_SSL_CAPATH $VW_SSL_DHFILE $VW_SSL_RANDFILE --timeout \"$VW_TIMEOUT\" --check-interval \"$VW_CHECK_INTERVAL\" --threads \"$VW_THREADS\" --keepalive \"$VW_KEEPALIVE\" --authentication \"$VW_AUTHENTICATION\" $VW_LOGFILE --logrotate \"$VW_ROTATE\" --logsize \"$VW_LOGSIZE\" --loginterval \"$VW_LOGINTERVAL\"" 68 99 69 100 VW_EXIT=$? -
trunk/src/VBox/Installer/solaris/virtualbox-webservice.xml
r36520 r40130 5 5 # $Id$ 6 6 7 Copyright (C) 2008-201 1Oracle Corporation7 Copyright (C) 2008-2012 Oracle Corporation 8 8 9 9 This file is part of VirtualBox Open Source Edition (OSE), as … … 87 87 <propval name='host' type='astring' value='localhost' /> 88 88 <propval name='port' type='integer' value='18083' /> 89 <propval name='keyfile' type='astring' value='' /> 89 90 </property_group> 90 91 -
trunk/src/VBox/Main/webservice/Makefile.kmk
r39876 r40130 7 7 8 8 # 9 # Copyright (C) 2006-201 1Oracle Corporation9 # Copyright (C) 2006-2012 Oracle Corporation 10 10 # 11 11 # This file is part of VirtualBox Open Source Edition (OSE), as … … 212 212 $(VBOXWEB_OUT_DIR) \ 213 213 $(PATH_SUB_CURRENT) 214 ifdef VBOX_WITH_WEBSERVICES_SSL 215 vboxsoap_DEFS += WITH_OPENSSL 216 vboxsoap_SDKS += VBOX_OPENSSL2 217 endif 214 218 ifdef VBOX_WITHOUT_SPLIT_SOAPC 215 219 vboxsoap_SOURCES = \ … … 287 291 vboxwebsrv_LIBS += \ 288 292 $(PATH_STAGE_LIB)/vboxsoap$(VBOX_SUFF_LIB) \ 289 $(VBOX_GSOAP_CXX_LIBS) 293 $(VBOX_GSOAP_CXX_LIBS) \ 294 $(LIB_RUNTIME) 290 295 vboxwebsrv_LIBS.solaris += socket nsl 296 ifdef VBOX_WITH_WEBSERVICES_SSL 297 vboxwebsrv_DEFS += WITH_OPENSSL 298 vboxwebsrv_SDKS += VBOX_OPENSSL2 299 endif 291 300 vboxwebsrv_SOURCES = \ 292 301 vboxweb.cpp \ … … 430 439 webtest_LIBS += \ 431 440 $(PATH_STAGE_LIB)/vboxsoap$(VBOX_SUFF_LIB) \ 432 $(VBOX_GSOAP_CXX_LIBS) 441 $(VBOX_GSOAP_CXX_LIBS) \ 442 $(LIB_RUNTIME) 433 443 webtest_LIBS.solaris += nsl 444 ifdef VBOX_WITH_WEBSERVICES_SSL 445 webtest_DEFS += WITH_OPENSSL 446 webtest_SDKS += VBOX_OPENSSL2 447 endif 434 448 webtest_SOURCES = \ 435 449 webtest.cpp \ -
trunk/src/VBox/Main/webservice/vboxweb.cpp
r38802 r40130 6 6 * server, to which clients can connect. 7 7 * 8 * Copyright (C) 2006-201 1Oracle Corporation8 * Copyright (C) 2006-2012 Oracle Corporation 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 23 23 #include <VBox/com/com.h> 24 24 #include <VBox/com/array.h> 25 #include <VBox/com/string.h> 25 26 #include <VBox/com/ErrorInfo.h> 26 27 #include <VBox/com/errorprint.h> … … 42 43 #include <iprt/rand.h> 43 44 #include <iprt/semaphore.h> 45 #include <iprt/critsect.h> 44 46 #include <iprt/string.h> 45 47 #include <iprt/thread.h> … … 48 50 #include <iprt/system.h> 49 51 #include <iprt/base64.h> 52 #include <iprt/stream.h> 50 53 51 54 // workaround for compile problems on gcc 4.1 … … 75 78 76 79 RT_C_DECLS_END 80 81 static void WebLogSoapError(struct soap *soap); 77 82 78 83 /**************************************************************************** … … 117 122 unsigned int g_uBindToPort = 18083; // port 118 123 unsigned int g_uBacklog = 100; // backlog = max queue size for requests 124 125 #ifdef WITH_OPENSSL 126 bool g_fSSL = false; // if SSL is enabled 127 const char *g_pcszKeyFile = NULL; // server key file 128 const char *g_pcszPassword = NULL; // password for server key 129 const char *g_pcszCACert = NULL; // file with trusted CA certificates 130 const char *g_pcszCAPath = NULL; // directory with trusted CA certificates 131 const char *g_pcszDHFile = NULL; // DH file name or DH key length in bits, NULL=use RSA 132 const char *g_pcszRandFile = NULL; // file with random data seed 133 const char *g_pcszSID = "vboxwebsrv"; // server ID for SSL session cache 134 #endif /* WITH_OPENSSL */ 135 119 136 unsigned int g_cMaxWorkerThreads = 100; // max. no. of worker threads 120 137 unsigned int g_cMaxKeepAlive = 100; // maximum number of soap requests in one connection 138 139 const char *g_pcszAuthentication = NULL; // web service authentication 121 140 122 141 uint32_t g_cHistory = 10; // enable log rotation, 10 files … … 180 199 { "--host", 'H', RTGETOPT_REQ_STRING }, 181 200 { "--port", 'p', RTGETOPT_REQ_UINT32 }, 201 #ifdef WITH_OPENSSL 202 { "--ssl", 's', RTGETOPT_REQ_NOTHING }, 203 { "--keyfile", 'K', RTGETOPT_REQ_STRING }, 204 { "--passwordfile", 'a', RTGETOPT_REQ_STRING }, 205 { "--cacert", 'c', RTGETOPT_REQ_STRING }, 206 { "--capath", 'C', RTGETOPT_REQ_STRING }, 207 { "--dhfile", 'D', RTGETOPT_REQ_STRING }, 208 { "--randfile", 'r', RTGETOPT_REQ_STRING }, 209 #endif /* WITH_OPENSSL */ 182 210 { "--timeout", 't', RTGETOPT_REQ_UINT32 }, 183 211 { "--check-interval", 'i', RTGETOPT_REQ_UINT32 }, 184 212 { "--threads", 'T', RTGETOPT_REQ_UINT32 }, 185 213 { "--keepalive", 'k', RTGETOPT_REQ_UINT32 }, 214 { "--authentication", 'A', RTGETOPT_REQ_STRING }, 186 215 { "--verbose", 'v', RTGETOPT_REQ_NOTHING }, 187 216 { "--pidfile", 'P', RTGETOPT_REQ_STRING }, … … 226 255 break; 227 256 257 #ifdef WITH_OPENSSL 258 case 's': 259 pcszDescr = "Enable SSL/TLS encryption."; 260 break; 261 262 case 'K': 263 pcszDescr = "Server key and certificate file, PEM format (\"\")."; 264 break; 265 266 case 'a': 267 pcszDescr = "File name for password to server key (\"\")."; 268 break; 269 270 case 'c': 271 pcszDescr = "CA certificate file, PEM format (\"\")."; 272 break; 273 274 case 'C': 275 pcszDescr = "CA certificate path (\"\")."; 276 break; 277 278 case 'D': 279 pcszDescr = "DH file name or DH key length in bits (\"\")."; 280 break; 281 282 case 'r': 283 pcszDescr = "File containing seed for random number generator (\"\")."; 284 break; 285 #endif /* WITH_OPENSSL */ 286 228 287 case 't': 229 288 pcszDescr = "Session timeout in seconds; 0 = disable timeouts (" DEFAULT_TIMEOUT_SECS_STRING ")."; … … 236 295 case 'k': 237 296 pcszDescr = "Maximum number of requests before a socket will be closed (100)."; 297 break; 298 299 case 'A': 300 pcszDescr = "Authentication method for the webservice (\"\")."; 238 301 break; 239 302 … … 516 579 m_soap->recv_timeout = 60; 517 580 // process the request; this goes into the COM code in methodmaps.cpp 518 soap_serve(m_soap); 581 do { 582 #ifdef WITH_OPENSSL 583 if (g_fSSL && soap_ssl_accept(m_soap)) 584 { 585 WebLogSoapError(m_soap); 586 break; 587 } 588 #endif /* WITH_OPENSSL */ 589 soap_serve(m_soap); 590 } while (0); 519 591 520 592 soap_destroy(m_soap); // clean up class instances … … 632 704 * @param soap 633 705 */ 706 /*static*/ 634 707 void WebLogSoapError(struct soap *soap) 635 708 { … … 715 788 } 716 789 790 #ifdef WITH_OPENSSL 717 791 /**************************************************************************** 718 792 * 793 * OpenSSL convenience functions for multithread support 794 * 795 ****************************************************************************/ 796 797 static RTCRITSECT *g_pSSLMutexes = NULL; 798 799 struct CRYPTO_dynlock_value 800 { 801 RTCRITSECT mutex; 802 }; 803 804 static unsigned long CRYPTO_id_function() 805 { 806 return RTThreadNativeSelf(); 807 } 808 809 static void CRYPTO_locking_function(int mode, int n, const char * /*file*/, int /*line*/) 810 { 811 if (mode & CRYPTO_LOCK) 812 RTCritSectEnter(&g_pSSLMutexes[n]); 813 else 814 RTCritSectLeave(&g_pSSLMutexes[n]); 815 } 816 817 static struct CRYPTO_dynlock_value *CRYPTO_dyn_create_function(const char * /*file*/, int /*line*/) 818 { 819 struct CRYPTO_dynlock_value *value = (struct CRYPTO_dynlock_value *)RTMemAlloc(sizeof(struct CRYPTO_dynlock_value)); 820 if (value) 821 RTCritSectInit(&value->mutex); 822 823 return value; 824 } 825 826 static void CRYPTO_dyn_lock_function(int mode, struct CRYPTO_dynlock_value *value, const char * /*file*/, int /*line*/) 827 { 828 if (mode & CRYPTO_LOCK) 829 RTCritSectEnter(&value->mutex); 830 else 831 RTCritSectLeave(&value->mutex); 832 } 833 834 static void CRYPTO_dyn_destroy_function(struct CRYPTO_dynlock_value *value, const char * /*file*/, int /*line*/) 835 { 836 if (value) 837 { 838 RTCritSectDelete(&value->mutex); 839 free(value); 840 } 841 } 842 843 static int CRYPTO_thread_setup() 844 { 845 int num_locks = CRYPTO_num_locks(); 846 g_pSSLMutexes = (RTCRITSECT *)RTMemAlloc(num_locks * sizeof(RTCRITSECT)); 847 if (!g_pSSLMutexes) 848 return SOAP_EOM; 849 850 for (int i = 0; i < num_locks; i++) 851 { 852 int rc = RTCritSectInit(&g_pSSLMutexes[i]); 853 if (RT_FAILURE(rc)) 854 { 855 for ( ; i >= 0; i--) 856 RTCritSectDelete(&g_pSSLMutexes[i]); 857 RTMemFree(g_pSSLMutexes); 858 g_pSSLMutexes = NULL; 859 return SOAP_EOM; 860 } 861 } 862 863 CRYPTO_set_id_callback(CRYPTO_id_function); 864 CRYPTO_set_locking_callback(CRYPTO_locking_function); 865 CRYPTO_set_dynlock_create_callback(CRYPTO_dyn_create_function); 866 CRYPTO_set_dynlock_lock_callback(CRYPTO_dyn_lock_function); 867 CRYPTO_set_dynlock_destroy_callback(CRYPTO_dyn_destroy_function); 868 869 return SOAP_OK; 870 } 871 872 static void CRYPTO_thread_cleanup() 873 { 874 if (!g_pSSLMutexes) 875 return; 876 877 CRYPTO_set_id_callback(NULL); 878 CRYPTO_set_locking_callback(NULL); 879 CRYPTO_set_dynlock_create_callback(NULL); 880 CRYPTO_set_dynlock_lock_callback(NULL); 881 CRYPTO_set_dynlock_destroy_callback(NULL); 882 883 int num_locks = CRYPTO_num_locks(); 884 for (int i = 0; i < num_locks; i++) 885 RTCritSectDelete(&g_pSSLMutexes[i]); 886 887 RTMemFree(g_pSSLMutexes); 888 g_pSSLMutexes = NULL; 889 } 890 #endif /* WITH_OPENSSL */ 891 892 /**************************************************************************** 893 * 719 894 * SOAP queue pumper thread 720 895 * … … 723 898 void doQueuesLoop() 724 899 { 900 #ifdef WITH_OPENSSL 901 if (g_fSSL && CRYPTO_thread_setup()) 902 { 903 WebLog("Failed to set up OpenSSL thread mutex!"); 904 exit(RTEXITCODE_FAILURE); 905 } 906 #endif /* WITH_OPENSSL */ 907 725 908 // set up gSOAP 726 909 struct soap soap; 727 910 soap_init(&soap); 911 912 #ifdef WITH_OPENSSL 913 if (g_fSSL && soap_ssl_server_context(&soap, SOAP_SSL_DEFAULT, g_pcszKeyFile, 914 g_pcszPassword, g_pcszCACert, g_pcszCAPath, 915 g_pcszDHFile, g_pcszRandFile, g_pcszSID)) 916 { 917 WebLogSoapError(&soap); 918 exit(RTEXITCODE_FAILURE); 919 } 920 #endif /* WITH_OPENSSL */ 728 921 729 922 soap.bind_flags |= SO_REUSEADDR; … … 739 932 else 740 933 { 741 WebLog("Socket connection successful: host = %s, port = %u, master socket = %d\n",934 WebLog("Socket connection successful: host = %s, port = %u, %smaster socket = %d\n", 742 935 (g_pcszBindToHost) ? g_pcszBindToHost : "default (localhost)", 743 936 g_uBindToPort, 937 #ifdef WITH_OPENSSL 938 g_fSSL ? "SSL, " : "", 939 #else /* !WITH_OPENSSL */ 940 "", 941 #endif /*!WITH_OPENSSL */ 744 942 m); 745 943 … … 766 964 } 767 965 soap_done(&soap); // close master socket and detach environment 966 967 #ifdef WITH_OPENSSL 968 if (g_fSSL) 969 CRYPTO_thread_cleanup(); 970 #endif /* WITH_OPENSSL */ 768 971 } 769 972 … … 840 1043 break; 841 1044 1045 #ifdef WITH_OPENSSL 1046 case 's': 1047 g_fSSL = true; 1048 break; 1049 1050 case 'K': 1051 g_pcszKeyFile = ValueUnion.psz; 1052 break; 1053 1054 case 'a': 1055 if (ValueUnion.psz[0] == '\0') 1056 g_pcszPassword = NULL; 1057 else 1058 { 1059 PRTSTREAM StrmIn; 1060 if (!strcmp(ValueUnion.psz, "-")) 1061 StrmIn = g_pStdIn; 1062 else 1063 { 1064 int vrc = RTStrmOpen(ValueUnion.psz, "r", &StrmIn); 1065 if (RT_FAILURE(vrc)) 1066 return RTMsgErrorExit(RTEXITCODE_FAILURE, "failed to open password file (%s, %Rrc)", ValueUnion.psz, vrc); 1067 } 1068 char szPasswd[512]; 1069 int vrc = RTStrmGetLine(StrmIn, szPasswd, sizeof(szPasswd)); 1070 if (RT_FAILURE(vrc)) 1071 return RTMsgErrorExit(RTEXITCODE_FAILURE, "failed to read password (%s, %Rrc)", ValueUnion.psz, vrc); 1072 g_pcszPassword = RTStrDup(szPasswd); 1073 memset(szPasswd, '\0', sizeof(szPasswd)); 1074 if (StrmIn != g_pStdIn) 1075 RTStrmClose(StrmIn); 1076 } 1077 break; 1078 1079 case 'c': 1080 g_pcszCACert = ValueUnion.psz; 1081 break; 1082 1083 case 'C': 1084 g_pcszCAPath = ValueUnion.psz; 1085 break; 1086 1087 case 'D': 1088 g_pcszDHFile = ValueUnion.psz; 1089 break; 1090 1091 case 'r': 1092 g_pcszRandFile = ValueUnion.psz; 1093 break; 1094 #endif /* WITH_OPENSSL */ 1095 842 1096 case 't': 843 1097 g_iWatchdogTimeoutSecs = ValueUnion.u32; … … 874 1128 case 'k': 875 1129 g_cMaxKeepAlive = ValueUnion.u32; 1130 break; 1131 1132 case 'A': 1133 g_pcszAuthentication = ValueUnion.psz; 876 1134 break; 877 1135 … … 964 1222 #endif 965 1223 1224 // initialize SOAP SSL support if enabled 1225 #ifdef WITH_OPENSSL 1226 if (g_fSSL) 1227 soap_ssl_init(); 1228 #endif /* WITH_OPENSSL */ 1229 966 1230 // initialize COM/XPCOM 967 1231 HRESULT hrc = com::Initialize(); … … 989 1253 RTMsgError("Failed to get VirtualBox object (rc=%Rhrc)!", hrc); 990 1254 return RTEXITCODE_FAILURE; 1255 } 1256 1257 // set the authentication method if requested 1258 if (g_pVirtualBox && g_pcszAuthentication && g_pcszAuthentication[0]) 1259 { 1260 ComPtr<ISystemProperties> pSystemProperties; 1261 g_pVirtualBox->COMGETTER(SystemProperties)(pSystemProperties.asOutParam()); 1262 if (pSystemProperties) 1263 pSystemProperties->COMSETTER(WebServiceAuthLibrary)(com::Bstr(g_pcszAuthentication).raw()); 991 1264 } 992 1265 … … 1114 1387 ++it; 1115 1388 } 1389 1390 // re-set the authentication method in case it has been changed 1391 if (g_pVirtualBox && g_pcszAuthentication && g_pcszAuthentication[0]) 1392 { 1393 ComPtr<ISystemProperties> pSystemProperties; 1394 g_pVirtualBox->COMGETTER(SystemProperties)(pSystemProperties.asOutParam()); 1395 if (pSystemProperties) 1396 pSystemProperties->COMSETTER(WebServiceAuthLibrary)(com::Bstr(g_pcszAuthentication).raw()); 1397 } 1116 1398 } 1117 1399 -
trunk/src/VBox/Main/webservice/webtest.cpp
r33451 r40130 4 4 * functionality of VBoxManage for testing purposes. 5 5 * 6 * Copyright (C) 2006-201 0Oracle Corporation6 * Copyright (C) 2006-2012 Oracle Corporation 7 7 * 8 8 * This file is part of VirtualBox Open Source Edition (OSE), as … … 26 26 27 27 28 static void usage(int exitcode) 29 { 30 std::cout << 31 "webtest: VirtualBox webservice testcase.\n" 32 "\nUsage: webtest [options] [command]...\n" 33 "\nSupported options:\n" 34 " -h: print this help message and exit.\n" 35 " -c URL: specify the webservice server URL (default http://localhost:18083/).\n" 36 "\nSupported commands:\n" 37 " - IWebsessionManager:\n" 38 " - webtest logon <user> <pass>: IWebsessionManager::logon().\n" 39 " - webtest getsession <vboxref>: IWebsessionManager::getSessionObject().\n" 40 " - webtest logoff <vboxref>: IWebsessionManager::logoff().\n" 41 " - IVirtualBox:\n" 42 " - webtest version <vboxref>: IVirtualBox::getVersion().\n" 43 " - webtest gethost <vboxref>: IVirtualBox::getHost().\n" 44 " - webtest getpc <vboxref>: IVirtualBox::getPerformanceCollector().\n" 45 " - webtest getmachines <vboxref>: IVirtualBox::getMachines().\n" 46 " - webtest createmachine <vboxref> <settingsPath> <name>: IVirtualBox::createMachine().\n" 47 " - webtest registermachine <vboxref> <machineref>: IVirtualBox::registerMachine().\n" 48 " - IHost:\n" 49 " - webtest getdvddrives <hostref>: IHost::getDVDDrives.\n" 50 " - IHostDVDDrive:\n" 51 " - webtest getdvdname <dvdref>: IHostDVDDrive::getname.\n" 52 " - IMachine:\n" 53 " - webtest getname <machineref>: IMachine::getName().\n" 54 " - webtest getid <machineref>: IMachine::getId().\n" 55 " - webtest getostype <machineref>: IMachine::getGuestOSType().\n" 56 " - webtest savesettings <machineref>: IMachine::saveSettings().\n" 57 " - IPerformanceCollector:\n" 58 " - webtest setupmetrics <pcref>: IPerformanceCollector::setupMetrics()\n" 59 " - webtest querymetricsdata <pcref>: IPerformanceCollector::QueryMetricsData()\n" 60 " - All managed object references:\n" 61 " - webtest getif <ref>: report interface of object.\n" 62 " - webtest release <ref>: IUnknown::Release().\n"; 63 exit(exitcode); 64 } 65 28 66 /** 29 67 * … … 34 72 int main(int argc, char* argv[]) 35 73 { 74 bool fSSL = false; 75 const char *pcszArgEndpoint = "http://localhost:18083/"; 76 77 int ap; 78 for (ap = 1; ap <= argc; ap++) 79 { 80 if (argv[ap][0] == '-') 81 { 82 if (!strcmp(argv[ap], "-h")) 83 usage(0); 84 else if (!strcmp(argv[ap], "-c")) 85 { 86 ap++; 87 if (ap > argc) 88 usage(1); 89 pcszArgEndpoint = argv[ap]; 90 fSSL = !strncmp(pcszArgEndpoint, "https://", 8); 91 } 92 else 93 usage(1); 94 } 95 else 96 break; 97 } 98 99 if (argc < 1 + ap) 100 usage(1); 101 102 #ifdef WITH_OPENSSL 103 if (fSSL) 104 soap_ssl_init(); 105 #endif /* WITH_OPENSSL */ 106 36 107 struct soap soap; // gSOAP runtime environment 37 108 soap_init(&soap); // initialize runtime environment (only once) 38 39 if (argc < 2) 40 { 41 std::cout << 42 "webtest: VirtualBox webservice testcase.\n" 43 "Usage:\n" 44 " - IWebsessionManager:\n" 45 " - webtest logon <user> <pass>: IWebsessionManager::logon().\n" 46 " - webtest getsession <vboxref>: IWebsessionManager::getSessionObject().\n" 47 " - webtest logoff <vboxref>: IWebsessionManager::logoff().\n" 48 " - IVirtualBox:\n" 49 " - webtest version <vboxref>: IVirtualBox::getVersion().\n" 50 " - webtest gethost <vboxref>: IVirtualBox::getHost().\n" 51 " - webtest getpc <vboxref>: IVirtualBox::getPerformanceCollector().\n" 52 " - webtest getmachines <vboxref>: IVirtualBox::getMachines().\n" 53 " - webtest createmachine <vboxref> <settingsPath> <name>: IVirtualBox::createMachine().\n" 54 " - webtest registermachine <vboxref> <machineref>: IVirtualBox::registerMachine().\n" 55 " - IHost:\n" 56 " - webtest getdvddrives <hostref>: IHost::getDVDDrives.\n" 57 " - IHostDVDDrive:\n" 58 " - webtest getdvdname <dvdref>: IHostDVDDrive::getname.\n" 59 " - IMachine:\n" 60 " - webtest getname <machineref>: IMachine::getName().\n" 61 " - webtest getid <machineref>: IMachine::getId().\n" 62 " - webtest getostype <machineref>: IMachine::getGuestOSType().\n" 63 " - webtest savesettings <machineref>: IMachine::saveSettings().\n" 64 " - IPerformanceCollector:\n" 65 " - webtest setupmetrics <pcref>: IPerformanceCollector::setupMetrics()\n" 66 " - webtest querymetricsdata <pcref>: IPerformanceCollector::QueryMetricsData()\n" 67 " - All managed object references:\n" 68 " - webtest getif <ref>: report interface of object.\n" 69 " - webtest release <ref>: IUnknown::Release().\n"; 109 #ifdef WITH_OPENSSL 110 // Use SOAP_SSL_NO_AUTHENTICATION here to accept broken server configs. 111 // In a real world setup please use at least SOAP_SSL_DEFAULT and provide 112 // the necessary CA certificate for validating the server's certificate. 113 if (fSSL && soap_ssl_client_context(&soap, SOAP_SSL_NO_AUTHENTICATION, 114 NULL /*clientkey*/, NULL /*password*/, 115 NULL /*cacert*/, NULL /*capath*/, 116 NULL /*randfile*/)) 117 { 118 soap_print_fault(&soap, stderr); 70 119 exit(1); 71 120 } 72 73 const char *pcszArgEndpoint = "localhost:18083"; 74 75 const char *pcszMode = argv[1]; 76 int soaprc = 2; 121 #endif /* WITH_OPENSSL */ 122 123 const char *pcszMode = argv[ap]; 124 int soaprc = SOAP_SVR_FAULT; 77 125 78 126 if (!strcmp(pcszMode, "logon")) 79 127 { 80 if (argc < 4)128 if (argc < 3 + ap) 81 129 std::cout << "Not enough arguments for \"" << pcszMode << "\" mode.\n"; 82 130 else 83 131 { 84 132 _vbox__IWebsessionManager_USCORElogon req; 85 req.username = argv[ 2];86 req.password = argv[ 3];133 req.username = argv[ap + 1]; 134 req.password = argv[ap + 2]; 87 135 _vbox__IWebsessionManager_USCORElogonResponse resp; 88 136 … … 97 145 else if (!strcmp(pcszMode, "getsession")) 98 146 { 99 if (argc < 3)147 if (argc < 2 + ap) 100 148 std::cout << "Not enough arguments for \"" << pcszMode << "\" mode.\n"; 101 149 else 102 150 { 103 151 _vbox__IWebsessionManager_USCOREgetSessionObject req; 104 req.refIVirtualBox = argv[ 2];152 req.refIVirtualBox = argv[ap + 1]; 105 153 _vbox__IWebsessionManager_USCOREgetSessionObjectResponse resp; 106 154 … … 115 163 else if (!strcmp(pcszMode, "logoff")) 116 164 { 117 if (argc < 3)165 if (argc < 2 + ap) 118 166 std::cout << "Not enough arguments for \"" << pcszMode << "\" mode.\n"; 119 167 else 120 168 { 121 169 _vbox__IWebsessionManager_USCORElogoff req; 122 req.refIVirtualBox = argv[ 2];170 req.refIVirtualBox = argv[ap + 1]; 123 171 _vbox__IWebsessionManager_USCORElogoffResponse resp; 124 172 … … 135 183 else if (!strcmp(pcszMode, "version")) 136 184 { 137 if (argc < 3)185 if (argc < 2 + ap) 138 186 std::cout << "Not enough arguments for \"" << pcszMode << "\" mode.\n"; 139 187 else 140 188 { 141 189 _vbox__IVirtualBox_USCOREgetVersion req; 142 req._USCOREthis = argv[ 2];190 req._USCOREthis = argv[ap + 1]; 143 191 _vbox__IVirtualBox_USCOREgetVersionResponse resp; 144 192 … … 153 201 else if (!strcmp(pcszMode, "gethost")) 154 202 { 155 if (argc < 3)203 if (argc < 2 + ap) 156 204 std::cout << "Not enough arguments for \"" << pcszMode << "\" mode.\n"; 157 205 else 158 206 { 159 207 _vbox__IVirtualBox_USCOREgetHost req; 160 req._USCOREthis = argv[ 2];208 req._USCOREthis = argv[ap + 1]; 161 209 _vbox__IVirtualBox_USCOREgetHostResponse resp; 162 210 … … 173 221 else if (!strcmp(pcszMode, "getpc")) 174 222 { 175 if (argc < 3)223 if (argc < 2 + ap) 176 224 std::cout << "Not enough arguments for \"" << pcszMode << "\" mode.\n"; 177 225 else 178 226 { 179 227 _vbox__IVirtualBox_USCOREgetPerformanceCollector req; 180 req._USCOREthis = argv[ 2];228 req._USCOREthis = argv[ap + 1]; 181 229 _vbox__IVirtualBox_USCOREgetPerformanceCollectorResponse resp; 182 230 … … 193 241 else if (!strcmp(pcszMode, "getmachines")) 194 242 { 195 if (argc < 3)243 if (argc < 2 + ap) 196 244 std::cout << "Not enough arguments for \"" << pcszMode << "\" mode.\n"; 197 245 else 198 246 { 199 247 _vbox__IVirtualBox_USCOREgetMachines req; 200 req._USCOREthis = argv[ 2];248 req._USCOREthis = argv[ap + 1]; 201 249 _vbox__IVirtualBox_USCOREgetMachinesResponse resp; 202 250 … … 219 267 else if (!strcmp(pcszMode, "createmachine")) 220 268 { 221 if (argc < 5)269 if (argc < 4 + ap) 222 270 std::cout << "Not enough arguments for \"" << pcszMode << "\" mode.\n"; 223 271 else 224 272 { 225 273 _vbox__IVirtualBox_USCOREcreateMachine req; 226 req._USCOREthis = argv[ 2];227 req.settingsFile = argv[ 3];228 req.name = argv[ 4];274 req._USCOREthis = argv[ap + 1]; 275 req.settingsFile = argv[ap + 2]; 276 req.name = argv[ap + 3]; 229 277 std::cout << "createmachine: settingsFile = \"" << req.settingsFile << "\", name = \"" << req.name << "\"\n"; 230 278 _vbox__IVirtualBox_USCOREcreateMachineResponse resp; … … 240 288 else if (!strcmp(pcszMode, "registermachine")) 241 289 { 242 if (argc < 4)290 if (argc < 3 + ap) 243 291 std::cout << "Not enough arguments for \"" << pcszMode << "\" mode.\n"; 244 292 else 245 293 { 246 294 _vbox__IVirtualBox_USCOREregisterMachine req; 247 req._USCOREthis = argv[ 2];248 req.machine = argv[ 3];295 req._USCOREthis = argv[ap + 1]; 296 req.machine = argv[ap + 2]; 249 297 _vbox__IVirtualBox_USCOREregisterMachineResponse resp; 250 298 if (!(soaprc = soap_call___vbox__IVirtualBox_USCOREregisterMachine(&soap, … … 258 306 else if (!strcmp(pcszMode, "getdvddrives")) 259 307 { 260 if (argc < 3)308 if (argc < 2 + ap) 261 309 std::cout << "Not enough arguments for \"" << pcszMode << "\" mode.\n"; 262 310 else 263 311 { 264 312 _vbox__IHost_USCOREgetDVDDrives req; 265 req._USCOREthis = argv[ 2];313 req._USCOREthis = argv[ap + 1]; 266 314 _vbox__IHost_USCOREgetDVDDrivesResponse resp; 267 315 if (!(soaprc = soap_call___vbox__IHost_USCOREgetDVDDrives(&soap, … … 283 331 else if (!strcmp(pcszMode, "getname")) 284 332 { 285 if (argc < 3)333 if (argc < 2 + ap) 286 334 std::cout << "Not enough arguments for \"" << pcszMode << "\" mode.\n"; 287 335 else 288 336 { 289 337 _vbox__IMachine_USCOREgetName req; 290 req._USCOREthis = argv[ 2];338 req._USCOREthis = argv[ap + 1]; 291 339 _vbox__IMachine_USCOREgetNameResponse resp; 292 340 if (!(soaprc = soap_call___vbox__IMachine_USCOREgetName(&soap, … … 300 348 else if (!strcmp(pcszMode, "getid")) 301 349 { 302 if (argc < 3)350 if (argc < 2 + ap) 303 351 std::cout << "Not enough arguments for \"" << pcszMode << "\" mode.\n"; 304 352 else 305 353 { 306 354 _vbox__IMachine_USCOREgetId req; 307 req._USCOREthis = argv[ 2];355 req._USCOREthis = argv[ap + 1]; 308 356 _vbox__IMachine_USCOREgetIdResponse resp; 309 357 if (!(soaprc = soap_call___vbox__IMachine_USCOREgetId(&soap, … … 317 365 else if (!strcmp(pcszMode, "getostypeid")) 318 366 { 319 if (argc < 3)367 if (argc < 2 + ap) 320 368 std::cout << "Not enough arguments for \"" << pcszMode << "\" mode.\n"; 321 369 else 322 370 { 323 371 _vbox__IMachine_USCOREgetOSTypeId req; 324 req._USCOREthis = argv[ 2];372 req._USCOREthis = argv[ap + 1]; 325 373 _vbox__IMachine_USCOREgetOSTypeIdResponse resp; 326 374 if (!(soaprc = soap_call___vbox__IMachine_USCOREgetOSTypeId(&soap, … … 334 382 else if (!strcmp(pcszMode, "savesettings")) 335 383 { 336 if (argc < 3)384 if (argc < 2 + ap) 337 385 std::cout << "Not enough arguments for \"" << pcszMode << "\" mode.\n"; 338 386 else 339 387 { 340 388 _vbox__IMachine_USCOREsaveSettings req; 341 req._USCOREthis = argv[ 2];389 req._USCOREthis = argv[ap + 1]; 342 390 _vbox__IMachine_USCOREsaveSettingsResponse resp; 343 391 if (!(soaprc = soap_call___vbox__IMachine_USCOREsaveSettings(&soap, … … 351 399 else if (!strcmp(pcszMode, "setupmetrics")) 352 400 { 353 if (argc < 3)401 if (argc < 2 + ap) 354 402 std::cout << "Not enough arguments for \"" << pcszMode << "\" mode.\n"; 355 403 else 356 404 { 357 405 _vbox__IPerformanceCollector_USCOREsetupMetrics req; 358 req._USCOREthis = argv[ 2];406 req._USCOREthis = argv[ap + 1]; 359 407 // req.metricNames[0] = "*"; 360 408 // req.objects … … 380 428 else if (!strcmp(pcszMode, "querymetricsdata")) 381 429 { 382 if (argc < 3)430 if (argc < 2 + ap) 383 431 std::cout << "Not enough arguments for \"" << pcszMode << "\" mode.\n"; 384 432 else 385 433 { 386 434 _vbox__IPerformanceCollector_USCOREqueryMetricsData req; 387 req._USCOREthis = argv[ 2];435 req._USCOREthis = argv[ap + 1]; 388 436 // req.metricNames[0] = "*"; 389 437 // req.objects … … 407 455 else if (!strcmp(pcszMode, "release")) 408 456 { 409 if (argc < 3)457 if (argc < 2 + ap) 410 458 std::cout << "Not enough arguments for \"" << pcszMode << "\" mode.\n"; 411 459 else 412 460 { 413 461 _vbox__IManagedObjectRef_USCORErelease req; 414 req._USCOREthis = argv[ 2];462 req._USCOREthis = argv[ap + 1]; 415 463 _vbox__IManagedObjectRef_USCOREreleaseResponse resp; 416 464 if (!(soaprc = soap_call___vbox__IManagedObjectRef_USCORErelease(&soap, … … 435 483 std::cout << "Bad object ID: " << soap.fault->detail->vbox__InvalidObjectFault->badObjectID << "\n"; 436 484 } 437 if (soap.fault->detail->vbox__RuntimeFault)485 else if (soap.fault->detail->vbox__RuntimeFault) 438 486 { 439 487 std::cout << "Result code: 0x" << std::hex << soap.fault->detail->vbox__RuntimeFault->resultCode << "\n"; … … 442 490 std::cout << "Interface ID: " << std::hex << soap.fault->detail->vbox__RuntimeFault->interfaceID << "\n"; 443 491 } 492 else 493 { 494 // generic fault 495 std::cerr << "Generic fault message:\n"; 496 soap_print_fault(&soap, stderr); // display the SOAP fault message on the stderr stream 497 } 444 498 } 445 499 else -
trunk/src/VBox/Runtime/VBox/VBoxRTDeps.cpp
r37277 r40130 5 5 6 6 /* 7 * Copyright (C) 2006-201 1Oracle Corporation7 * Copyright (C) 2006-2012 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 44 44 #include <openssl/rsa.h> 45 45 #include <openssl/ssl.h> 46 #include <openssl/rand.h> 46 47 47 48 … … 63 64 (PFNRT)PEM_read_bio_PrivateKey, 64 65 (PFNRT)X509_free, 66 (PFNRT)X509_verify_cert_error_string, 67 (PFNRT)i2d_X509, 65 68 (PFNRT)i2d_X509, 66 69 (PFNRT)RSA_generate_key, 70 (PFNRT)RAND_load_file, 71 (PFNRT)CRYPTO_set_dynlock_create_callback, 72 (PFNRT)CRYPTO_set_dynlock_lock_callback, 73 (PFNRT)CRYPTO_set_dynlock_destroy_callback, 67 74 (PFNRT)RTAssertShouldPanic, 68 75 (PFNRT)ASMAtomicReadU64, … … 71 78 (PFNRT)SSL_free, 72 79 (PFNRT)SSL_library_init, 80 (PFNRT)SSL_load_error_strings, 73 81 (PFNRT)SSL_CTX_free, 74 82 (PFNRT)SSL_CTX_use_certificate_file, 83 (PFNRT)SSLv23_method, 75 84 (PFNRT)TLSv1_server_method, 76 85 NULL
Note:
See TracChangeset
for help on using the changeset viewer.