# openssl req -x509 -new -nodes -newkey rsa:2048 -keyout wpk_root.key -out wpk_root.pem -batch
# openssl req -new -nodes -newkey rsa:2048 -keyout wpkcert.key -out wpkcert.csr -subj '/C=US/ST=CA/O=Wazuh'
Set the location as follows:
/C=US is the country.
/ST=CA is the state.
/O=Wazuh is the organization’s name.
WPK packages will generally contain the complete agent code, however, this is not required.
A WPK package must contain an installation program in binary form or a script in any language supported by the agent (Bash, Python, etc). Canonical WPK packages must contain a Bash script named
upgrade.sh for UNIX or
upgrade.bat for Windows. This program must:
fork itself, as the parent will return 0 immediately,
restart the agent, and
the installer must write a file called upgrade_result containing a status number (0 means OK) before exiting.
Python 2.7 or 3.5+
cryptographypackage. This may be obtained using the following command:pip install cryptography
Install development tools and compilers. In Linux this can easily be done using your distribution’s package manager:
For RPM-based distributions:# yum install make gcc policycoreutils-python automake autoconf libtool unzip
For Debian-based distributions:# apt-get install make gcc libc6-dev curl policycoreutils automake autoconf libtool unzip
Download and extract the latest version:
# curl -Ls https://github.com/wazuh/wazuh/archive/v3.7.2.tar.gz | tar zx
wazuh-3.7.2/etc/preloaded-vars.conffile that was downloaded to deploy an unattended update in the agent by uncommenting the following lines:
USER_LANGUAGE="en" USER_NO_STOP="y" USER_UPDATE="y"
Compile the project from the
# cd wazuh-3.7.2/src # make deps # make TARGET=agent
Install the root CA if you want to overwrite the root CA with the file you created previously:
# cd ../ # cp path/to/wpk_root.pem etc/wpk_root.pem
Compile the WPK package using your SSL certificate and key:
# contrib/agent-upgrade/wpkpack.py output/myagent.wpk path/to/wpkcert.pem path/to/wpkcert.key *
output/myagent.wpk is the name of the output WPK package.
path/to/wpkcert.pem is the path to your SSL certificate.
path/to/wpkcert.key is the path to your SSL certificate’s key.
* is the file (or the files) to be included into the WPK package. In this case, all the contents will be added.
In this example, the Wazuh project’s root directory contains the proper
This is only an example. If you want to distribute a WPK package using this method, it’s important to begin with an empty directory.