项目作者: flavienbwk

项目描述 :
An end-to-end fully secure Elasticsearch cluster with Kibana and run by Docker. Using official images.
高级语言:
项目地址: git://github.com/flavienbwk/Secure-Docker-Elastic-Cluster.git
创建时间: 2020-06-12T10:49:57Z
项目社区:https://github.com/flavienbwk/Secure-Docker-Elastic-Cluster

开源协议:MIT License

下载


Secure Docker Elastic cluster

An end-to-end fully secure Elasticsearch cluster (of 3 Elasticsearch instances) with Kibana and run by Docker. Using official images. Ever dreamed of the following ?

Kibana Elasticsearch cluster

First, you will need to raise your host’s ulimits for Elasticsearch to be able to handle high I/O :

  1. sudo sysctl -w vm.max_map_count=500000

Now, we will generate the certificates for your cluster :

  1. docker-compose -f create-certs.yml run --rm create_certs

That’s it ! Start the cluster with :

  1. docker-compose up -d

Access Kibana through https://localhost:5601

Default username is elastic and password is changeme

User management

User management can be performed both through the UI and from API calls. This chapter focuses on API call examples.

To create a new user ingest with password changeme :

  1. curl -k -X POST "https://localhost:9200/_security/user/ingest" -H "Content-Type: application/json" -u elastic:changeme -d '{
  2. "password" : "changeme",
  3. "full_name" : "Ingest User",
  4. "roles": [],
  5. "email" : "ingest@example.com",
  6. "metadata" : {
  7. "intelligence" : 7
  8. }
  9. }'

To update a password :

  1. docker exec -it secure-docker-elastic-cluster-es01-1 bin/elasticsearch-users passwd admin

Make it so ingest can write data in *metric* or *logs* indices :

  1. curl -k -X PUT "https://localhost:9200/_security/role/ingest-role" -H "Content-Type: application/json" -u elastic:changeme -d'
  2. {
  3. "cluster": ["manage_index_templates", "monitor", "manage_ilm"],
  4. "indices": [
  5. {
  6. "names": [ "*metric*", "*logs*" ],
  7. "privileges": ["read","write"]
  8. }
  9. ]
  10. }'
  11. curl -k -X PUT "https://localhost:9200/_security/user/ingest" -H "Content-Type: application/json" -u elastic:changeme -d '{
  12. "roles" : ["ingest-role"],
  13. "full_name" : "Ingest User",
  14. "email" : "ingest@example.com",
  15. "metadata" : {
  16. "intelligence" : 7
  17. }
  18. }'

Test authentication :

  1. curl -k -u ingest:changeme https://localhost:9200/_cluster/health