Skip to content

Instantly share code, notes, and snippets.

@urso
Created July 16, 2019 18:11
Show Gist options
  • Save urso/67ed8b68b4cbaaf2e3550212d5c0d3ca to your computer and use it in GitHub Desktop.
Save urso/67ed8b68b4cbaaf2e3550212d5c0d3ca to your computer and use it in GitHub Desktop.
ES+Beats roles testing
version: '2.2'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.2.1-SNAPSHOT
environment:
- "discovery.type=single-node"
- "ELASTIC_PASSWORD=elastic"
- xpack.license.self_generated.type=trial
- xpack.security.enabled=true
- xpack.ml.enabled=false
ports:
- 9200:9200
- 9300:9300
kibana:
image: docker.elastic.co/kibana/kibana:7.2.1-SNAPSHOT
ports:
- 5601:5601
environment:
- XPACK_SECURITY_ENABLED=true
- XPACK_ML_ENABLED=true
- ELASTICSEARCH_USERNAME=elastic
- ELASTICSEARCH_PASSWORD=elastic
setup.template.settings:
index.number_of_shards: 1
setup.ilm.enabled: false
output.elasticsearch:
hosts: ["localhost:9200"]
username: beats_index_writer
password: beats_index_writer
# Configure output with user having beats_indexer role only.
# This assume that users did run `<beatname> setup` before.
#
# Required cluster privileges: monitor
# Required index privileges: index, view_index_metadata
setup.template.enabled: false
setup.ilm:
enabled: true
check_exists: false
overwrite: false
output.elasticsearch:
hosts: ["localhost:9200"]
username: beats_indexer
password: beats_indexer
PUT _security/role/beats_setup
{
"cluster": [
"manage_index_templates",
"monitor",
"manage_ilm",
"manage_ml",
"manage_ingest_pipelines"
],
"indices": [
{
"names": ["filebeat-*"],
"privileges": ["create_index", "manage"]
}
],
"applications": [
{
"application" : "kibana-.kibana",
"privileges" : [
"all"
],
"resources" : [
"*"
]
}
]
}
PUT _security/role/beats_indexer
{
"cluster": ["monitor"],
"indices": [
{
"names": ["filebeat-*"],
"privileges": ["index", "view_index_metadata"]
}
]
}
PUT _security/role/beats_writer
{
"cluster": ["monitor", "read_ilm", "manage_index_templates"],
"indices": [
{
"names": ["filebeat-*"],
"privileges": ["index", "view_index_metadata"]
}
]
}
PUT _security/role/beats_index_writer
{
"cluster": ["monitor", "read_ilm", "manage_index_templates"],
"indices": [
{
"names": ["filebeat-*"],
"privileges": ["index", "create_index", "view_index_metadata"]
}
]
}
PUT _security/user/beats_setup
{
"username" : "beats_setup",
"password": "beats_setup",
"roles" : [
"beats_setup",
"kibana_user"
],
"full_name" : "Beats Setup User",
"email" : "",
"metadata" : { },
"enabled" : true
}
PUT _security/user/beats_indexer
{
"username" : "beats_indexer",
"password": "beats_indexer",
"roles" : [
"beats_indexer"
],
"full_name" : "Beats Indexer User",
"email" : "",
"metadata" : { },
"enabled" : true
}
PUT _security/user/beats_writer
{
"username" : "beats_writer",
"password": "beats_writer",
"roles" : [
"beats_writer"
],
"full_name" : "Beats Indexer User",
"email" : "",
"metadata" : { },
"enabled" : true
}
PUT _security/user/beats_index_writer
{
"username" : "beats_index_writer",
"password": "beats_index_writer",
"roles" : [
"beats_index_writer"
],
"full_name" : "Beats Indexer User",
"email" : "",
"metadata" : { },
"enabled" : true
}
PUT _security/user/beats_self_managed
{
"username": "beats_self_managed",
"password": "beats_self_managed",
"roles": ["beats_setup", "beats_indexer"],
"full_name": "Beats Self Managed Used (with ILM)",
"email" : "",
"metadata" : { },
"enabled" : true
}
setup.template.settings:
overwrite: false
index.number_of_shards: 1
setup.ilm.enabled: true
output.elasticsearch:
hosts: ["localhost:9200"]
username: beats_self_managed
password: beats_self_managed
setup.template.settings:
index.number_of_shards: 1
setup.kibana:
host: "localhost:5601"
output.elasticsearch:
hosts: ["localhost:9200"]
username: beats_setup
password: beats_setup
setup.template.settings:
index.number_of_shards: 1
setup.ilm.enabled: false
setup.kibana:
host: "localhost:5601"
setup.dashboards.directory: './build'
output.elasticsearch:
hosts: ["localhost:9200"]
username: beats_setup
password: beats_setup
filebeat.inputs:
- type: log
paths:
- nasa.log
setup.template.settings:
overwrite: false
index.number_of_shards: 1
setup.ilm.enabled: true
output.elasticsearch:
hosts: ["localhost:9200"]
username: beats_writer
password: beats_writer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment