3.9 KiB
3.9 KiB
X-Pack Security SSL/TLS
The role allows configuring HTTP and transport layer SSL/TLS for the cluster. You will need to generate and provide your own PKCS12 or PEM encoded certificates as described in Encrypting communications in Elasticsearch.
By default this role will upload the certs to your elasticsearch servers. If you already copied the certs by your own way, set es_ssl_upload to false (default: true)
If you don't want this role to add autogenerated SSL configuration to elasticsearch.yml set es_enable_auto_ssl_configuration to false (default: true).
The following should be configured to ensure a security-enabled cluster successfully forms:
es_enable_http_sslDefaultfalse. Setting this totruewill enable HTTP client SSL/TLSes_enable_transport_ssl- Defaultfalse. Setting this totruewill enable transport layer SSL/TLS
When using a PKCS12 keystore and truststore:
es_ssl_keystorepath to your PKCS12 keystore (can be the same ases_ssl_truststore)es_ssl_keystore_passwordset this if your keystore is protected with a passwordes_ssl_truststorepath to your PKCS12 keystore (can be the same ases_ssl_keystore)es_ssl_truststore_passwordset this if your truststore is protected with a password
When using PEM encoded certificates:
es_ssl_keypath to your SSL keyes_ssl_key_passwordset this if your SSL key is protected with a passwordes_ssl_certificatethe path to your SSL certificate
Generating an SSL keystore
With a password:
$ bin/elasticsearch-certutil ca --out ./my-ca.p12 --pass "ca_password"
$ bin/elasticsearch-certutil cert --ca ./my-ca.p12 --ca-pass "ca_password" --out ./my-keystore.p12 --pass "keystore_password"
Without a password:
$ bin/elasticsearch-certutil ca --out ./my-ca.p12 --pass ""
$ bin/elasticsearch-certutil cert --ca ./my-ca.p12 --out ./my-keystore.p12 --pass ""
Additional optional SSL/TLS configuration
es_enable_auto_ssl_configurationDefaulttrue. Whether this role should add automatically generated SSL config to elasticsearch.yml.es_ssl_certificate_pathDefault{{ es_conf_dir }}/certs. The location where certificates should be stored on the ES node.es_ssl_verification_modeDefaultcertificate. See SSL verification_mode for options.es_ssl_certificate_authorityPEM encoded certificate file that should be trusted.es_validate_certsDefaultyes. Determines if ansible should validate SSL certificates when performing actions over HTTPS. e.g. installing templates and managing native users.
Example SSL/TLS configuration
- name: Elasticsearch with SSL/TLS enabled
hosts: localhost
roles:
- role: elastic.elasticsearch
vars:
es_config:
node.name: "node1"
cluster.name: "custom-cluster"
discovery.seed_hosts: "localhost:9301"
http.port: 9201
transport.port: 9301
node.data: false
node.master: true
bootstrap.memory_lock: true
xpack.security.authc.realms.file.file1.order: 0
xpack.security.authc.realms.native.native1.order: 1
es_heap_size: 1g
es_api_basic_auth_username: elastic
es_api_basic_auth_password: changeme
es_enable_http_ssl: true
es_enable_transport_ssl: true
es_ssl_keystore: "files/certs/my-keystore.p12"
es_ssl_truststore: "files/certs/my-truststore.p12"
es_ssl_keystore_password: "keystore_password"
es_ssl_truststore_password: "truststore_password"
es_validate_certs: no