Merge pull request #453 from Security-Onion-Solutions/fix/kibana_config_load

Fix/kibana config load
This commit is contained in:
weslambert
2020-03-23 23:24:09 -04:00
committed by GitHub
2 changed files with 27 additions and 10 deletions

View File

@@ -1,6 +1,24 @@
#!/bin/bash
VERSION="7.6.1"
curl -X PUT "localhost:5601/api/saved_objects/config/$VERSION" -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d'
KIBANA_VERSION="7.6.1"
MAX_WAIT=60
# Check to see if Kibana is available
wait_step=0
until curl -s -XGET http://localhost:5601 > /dev/null ; do
wait_step=$(( ${wait_step} + 1 ))
echo "Waiting on Kibana...Attempt #$wait_step"
if [ ${wait_step} -gt ${MAX_WAIT} ]; then
echo "ERROR: Kibana not available for more than ${MAX_WAIT} seconds."
exit 5
fi
sleep 1s;
done
# Sleep additional JIC server is not ready
sleep 30s
# Load config
curl -X PUT "localhost:5601/api/saved_objects/config/$KIBANA_VERSION" -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d'
{ "attributes":
{
"defaultIndex": "2289a0c0-6970-11ea-a0cd-ffa0f6a1bc29",
@@ -12,6 +30,5 @@ curl -X PUT "localhost:5601/api/saved_objects/config/$VERSION" -H 'kbn-xsrf: tru
}
}'
curl -X POST "localhost:5601/api/saved_objects/_import" -H "kbn-xsrf: true" --form file=@/opt/so/saltstack/salt/kibana/etc/saved_objects.ndjson
# Load saved objects
curl -X POST "localhost:5601/api/saved_objects/_import" -H "kbn-xsrf: true" --form file=@/opt/so/saltstack/salt/kibana/saved_objects.ndjson

View File

@@ -79,11 +79,11 @@ so-kibana:
- port_bindings:
- 0.0.0.0:5601:5601
#o-kibana-config-load:
# cmd.script:
# - shell: /bin/bash
# - runas: socore
# - source: salt://kibana/bin/so-kibana-config-load
so-kibana-config-load:
cmd.script:
- shell: /bin/bash
- runas: socore
- source: salt://kibana/bin/so-kibana-config-load
# Keep the setting correct
#KibanaHappy: