opensearch-docs-cn/_security/configuration/demo-configuration.md

4.5 KiB

layout title parent nav_order
default Setting up a demo configuration Configuration 4

Setting up a demo configuration

Welcome to the OpenSearch Security plugin demo configuration setup guide. This tool provides a quick and easy way to replicate a production environment for testing purposes. The demo configuration includes the setup of security-related components, such as internal users, roles, role mappings, audit configuration, basic authentication, tenants, and allow lists.

The demo configuration tool performs the following tasks:

  1. Configures security settings, which are then loaded into the security index.
  2. Generates demo certificates.
  3. Adds security-related settings to the opensearch.yml file.

Installing the demo configuration

The demo configuration is automatically called as part of the setup for each supported distribution of OpenSearch. The following are instructions for each distribution.

Note: Starting with OpenSearch 2.12, a custom admin password is required in order to install the demo configuration. If none is provided, the cluster will fail to start. Note that this change only affects new clusters. Existing clusters are not affected because they already have opensearch.yml configured, so the installation tool will not run.

Docker

Use the following steps to set up the Security plugin using Docker:

  1. Download docker-compose.yml.
  2. In the docker-compose.yml file, set DISABLE_SECURITY_PLUGIN to false.
  3. Run the following command:
$ docker-compose up

Setting up a custom admin password

Note: For OpenSearch versions 2.12 and later, you must set the initial admin password before installation. To customize the admin password, you can take the following steps:

  1. Download the following sample docker-compose.yml file.
  2. Create a .env file.
  3. Add the variable OPENSEARCH_INITIAL_ADMIN_PASSWORD and set the variable with a strong string password.
  4. Run docker-compose up.

TAR (Linux)

For TAR distributions on Linux, download the Linux setup files from the OpenSearch Download & Get Started page. Then use the following command to run the demo configuration:

$ ./opensearch-tar-install.sh

For OpenSearch 2.12 or later, set a new custom admin password before installation by using the following command:

$ export OPENSEARCH_INITIAL_ADMIN_PASSWORD=<custom-admin-password>

Windows

For ZIP distributions on Windows, after downloading and extracting the setup files, run the following command:

> .\opensearch-windows-install.bat

For OpenSearch 2.12 or later, set a new custom admin password before installation by running the following command:

> set OPENSEARCH_INITIAL_ADMIN_PASSWORD=<custom-admin-password>

Helm

For Helm charts, the demo configuration is automatically installed during the OpenSearch installation. For OpenSearch 2.12 or later, customize the admin password in values.yaml under extraEnvs:

extraEnvs:
  - name: OPENSEARCH_INITIAL_ADMIN_PASSWORD
    value: <custom-admin-password>

RPM

For RPM packages, install OpenSearch and set up the demo configuration by running the following command:

$ sudo yum install opensearch-{{site.opensearch_version}}-linux-x64.rpm

For OpenSearch 2.12 or later, set a new custom admin password before installation by using the following command:

$ sudo env OPENSEARCH_INITIAL_ADMIN_PASSWORD=<custom-admin-password> yum install opensearch-{{site.opensearch_version}}-linux-x64.rpm

DEB

For DEB packages, install OpenSearch and set up the demo configuration by running the following command:

$ sudo dpkg -i opensearch-{{site.opensearch_version}}-linux-arm64.deb

For OpenSearch 2.12 or later, set a new custom admin password before installation by using the following command:

$ sudo env OPENSEARCH_INITIAL_ADMIN_PASSWORD=<custom-admin-password> dpkg -i opensearch-{{site.opensearch_version}}-linux-arm64.deb

Local distribution

If you are building a local distribution, refer to DEVELOPER_GUIDE.md for instructions on building a local binary for the Security plugin.

For OpenSearch 2.12 or later, make sure that you set a strong password before installation.