Update all configs to pass user/pass to ES

This commit is contained in:
Jason Ertel
2021-06-02 12:17:15 -04:00
parent 4ff85ab0c4
commit 20e896cacf
19 changed files with 80 additions and 11 deletions

View File

@@ -3,6 +3,8 @@
{% elif grains['role'] in ['so-eval', 'so-managersearch', 'so-standalone'] %} {% elif grains['role'] in ['so-eval', 'so-managersearch', 'so-standalone'] %}
{%- set elasticsearch = salt['pillar.get']('manager:mainip', '') -%} {%- set elasticsearch = salt['pillar.get']('manager:mainip', '') -%}
{%- endif %} {%- endif %}
{%- set ES_USER = salt['pillar.get']('elasticsearch:auth:users:so_elastic_user:user', '') %})
{%- set ES_PASS = salt['pillar.get']('elasticsearch:auth:users:so_elastic_user:pass', '') %})
--- ---
# Remember, leave a key empty if there is no value. None will be a string, # Remember, leave a key empty if there is no value. None will be a string,
@@ -11,6 +13,8 @@ client:
hosts: hosts:
- {{elasticsearch}} - {{elasticsearch}}
port: 9200 port: 9200
username: {{ ES_USER }}
password: {{ ES_PASS }}
url_prefix: url_prefix:
use_ssl: True use_ssl: True
certificate: certificate:

View File

@@ -1,3 +1,5 @@
{%- set ES_USER = salt['pillar.get']('elasticsearch:auth:users:so_elastic_user:user', '') %})
{%- set ES_PASS = salt['pillar.get']('elasticsearch:auth:users:so_elastic_user:pass', '') %})
elastalert: elastalert:
config: config:
rules_folder: /opt/elastalert/rules/ rules_folder: /opt/elastalert/rules/
@@ -19,8 +21,8 @@ elastalert:
use_ssl: true use_ssl: true
verify_certs: false verify_certs: false
#es_send_get_body_as: GET #es_send_get_body_as: GET
#es_username: someusername es_username: {{ ES_USER }}
#es_password: somepassword es_password: {{ ES_PASS }}
writeback_index: elastalert_status writeback_index: elastalert_status
alert_time_limit: alert_time_limit:
days: 2 days: 2

View File

@@ -3,6 +3,8 @@
{%- else %} {%- else %}
{%- set MANAGER = salt['grains.get']('master') %} {%- set MANAGER = salt['grains.get']('master') %}
{%- endif %} {%- endif %}
{%- set ES_USER = salt['pillar.get']('elasticsearch:auth:users:so_beats_user:user', '') %})
{%- set ES_PASS = salt['pillar.get']('elasticsearch:auth:users:so_beats_user:pass', '') %})
{%- set HOSTNAME = salt['grains.get']('host', '') %} {%- set HOSTNAME = salt['grains.get']('host', '') %}
@@ -261,6 +263,8 @@ output.{{ type }}:
output.elasticsearch: output.elasticsearch:
enabled: true enabled: true
hosts: ["https://{{ MANAGER }}:9200"] hosts: ["https://{{ MANAGER }}:9200"]
username: "{{ ES_USER }}"
password: "{{ ES_PASS }}"
ssl.certificate_authorities: ["/usr/share/filebeat/intraca.crt"] ssl.certificate_authorities: ["/usr/share/filebeat/intraca.crt"]
pipelines: pipelines:
- pipeline: "%{[module]}.%{[dataset]}" - pipeline: "%{[module]}.%{[dataset]}"

View File

@@ -1,14 +1,16 @@
--- ---
# Default Kibana configuration from kibana-docker. # Default Kibana configuration from kibana-docker.
{%- set ES = salt['pillar.get']('manager:mainip', '') -%} {%- set ES = salt['pillar.get']('manager:mainip', '') -%}
{%- set ES_USER = salt['pillar.get']('elasticsearch:auth:users:so_kibana_user:user', '') %})
{%- set ES_PASS = salt['pillar.get']('elasticsearch:auth:users:so_kibana_user:pass', '') %})
server.name: kibana server.name: kibana
server.host: "0" server.host: "0"
server.basePath: /kibana server.basePath: /kibana
elasticsearch.hosts: [ "https://{{ ES }}:9200" ] elasticsearch.hosts: [ "https://{{ ES }}:9200" ]
elasticsearch.ssl.verificationMode: none elasticsearch.ssl.verificationMode: none
#kibana.index: ".kibana" #kibana.index: ".kibana"
#elasticsearch.username: elastic elasticsearch.username: {{ ES_USER }}
#elasticsearch.password: changeme elasticsearch.password: {{ ES_PASS }}
#xpack.monitoring.ui.container.elasticsearch.enabled: true #xpack.monitoring.ui.container.elasticsearch.enabled: true
elasticsearch.requestTimeout: 90000 elasticsearch.requestTimeout: 90000
logging.dest: /var/log/kibana/kibana.log logging.dest: /var/log/kibana/kibana.log

View File

@@ -3,11 +3,15 @@
{%- else %} {%- else %}
{%- set ES = salt['pillar.get']('elasticsearch:mainip', '') -%} {%- set ES = salt['pillar.get']('elasticsearch:mainip', '') -%}
{%- endif %} {%- endif %}
{%- set ES_USER = salt['pillar.get']('elasticsearch:auth:users:so_logstash_user:user', '') %})
{%- set ES_PASS = salt['pillar.get']('elasticsearch:auth:users:so_logstash_user:pass', '') %})
output { output {
if [module] =~ "zeek" and "import" not in [tags] { if [module] =~ "zeek" and "import" not in [tags] {
elasticsearch { elasticsearch {
pipeline => "%{module}.%{dataset}" pipeline => "%{module}.%{dataset}"
hosts => "{{ ES }}" hosts => "{{ ES }}"
username => "{{ ES_USER }}"
password => "{{ ES_PASS }}"
index => "so-zeek" index => "so-zeek"
template_name => "so-zeek" template_name => "so-zeek"
template => "/templates/so-zeek-template.json" template => "/templates/so-zeek-template.json"

View File

@@ -3,11 +3,15 @@
{%- else %} {%- else %}
{%- set ES = salt['pillar.get']('elasticsearch:mainip', '') -%} {%- set ES = salt['pillar.get']('elasticsearch:mainip', '') -%}
{%- endif %} {%- endif %}
{%- set ES_USER = salt['pillar.get']('elasticsearch:auth:users:so_logstash_user:user', '') %})
{%- set ES_PASS = salt['pillar.get']('elasticsearch:auth:users:so_logstash_user:pass', '') %})
output { output {
if "import" in [tags] { if "import" in [tags] {
elasticsearch { elasticsearch {
pipeline => "%{module}.%{dataset}" pipeline => "%{module}.%{dataset}"
hosts => "{{ ES }}" hosts => "{{ ES }}"
username => "{{ ES_USER }}"
password => "{{ ES_PASS }}"
index => "so-import" index => "so-import"
template_name => "so-import" template_name => "so-import"
template => "/templates/so-import-template.json" template => "/templates/so-import-template.json"

View File

@@ -3,10 +3,14 @@
{%- else %} {%- else %}
{%- set ES = salt['pillar.get']('elasticsearch:mainip', '') -%} {%- set ES = salt['pillar.get']('elasticsearch:mainip', '') -%}
{%- endif %} {%- endif %}
{%- set ES_USER = salt['pillar.get']('elasticsearch:auth:users:so_logstash_user:user', '') %})
{%- set ES_PASS = salt['pillar.get']('elasticsearch:auth:users:so_logstash_user:pass', '') %})
output { output {
if [event_type] == "sflow" { if [event_type] == "sflow" {
elasticsearch { elasticsearch {
hosts => "{{ ES }}" hosts => "{{ ES }}"
username => "{{ ES_USER }}"
password => "{{ ES_PASS }}"
index => "so-flow" index => "so-flow"
template_name => "so-flow" template_name => "so-flow"
template => "/templates/so-flow-template.json" template => "/templates/so-flow-template.json"

View File

@@ -3,10 +3,14 @@
{%- else %} {%- else %}
{%- set ES = salt['pillar.get']('elasticsearch:mainip', '') -%} {%- set ES = salt['pillar.get']('elasticsearch:mainip', '') -%}
{%- endif %} {%- endif %}
{%- set ES_USER = salt['pillar.get']('elasticsearch:auth:users:so_logstash_user:user', '') %})
{%- set ES_PASS = salt['pillar.get']('elasticsearch:auth:users:so_logstash_user:pass', '') %})
output { output {
if [event_type] == "ids" and "import" not in [tags] { if [event_type] == "ids" and "import" not in [tags] {
elasticsearch { elasticsearch {
hosts => "{{ ES }}" hosts => "{{ ES }}"
username => "{{ ES_USER }}"
password => "{{ ES_PASS }}"
index => "so-ids" index => "so-ids"
template_name => "so-ids" template_name => "so-ids"
template => "/templates/so-ids-template.json" template => "/templates/so-ids-template.json"

View File

@@ -3,11 +3,15 @@
{%- else %} {%- else %}
{%- set ES = salt['pillar.get']('elasticsearch:mainip', '') -%} {%- set ES = salt['pillar.get']('elasticsearch:mainip', '') -%}
{%- endif %} {%- endif %}
{%- set ES_USER = salt['pillar.get']('elasticsearch:auth:users:so_logstash_user:user', '') %})
{%- set ES_PASS = salt['pillar.get']('elasticsearch:auth:users:so_logstash_user:pass', '') %})
output { output {
if [module] =~ "syslog" { if [module] =~ "syslog" {
elasticsearch { elasticsearch {
pipeline => "%{module}" pipeline => "%{module}"
hosts => "{{ ES }}" hosts => "{{ ES }}"
username => "{{ ES_USER }}"
password => "{{ ES_PASS }}"
index => "so-syslog" index => "so-syslog"
template_name => "so-syslog" template_name => "so-syslog"
template => "/templates/so-syslog-template.json" template => "/templates/so-syslog-template.json"

View File

@@ -3,11 +3,15 @@
{%- else %} {%- else %}
{%- set ES = salt['pillar.get']('elasticsearch:mainip', '') -%} {%- set ES = salt['pillar.get']('elasticsearch:mainip', '') -%}
{%- endif %} {%- endif %}
{%- set ES_USER = salt['pillar.get']('elasticsearch:auth:users:so_logstash_user:user', '') %})
{%- set ES_PASS = salt['pillar.get']('elasticsearch:auth:users:so_logstash_pass:pass', '') %})
output { output {
if [module] =~ "osquery" and "live_query" not in [dataset] { if [module] =~ "osquery" and "live_query" not in [dataset] {
elasticsearch { elasticsearch {
pipeline => "%{module}.%{dataset}" pipeline => "%{module}.%{dataset}"
hosts => "{{ ES }}" hosts => "{{ ES }}"
username => "{{ ES_USER }}"
password => "{{ ES_PASS }}"
index => "so-osquery" index => "so-osquery"
template_name => "so-osquery" template_name => "so-osquery"
template => "/templates/so-osquery-template.json" template => "/templates/so-osquery-template.json"

View File

@@ -3,6 +3,8 @@
{%- else %} {%- else %}
{%- set ES = salt['pillar.get']('elasticsearch:mainip', '') -%} {%- set ES = salt['pillar.get']('elasticsearch:mainip', '') -%}
{%- endif %} {%- endif %}
{%- set ES_USER = salt['pillar.get']('elasticsearch:auth:users:so_logstash_user:user', '') %})
{%- set ES_PASS = salt['pillar.get']('elasticsearch:auth:users:so_logstash_user:pass', '') %})
{% set FEATURES = salt['pillar.get']('elastic:features', False) %} {% set FEATURES = salt['pillar.get']('elastic:features', False) %}
filter { filter {
@@ -30,6 +32,8 @@ output {
elasticsearch { elasticsearch {
pipeline => "osquery.live_query" pipeline => "osquery.live_query"
hosts => "{{ ES }}" hosts => "{{ ES }}"
username => "{{ ES_USER }}"
password => "{{ ES_PASS }}"
index => "so-osquery" index => "so-osquery"
template_name => "so-osquery" template_name => "so-osquery"
template => "/templates/so-osquery-template.json" template => "/templates/so-osquery-template.json"

View File

@@ -3,10 +3,14 @@
{%- else %} {%- else %}
{%- set ES = salt['pillar.get']('elasticsearch:mainip', '') -%} {%- set ES = salt['pillar.get']('elasticsearch:mainip', '') -%}
{%- endif %} {%- endif %}
{%- set ES_USER = salt['pillar.get']('elasticsearch:auth:users:so_logstash_user:user', '') %})
{%- set ES_PASS = salt['pillar.get']('elasticsearch:auth:users:so_logstash_user:pass', '') %})
output { output {
if [dataset] =~ "firewall" { if [dataset] =~ "firewall" {
elasticsearch { elasticsearch {
hosts => "{{ ES }}" hosts => "{{ ES }}"
username => "{{ ES_USER }}"
password => "{{ ES_PASS }}"
index => "so-firewall" index => "so-firewall"
template_name => "so-firewall" template_name => "so-firewall"
template => "/templates/so-firewall-template.json" template => "/templates/so-firewall-template.json"

View File

@@ -3,11 +3,15 @@
{%- else %} {%- else %}
{%- set ES = salt['pillar.get']('elasticsearch:mainip', '') -%} {%- set ES = salt['pillar.get']('elasticsearch:mainip', '') -%}
{%- endif %} {%- endif %}
{%- set ES_USER = salt['pillar.get']('elasticsearch:auth:users:so_logstash_user:user', '') %})
{%- set ES_PASS = salt['pillar.get']('elasticsearch:auth:users:so_logstash_user:pass', '') %})
output { output {
if [module] =~ "suricata" and "import" not in [tags] { if [module] =~ "suricata" and "import" not in [tags] {
elasticsearch { elasticsearch {
pipeline => "%{module}.%{dataset}" pipeline => "%{module}.%{dataset}"
hosts => "{{ ES }}" hosts => "{{ ES }}"
username => "{{ ES_USER }}"
password => "{{ ES_PASS }}"
index => "so-ids" index => "so-ids"
template_name => "so-ids" template_name => "so-ids"
template => "/templates/so-ids-template.json" template => "/templates/so-ids-template.json"

View File

@@ -3,11 +3,15 @@
{%- else %} {%- else %}
{%- set ES = salt['pillar.get']('elasticsearch:mainip', '') -%} {%- set ES = salt['pillar.get']('elasticsearch:mainip', '') -%}
{%- endif %} {%- endif %}
{%- set ES_USER = salt['pillar.get']('elasticsearch:auth:users:so_logstash_user:user', '') %})
{%- set ES_PASS = salt['pillar.get']('elasticsearch:auth:users:so_logstash_user:pass', '') %})
output { output {
if "beat-ext" in [tags] and "import" not in [tags] { if "beat-ext" in [tags] and "import" not in [tags] {
elasticsearch { elasticsearch {
pipeline => "beats.common" pipeline => "beats.common"
hosts => "{{ ES }}" hosts => "{{ ES }}"
username => "{{ ES_USER }}"
password => "{{ ES_PASS }}"
index => "so-beats" index => "so-beats"
template_name => "so-beats" template_name => "so-beats"
template => "/templates/so-beats-template.json" template => "/templates/so-beats-template.json"

View File

@@ -3,11 +3,15 @@
{%- else %} {%- else %}
{%- set ES = salt['pillar.get']('elasticsearch:mainip', '') -%} {%- set ES = salt['pillar.get']('elasticsearch:mainip', '') -%}
{%- endif %} {%- endif %}
{%- set ES_USER = salt['pillar.get']('elasticsearch:auth:users:so_logstash_user:user', '') %})
{%- set ES_PASS = salt['pillar.get']('elasticsearch:auth:users:so_logstash_user:pass', '') %})
output { output {
if [module] =~ "ossec" { if [module] =~ "ossec" {
elasticsearch { elasticsearch {
pipeline => "%{module}" pipeline => "%{module}"
hosts => "{{ ES }}" hosts => "{{ ES }}"
username => "{{ ES_USER }}"
password => "{{ ES_PASS }}"
index => "so-ossec" index => "so-ossec"
template_name => "so-ossec" template_name => "so-ossec"
template => "/templates/so-ossec-template.json" template => "/templates/so-ossec-template.json"

View File

@@ -3,11 +3,15 @@
{%- else %} {%- else %}
{%- set ES = salt['pillar.get']('elasticsearch:mainip', '') -%} {%- set ES = salt['pillar.get']('elasticsearch:mainip', '') -%}
{%- endif %} {%- endif %}
{%- set ES_USER = salt['pillar.get']('elasticsearch:auth:users:so_logstash_user:user', '') %})
{%- set ES_PASS = salt['pillar.get']('elasticsearch:auth:users:so_logstash_user:pass', '') %})
output { output {
if [module] =~ "strelka" { if [module] =~ "strelka" {
elasticsearch { elasticsearch {
pipeline => "%{module}.%{dataset}" pipeline => "%{module}.%{dataset}"
hosts => "{{ ES }}" hosts => "{{ ES }}"
username => "{{ ES_USER }}"
password => "{{ ES_PASS }}"
index => "so-strelka" index => "so-strelka"
template_name => "so-strelka" template_name => "so-strelka"
template => "/templates/so-strelka-template.json" template => "/templates/so-strelka-template.json"

View File

@@ -18,6 +18,8 @@
{%- import_json "soc/files/soc/menu.actions.json" as menu_actions %} {%- import_json "soc/files/soc/menu.actions.json" as menu_actions %}
{%- import_json "soc/files/soc/tools.json" as tools %} {%- import_json "soc/files/soc/tools.json" as tools %}
{%- set DNET = salt['pillar.get']('global:dockernet', '172.17.0.0') %} {%- set DNET = salt['pillar.get']('global:dockernet', '172.17.0.0') %}
{%- set ES_USER = salt['pillar.get']('elasticsearch:auth:users:so_elastic_user:user', '') %})
{%- set ES_PASS = salt['pillar.get']('elasticsearch:auth:users:so_elastic_user:pass', '') %})
{ {
"logFilename": "/opt/sensoroni/logs/sensoroni-server.log", "logFilename": "/opt/sensoroni/logs/sensoroni-server.log",
@@ -47,8 +49,8 @@
{%- endfor %} {%- endfor %}
], ],
{%- endif %} {%- endif %}
"username": "", "username": "{{ ES_USER }}",
"password": "", "password": "{{ ES_PASS }}",
"cacheMs": {{ ES_FIELDCAPS_CACHE }}, "cacheMs": {{ ES_FIELDCAPS_CACHE }},
"verifyCert": false, "verifyCert": false,
"timeoutMs": {{ API_TIMEOUT }} "timeoutMs": {{ API_TIMEOUT }}

View File

@@ -3,13 +3,14 @@
{%- set HIVEKEY = salt['pillar.get']('global:hivekey', '') %} {%- set HIVEKEY = salt['pillar.get']('global:hivekey', '') %}
{%- set CORTEXKEY = salt['pillar.get']('global:cortexorguserkey', '') %} {%- set CORTEXKEY = salt['pillar.get']('global:cortexorguserkey', '') %}
{%- set PLAYBOOK_KEY = salt['pillar.get']('playbook:api_key', '') %} {%- set PLAYBOOK_KEY = salt['pillar.get']('playbook:api_key', '') %}
{%- set ES_USER = salt['pillar.get']('elasticsearch:auth:users:so_elastic_user:user', '') %})
{%- set ES_PASS = salt['pillar.get']('elasticsearch:auth:users:so_elastic_user:pass', '') %})
[es] [es]
es_url = https://{{MANAGER}}:9200 es_url = https://{{MANAGER}}:9200
es_ip = {{MANAGER}} es_ip = {{MANAGER}}
es_user = es_user = {{ ES_USER }}
es_pass = es_pass = {{ ES_PASS }}
es_index_pattern = so-* es_index_pattern = so-*
es_verifycert = no es_verifycert = no

View File

@@ -14,6 +14,8 @@
# for numbers and booleans they should be plain (ie, $INT_VAR, $BOOL_VAR) # for numbers and booleans they should be plain (ie, $INT_VAR, $BOOL_VAR)
{%- set MANAGER = salt['grains.get']('master') %} {%- set MANAGER = salt['grains.get']('master') %}
{%- set ES_USER = salt['pillar.get']('elasticsearch:auth:users:so_elastic_user:user', '') %})
{%- set ES_PASS = salt['pillar.get']('elasticsearch:auth:users:so_elastic_user:pass', '') %})
{% set NODEIP = salt['pillar.get']('elasticsearch:mainip', '') %} {% set NODEIP = salt['pillar.get']('elasticsearch:mainip', '') %}
{% set HELIX_API_KEY = salt['pillar.get']('fireeye:helix:api_key', '') %} {% set HELIX_API_KEY = salt['pillar.get']('fireeye:helix:api_key', '') %}
{% set UNIQUEID = salt['pillar.get']('sensor:uniqueid', '') %} {% set UNIQUEID = salt['pillar.get']('sensor:uniqueid', '') %}
@@ -620,10 +622,14 @@
{% if grains['role'] in ['so-manager', 'so-eval', 'so-managersearch', 'so-standalone'] %} {% if grains['role'] in ['so-manager', 'so-eval', 'so-managersearch', 'so-standalone'] %}
[[inputs.elasticsearch]] [[inputs.elasticsearch]]
servers = ["https://{{ MANAGER }}:9200"] servers = ["https://{{ MANAGER }}:9200"]
username = "{{ ES_USER }}"
password = "{{ ES_PASS }}"
insecure_skip_verify = true insecure_skip_verify = true
{% elif grains['role'] in ['so-node', 'so-hotnode', 'so-warmnode', 'so-heavynode'] %} {% elif grains['role'] in ['so-node', 'so-hotnode', 'so-warmnode', 'so-heavynode'] %}
[[inputs.elasticsearch]] [[inputs.elasticsearch]]
servers = ["https://{{ NODEIP }}:9200"] servers = ["https://{{ NODEIP }}:9200"]
username = "{{ ES_USER }}"
password = "{{ ES_PASS }}"
insecure_skip_verify = true insecure_skip_verify = true
{% endif %} {% endif %}