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 commercial 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.
To enable TLS for Elasticsearch communication once X-Pack is installed please follow these instructions by elastic Encrypting Communications in Elasticsearch.
As Optimize v2.4.0+ communicates with Elasticsearch only via HTTP, the minimum encryption setup is that of the Encrypting HTTP Client Communications. However if you operate an elasticsearch cluster, it is recommended to encrypt the transport layer as well, see Encrypting Communications Between Nodes in a Cluster.
Some comments on the guide:
- To secure Elasticsearch HTTP communication 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):
xpack.security.http.ssl.enabled: true xpack.security.http.key: path/to/server.key xpack.security.http.certificate: path/to/server.crt xpack.security.http.certificate_authorities: path/to/ca.crt
- 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. See Setting Up User Authentication for further details.
Enable Optimize to connect to the secured HTTP Elasticsearch instance
Now that you have configured your Elasticsearch instance, you need to setup the connection security settings accordingly to allow Optimize to connect to the secured Elasticsearch instance via HTTPS.
All the necessary Optimize settings can be found in the configuration guide.