Preparing Environment for Custom Integrations

Preparing Environment for Custom Integrations

Lumu Custom integrations are designed to run on multiple platforms by using:

  • Python 3.10 or above or 

  • A Docker container. 

This article will focus on the environment setup using Python 3.10 or above.

For Docker-specific instructions, refer to the Custom Integration article you are setting up Docker for.

Prepare Python on your environment

As a recommended practice, we encourage you to create a Virtual environment for each integration to avoid conflicts between them and your operating system tools. You can deploy Python on different operating systems. Here, you will find specific instructions on how to prepare your integration environment before deploying any of them. 

Deploying a custom integration on a Virtual Appliance instead of creating a dedicated environment is discouraged. Keep in mind that engaging in such practices could result in losing support for your Virtual Appliance.

Linux-based systems

Most of the current Linux distributions come with Python preinstalled. You can check if your distribution has the required Python version by running this command on a console.

$ python3 --version
Python 3.10.12

If you get a version 3.10 or above, you can start from the Install venv or pip header. Otherwise, please follow these instructions.

Install pyenv

Simple Python Version Management (pyenv) lets you manage multiple versions of Python in a single environment. If you just try to update your current System Python’s version, you will have unexpected results. So, it’s recommended to manage multiple versions. 

Build dependencies

Follow the instructions according to your Linux distribution.

Ubuntu/Debian

It you are running a Ubuntu/Debian environment, run the following command on a console:

$ sudo apt-get install -y make build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev \
libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python-openssl git

Fedora/CentOS/RHEL

It you are running a Fedora/CentOS/RHEL environment, run the following command on a console:

$ sudo yum install gcc zlib-devel bzip2 bzip2-devel readline-devel sqlite \
sqlite-devel openssl-devel xz xz-devel libffi-devel git

openSUSE

It you are running a Fedora/CentOS/RHEL environment, run the following command on a console:

$ zypper in zlib-devel bzip2 libbz2-devel libffi-devel \
libopenssl-devel readline-devel sqlite3 sqlite3-devel xz xz-devel git

Install pyenv

To install pyenv, you must use the pyenv-installer. Run this command on a console:

$ curl https://pyenv.run | bash

You will get an output like the following.

WARNING: seems you still have not added 'pyenv' to the load path.

Load pyenv automatically by adding
the following to ~/.bashrc:

export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"

Follow the on-screen instructions. Finally, reload your shell.

$ exec "$SHELL"

Install Python

Now you can install the required Python version. Run this command on a console.

$ pyenv install 3.10.14

You will get the following output.

Downloading Python-3.10.14.tar.xz...
-> https://www.python.org/ftp/python/3.10.14/Python-3.10.14.tar.xz
Installing Python-3.10.14...
Installed Python-3.10.14 to `$HOME`/.pyenv/versions/3.10.14

Windows systems

You must download and install the required Python version from the Python official website. It’s recommended to download the latest release of Python 3.10 or above.

Run the installer and follow the on-screen instructions.

For custom installations, you must select the pip option. This is required for managing packages and dependencies required by each integration.

If you are working on a Windows system with a previously installed Python version different from the required version, you can install a later version with no issue. Just download the required installation package, run it, and follow the on-screen instructions.

Install venv or pip

You need venv and pip packages to create Python virtual environments. According to your Operating System, you must follow a different set of instructions.

Linux-based systems

You need to install the python3-env package to be able to create Python virtual environments. Use your distro package manager to install it.

Ubuntu/Debian

$ sudo apt-get install python3-venv

Fedora/CentOS/RHEL

$ sudo yum install python3-venv

openSUSE

$ zypper in python3-venv

Windows systems

These requirements are already installed if you followed the instructions starting from the Prepare Python on your environment for Windows systems header.

Create a Virtual Environment

After installing Python, you can create your virtual environment. According to your environment and how you set up Python, you must follow one of the following.

Linux-based systems

For pure-Python deployments

If you did not install a different version of Python in your environment by following the pyenv instructions, you can create your Virtual environment by using the following command:

$ python3 -m venv ENV_FOLDER

Where ENV_FOLDER must be replaced by the name you want to give to your Python virtual environment. We recommend using venv or .venv.

For deployments with pyenv

If you installed a new Python version for running your integrations, run the following command on your device console to create your Python virtua environment.

$ ~/.pyenv/versions/3.10.14/bin/python -m venv ENV_FOLDER

Where ENV_FOLDER must be replaced by the name you want to give to your Python virtual environment. We recommend using venv or .venv.

Windows systems

The process to create a Python virtual environment is similar to other operating systems. Open a command prompt and run the following command.

> python -m venv ENV_FOLDER

Where ENV_FOLDER must be replaced by the name you want to give to your Python virtual environment. We recommend using venv or .venv.

Please keep the ENV_FOLDER value at hand. It will be required for setting the integration.

References



        • Related Articles

        • Infoblox Custom Response Integration

          Before going through this article, check our Out-of-the-box App Integrations category. This is the recommended way to integrate the components of your cybersecurity stack with Lumu. If the product you are looking to integrate is there, it is advised ...
        • 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 ...
        • 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 ...
        • DNSFilter Custom Response Integration

          This article shows how to leverage the Lumu Response API and DNSFilter API to mitigate security risks. Requirements An active DNSFilter subscription. A DNSFilter Pro subscription or up is required. Script host. A scripting host is required to deploy ...
        • Azure Custom Response Integration

          This article shows how to leverage Azure Virtual Networks REST API and Lumu Defender API to enhance your Response capabilities. Response integration between Azure and Lumu Requirements An Azure subscription with Compute services deployed. An Azure ...