Add custom bundles and plugins to your deployment

edit

Follow these steps to upload custom bundles and plugins to your Elasticsearch clusters, so that it uses your custom bundles or plugins.

  • Update your Elasticsearch cluster in the advanced configuration editor:
  • For bundles, modify the user_bundles JSON attribute.
  • For plugins, modify the user_plugins JSON attribute.

We’ve provided some examples, including LDAP bundles, SAML bundles, and adding a JVM trustore.

Add custom plugins to your deployment

edit

Custom plugins can include the official Elasticsearch plugins not provided with Elasticsearch Service, any of the community-sourced plugins, or plugins that you write yourself.

  1. Log into the Cloud UI.
  2. From the Deployments page, select your deployment.

    Narrow the list by name, ID, or choose from several other filters. To further define the list, use a combination of filters.

  3. From your deployment menu, select Edit then go to the bottom of the page and click advanced Elasticsearch configuration.
  4. Within the plan find the user_plugins section. If you don’t see it, you can add it within the Elasticsearch umbrella as shown in the examples below.

      "elasticsearch": {
        ...
        "enabled_built_in_plugins": [],
        "user_bundles": [
          {.....
              ....
          } ] ,
        "user_plugins": [
          {
            "url" : "<some static non_expirable url>", 
            "name" : "plugin_name",
            "elasticsearch_version" : "<es_version>" 
          },
          {
            "url": "http://192.168.100.10:8080/my-custom-plugin.zip",
            "name": "my-custom-plugin",
            "elasticsearch_version": "7.1.1"
          }
        ]
    }

    The URL for the plugin must be always available. Make sure you host the plugin artifacts internally in a highly available environment.

    The version must match exactly your Elasticsearch version, such as 6.4.2. Wildcards (*) are not allowed.

    If the plugin URL becomes unreachable, (the URL changes at remote end, or connectivity to the remote web server has issues) you might encounter boot loops.

  5. Save your changes.
  6. To verify that all nodes have the plugins installed, use one of these commands: GET /_nodes/plugins?filter_path=nodes.*.plugins or GET _cat/plugins?v

Example: Custom LDAP bundle

edit

