It is possible to connect Optimize to an Elasticsearch instance or cluster which is secured by the Elasticsearch extension X-Pack. Bear in mind that X-Pack is an enterprise feature of Elasticsearch and might require to obtain a license before it can be used in a commercical context.
All the information about how to install X-Pack to secure Elasticsearch can be found at the Installing X-Pack in Elasticsearch guide. Please follow the steps 1 to 5.
Some comments on the guide:
- To secure Elasticsearch you should have added at least the following settings to the Elasticsearch configuration file
elasticsearch.ymlin the config folder of your Elasticsearch distribution (please adjust the values):
- If you want to use hostname verification within your cluster, run the
certutil certcommand once for each of your nodes and provide the –name, –dns and –ip options.
- If you used the –dns or –ip options with the certutil cert command and you want to enable strict hostname checking, set the verification mode to
full. Otherwise the verification mode needs to be set to
certificate. The respective Elasticsearch setting is called
xpack.security.transport.ssl.verification_modeand needs to be added to the
It is recommended to set up a user just for optimize, which has only the necessary rights to execute queries in Elasticsearch. For instance, you could add an
optimizeuser with the password
IloveOptimizeand give him the
superuserrights by executing the following command in the Elasticsearch root directory:
./bin/x-pack/users useradd optimize -p IloveOptimize -r superuser
Note: Although the
superuserrole does allow Optimize to communicate with the secured Elasticsearch instance, this role also grants full access to the cluster. A user with the superuser role can also manage users, roles and impersonate any other user in the system and might be a security risk for your system.
Enable Optimize to connect to the secured Elasticsearch instance
To connect to the secured Elasticsearch Optimize needs a dependency - the x-pack transport client library. Since this is part of the Elasticsearch commercial license, Optimize is unfortunately not able to ship this libary automatically with the artefact. Therefore, you need to add the library and its dependency manually. To do that, download the following jar files from the given pages and place them in the
plugin folder of the Optimize distribution:
Now that you have configured your Elasticsearch instance and added the necessary dependencies to Optimize, you need to setup the connection security settings accordingly to allow Optimize to connect to the secured Elasticsearch instance. All the necessary settings can be found in the configuration guide. Bear in mind that the verification mode in Elasticsearch and Optimize must have the same value.