# 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+
Cryptography package for Python. This may be obtained using the following:pip install cryptography
Download the sources from GitHub branch 3.2:
# curl -Lo wazuh-3.4.zip https://github.com/wazuh/wazuh/archive/3.4.zip && unzip wazuh-3.4.zip
wazuh-3.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:
# make -C wazuh-3.2/src TARGET=agent
Change to the base directory:
# cd wazuh-3.2
Install the root CA if you want to overwrite the root CA with the file you created previously:
# 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 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.