This example adds a custom LDAP bundle for deployment level role-based access control (RBAC). To set platform level RBAC, see Configure RBAC.

  1. Prepare a custom bundle as a ZIP file that contains your keystore file with the private key and certificate inside of a truststore folder in the same way that you would on Elastic Cloud. This bundle allows all Elasticsearch containers to access the same keystore file through your ssl.truststore settings.
  2. Prepare your custom bundle ZIP file with a role mapping file stored in a mappings folder. The role mapping file should contain:

    admin:
      - "cn=administrators,ou=groups,dc=example,dc=com"
    readonly:
      - "cn=users,ou=groups,dc=example,dc=com"
  3. In the advanced configuration editor, update your new Elasticsearch cluster with the custom bundle you have just created. Modify the user_bundles JSON attribute as shown in the following example:

    {
      "cluster_name": "xxxxxxx",
      "plan": {
    
        ...
    
        "elasticsearch": {
          "version": "5.5.1",
          "user_bundles": [
            {
              "name": "ldap-cert",
              "url": "https://www.myurl.com/ldapcert.zip", 
              "elasticsearch_version": "5.5.1"
            },
            {
              "name": "role-mappings",
              "url": "https://www.myurl.com/role-mappings.zip",
              "elasticsearch_version": "5.5.1"
            }
          ]
        }
      }

    The URLs for the bundle ZIP files (ldapcert.zip and role-mappings.zip) must be always available. Make sure you host the plugin artifacts internally in a highly available environment.

    If the bundle URL becomes unreachable (such as the URL changing at remote end or connectivity to the remote web server having issues) you might encounter boot loops.

  4. Custom bundles are unzipped in /app/config/BUNDLE_DIRECTORY_STRUCTURE, where BUNDLE_DIRECTORY_STRUCTURE is the directory structure within the bundle ZIP file itself. These file locations are needed in the next step.

    $ tree .
    .
    └── truststore
          └── keystore.ks

    In this example, the unzipped keystore file gets placed under /app/config/truststore/keystore.ks and the unzipped role mappings file under /app/config/mappings/role-mappings.yml.

Example: Custom SAML bundle

edit

This example adds a custom SAML bundle for deployment level role-based access control (RBAC). To set platform level RBAC, see Configure RBAC.

  1. If your Identity Provider doesn’t publish its SAML metadata at an HTTP URL, or if your Elasticsearch cluster cannot reach that URL, you can upload the SAML metadata as a file.

    1. Prepare a ZIP file with a custom bundle that contains your Identity Provider’s metadata (metadata.xml) and store it in the saml folder.

      This bundle allows all Elasticsearch containers to access the metadata file.

    2. In the advanced configuration editor, update your Elasticsearch cluster configuration with the bundle you prepared in the previous step. Modify the user_bundles JSON attribute as shown in the following example:

      {
        "cluster_name": "REPLACE_WITH_YOUR_CLUSTER_NAME",
        "plan": {
      
          ...
      
          "elasticsearch": {
            "version": "6.4.1",
            "user_bundles": [
              {
                "name": "saml-metadata",
                "url": "https://www.MYURL.com/saml-metadata.zip", 
                "elasticsearch_version": "6.4.1"
              }
            ]
          }
        }

      The URL for the bundle ZIP file must be always available. Make sure you host the plugin artifacts internally in a highly available environment.

      If the bundle URL becomes unreachable (such as the URL changing at remote end or connectivity to the remote web server having issues) you might encounter boot loops.

      Custom bundles are unzipped in /app/config/BUNDLE_DIRECTORY_STRUCTURE, where BUNDLE_DIRECTORY_STRUCTURE is the directory structure within the ZIP file itself. These file locations are needed in the next step.

      In this example, the SAML metadata file is located in the path /app/config/saml/metadata.xml:

      $ tree .
      .
      └── saml
            └── metadata.xml
    3. Adjust your saml realm configuration accordingly:

          idp.metadata.path: /app/config/saml/metadata.xml 

      The path to the SAML metadata file that was uploaded

Example: Custom JVM trust store bundle

edit

This functionality is supported for Elasticsearch versions 6.x, starting with 6.8.2, and Elasticsearch 7.x, starting with 7.2.1

If you are using SSL certificates signed by non-public certificate authorities, Elasticsearch is not be able to communicate with the services using those certificates unless you import a custom JVM trust store containing the certificates of your signing authority into your Elastic Cloud Enterprise installation. You’ll need the trust store to access snapshot repositories like Minio, for your Elastic Cloud Enterprise proxy, or to reindex from remote.

To import a JVM trust store:

  1. Prepare the custom JVM trust store:

    1. Pull the certificate from the service you want to make accessible:

        openssl s_client -connect <server using the certificate> -showcerts , 

      The server address (name and port number) of the service that you want Elasticsearch to be able to access. This command prints the entire certificate chain to stdout. You can choose a certificate at any level to be added to the trust store.

    2. Save it to a file with as a PEM extension.
    3. Locate your JRE’s default trust store, and copy it to the current directory:

        cp <default trust store location> cacerts 

      Default JVM trust store is typically located in $JAVA_HOME/jre/libs/security/cacerts

      Default trust store contains certificates of many well known root authorities that are trusted by default. If you only want to include a limited list of CAs to trust, skip this step, and simply import specific certificates you want to trust into an empty store as shown next

    4. Use keytool command from your JRE to import certificate(s) into the keystore:

      $JAVA_HOME/bin/keytool -keystore cacerts -storepass changeit -noprompt -importcert -file <certificate>.pem -alias <some alias> 

      The file where you saved the certificate to import, and an alias you assign to it, that is descriptive of the origin of the certificate

      You should keep file name and password for the trust store as JVM defaults (cacerts and changeit respectively).

      You can have multiple certificates to the trust store, repeating the same command. There is only one trust store per cluster currently supported. You cannot, for example, add multiple bundles with different trust stores to the same cluster, they will not get merged. Add all certificates to be trusted to the same trust store

  2. Create the bundle:

     zip cacerts.zip cacerts 

    The name of the zip archive is not significant

    A bundle may contain other contents beyond the trust store if you prefer, but we recommend creating separate bundles for different purposes.

  3. In the advanced configuration editor, update your Elasticsearch cluster configuration with the bundle you prepared in the previous step. Modify the user_bundles JSON attribute as shown in the following example:

    {
      "cluster_name": "REPLACE_WITH_YOUR_CLUSTER_NAME",
      "plan": {
    
        ...
    
        "elasticsearch": {
          "version": "6.4.1",
          "user_bundles": [
            {
              "name": "custom-ca-certs",
              "url": "https://www.MYURL.com/cacerts.zip", 
              "elasticsearch_version": "*"
            }
          ]
        }
      }

    The URL for the bundle ZIP file must be always available. Make sure you host the plugin artefacts internally in a highly available environment.

    If the bundle URL becomes unreachable, (the URL changes at remote end, or connectivity to the remote web server has issues) you might encounter boot loops.