Wazuh XDR Custom SecOps Integration

Wazuh XDR Custom SecOps Integration

The Wazuh XDR Custom SecOps Integration allows you to poll and push adversary-related events to your Wazuh deployment. After configuring the integration, your Wazuh deployment will be able to receive and process Lumu events. By using it, you will be able to see adversarial activity detected by Lumu, giving your Security Operations team more visibility.

SecOps integration between Wazuh XDR and Lumu

Requirements

  • A Wazuh deployment (Cloud or On-premise)For Cloud deployments, you need a forwarding agent reporting to the Wazuh Cloud manager
  • Lumu Defender API key
    • To retrieve an API token, please refer to the Defender API document.
  • Script host.
    • A scripting host is required to deploy the integration. This host must have Internet visibility over Lumu Defender API endpoints and Wazuh REST API. According to the deployment model you select, you will need a host with:
      • Python 3.10+
        OR
      • A Docker-enabled host.

Contacted hosts

Allow all the traffic to the following hosts. These are required for the operation of this integration:

  • Wazuh Manager host (Cloud or On-premise)
  • defender.lumu.io

Integration’s overview

The integration configures your Wazuh XDR deployment to process and trigger alerts for Lumu detections based on the level defined in the Wazuh detection rules. For detailed information about Wazuh Data analysis and rules capabilities, please refer to Wazuh Data Analysis and Wazuh rule classification.

Prepare Wazuh for Lumu integration

Before deploying and implementing the Lumu Integration, you must prepare your Wazuh deployment to ensure the integration works as expected. The steps depicted below depend on the deployment you are working on, Cloud or On-premise.

General preparation

The following steps apply to prepare Cloud and On-premise environments

It’s encouraged to create a dedicated policy for the integration user to avoid potential security risks

The integration needs a policy that allows the integration user to run some tasks on the Wazuh manager after setting up the decoders and rules. To do so, login to your Wazuh server and follow these steps:

1. Click on the hamburger icon in the top left corner of the screen. Then, expand the Server management section and click on the Security menu
2. Under the Policies tab in the Security screen, click on the Create policy button.

3. Fill in the required data for your new policy as follows:

Action Resources
cluster:read node:id:*
cluster:restart node:id:*
manager:read *:*:*
manager:restart *:*:*
            In the Effect dropdown menu, choose Allow

You can use the following image for guidance.

4. Create your policy by clicking on the Create policy button

It’s encouraged to create a dedicated rule for the integration user to avoid potential security risks

Now it’s time to create a tailored role for the integration and linking the created policy. To create the integration role, go to the Security screen by following the steps in the previous section. There, follow these steps:

1. Under the Roles tab in the Security screen, click on the Create role button.
2. Fill in the required data for your new role following the next example:
Role name lumu_integration
Policies:
decoders_read_decoders
decoders_all_resourceless
rules_read_rules
rules_all_resourceless
manager_integration

You can use the following image for guidance.

3. Create your role by clicking the Create role button

On-premise deployment preparation

These steps apply for Wazuh On-premise deployments.

Make sure you use a Wazuh REST API user with the following permissions if you choose not to follow this step:
  • Decoders: read and update
  • Rules: read and update
  • Manager: read and restart
  • Cluster: read and restart for all nodes
A Wazuh API user is required for the integration to set up your on-premise environment to process Lumu detections. To create it, go to the Security screen by following the steps in the previous section. Then follow these steps:

1. Under the Users tab in the Security screen, click on the Create user button

2. Fill in the data for your new user. Make sure you assign the lumu_integration role created before.

3. Create your user by clicking on the Apply button

Collect the integration username and password. These will be used to set up the integration later.

Cloud deployment preparation

These steps apply for Wazuh Cloud deployments.

Make sure you use a Wazuh user with the following permissions if you choose not to follow this step:
  • Decoders: read and update
  • Rules: read and update
  • Manager: read and restart
  • Cluster: read and restart for all nodes

