You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
69
69
70
70
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:
71
71
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:
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.
82
99
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.
84
101
85
102
#. 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.
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.
78
78
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 issuer’s 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.
80
80
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:
82
82
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:
84
91
85
92
.. 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>
109
101
110
102
#. 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:
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
+
124
138
.. code-block:: none
125
139
:class: output
126
-
140
+
127
141
{
128
142
"name" : "node-1",
129
143
"cluster_name" : "wazuh-cluster",
@@ -141,14 +155,16 @@ JWT authentication is not enabled by default, and its settings are specified wit
141
155
"tagline" : "The OpenSearch Project: https://opensearch.org/"
142
156
}
143
157
144
-
Optionally, you can use your JWT as an environment variable.
158
+
Optionally, you can use your JWT as an environment variable.
145
159
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.
If you are using an environment variable, replace ``<WAZUH_INDEXER_JWT>`` with your environment variable e.g. ``$TOKEN``.
167
+
152
168
Configuration options
153
169
~~~~~~~~~~~~~~~~~~~~~
154
170
@@ -282,7 +298,7 @@ The Python ``requests`` library allows us to send HTTP requests to the Wazuh Ind
282
298
from requests.auth import HTTPBasicAuth
283
299
284
300
# Base URL and endpoint
285
-
Wazuh_indexer_url="https://localhost:9200"
301
+
wazuh_indexer_url="https://localhost:9200"
286
302
endpoint ="/_cluster/health"
287
303
288
304
# Full URL
@@ -349,63 +365,71 @@ Using Bash
349
365
350
366
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.
Copy file name to clipboardExpand all lines: source/user-manual/indexer-api/index.rst
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,7 @@ Here is a list of some of the Wazuh indexer API capabilities:
22
22
- Configuration management
23
23
- Index lifecycle management
24
24
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.
0 commit comments