Skip to content

OpenSearch Secure Configuration

Secure configuration recommendations for OpenSearch 2.19.4 in HEAL.

6 min read Updated SS RS

Version: OpenSearch 2.x (2.18.0 in HEAL 2.3.4, 2.19.4 in HEAL 2.4.1)

Security in OpenSearch is provided by the OpenSearch Security plugin, which is installed by default with OpenSearch. The opensearch.yml settings on this page are static settings: restart OpenSearch (the OpenSearch service or container) on the node after changing them.

Enable the Security plugin#

Ensure that the Security plugin is enabled on each node in your cluster.

Risk/Impact#

Risk Rating: High

If the Security plugin is disabled, security features are disabled, and message authentication will not be performed, which may lead to malicious attacks.

Verification/Implementation steps#

In the opensearch.yml file, ensure that the plugins.security.disabled setting is either absent or set as below:

plugins.security.disabled: false

The Security plugin is enabled by default and is disabled only when plugins.security.disabled is set to true. If it is set to true, remove the setting (or set it to false) on every node and perform a full cluster restart. In container deployments, also ensure that the DISABLE_SECURITY_PLUGIN environment variable is not set to true on the OpenSearch container.

To confirm that the Security plugin is running, call its health endpoint (this endpoint does not require credentials):

curl --cacert /path/to/root-ca.pem https://<host>:<port>/_plugins/_security/health

A response with "status": "UP" confirms that the plugin is running.

Disable Anonymous Access Settings#

Incoming requests are anonymous if no credentials can be extracted from the incoming request. By default, the Security plugin rejects anonymous requests and returns an authentication error (status code 401).

Risk/Impact#

Risk Rating: Medium

The attacker's activities cannot be audited, and the cluster can be vulnerable.

Verification/Implementation steps#

1. Ensure that anonymous access is disabled.

2. In the Security plugin configuration file config.yml (in the opensearch-security configuration directory, for example config/opensearch-security/config.yml), ensure the setting is as below:

config:
  dynamic:
    http:
      anonymous_auth_enabled: false

3. Changes to config.yml are not applied automatically. securityadmin.sh requires HTTPS on the REST layer (plugins.security.ssl.http.enabled: true; see Setting up SSL/TLS on a cluster below). Load the file into the Security plugin configuration index with securityadmin.sh, run from the plugins/opensearch-security/tools directory with an admin certificate whose DN is listed in plugins.security.authcz.admin_dn in opensearch.yml:

./securityadmin.sh -f ../../../config/opensearch-security/config.yml -t config \
  -icl -nhnv \
  -cacert /path/to/root-ca.pem \
  -cert /path/to/admin.pem \
  -key /path/to/admin-key.pem

Note: securityadmin.sh overwrites the corresponding part of the security configuration index. Back up the current security configuration first with the -backup option, especially if settings were changed through the REST API or OpenSearch Dashboards.

4. Verify that a request without credentials is rejected with status code 401 (Unauthorized):

curl --cacert /path/to/root-ca.pem -i https://<host>:<port>/

You can also check the active configuration with GET _plugins/_security/api/securityconfig (as a user with access to the Security REST API) and confirm that anonymous_auth_enabled is false.

Enable GC Logging#

OpenSearch enables garbage collection (GC) logs by default. These are configured in jvm.options and output to the same default location as the OpenSearch logs. The GC log is an essential tool for revealing potential improvements to the heap and GC configuration or the object allocation pattern of the application.

Risk/Impact#

Risk Rating: High

In the absence of GC logging, it is difficult to detect and prevent incoming/anticipated attacks.

Verification/Implementation steps#

In jvm.options, ensure that the GC logging option is present and not commented out, for example (change the file= path and options to log to a custom location):

-Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m

In the default jvm.options, this option is prefixed with 9-:, which applies it to JDK 9 and later, including the JDK bundled with OpenSearch 2.x. The path logs/gc.log is relative to the OpenSearch home directory; RPM and DEB package installations use /var/log/opensearch/gc.log. Restart OpenSearch on the node after changing jvm.options.

Setting up SSL/TLS on a cluster#

Encrypt traffic to and from OpenSearch nodes using SSL/TLS to reduce risk from network-based attacks.

Risk/Impact#

Risk Rating: Medium

Attacks on the network could include sniffing of the data, manipulation of the data, and attempts to gain access to the server and thus the files storing the data.

Verification/Implementation steps#

Ensure appropriate SSL certificates are in place in order to encrypt traffic.

Follow the below mentioned steps on each node of the cluster.