If you are working with a Cloud deployment, you need to create an internal user and map it to the created role. First, let’s create the internal user. To do it, follow these steps:

1. Click on the Security menu under the Indexer Management section.

2. In the Security window, click on the Internal users option in the left menu. Then click on the Create internal user button.

3. Fill in the Username and Password fields. Other fields are optional. Click on the Create button.

Collect the username and password. These will be used to set up the integration later.

Now, it’s time to map it to the created role.

1. Click on the hamburger icon in the top left corner of the screen. Then, expand the Server management section and click on the Security menu

2. In the Security window, click on the Roles mapping tab. Then click on the Create Role mapping button

3. Fill in the information in the Create new role mapping window. Make sure you select the lumu_integration role under the Roles field. Under the Internal users field, select the internal user created before.

4. Click on the Save role mapping buton to create your new mapping.

Configure Syslog forwarding on a Wazuh agent

Wazuh Cloud deployments rely on Syslog forwarding from its agents to process data. Follow the Forward syslog events document to configure it.

Collect the required data from Lumu portal

The integration set-up process needs you to collect this information from Lumu portal:

  • Lumu Defender API key

  • Company UUID

Log in to your Lumu portal and run the following data collection procedures.

Collect the Lumu Defender API key

To collect the Lumu Defender API key, refer to the Defender API document.

Collect your Lumu company UUID

To collect your Lumu company UUID, log in to your Lumu portal. Once you are in the main window, copy the string below your company name.

Deploy the integration

There are 2 environment options to deploy the script, select the one that best fits your current infrastructure.

  • Run it as a Python script executing the install.sh bash file
    • Creates a Python virtual run time and its dependencies for you
    • Installs the crontab line in the host
  • Run it as a Docker container.

Whichever alternative you select, you must first unpack the integration package shared by our Support team.

Unpack the deployment package provided by Lumu in your preferred path/folder. Bear in mind this location, as it will be required for further configurations. From now on, we will refer to this folder as <app_lumu_root>.

If you use the install script, use the .bash file to remove the integration from the host

Set up the configuration file

To set up the integration, add and edit the companies.yml configuration file. This file contains the collected information from your Wazuh and Lumu deployments

Inside the integration package, you will find the sample file companies_template.yml, which you can use to build your configuration file.

The companies file defines how the integration:

  • Connects to your Wazuh deployment for setting up the decoders and rules
  • Connects to Lumu and extracts the information of the incidents.
  • Sends Lumu collected information to your Wazuh collector

  1. lumu:
    uuid: "<COMPANY-UUID>"
    defender_key: "<DEFENDER-KEY>"
    include_muted_updates: false # Boolean: true | false
    throttle: 0 # INT<[0-5]> minutes
    incident_types: ["C2C", "Malware", "DGA", "Mining", "Spam", "Phishing"] # ["C2C", "Malware", "DGA", "Mining", "Spam", "Phishing"] | [] | null
    app:
    rule_level:
    # Define rule severity. This will be used for creating the Lumu rules in Wazuh
    # For further reference, check https://documentation.wazuh.com/current/user-manual/ruleset/rules/rules-classification.html
    new_incident: 14 # 0-16 (14 | High importance security event | It is triggered with correlation most of the time, and it indicates an attack.)
    updated_incident: 14 # 0-16 (14 | High importance security event | It is triggered with correlation most of the time, and it indicates an attack.)
    # Defines the wazuh receiver information
    wazuh_receiver: "<WAZUH_RECEIVER_DATA>" # (udp|tcp):hostname_ip:port
    api:
    # Connection parameters to manage Wazuh
    host: "<WAZUH_HOST_IP>" # Wazuh Manager host or IP address. For Cloud deployments, this has the format HOSTNAME.cloud.wazuh.com
    port: <WAZUH_API_PORT> # Wazuh Manager API port. By default is 55000
    username: "<WAZUH_API_USERNAME>" # Wazuh API username
    password: "<WAZUH_API_PASSWORD>" # Wazuh API password
    verify: false # Verify Wazuh SSL certificate

