COMPILING OPENVAS-LIBRARIES WITH WMI SUPPORT
============================================

Last updated: 2011-02-03

To compile openvas-libraries with WMI support, please follow the steps described
below. Our hope is that this code will ultimately make it into Samba itself;
until then, some additional work is necessary but should be straightforward if
you follow this guide.

1) Download the source tarball for wmi-1.3.14
You can download download the tarball from a number of places, the following
location provided by Zenoss, Inc. is recommended:

http://dev.zenoss.org/svn/trunk/inst/externallibs/wmi-1.3.14.tar.bz2

In case you are unable to download the tarball from this location, a copy of the
tarball is available at:

http://www.openvas.org/download/wmi/wmi-1.3.14.tar.bz2

Untar the source tarball with the following command:
$ tar xjvf wmi-1.3.14.tar.bz2

2) Apply the patch
To enable the WMI integration in OpenVAS, a patch needs to be applied to the
source you just downloaded. You can download the patch from the following
location:

http://www.openvas.org/download/wmi/openvas-wmi-1.3.14.patch

Copy the patch to the wmi-1.3.14 directory you just created and apply the patch
with the following command:

$ patch -p1 < openvas-wmi-1.3.14.patch

3) Compile the source
In the wmi-1.3.14 directory, execute the following commands:
$ cd Samba/source
$ ./autogen.sh
$ ./configure
$ make proto all
$ make libraries

If successful, this will result in the creation of the file
wmi-1.3.14/Samba/source/wmi/libwmiclient.so.

Now execute the "install-libwmiclient.sh" script in the Samba/source directory:
$ bash install-libwmiclient.sh

NOTE: If you want to use a prefix for your OpenVAS installation, remember to add
it when calling the script:

$ bash install-libwmiclient.sh /prefix/to/your/openvas/install

The script will copy the library files to the correct location and ensure it is
visible to openvas-libraries.

4) Compile openvas-libraries
Now configure openvas-libraries in the usual way. Remember to chose the same
prefix (if any) you used in the previous step. For example:

$ cmake -DCMAKE_INSTALL_PREFIX=/prefix/to/your/openvas/install

Watch the configure output closely. If you followed the steps above correctly,
you should see the following lines in the output:

-- checking for module 'wmiclient>=1.3.14'
--   found wmiclient, version 1.3.14

If you see the message "package 'wmiclient>=1.3.14' not found" instead, make
sure you have run install-libwmiclient.sh with the correct prefix. Also be sure
to follow the instruction provided in the openvas-libraries/INSTALL file,
especially setting the PKG_CONFIG_PATH variable. Once you have fixed any
remaining issue, run cmake again until wmiclient is found.

Now (re)build openvas-libraries and install them:

$ make
$ make install

Note that if you are adding WMI functions to an existing openvas deployment
you must recompile openvas-scanner also.

After installing, you will be able to use NASL NVTs incorporating the new WMI
NASL functions.
