Skip to content

Commit

Permalink
Merge pull request #7298 from wazuh/fix/6849-cloud-modules-templates
Browse files Browse the repository at this point in the history
Add python and pip installation templates
  • Loading branch information
javimed committed May 15, 2024
2 parents 1922c58 + 410beb0 commit 957bbbe
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 176 deletions.
7 changes: 7 additions & 0 deletions source/_templates/cloud/notes.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.. Copyright (C) 2015 Wazuh, Inc.
You can configure the integration with |service| either in the Wazuh manager or in a Wazuh agent. This choice depends solely on how you access your |service| infrastructure in your environment.

You only need to install dependencies when configuring the integration with |service| in a Wazuh agent. The Wazuh manager already includes all the necessary dependencies.

.. End of include file
43 changes: 43 additions & 0 deletions source/_templates/cloud/pip_installation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
.. Copyright (C) 2015 Wazuh, Inc.
You can install the required modules with Pip, the Python package manager. Most UNIX distributions have this tool available in their software repositories.

.. tabs::

.. group-tab:: Yum

.. code-block:: console
# yum update && yum install python3-pip
.. group-tab:: APT

.. code-block:: console
# apt-get update && apt-get install python3-pip
We recommend using Pip 19.3 or later to simplify the installation of the dependencies.

.. tabs::

.. group-tab:: Python 3.8–3.10

.. code-block:: console
# pip3 install --upgrade pip
.. group-tab:: Python 3.11

.. code-block:: console
# pip3 install --upgrade pip --break-system-packages
.. note::

This command modifies the default externally managed Python environment. See the `PEP 668 <https://peps.python.org/pep-0668/>`__ description for more information.

To prevent the modification, you can run ``pip3 install --upgrade pip`` within a virtual environment. You must update the shebang of the |module_script| Python script with the interpreter in your virtual environment. For example, ``#!/path/to/your/virtual/environment/bin/python3``.


.. End of include file
20 changes: 20 additions & 0 deletions source/_templates/cloud/python_installation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.. Copyright (C) 2015 Wazuh, Inc.
The |service| module requires `Python 3 <https://www.python.org/downloads/>`__. Specifically, it's compatible with Python |py_cloud_cont_min|–|py_cloud_cont_max|. While later Python versions should work as well, we can't assure they are compatible.

.. tabs::

.. group-tab:: Yum

.. code-block:: console
# yum update && yum install python3
.. group-tab:: APT

.. code-block:: console
# apt-get update && apt-get install python3
.. End of include file
Original file line number Diff line number Diff line change
Expand Up @@ -8,72 +8,21 @@
Installing dependencies
=======================

.. note::
The integration with AWS S3 can be configured in the Wazuh manager (which also behaves as an agent) or directly in a Wazuh agent. This choice merely depends on how you decide to access your AWS infrastructure in your environment.

.. warning::
The Wazuh manager includes all dependencies installed, these steps are only necessary when configuring the integration in a Wazuh agent.
.. |service| replace:: AWS

.. include:: /_templates/cloud/notes.rst

Python
------

The AWS module requires `Python 3 <https://www.python.org/>`__. Specifically, it's compatible with
`Python |PYTHON_CLOUD_CONTAINERS_MIN|–|PYTHON_CLOUD_CONTAINERS_MAX| <https://www.python.org/downloads/>`_. While later Python versions should work as well, we can't assure they are compatible.

.. tabs::

.. group-tab:: Yum

.. code-block:: console
# yum update && yum install python3
.. group-tab:: APT

.. code-block:: console
# apt-get update && apt-get install python3
The required modules can be installed with Pip, the Python package manager. Most UNIX distributions have this tool available in their software repositories:

.. tabs::

.. group-tab:: Yum

.. code-block:: console
# yum update && yum install python3-pip
.. group-tab:: APT

.. code-block:: console
# apt-get update && apt-get install python3-pip
It is recommended to use a pip version greater than or equal to 19.3 to ease the installation of the required dependencies.

.. tabs::

.. group-tab:: Python 3.8–3.10

.. code-block:: console
# pip3 install --upgrade pip
.. group-tab:: Python 3.11

.. code-block:: console
# pip3 install --upgrade pip --break-system-packages
.. note::
.. |py_cloud_cont_min| replace:: |PYTHON_CLOUD_CONTAINERS_MIN|
.. |py_cloud_cont_max| replace:: |PYTHON_CLOUD_CONTAINERS_MAX|

This command modifies the default externally managed Python environment. See the `PEP 668 <https://peps.python.org/pep-0668/>`__ description for more information.
.. include:: /_templates/cloud/python_installation.rst

To prevent the modification, you can run ``pip3 install --upgrade pip`` within a virtual environment. You must update the ``aws-s3`` script shebang with your virtual environment interpreter, for example, ``#!/path/to/your/virtual/environment/bin/python3``.
.. |module_script| replace:: ``/var/ossec/wodles/aws/aws-s3``

.. include:: /_templates/cloud/pip_installation.rst

.. _boto-3:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,73 +6,21 @@
Installing dependencies
=======================

.. note::

The Azure monitoring module can be configured in the Wazuh manager (which also behaves as an agent) or directly in a Wazuh agent.

.. warning::
The Wazuh manager includes all dependencies installed, these steps are only necessary when configuring the integration in a Wazuh agent.
.. |service| replace:: Azure

.. include:: /_templates/cloud/notes.rst

Python
------

The Azure module requires `Python 3 <https://www.python.org/>`__. Specifically, it's compatible with
`Python |PYTHON_CLOUD_CONTAINERS_MIN|–|PYTHON_CLOUD_CONTAINERS_MAX| <https://www.python.org/downloads/>`_. While later Python versions should work as well, we can't assure they are compatible.

.. tabs::

.. group-tab:: Yum

.. code-block:: console
# yum update && yum install python3
.. group-tab:: APT

.. code-block:: console
# apt-get update && apt-get install python3
The required modules can be installed with Pip, the Python package manager. Most of UNIX distributions have this tool available in their software repositories:

.. tabs::

.. group-tab:: Yum

.. code-block:: console
# yum update && yum install python3-pip
.. group-tab:: APT

.. code-block:: console
# apt-get update && apt-get install python3-pip
.. |py_cloud_cont_min| replace:: |PYTHON_CLOUD_CONTAINERS_MIN|
.. |py_cloud_cont_max| replace:: |PYTHON_CLOUD_CONTAINERS_MAX|

.. include:: /_templates/cloud/python_installation.rst

It is recommended to use a pip version greater than or equal to 19.3 to ease the installation of the required dependencies.
.. |module_script| replace:: ``/var/ossec/wodles/azure/azure-logs``

.. tabs::

.. group-tab:: Python 3.8–3.10

.. code-block:: console
# pip3 install --upgrade pip
.. group-tab:: Python 3.11

.. code-block:: console
# pip3 install --upgrade pip --break-system-packages
.. note::

This command modifies the default externally managed Python environment. See the `PEP 668 <https://peps.python.org/pep-0668/>`__ description for more information.

To prevent the modification, you can run ``pip3 install --upgrade pip`` within a virtual environment. You must update the ``azure-logs`` script shebang with your virtual environment interpreter, for example, ``#!/path/to/your/virtual/environment/bin/python3``.
.. include:: /_templates/cloud/pip_installation.rst

Azure Storage client library for Python
---------------------------------------
Expand Down
66 changes: 7 additions & 59 deletions source/cloud-security/gcp/prerequisites/dependencies.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,73 +5,21 @@
Installing dependencies
=======================

The Wazuh module for Google Cloud Pub/Sub and the Wazuh module for Google Cloud Storage buckets can be configured on both the Wazuh server and the monitored endpoint. This choice depends on where you want to reach the Google Cloud services. Perform the steps below to install Python and Pip on the endpoint you are performing the integration.
.. |service| replace:: GCP

.. warning::

The Wazuh server includes all dependencies installed; the following steps are only necessary when configuring the modules on a monitored endpoint.
.. include:: /_templates/cloud/notes.rst

Python
------

The Wazuh module for Google Cloud Pub/Sub and the Wazuh module for Google Cloud Storage buckets require `Python 3 <https://www.python.org/>`__. It's compatible with
`Python |PYTHON_CLOUD_CONTAINERS_MIN|–|PYTHON_CLOUD_CONTAINERS_MAX| <https://www.python.org/downloads/>`_. While later Python versions should work as well, we can't assure they are compatible.

Run the following command to install Python 3 if you do not already have it installed:

.. tabs::

.. group-tab:: Yum

.. code-block:: console
$ sudo yum update && yum install python3
.. group-tab:: APT

.. code-block:: console
$ sudo apt-get update && apt-get install python3
Run the command below to install Pip, the Python package manager. Most UNIX distributions have this tool available in their software repositories by default.

Perform the next steps if you do not already have it installed.

.. tabs::

.. group-tab:: Yum

.. code-block:: console
.. |py_cloud_cont_min| replace:: |PYTHON_CLOUD_CONTAINERS_MIN|
.. |py_cloud_cont_max| replace:: |PYTHON_CLOUD_CONTAINERS_MAX|

$ sudo yum update && yum install python3-pip
.. include:: /_templates/cloud/python_installation.rst

.. group-tab:: APT
.. |module_script| replace:: ``/var/ossec/wodles/gcloud/gcloud``

.. code-block:: console
$ sudo apt-get update && apt-get install python3-pip
If you already have Python3 and Pip installed, perform the following steps to upgrade your Pip version. We recommend using a pip version greater than or equal to 19.3 to ease the installation of the required dependencies.

.. tabs::

.. group-tab:: Python 3.8–3.10

.. code-block:: console
$ sudo pip3 install --upgrade pip
.. group-tab:: Python 3.11

.. code-block:: console
$ sudo pip3 install --upgrade pip --break-system-packages
.. note::

This command modifies the default externally managed Python environment. See the `PEP 668 <https://peps.python.org/pep-0668/>`__ description for more information.

To prevent the modification, you can run ``pip3 install --upgrade pip`` within a virtual environment. You must update the gcloud ``var/ossec/wodles/gcloud/gcloud`` module shebang with your virtual environment interpreter. For example: ``#!</path/to/your/virtual/environment>/bin/python3``.
.. include:: /_templates/cloud/pip_installation.rst

Google Cloud pip dependencies
-----------------------------
Expand Down

0 comments on commit 957bbbe

Please sign in to comment.