Mandatory fields

Within the configuration file, fill in these fields:

From Lumu

  • COMPANY-UUID: The company ID collected from Lumu portal
  • DEFENDER-KEY: The Lumu Defender API key

From Wazuh

  • WAZUH_RECEIVER_DATA: The Wazuh receiver data, protocol, server, and port where the incident data will be sent. Use the format
    (tcp|udp):HOSTNAME_IP:PORT
  • WAZUH_HOST_IP: The Wazuh Manager host or IP address. This will be used for setting up the decoders and rules
  • WAZUH_API_PORT: The Wazuh Manager API port
  • WAZUH_API_USERNAME: The Wazuh API username created in previous steps
  • WAZUH_API_PASSWORD: The corresponding Wazuh API user password
WAZUH_RECEIVER_DATA for On-premise deployments usually is the same Wazuh manager server. Make sure your manager server can receiver Syslog traffic.

Other fields

To tailor in detail your integration, you can use the following parameters within the configuration file:

  • include_muted_updates. Indicates if the updates to muted incidents must be processed. We recommend you leave the default value of false.
  • incident_types: A list of the incident types the integration will process and send to your Wazuh server. If you want to remove a particular type of incident, this is the parameter you need.
  • new_incident: Define the level of the associated rule with Lumu’s new incident events.
  • updated_incident: Define the level of the associated rule with Lumu’s new incident events.
  • verify: Set it to false if your Wazuh Manager uses a self-signed certificate and you don’t have it installed in your system.

Prepare Python on your environment

If Docker is your chosen deployment method, you may skip this step.

If Python is your chosen deployment method, you will need to create a Virtual environment for each integration to avoid conflicts between them and your operating system tools. Make sure you follow the steps in our  Preparing Environment for Custom Integrations article.

Deploy Integration as a script

To deploy the integration as a script, run the install.sh script inside the integration package.

Make sure the install.sh script has the execution permission before running it.

To run the installation script, locate yourself in the app_lumu_root folder, then execute this line through CLI.

./install.sh all

The installation script will set up the Python environment and a cron job. This job will try to keep running your integration script even if your deployment host restarts.

If you want to modify the running interval set up by the installation script, change the latest crob job entry based on your environment requirements.
If you want to restart or uninstall the integration run the ./restart all and ./uninstall all respectively

Script details

To use the script, you must locate yourself on the path selected for deployment (<app_lumu_root>). Use the following command to show all options available for the package:

python wazuh_lumu.py -h

usage: wazuh_lumu [-h] [--config CONFIG] [--ioc-manager-db-path IOC_MANAGER_DB_PATH] [-v] [-c] [-l {screen,file}] [--hours HOURS]

Options Description
-h, --help show this help message and exit
--config CONFIG CONFIG FILE PATH of the integration. (Default: companies.yml)
--logging {screen,file} Logging option (default screen).
--verbose, -v Verbosity level.
--hours HOURS keep db log record from [x hours], for auto maintenance local db purpose

Usage Examples

Task: configure your Wazuh Manager and send Lumu detection events to your Wazuh receiver with the default values

To configure your Wazuh Manager and send Lumu detection events to your Wazuh deployment with the default values, run the following command.

python3 wazuh_lumu.py
You must use the default companies.yml file filling in the required values to use the default/suggested configuration.

Other tasks

According to your needs, you can combine the examples shown. If you need more details on the steps executed by the integration script, you can add the –logging {file, screen} and –verbose arguments. These arguments can be used for troubleshooting.

Deploy as a Docker container (Optional)

If you choose to deploy your integrations in a Docker-based model, you must install the Docker engine in your device. Please refer to the Install Docker Engine documentation, and follow the specific instructions for your operating system.

