1. TLS and certificates #
Encrypting everything.
Certificates #
bin/elasticsearch-certutil ca --pem --out ca.zip
bin/elasticsearch-certutil cert --pem --ca-cert ca/ca.crt --ca-key ca/ca.key --in instances.yml --out certs.zip# elasticsearch.yml
xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true
xpack.security.transport.ssl.verification_mode: certificate
xpack.security.transport.ssl.key: certs/es01/es01.key
xpack.security.transport.ssl.certificate: certs/es01/es01.crt
xpack.security.transport.ssl.certificate_authorities: certs/ca/ca.crt
xpack.security.http.ssl.enabled: true
xpack.security.http.ssl.key: certs/es01/es01.key
xpack.security.http.ssl.certificate: certs/es01/es01.crtGood practice: Track certificate expiry dates (GET _ssl/certificates) and renew them with a written, tested procedure: an expired transport certificate cuts the cluster off.2. API keys and fine-grained privileges #
Least privilege.
Examples #
POST _security/api_key
{ "name": "ingest-nginx", "expiration": "90d",
"role_descriptors": { "writer": { "indices": [ { "names": [ "logs-nginx-*" ], "privileges": [ "create_doc", "auto_configure" ] } ] } } }
PUT _security/role/support-eu
{ "indices": [ { "names": [ "orders-*" ],
"privileges": [ "read" ],
"field_security": { "grant": [ "*" ], "except": [ "customer.email", "card.*" ] },
"query": { "term": { "region": "eu" } } } ] }- One API key per application, with expiry and limited privileges; scheduled rotation (
POST _security/api_key/_invalidate). - Field-level security: hide fields; document-level security: restrict documents with a query.
- Audit:
xpack.security.audit.enabled: truelogs authentications, denials and role changes.
Good to know: Some features depend on the version and the license level (Basic, Platinum, Enterprise): check them in the documentation and on the Elastic subscriptions page before using them in production.
My progress
Sign in to track your progress and take notes. Sign in
💬 Recent discussions about this course
- Elasticsearch : supprimer automatiquement les logs de plus de 30 jours✓ solved · 1 reply(ies)
Ask a question about this lesson →See all discussions about this course
Course Glossary
RBAC (Role-Based Access Control)
An access control method where permissions are assigned to specific roles (e.g., admin, reader) rather than directly to individual users.
Authentication
The process of verifying the identity of a user or system (e.g., login/password, tokens, biometrics).
Authorization
The process that occurs after authentication to determine if the entity has the necessary rights and privileges to access a resource.
API Key
A unique alphanumeric code used to identify, authenticate, and authorize access to an Application Programming Interface (API).
Architecture
The overall structural design of an IT system, defining its various components, their relationships, and the principles guiding its evolution.
Repository
A centralized storage location. This can refer to a source code repository (e.g., Git) or an artifact and binary repository (e.g., Harbor, Nexus, Arti...
Elasticsearch
A distributed, RESTful search and analytics engine capable of addressing a growing number of use cases, built on Apache Lucene.
Recommended Articles
Advanced OpenSearch security: authentication, roles and audit
Securing OpenSearch in depth: transport and API TLS, internal, LDAP, OpenID Connect and SAML auth...
Advanced Elasticsearch Query DSL and aggregations, with ES|QL
Write advanced Elasticsearch queries: bool, filter and score, nested, function_score and BM25 rel...
Elasticsearch mappings and text analysis: field types, analyzers and dynamic mapping
Master Elasticsearch mappings: field types (text, keyword, numeric, date, ip, nested), multi-fiel...
Elasticsearch monitoring and troubleshooting: health, unassigned shards, JVM, hot threads and slow logs
Diagnose an Elasticsearch cluster: cluster health and CAT APIs, unassigned shards and allocation ...
Azure DevOps security, governance and best practices
Running Azure DevOps securely: permissions and groups, protected resources, pipeline authorizatio...
Grafana Loki vs Elasticsearch: the battle of log storage
A comparison between Loki, the Prometheus-inspired log system, and Elasticsearch, the reference f...
Elasticsearch best practices: mappings, shards, lifecycle and operations
Elasticsearch best practices: shard sizing, explicit mappings, templates, ILM, JVM memory, securi...
Elasticsearch ingestion: Bulk API, ingest pipelines, enrich and reindex
Ingest and transform data in Elasticsearch: Bulk API, ingest pipelines and processors (grok, diss...
Automation and infrastructure as code for Elasticsearch: API, Terraform, Ansible and CI/CD
Automate Elasticsearch administration: REST API and clients, the elasticstack Terraform provider ...