1. Enable TLS on the transport and HTTP layers in opensearch.yml:

  • Transport layer (node-to-node communication): TLS is mandatory on the transport layer when the Security plugin is enabled. Configure the node certificate, its private key (PKCS #8), and the root CA certificate with plugins.security.ssl.transport.pemcert_filepath, plugins.security.ssl.transport.pemkey_filepath, and plugins.security.ssl.transport.pemtrustedcas_filepath.
  • HTTP (REST) layer: plugins.security.ssl.http.enabled: true (the default is false; when enabled, only HTTPS is allowed), with plugins.security.ssl.http.pemcert_filepath, plugins.security.ssl.http.pemkey_filepath, and plugins.security.ssl.http.pemtrustedcas_filepath.
  • plugins.security.ssl.transport.enabled_protocols and plugins.security.ssl.http.enabled_protocols

It is recommended to set TLS v1.2 and above protocol (TLSv1.2 and TLSv1.3). For example:

plugins.security.ssl.transport.pemcert_filepath: node.pem
plugins.security.ssl.transport.pemkey_filepath: node-key.pem
plugins.security.ssl.transport.pemtrustedcas_filepath: root-ca.pem
plugins.security.ssl.transport.enabled_protocols:
  - "TLSv1.2"
  - "TLSv1.3"
plugins.security.ssl.http.enabled: true
plugins.security.ssl.http.pemcert_filepath: node.pem
plugins.security.ssl.http.pemkey_filepath: node-key.pem
plugins.security.ssl.http.pemtrustedcas_filepath: root-ca.pem
plugins.security.ssl.http.enabled_protocols:
  - "TLSv1.2"
  - "TLSv1.3"

The certificate and key files must be located under the OpenSearch config directory and are specified as relative paths; the file names above are examples.

2. Restart OpenSearch on each node.

Enabling Cipher suites#

Data present in the nodes are to be encrypted. The SSL/TLS protocols use a cipher suite that determines the strength of encryption used to protect the data.

Risk/Impact#

Risk Rating: Medium

Man-in-the-middle attacks can have easy access to raw data if it is not encrypted.

Verification/Implementation steps#

Ensure the following points are considered:

  • The communication is secured with appropriate cipher suites.
  • To enable the ciphers, use the following settings in opensearch.yml: plugins.security.ssl.http.enabled_ciphers (HTTP/REST layer) and plugins.security.ssl.transport.enabled_ciphers (transport layer). Only Java-format cipher suite names are supported.
  • The strong cipher suites such as AES_256_GCM are configured.

For example:

plugins.security.ssl.http.enabled_ciphers:
  - "TLS_AES_256_GCM_SHA384"
  - "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384"
  - "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384"
plugins.security.ssl.transport.enabled_ciphers:
  - "TLS_AES_256_GCM_SHA384"
  - "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384"
  - "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384"

TLS_AES_256_GCM_SHA384 is the suite used with TLSv1.3; the two TLS_ECDHE suites are used with TLSv1.2 (RSA or ECDSA certificates). If these settings are not configured, the cipher suite is negotiated automatically, which in some cases can lead to a weaker cipher suite being used.

Note: Restart OpenSearch on each node after changing these settings. Make sure that every client that connects to OpenSearch supports at least one of the configured cipher suites.

File descriptors limit#

Set the file descriptor limit, as OpenSearch uses a lot of file descriptors or file handles.

Risk/Impact#

Risk Rating: Medium

Running out of file descriptors can be disastrous and will most probably lead to data loss.

Verification/Implementation steps#

1. For the .tar.gz package, set ulimit -n 65535 as root before starting OpenSearch:

ulimit -n 65535

or set nofile to 65535 in /etc/security/limits.conf for the user that runs OpenSearch (for example, opensearch):

opensearch  soft  nofile  65535
opensearch  hard  nofile  65535

Note: If OpenSearch runs as a systemd service, set the limit with LimitNOFILE=65535 in the service unit. In container deployments, set the limit on the OpenSearch container itself (for example, the nofile entry under ulimits in docker-compose.yml) rather than in limits.conf on the host.

Also verify or check the max_file_descriptors configuration (at each node) using the Nodes stats API, with:

GET _nodes/stats/process?filter_path=**.max_file_descriptors

Each node should report a value of 65535 or higher.

Upgrade OpenSearch#

Security patches protect against the latest vulnerabilities. They are released whenever a vulnerability is detected and needs to be installed.

Risk/Impact#

Risk Rating: Medium

Server can get affected by the latest vulnerabilities and may get compromised.

Verification/Implementation steps#

Download and install the latest supported version and the latest security patches released (the patches should be tested on a test server for dependencies before they are installed on Production servers). HEAL 2.3.4 ships OpenSearch 2.18.0, and HEAL 2.4.1 ships OpenSearch 2.19.4.

To check the installed version, send a GET / request to a node; the version.number field in the response shows the OpenSearch version.

Note: If the server is integrated with Patch Management Server such as BMC, then the control can be marked as not applicable.