If you have a Docker environment, you can select this option to run the integration as a Docker process. To deploy and run your integration as a docker container, locate yourself at the <app_lumu_root> folder, and follow these instructions:

1. Build the container by running the following command.

docker build \ 
[--build-arg ADDITIONAL_ARGUMENS='<ADDITIONAL_ARGUMENTS>']
--tag img-lumu-wazuh-secops \
--file Dockerfile .
Do not forget the dot "."
<ADDITIONAL_ARGUMENTS> can be used to pass to your Docker container other arguments. For further reference, check the Deploy Integration as a script section. You can use this argument to collect DEBUG logs by setting ADDITIONAL_ARGUMENTS to -v.

2. Run the container by using the following command.

docker run -d \
--restart unless-stopped \
--log-driver json-file \
--log-opt max-size=30m \
--log-opt max-file=3 \
--name lumu-wazuh-secops \
img-lumu-wazuh-secops

Troubleshooting

For troubleshooting purposes, you can run the following commands:

To log in to your container using an interactive shell:

docker exec -it lumu-wazuh-secops bash

To collect integration logs:

docker logs -f lumu-wazuh-secops

Expected results

After running the integration, you will see:

  • New decoders

  • New rules

These will allow Wazuh to process Lumu alerts. You will see them in your Wazuh dashboard for new incidents or new contacts to identified adversaries.


Troubleshooting and known issues

To identify failures in the script execution, use the -v flag. The script execution log will show more detailed information.

The application logs will be redirected to lumu.log file. The file errors.log stores only the errors to make them easier to find and aid the troubleshooting process.

Input Validation

If you receive errors like this:

ValidationError: 1 validation error for CompanyPyModel
app.api.gh
  Extra inputs are not permitted [type=extra_forbidden, input_value='kh', input_type=str]

It means you are using the wrong key parameters or the wrong values for those parameters.

Another instance is running

If you receive the following error:

Stopping the integration 1551865, it might have another older instance running, check if is feasible or not
older pid: 1551847 - cwd: /home/lumu/Documents/repos/lumu-wazuh-secops - since: 2024-05-08 17:59:46.970000 
cmdline: /home/lumu/Documents/repos/lumu-wazuh-secops/.venv31013/bin/python /home/lumu/Documents/repos/lumu-wazuh-secops/wazuh_lumu.py

There could be another instance running. To check this, open the pid.pid file in the integration folder. This file stores the process ID if it’s running.


        • Related Articles

        • Cortex XDR Custom SecOps Integration

          The Cortex XDR Custom SecOps Integration allows you to poll and push adversary-related events to your Cortex XDR deployment. After configuring the integration, your Cortex deployment will be able to receive and process Lumu events. Using it lets you ...
        • ServiceNow Custom SecOps Integration

          This article shows how to leverage ServiceNow API and Lumu Defender API to enhance your SecOps capabilities, pushing Lumu incidents into a ServiceNow deployment Incident Tickets, and syncing both systems. Requirements ServiceNow active subscription ...
        • GLPI Custom SecOps Integration

          This article shows how to leverage GLPI API and Lumu Defender API to enhance your SecOps capabilities, pushing Lumu incidents into a GLPI deployment as Service Tickets, and syncing both systems. Requirements A GLPI active server and Web access. An ...
        • Chronicle SIEM Custom SecOps Integration

          The Chronicle SIEM Custom SecOps integration allows you to receive Lumu detections and related operating events. In this article, you will find out how to configure your Chronicle SIEM instance and its Lumu integration to enhance your current ...
        • Kaseya BMS PSA Custom SecOps Integration

          This article shows how to leverage Kaseya BMS API and Lumu Defender API to enhance your SecOps capabilities, pushing Lumu incidents into a BMS deployment as Service Desk - Tickets, and syncing both systems. SecOps integration between Kaseya BMS and ...