Awesome Open Source
Awesome Open Source

Wazuh - Chef

Slack Email Documentation Documentation

Deploy the Wazuh platform using Chef cookbooks. Chef recipes are prepared for installing and configuring Agent, Manager (cluster) and RESTful API.


Every cookbook will install its own required dependencies, Berksfile and metadata.rb contains all the information about which dependencies will be installed.

There is software that must be installed to ensure the correct installation.

  • Curl
  • Wget
  • Chef Server Core v12.19.31


Each cookbook has its


You can find predefined roles for a default installation of Wazuh Agent and Manager in the roles folder.

Check roles README for more information about default attributes and how to customize your installation.


Cloning whole repository

You can clone the repository by running: git clone and you will get the whole repository.

Use through Berkshelf

The easiest way to making use of these cookbooks (especially wazuh_filebeat & wazuh_elastic until they are published to Supermarket) is by including in your Berksfile the desired cookbooks as stated below:

cookbook "wazuh_agent", git: "",rel: 'cookbooks/wazuh_agent'
cookbook "wazuh_manager", git: "",rel: 'cookbooks/wazuh_manager'
cookbook 'wazuh_filebeat', github: '', rel: 'cookbooks/wazuh_filebeat'
cookbook 'wazuh_elastic', github: '', rel: 'cookbooks/wazuh_elastic'

You can specify tags, branches, and revisions. More info on


The following describes how to define the needed JSON files to generate an encrypted data bag.

Important: If API user secret is declared will be installed. Otherwise, the default user will be foo:bar.


It contains the username and password that will be installed for Wazuh API authentication. Is required by the manager.

Example of a configuration file api_configuration.json before encryption:

 "id": "api",
 "htpasswd_user": "<YOUR USER>",
 "htpasswd_passcode": "<YOUR PASSWORD>"

Using Data Bags

To transfer our credentials securely, Chef provides data_bags that allows encrypting some sensitive data before communication.

The following process describes an example of how to create secrets and data bags to encrypt data.

  • Install a key or generate one (with OpenSSL for example) on your Workstation openssl rand -base64 512 | tr -d '\r\n' > /tmp/encrypted_data_bag_secret

  • Create the required secret by using : knife data bag from file wazuh_secrets ./api_configuration.json --secret-file /tmp/encrypted_data_bag_secret -z

  • Upload your new secrets with knife upload /

  • Before installing Wazuh-Manager, Wazuh-Filebeat or Wazuh-Elastic you will need to copy the key in /etc/chef/encrypted_data_bag_secret (default path) or in the desired path (remember to specify the key path in knife.rb and config.rb) of your workstation.

After encryption, the previous JSON files will have new fields that describe the encryption method and other useful info. For example api.json after encryption will look like this:

  "id": "api",
  "htpasswd_user": {
    "encrypted_data": "whdiITsM/JFBwiAcCE5MaVE2MinRLdDIGbJ0\n",
    "iv": "NVK/ezXHBsSFuiMm\n",
    "auth_tag": "NFPZcxGrjqxRSF7v/+i6Kw==\n",
    "version": 3,
    "cipher": "aes-256-gcm"
  "htpasswd_passcode": {
    "encrypted_data": "rX952YaNifO1gtcFXHxjteKCk6Zi592FZGgyE1gs0A==\n",
    "iv": "LThJWRCIB4JaDP4E\n",
    "auth_tag": "2oS9JDBtNdcRhsOdgg/A9A==\n",
    "version": 3,
    "cipher": "aes-256-gcm"

Using Chef Vault

Chef Vault provides an easier way to manage Data bags and configure them. To configure it you can follow these steps:

  • Configure knife.rb or config.rb and add knife[:vault_mode] = 'client' to make the workstation transfer vault to the server.

  • Create the vault with:

knife vault create wazuh_secrets api '{"id": "api", "htpasswd_user": "user", "htpasswd_passcode": "password"}' -A "username" -C "manager-1"

Where -A defines the workstation users authorized to modify/edit the vault and -C defines the nodes that have access to the defined vault.

After that, the vault will be created and synced with the server. The defined nodes will store the required keys to decrypt the vault content and consume it.

You can check Chef Official Documentation about Chef Vault for detailed info.

Use through Berkshelf

The easiest way to making use of these cookbooks (especially wazuh_filebeat & wazuh_elastic until they are published to Supermarket) is by including in your Berksfile something like the below:

cookbook 'wazuh', gitHub: 'wazuh/wazuh-chef', rel: 'wazuh'
cookbook 'wazuh_filebeat', gitHub: 'wazuh/wazuh-chef', rel: 'wazuh_filebeat'
cookbook 'wazuh_elastic', gitHub: 'wazuh/wazuh-chef', rel: 'wazuh_elastic'

This will source all three cookbooks housed in this repo from GitHub.

Choose to register an agent into a manager or not

Now we give the possibility to choose to register an agent after being configured and installed in a manager.

In order to do so, it's only needed to assign the value yes to the variable default['ossec']['agent_auth']['register'] in the attributes file_ wazuh-chef/cookbooks/wazuh_agent/attributes/authd.rb:

default['ossec']['agent_auth']['register'] = 'yes'

In other case, we just assign a different value which is not yes.


If you want to contribute to our project please don't hesitate to send a pull request. You can also join our users mailing list, by sending an email to [email protected], to ask questions and participate in discussions.

License and copyright

Wazuh App Copyright (C) 2019 Wazuh Inc. (License GPLv2)


Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
ruby (12,374
security (1,840
monitoring (610
elasticsearch (540
chef (104
incident-response (68
vulnerability-detection (61
security-hardening (58
compliance (56
intrusion-detection (36
ids (32
log-analysis (22
pci-dss (16

Find Open Source By Browsing 7,000 Topics Across 59 Categories