Skip to content
Snippets Groups Projects
Commit 14e002f0 authored by Václav Bartoš's avatar Václav Bartoš
Browse files

new configuration for OpenSearch Dashboards + fix of update-config role

- New config:
-- migration and renaming of Kibana->OSDasboards
-- removal of TheHiveButton plugin (not compatible with OSD, needs to be updated)
- Ansible role update-config fixed.
- The script to convert exported objects to a template updated.
parent d1559b4f
No related branches found
No related tags found
1 merge request!5Migrate from ODFE to OpenSearch
......@@ -42,8 +42,7 @@
- "{{playbook_dir}}/secrets/CA/ca.crt"
- "{{playbook_dir}}/secrets/CA/private/{{soctools_users[0].CN}}.p12"
- name: Get openid authkey
remote_user: dashboards
- name: Get authkey
set_fact:
kibanasecret: "{{lookup('file', '{{playbook_dir}}/secrets/tokens/kibanasecret',convert_data=False) | from_json }}"
......
---
- name: Get authkey
set_fact:
kibanasecret: "{{lookup('file', '{{playbook_dir}}/secrets/tokens/kibanasecret',convert_data=False) | from_json }}"
- name: Configure Opensearch Dashboards properties
remote_user: dashboards
template:
......@@ -16,10 +20,17 @@
owner: dashboards
group: dashboards
- name: Copy opensearch-dashboards_graphs.ndjson to container
remote_user: dashboards
template:
src: "opensearch-dashboards_graphs.ndjson.j2"
dest: /tmp/opensearch-dashboards_graphs.ndjson
- name: Import graphs to Opensearch Dashboards
remote_user: dashboards
shell: 'curl -X "POST" "https://{{soctoolsproxy}}:5601/api/saved_objects/_import?overwrite=true" \
-b /tmp/cookie.txt -c /tmp/cookie.txt \
-k --user admin:{{lookup("password", "{{playbook_dir}}/secrets/passwords/opensearches_adminpass")}} \
-H "osd-xsrf: reporting" -H "Content-Type: multipart/form-data" \
-F "file=@/tmp/opensearch-dashboards_graphs.ndjson"'
ignore_errors: True
Source diff could not be displayed: it is too large. Options to address this: view the blob.
#!/usr/bin/env python
# Get exported objects from OpenSearch dashobards (menu - Stack management - Saved objects - Export all)
# and convert them to a template to be put into:
# roles/opensearch-dashboards/templates/opensearch-dashboards_graphs.ndjson.j2
import argparse,re
parser = argparse.ArgumentParser()
parser.add_argument("graphsfile", help="input kibana_graphs.ndjson file")
parser.add_argument("graphsfile", help="input *.ndjson file")
parser.add_argument("templatefile", help="output template file")
args = parser.parse_args()
......@@ -11,8 +14,8 @@ r=open(args.graphsfile,"r")
w=open(args.templatefile,"w")
for line in r:
line=re.sub(r'(^.*thehive_button.*url\\":[^"].")[^\\"]*(.*apikey\\":[^"]*")[^\\"]*(.*owner\\":[^"]*")[^\\"]*(.*$)',"\g<1>https://{{soctoolsproxy}}:9000\g<2>{{lookup('file', '{{playbook_dir}}/secrets/tokens/thehive_kibana_secret_key')}}\g<3>{{THEHIVE_KIBANA_USER.username}}\g<4>",line)
line=re.sub(r"(^.*)https:\/\/[^\/]*(.*destination\.ip_misp\.keyword.*$)","\g<1>{{misp_url}}\g<2>",line)
#line=re.sub(r'(^.*thehive_button.*url\\":[^"].")[^\\"]*(.*apikey\\":[^"]*")[^\\"]*(.*owner\\":[^"]*")[^\\"]*(.*$)',"\g<1>https://{{soctoolsproxy}}:9000\g<2>{{lookup('file', '{{playbook_dir}}/secrets/tokens/thehive_kibana_secret_key')}}\g<3>{{THEHIVE_KIBANA_USER.username}}\g<4>",line)
line=re.sub(r"https://[^:]*:","https://{{soctoolsproxy}}:",line)
w.write(line)
r.close()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment