change how key is added

This commit is contained in:
m0duspwnens
2021-11-09 17:07:20 -05:00
parent 409ab623a5
commit 8a04fcd919
4 changed files with 16 additions and 2 deletions

View File

@@ -240,6 +240,7 @@
{% if KIBANA and grains.role in ['so-eval', 'so-manager', 'so-standalone', 'so-managersearch', 'so-import'] %} {% if KIBANA and grains.role in ['so-eval', 'so-manager', 'so-standalone', 'so-managersearch', 'so-import'] %}
{% do allowed_states.append('kibana') %} {% do allowed_states.append('kibana') %}
{% do allowed_states.append('kibana.secrets') %}
{% endif %} {% endif %}
{% if grains.role in ['so-eval', 'so-standalone', 'so-node', 'so-managersearch', 'so-heavynode', 'so-manager'] %} {% if grains.role in ['so-eval', 'so-standalone', 'so-node', 'so-managersearch', 'so-heavynode', 'so-manager'] %}

View File

@@ -6,4 +6,8 @@
{% do KIBANACONFIG.kibana.config.update({'xpack': {'security': {'authc': {'providers': {'anonymous': {'anonymous1': {'order': 0, 'credentials': 'elasticsearch_anonymous_user'}}}}}}}) %} {% do KIBANACONFIG.kibana.config.update({'xpack': {'security': {'authc': {'providers': {'anonymous': {'anonymous1': {'order': 0, 'credentials': 'elasticsearch_anonymous_user'}}}}}}}) %}
{% endif %} {% endif %}
{% if salt['file.file_exists']('/opt/so/saltstack/local/pillar/kibana/secrets.sls') %}
{% do KIBANACONFIG.kibana.config.update({'xpack': {'encryptedSavedObjects': {'encryptionKey': pillar['kibana']['secrets']['encryptedSavedObjects']['encryptionKey'] }}}) %}
{% endif %}
{% set KIBANACONFIG = salt['pillar.get']('kibana:config', default=KIBANACONFIG.kibana.config, merge=True) %} {% set KIBANACONFIG = salt['pillar.get']('kibana:config', default=KIBANACONFIG.kibana.config, merge=True) %}

View File

@@ -30,5 +30,3 @@ kibana:
xpack: xpack:
ml: ml:
enabled: False enabled: False
encryptedSavedObjects:
encryptionKey: {{ pillar['kibana']['secrets']['encryptedSavedObjects']['encryptionKey'] }}

View File

@@ -1,3 +1,6 @@
{% from 'allowed_states.map.jinja' import allowed_states %}
{% if sls in allowed_states %}
{% set kibana_encryptedSavedObjects_encryptionKey = salt['pillar.get']('kibana:secrets:encryptedSavedObjects:encryptionKey', salt['random.get_str'](72)) %} {% set kibana_encryptedSavedObjects_encryptionKey = salt['pillar.get']('kibana:secrets:encryptedSavedObjects:encryptionKey', salt['random.get_str'](72)) %}
kibana_pillar_directory: kibana_pillar_directory:
@@ -15,3 +18,11 @@ kibana_secrets_pillar:
encryptedSavedObjects: encryptedSavedObjects:
encryptionKey: {{ kibana_encryptedSavedObjects_encryptionKey }} encryptionKey: {{ kibana_encryptedSavedObjects_encryptionKey }}
- show_changes: False - show_changes: False
{% else %}
{{sls}}_state_not_allowed:
test.fail_without_changes:
- name: {{sls}}_state_not_allowed
{% endif %}