Skip to content

Commit 5c7e0b6

Browse files
authored
Merge pull request #9204 from wazuh/merge-4.14-into-4.14.2
Merge 4.14 into 4.14.2
2 parents 04bc5a0 + 51cf43c commit 5c7e0b6

File tree

6 files changed

+162
-101
lines changed

6 files changed

+162
-101
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ All notable changes to this project will be documented in this file.
4343
- **Post-release**: Updated the *Installation from sources* documentation. ([#9168](https://github.com/wazuh/wazuh-documentation/pull/9168))
4444
- **Post-release**: Updated diagram images in the documentation. ([#9097](https://github.com/wazuh/wazuh-documentation/pull/9097))
4545
- **Post-release**: Updated the Wazuh signed package (WPK) files section. ([#9175](https://github.com/wazuh/wazuh-documentation/pull/9175))
46+
- **Post-release**: Updated `offline-url` setting reference in the vulnerability detection capability section. ([#9197](https://github.com/wazuh/wazuh-documentation/pull/9197))
47+
- **Post-release**: Updated the Wazuh Indexer API documentation. ([#9200](https://github.com/wazuh/wazuh-documentation/pull/9200))
48+
- **Post-release**: Updated the *How to configure SCA* section. ([#9202](https://github.com/wazuh/wazuh-documentation/pull/9202))
4649

4750
### Fixed
4851

source/user-manual/capabilities/sec-config-assessment/how-to-configure.rst

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,22 +65,39 @@ The second is to disable them from the Wazuh agent ``ossec.conf`` file by adding
6565
How to share policy files and configuration with the Wazuh agents
6666
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6767

68-
As described in the :doc:`centralized configuration </user-manual/reference/centralized-configuration>` section, the Wazuh manager can push files and configurations to connected Wazuh agents.
68+
As described in the :doc:`centralized configuration </user-manual/reference/centralized-configuration>` section, the Wazuh server can push files and configurations to connected Wazuh agents.
6969

7070
You can enable this feature to push policy files to the Wazuh agents in defined groups. By default, every Wazuh agent belongs to the ``default`` group, which is used here as an example:
7171

72-
#. On the Wazuh agent, edit the ``local_internal_options.conf`` file to allow the execution of commands in SCA policies that use the ``c`` (command) rule type sent from the Wazuh server:
72+
#. Edit the Wazuh agent ``local_internal_options.conf`` file to allow the execution of commands in SCA policies sent from the Wazuh server:
7373

74-
.. code-block:: console
74+
.. tabs::
7575

76-
# echo "sca.remote_commands=1" >> /var/ossec/etc/local_internal_options.conf
76+
.. group-tab:: Linux
7777

78+
.. code-block:: console
79+
80+
# echo "sca.remote_commands=1" >> /var/ossec/etc/local_internal_options.conf
81+
82+
.. group-tab:: Windows
83+
84+
.. code-block:: doscon
85+
86+
> notepad "C:\Program Files (x86)\ossec-agent\local_internal_options.conf"
87+
88+
Append the command ``sca.remote_commands=1``.
89+
90+
.. group-tab:: macOS
91+
92+
.. code-block:: console
93+
94+
# echo "sca.remote_commands=1" >> /Library/Ossec/etc/local_internal_options.conf
7895
7996
.. note::
8097

81-
By enabling the ``sca.remote_commands`` flag, the Wazuh server can execute commands on the monitored endpoint for SC policies that include rules of type ``c`` (command). This setting is only required for SCA policies using the ``c`` rule type; policies with other rule types (e.g., ``f`` for file, ``p`` for process, or ``r`` for registry) are not affected by the ``sca.remote_commands`` flag and will function without enabling it.
98+
By enabling remote command execution, the Wazuh server can execute commands on the monitored endpoint. Remote commands are disabled by default as a security measure, helping reduce the attack surface if the Wazuh server is compromised.
8299

83-
Remote command execution is disabled by default as a security measure to reduce the attack surface in case the Wazuh server is compromised. If you prefer not to enable remote commands, you can manually deploy policy files to each agent without using the Wazuh server to push them. For example, you can create the policy file directly on the monitored endpoint or use ``scp`` to copy the policy file to the endpoint.
100+
You do not need to enable remote commands if you add the policy files to each agent without using Wazuh to push them. For example, you can manually create the policy file directly on the monitored endpoint, or use ``scp`` to copy the policy file to the monitored endpoint.
84101

85102
#. On the Wazuh server, place a new policy file in the ``/var/ossec/etc/shared/default`` folder and change its ownership. Replace ``<NEW_POLICY_FILE>`` with your policy name.
86103

source/user-manual/capabilities/vulnerability-detection/configuring-scans.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,12 +221,12 @@ Follow the steps below to configure the Vulnerability detection module for offli
221221
<enabled>yes</enabled>
222222
<index-status>yes</index-status>
223223
<feed-update-interval>60m</feed-update-interval>
224-
<offline-url><FILE_PATH_TO_OFFLINE_REPOSITORY></offline-url>
224+
<offline-url>file://<FILE_PATH_TO_OFFLINE_REPOSITORY></offline-url>
225225
</vulnerability-detection>
226226
227227
Where:
228228

229-
- ``<FILE_PATH_TO_OFFLINE_REPOSITORY>`` is the file path to the threat intelligence repository downloaded in the previous step.
229+
- ``<FILE_PATH_TO_OFFLINE_REPOSITORY>`` is the file and path to the threat intelligence repository downloaded in the previous step.
230230

231231
#. Restart the Wazuh manager to apply the configuration.
232232

source/user-manual/indexer-api/getting-started.rst

Lines changed: 112 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -76,54 +76,68 @@ JSON Web Token (JWT)
7676

7777
The JSON Web Token (JWT) is another method of authenticating to the Wazuh indexer API. JWT is an open standard (RFC 7519) that defines a compact and self-contained method for securely transmitting information between parties as a JSON object.
7878

79-
A JWT can be self-generated, and the validation key can be stored in the ``/etc/wazuh-indexer/opensearch-security/config.yml`` file or generated and validated through a JSON Web Key Set (JWKS) endpoint to retrieve the key from its location on the issuers server.
79+
A JWT can be self-generated using validation keys stored in the ``/etc/wazuh-indexer/opensearch-security/config.yml`` file or generated and validated through a JSON Web Key Set (JWKS) endpoint to retrieve the key from its location on the issuer's server.
8080

81-
JWT authentication is not enabled by default, and its settings are specified within the ``jwt_auth_domain`` section in the ``/etc/wazuh-indexer/opensearch-security/config.yml`` configuration file. Follow the steps below to enable and log into the Wazuh indexer using JWT authentication:
81+
JWT authentication is not enabled by default, and its settings are specified within the ``dynamic`` section in the ``/etc/wazuh-indexer/opensearch-security/config.yml`` configuration file. Follow the steps below to enable and log into the Wazuh indexer using JWT authentication:
8282

83-
#. Open the ``/etc/wazuh-indexer/opensearch-security/config.yml`` configuration file and update the highlighted settings:
83+
#. Run the following command twice to generate 64 bytes of cryptographically secure random data and output it as a Base64-encoded string:
84+
85+
.. code-block:: console
86+
87+
# openssl rand -base64 64
88+
# openssl rand -base64 64
89+
90+
#. Open the ``/etc/wazuh-indexer/opensearch-security/config.yml`` configuration file and update the highlighted settings. Use the first output as a signing key, replacing the ``<SIGNING_KEY>`` variable. Use the second output as an encryption key, replacing the ``<ENCRYPTION_KEY>`` variable below:
8491

8592
.. code-block:: yaml
86-
:emphasize-lines: 3,10,14,15
87-
88-
jwt_auth_domain:
89-
description: "Authenticate via Json Web Token"
90-
http_enabled: true
91-
transport_enabled: false
92-
order: 0
93-
http_authenticator:
94-
type: jwt
95-
challenge: false
96-
config:
97-
signing_key: "<ENCODED_SIGNING_KEY>"
98-
jwt_header: "Authorization"
99-
jwt_url_parameter: null
100-
jwt_clock_skew_tolerance_seconds: 30
101-
roles_key: <ROLES_KEY>
102-
subject_key: <SUBJECT_KEY>
103-
authentication_backend:
104-
type: noop
105-
106-
.. note::
107-
108-
Replace ``<ENCODED_SIGNING_KEY>`` with your base64 encoded HMAC key or public RSA/ECDSA pem key. Update the values of ``<ROLES_KEY>`` with the name of a backend user the JWT should attach to, and ``<SUBJECT_KEY>`` to a descriptive subject name that identifies the JWT. For example, setting the values to **admin** and **automationUser** respectively will attach the JWT to the internal admin user and name the JWT as automationUser.
93+
:emphasize-lines: 3,4,5,6
94+
95+
config:
96+
dynamic:
97+
on_behalf_of:
98+
enabled: 'true'
99+
signing_key: <SIGNING_KEY>
100+
encryption_key: <ENCRYPTION_KEY>
109101
110102
#. Run the ``/usr/share/wazuh-indexer/plugins/opensearch-security/tools/securityadmin.sh`` script to load the configuration changes made in the ``/etc/wazuh-indexer/opensearch-security/config.yml`` file:
111103

112104
.. code-block:: console
113-
105+
114106
# export JAVA_HOME=/usr/share/wazuh-indexer/jdk/ && bash /usr/share/wazuh-indexer/plugins/opensearch-security/tools/securityadmin.sh -f /etc/wazuh-indexer/opensearch-security/config.yml -icl -key /etc/wazuh-indexer/certs/admin-key.pem -cert /etc/wazuh-indexer/certs/admin.pem -cacert /etc/wazuh-indexer/certs/root-ca.pem -h 127.0.0.1 -nhnv
115107
108+
#. Run the command below to fetch a JSON web token.
109+
110+
.. code-block:: console
111+
112+
# curl -k -u <WAZUH_INDEXER_USER>:<WAZUH_INDEXER_PASSWORD> -XPOST "https://localhost:9200/_plugins/_security/api/generateonbehalfoftoken" -H 'Content-Type: application/json' -d
113+
'
114+
{
115+
"description":"Testing",
116+
"service":"Testing Service",
117+
"durationSeconds":"180"
118+
}
119+
'
120+
121+
Below is an example of an output.
122+
123+
.. code-block:: json
124+
:class: output
125+
126+
{"user":"admin","authenticationToken":"eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsImF1ZCI6IlRlc3RpbmcgU2VydmljZSIsIm5iZiI6MTc2Nzc5Njc1NiwiaXNzIjoid2F6dWgtY2x1c3RlciIsImV4cCI6MTc2Nzc5NjkzNiwiaWF0IjoxNzY3Nzk2NzU2LCJlciI6Illid1JkVGxKVDZWRXdvR2lSZS8rblNNalVyNG9zZFM3SnlSZkg5S09LTlE9In0.oUOVhPB6WCidAIp3O9W6GQnngq0dednQQNtBIHExhMhtJcNw9h1aL6MwZ42kGr4JORbA-a-wc9IpKcrUV2omGg","durationSeconds":180}
127+
128+
Replace the variables ``<WAZUH_INDEXER_USER>:<WAZUH_INDEXER_PASSWORD>`` with your Wazuh indexer username and password.
129+
116130
#. Authenticate to the Wazuh indexer API using your JWT, as seen below. In this example, we use cURL to connect and authenticate:
117131

118132
.. code-block:: console
119-
133+
120134
# curl -k -XGET "https://localhost:9200" -H "Authorization: Bearer <WAZUH_INDEXER_JWT>"
121135
122-
Replace ``<WAZUH_INDEXER_JWT>`` with your JWT. The expected output is as seen below:
123-
136+
Replace ``<WAZUH_INDEXER_JWT>`` with your generated JWT. The expected output is as seen below:
137+
124138
.. code-block:: none
125139
:class: output
126-
140+
127141
{
128142
"name" : "node-1",
129143
"cluster_name" : "wazuh-cluster",
@@ -141,14 +155,16 @@ JWT authentication is not enabled by default, and its settings are specified wit
141155
"tagline" : "The OpenSearch Project: https://opensearch.org/"
142156
}
143157
144-
Optionally, you can use your JWT as an environment variable.
158+
Optionally, you can use your JWT as an environment variable.
145159

146-
You can access any API endpoint using the below structure. Replace ``<METHOD>`` with the desired method, ``<ENDPOINT>`` with the string corresponding to the endpoint you wish to access, and ``<WAZUH_INDEXER_JWT>`` with your JWT. If you are using an environment variable, replace ``<WAZUH_INDEXER_JWT>`` with your environment variable, for example ``$TOKEN``.
160+
You can access any API endpoint using the below structure. Replace ``<METHOD>`` with the desired method, ``<ENDPOINT>`` with the string corresponding to the endpoint you wish to access, and ``<WAZUH_INDEXER_JWT>`` with your JWT.
147161

148162
.. code-block:: console
149163
150164
# curl -k -X <METHOD> "https://localhost:9200/<ENDPOINT>" -H "Authorization: Bearer <WAZUH_INDEXER_JWT>"
151165
166+
If you are using an environment variable, replace ``<WAZUH_INDEXER_JWT>`` with your environment variable e.g. ``$TOKEN``.
167+
152168
Configuration options
153169
~~~~~~~~~~~~~~~~~~~~~
154170

@@ -282,7 +298,7 @@ The Python ``requests`` library allows us to send HTTP requests to the Wazuh Ind
282298
from requests.auth import HTTPBasicAuth
283299
284300
# Base URL and endpoint
285-
Wazuh_indexer_url = "https://localhost:9200"
301+
wazuh_indexer_url = "https://localhost:9200"
286302
endpoint = "/_cluster/health"
287303
288304
# Full URL
@@ -349,63 +365,71 @@ Using Bash
349365

350366
You can also interact with the Wazuh indexer API using a bash script. A bash script is preferable when you do not want to install additional programs like Python. In the following ``check_wazuh_indexer_health.sh`` bash script, we query the Wazuh indexer API to retrieve the cluster health status.
351367

352-
.. code-block:: bash
353-
:emphasize-lines: 7,8
354-
355-
#!/bin/bash
356-
357-
# Base URL and endpoint for Wazuh Indexer API
358-
WAZUH_INDEXER_URL="https://localhost:9200"
359-
ENDPOINT="/_cluster/health"
360-
FULL_URL="${WAZUH_INDEXER_URL}${ENDPOINT}"
361-
USERNAME="<WAZUH_INDEXER_USERNAME>"
362-
PASSWORD="<WAZUH_INDEXER_PASSWORD>"
363-
364-
# Make the API request using basic authentication
365-
response=$(curl -s -k -u "$USERNAME:$PASSWORD" "$FULL_URL")
366-
# Check if the request was successful
367-
if [ $? -eq 0 ]; then
368-
echo "Cluster Health Status:"
369-
# Check if jq is installed
370-
if command -v jq > /dev/null; then
371-
echo "$response" | jq .
372-
else
373-
echo "Warning: 'jq' is not installed. Displaying raw JSON response:"
374-
echo "$response"
375-
fi
376-
else
377-
echo "Error: Failed to retrieve cluster health."
378-
fi
379-
380-
Run the ``check_wazuh_indexer_health`` script:
368+
#. Create a bash script called ``check_wazuh_indexer_health.sh`` and paste the content below:
381369

382-
.. code-block:: console
370+
.. code-block:: bash
371+
:emphasize-lines: 7,8
383372
384-
# ./check_wazuh_indexer_health
373+
#!/bin/bash
385374
386-
.. code-block:: none
387-
:class: output
375+
# Base URL and endpoint for Wazuh Indexer API
376+
WAZUH_INDEXER_URL="https://localhost:9200"
377+
ENDPOINT="/_cluster/health"
378+
FULL_URL="${WAZUH_INDEXER_URL}${ENDPOINT}"
379+
USERNAME="<WAZUH_INDEXER_USERNAME>"
380+
PASSWORD="<WAZUH_INDEXER_PASSWORD>"
381+
382+
# Make the API request using basic authentication
383+
response=$(curl -s -k -u "$USERNAME:$PASSWORD" "$FULL_URL")
384+
# Check if the request was successful
385+
if [ $? -eq 0 ]; then
386+
echo "Cluster Health Status:"
387+
# Check if jq is installed
388+
if command -v jq > /dev/null; then
389+
echo "$response" | jq .
390+
else
391+
echo "Warning: 'jq' is not installed. Displaying raw JSON response:"
392+
echo "$response"
393+
fi
394+
else
395+
echo "Error: Failed to retrieve cluster health."
396+
fi
388397
389-
Cluster Health Status:
390-
{
391-
"cluster_name": "wazuh-cluster",
392-
"status": "green",
393-
"timed_out": false,
394-
"number_of_nodes": 1,
395-
"number_of_data_nodes": 1,
396-
"discovered_master": true,
397-
"discovered_cluster_manager": true,
398-
"active_primary_shards": 30,
399-
"active_shards": 30,
400-
"relocating_shards": 0,
401-
"initializing_shards": 0,
402-
"unassigned_shards": 0,
403-
"delayed_unassigned_shards": 0,
404-
"number_of_pending_tasks": 0,
405-
"number_of_in_flight_fetch": 0,
406-
"task_max_waiting_in_queue_millis": 0,
407-
"active_shards_percent_as_number": 100
408-
}
398+
#. Run the following command to make the above script executable:
399+
400+
.. code-block:: console
401+
402+
# chmod +x check_wazuh_indexer_health.sh
403+
404+
#. Run the ``check_wazuh_indexer_health`` script:
405+
406+
.. code-block:: console
407+
408+
# ./check_wazuh_indexer_health.sh
409+
410+
.. code-block:: none
411+
:class: output
412+
413+
Cluster Health Status:
414+
{
415+
"cluster_name": "wazuh-cluster",
416+
"status": "green",
417+
"timed_out": false,
418+
"number_of_nodes": 1,
419+
"number_of_data_nodes": 1,
420+
"discovered_master": true,
421+
"discovered_cluster_manager": true,
422+
"active_primary_shards": 30,
423+
"active_shards": 30,
424+
"relocating_shards": 0,
425+
"initializing_shards": 0,
426+
"unassigned_shards": 0,
427+
"delayed_unassigned_shards": 0,
428+
"number_of_pending_tasks": 0,
429+
"number_of_in_flight_fetch": 0,
430+
"task_max_waiting_in_queue_millis": 0,
431+
"active_shards_percent_as_number": 100
432+
}
409433
410434
.. note::
411435

@@ -514,7 +538,7 @@ Example response to report a resource not found exception (HTTPS status code 404
514538
"reason" : "no such index [testindex]",
515539
"index" : "testindex",
516540
"resource.id" : "testindex",
517-
"resourcez.type" : "index_or_alias",
541+
"resource.type" : "index_or_alias",
518542
"index_uuid" : "_na_"
519543
},
520544
"status" : 404

source/user-manual/indexer-api/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Here is a list of some of the Wazuh indexer API capabilities:
2222
- Configuration management
2323
- Index lifecycle management
2424

25-
Take a look at the :doc:`Wazuh indexer API use cases <use-case>` for practical examples of how the Wazuh indexer API can be utilized.
25+
Refer to the :doc:`Wazuh indexer API reference <reference>` for details about all the Wazuh indexer API endpoints. Take a look at the :doc:`Wazuh indexer API use cases <use-case>` for practical examples of how the Wazuh indexer API can be utilized.
2626

2727
.. topic:: Contents
2828

0 commit comments

Comments
 (0)