-
Notifications
You must be signed in to change notification settings - Fork 385
Enhancement/idr454 ms graph update #9107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ayodeko
wants to merge
4
commits into
4.14
Choose a base branch
from
enhancement/idr454-ms-graph-update
base: 4.14
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,7 +46,7 @@ Certificates & secrets | |
|
|
||
| .. note:: | ||
|
|
||
| Ensure you write down the secret's value section because the UI won't let you copy it afterward. | ||
| Ensure you write down the secret's value section, as the UI won't let you copy it later. | ||
|
|
||
| .. _permissions-ms-graph-api-setup: | ||
|
|
||
|
|
@@ -71,18 +71,6 @@ To configure the application permissions, go to the **API permissions** page and | |
| .. thumbnail:: /images/cloud-security/ms-graph/add-api-permissions.png | ||
| :align: center | ||
| :width: 80% | ||
|
|
||
| #. Add the following relationships' permissions under the **DeviceManagementApps** and **DeviceManagementManagedDevices** sections: | ||
|
|
||
| - ``DeviceManagementApps.Read.All``. Read `auditEvents` & `detectedApps` relationship data from your tenant. | ||
|
|
||
| - ``DeviceManagementManagedDevices.Read.All``. Read `auditEvents` & `managedDevices` relationship data from your tenant. | ||
|
|
||
| .. thumbnail:: /images/cloud-security/ms-graph/4-azure-wazuh-app-configure-permissions-intune.png | ||
| :title: API permissions Intune | ||
| :alt: API permissions Intune | ||
| :align: center | ||
| :width: 100% | ||
|
|
||
| #. Use an admin user to **Grant admin consent** for the tenant: | ||
|
|
||
|
|
@@ -94,17 +82,16 @@ To configure the application permissions, go to the **API permissions** page and | |
|
|
||
| .. note:: | ||
|
|
||
| Admin consent is required for API permission changes. | ||
| An Admin account is required to Grant admin consent for Default Directory. | ||
|
|
||
| Wazuh server or agent | ||
| --------------------- | ||
|
|
||
| Next, we will see the necessary configuration to allow the integration to successfully pull logs from the Microsoft Graph API. | ||
| Next, we will set the necessary configurations to allow the Wazuh module for Microsoft Graph to pull logs from the Microsoft Graph API successfully. | ||
|
|
||
| #. Apply the following configuration to the local configuration file ``/var/ossec/etc/ossec.conf``: | ||
|
|
||
| .. code-block:: xml | ||
| :emphasize-lines: 15-17,20,21 | ||
|
|
||
| <ms-graph> | ||
| <enabled>yes</enabled> | ||
|
|
@@ -114,9 +101,9 @@ Next, we will see the necessary configuration to allow the integration to succes | |
| <interval>5m</interval> | ||
| <version>v1.0</version> | ||
| <api_auth> | ||
| <client_id>your_client_id</client_id> | ||
| <tenant_id>your_tenant_id</tenant_id> | ||
| <secret_value>your_secret_value</secret_value> | ||
| <client_id><YOUR_APPLICATION_ID></client_id> | ||
| <tenant_id><YOUR_TENANT_ID></tenant_id> | ||
| <secret_value><YOUR_SECRET_VALUE></secret_value> | ||
| <api_type>global</api_type> | ||
| </api_auth> | ||
| <resource> | ||
|
|
@@ -130,54 +117,47 @@ Next, we will see the necessary configuration to allow the integration to succes | |
| </resource> | ||
| </ms-graph> | ||
|
|
||
| The configuration monitors specific events at an interval of ``5m``. | ||
|
|
||
| - ``alerts_v2`` and ``incidents`` within the ``security`` resource. | ||
| - ``auditEvents`` within the ``deviceManagement`` resource. | ||
|
|
||
| Only logs created after the Wazuh module for Microsoft Graph starts are monitored. | ||
| In this case, we will search for ``alerts_v2`` and incidents within the security resource at an interval of ``5m``. The logs will only be created after the Wazuh module for Microsoft Graph starts. | ||
|
|
||
| Where: | ||
|
|
||
| - ``<client_id>`` (also known as an Application ID) is the unique identifier of your registered application. | ||
| - ``<tenant_id>`` (also known as Directory ID) is the unique identifier for your Azure tenant | ||
| - ``<secret_value>`` is the value of the client secret. It is used to authenticate the registered app on the Azure tenant. | ||
| - ``<api_type>`` specifies the type of Microsoft 365 subscription plan the tenant uses. global refers to either a commercial or GCC tenant. | ||
| - ``<name>`` specifies the resource's name (i.e., specific API endpoint) to query for logs. | ||
| - ``<client_id>`` (also known as an Application ID) is the unique identifier of your registered application. | ||
| - ``<tenant_id>`` (also known as Directory ID) is the unique identifier for your Azure tenant | ||
| - ``<secret_value>`` is the value of the client secret. It is used to authenticate the registered app on the Azure tenant. | ||
| - ``<api_type>`` specifies the type of Microsoft 365 subscription plan the tenant uses. ``global`` refers to either a commercial or GCC tenant. | ||
| - ``<name>`` specifies the resource's name (i.e., specific API endpoint) to query for logs. | ||
| - ``<relationship>`` specifies the types of content (relationships) to obtain logs for. | ||
|
|
||
| #. Restart your Wazuh server or agent, depending on where you configured the Wazuh module for Microsoft Graph. | ||
| 2. Restart your Wazuh server or agent, depending on where you configured the Wazuh module for Microsoft Graph. | ||
|
|
||
| .. tabs:: | ||
|
|
||
| .. tab:: Wazuh agent | ||
|
|
||
| .. code-block:: console | ||
|
|
||
| # systemctl restart wazuh-agent | ||
|
|
||
| .. tab:: Wazuh manager | ||
|
|
||
| .. code-block:: console | ||
|
|
||
| # systemctl restart wazuh-manager | ||
| Wazuh agent: | ||
|
||
|
|
||
| .. code-block:: console | ||
|
|
||
| # systemctl restart wazuh-agent | ||
|
|
||
| Wazuh server: | ||
|
|
||
| .. code-block:: console | ||
|
|
||
| # systemctl restart wazuh-manager | ||
|
|
||
| .. note:: | ||
| .. note:: | ||
|
|
||
| Multi-tenant is not supported. You can only configure one block of ``api_auth``. To learn more about the Wazuh module for Microsoft Graph options, see the :doc:`ms-graph </user-manual/reference/ossec-conf/ms-graph-module>` reference. | ||
| Multi-tenant is not supported. You can only configure one block of ``api_auth``. To learn more about the Wazuh module for Microsoft Graph options, see the :doc:`ms-graph </user-manual/reference/ossec-conf/ms-graph-module>` reference. | ||
|
|
||
| Use case | ||
| -------- | ||
| Use cases | ||
| --------- | ||
|
|
||
| Using the configuration mentioned above, you can examine two examples as follows. | ||
| Using the configuration mentioned above, we examine the following use cases: | ||
|
|
||
| - Malicious email as an example of a security event. | ||
| - Change enrollment configuration as an example of an Intune event. | ||
| - Monitoring security resources. | ||
| - Monitoring Microsoft Intune device management audit events. | ||
|
|
||
| Monitoring security resources | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
|
||
| One of the more ubiquitous alerts that an organization of any size receives is spam emails. In this case, we can specifically examine an example of a spam email containing malicious content and examine how Microsoft Graph & Wazuh report on this information. | ||
| One ubiquitous alert an organisation of any size receives is spam email. In this case, we can examine a spam email containing malicious content and see how Microsoft Graph and Wazuh report on this information. | ||
|
|
||
| We can set up the Wazuh module for Microsoft Graph to monitor the security resource and the ``alerts_v2`` relationship within our Microsoft 365 tenant described in :ref:`Retrieving content <retrieving_content>`. We also enable **Microsoft Defender for Office 365** within the Microsoft 365 tenant. Microsoft Defender for Office 365 monitors email messages for threats such as spam and malicious attachments. | ||
|
|
||
|
|
@@ -186,7 +166,7 @@ Detect malicious email | |
|
|
||
| Enable Microsoft Defender for Office 365 and send a malicious email to an email address in the monitored domain. A malicious email detection activity will produce a log that can be accessed using the ``alerts_v2`` relationship within the Microsoft 365 tenant. | ||
|
|
||
| #. Login to `Microsoft 365 Defender portal <https://security.microsoft.com/>`__ using an admin account. | ||
| #. Log in to `Microsoft 365 Defender portal <https://security.microsoft.com/>`__ using an admin account. | ||
| #. Navigate to **Policies & rules** > **Threat policies** > **Preset Security Policies**. | ||
| #. Toggle the **Standard protection is off** button under **Standard protection**. | ||
| #. Click on **Manage protection settings** and follow the prompt to set up the policies. | ||
|
|
@@ -237,7 +217,7 @@ When Microsoft Defender for Office 365 detects a malicious email event, a log si | |
| } | ||
|
|
||
|
|
||
| The Wazuh module for Microsoft Graph retrieves this log via Microsoft Graph API. This log matches an out-of-the-box rule with ID ``99506``. This triggers an alert with the following details: | ||
| The Wazuh module for Microsoft Graph retrieves this log via the Microsoft Graph API. This log matches an out-of-the-box rule with ID ``99506``. This triggers an alert with the following details: | ||
|
|
||
| .. code-block:: none | ||
| :class: output | ||
|
|
@@ -319,12 +299,17 @@ The alert is seen on the Wazuh dashboard. | |
| :align: center | ||
| :width: 80% | ||
|
|
||
| Monitoring device management audit events | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
|
||
| Intune event | ||
| ^^^^^^^^^^^^ | ||
| ~~~~~~~~~~~~ | ||
|
|
||
| Mobile Device Management (MDM) tools like Microsoft Intune enable organizations to manage devices. By integrating Microsoft Graph with Wazuh, organizations can monitor Microsoft Intune logs. | ||
| Mobile Device Management (MDM) tools, such as Microsoft Intune, enable organizations to manage devices. By integrating Microsoft Graph with Wazuh, organizations can monitor Microsoft Intune logs. | ||
|
|
||
| For instance, if a user updates the enrollment settings, configuring the module to monitor the ``deviceManagement`` resource and the ``auditEvents`` relationship might generate a JSON like the following one: | ||
| For instance, if a user updates the enrollment settings, configuring the module to monitor the ``deviceManagement`` resource, the ``auditEvents`` relationship generates a JSON like the following: | ||
|
|
||
| **Output** | ||
|
|
||
| .. code-block:: json | ||
| :class: output | ||
|
|
@@ -413,7 +398,7 @@ For instance, if a user updates the enrollment settings, configuring the module | |
| ] | ||
| } | ||
|
|
||
| In this example, you can take a look at the rule id ``99652``, which corresponds to ``MS Graph message: MDM Intune audit event.``. | ||
| In this example, you can look at rule ID ``99652``, which corresponds to the ``Microsoft Graph message "MDM Intune audit event.`` | ||
|
|
||
| .. code-block:: xml | ||
|
|
||
|
|
@@ -424,7 +409,9 @@ In this example, you can take a look at the rule id ``99652``, which corresponds | |
| <description>MS Graph message: MDM Intune audit event.</description> | ||
| </rule> | ||
|
|
||
| Once Wazuh connects with the Microsoft Graph API, the previous log triggers the rule and raises the following alert: | ||
| Once Wazuh connects with the Microsoft Graph API, the previous log triggers the rule and raises the following Wazuh alert: | ||
|
|
||
| **Output** | ||
|
|
||
| .. code-block:: json | ||
| :emphasize-lines: 5 | ||
|
||
|
|
@@ -543,3 +530,8 @@ Once Wazuh connects with the Microsoft Graph API, the previous log triggers the | |
| }, | ||
| "location": "ms-graph" | ||
| } | ||
|
|
||
|
|
||
| .. thumbnail:: /images/cloud-security/ms-graph/ms-graph-intune-details.png | ||
| :align: center | ||
| :width: 100% | ||
Binary file removed
BIN
-225 KB
...ages/cloud-security/ms-graph/4-azure-wazuh-app-configure-permissions-intune.png
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Auto-numbering broken