Merge pull request #511 from Security-Onion-Solutions/fix/kibana_load

update Kibana config
This commit is contained in:
weslambert
2020-04-02 21:00:45 -04:00
committed by GitHub
3 changed files with 594 additions and 588 deletions

View File

@@ -1,18 +1,18 @@
{%- set MASTER = salt['pillar.get']('static:masterip', '') %}
#!/bin/bash #!/bin/bash
KIBANA_VERSION="7.6.1" KIBANA_VERSION="7.6.1"
MAX_WAIT=60 MAX_WAIT=60
# Check to see if Kibana is available # Check to see if Kibana is available
wait_step=0 until curl "{{ MASTER }}:5601/nonexistenturl" 2>&1 |grep -q "Not Found" ; do
until curl -s -XGET http://localhost:5601 > /dev/null ; do wait_step=$(( ${wait_step} + 1 ))
wait_step=$(( ${wait_step} + 1 )) echo "Waiting on Kibana ({{ MASTER }}:5601)...Attempt #$wait_step"
echo "Waiting on Kibana...Attempt #$wait_step"
if [ ${wait_step} -gt ${MAX_WAIT} ]; then if [ ${wait_step} -gt ${MAX_WAIT} ]; then
echo "ERROR: Kibana not available for more than ${MAX_WAIT} seconds." echo "ERROR: Kibana not available for more than ${MAX_WAIT} seconds."
exit 5 exit 5
fi fi
sleep 1s; sleep 1s;
done done
# Sleep additional JIC server is not ready # Sleep additional JIC server is not ready
sleep 30s sleep 30s
@@ -30,5 +30,10 @@ curl -X PUT "localhost:5601/api/saved_objects/config/$KIBANA_VERSION" -H 'kbn-xs
} }
}' }'
# Sub our IP for placholders
for i in FLEETPLACEHOLDER PCAPPLACEHOLDER SOCTOPUSPLACEHOLDER; do
sed -i "s/$i/{{ MASTER }}/" /opt/so/saltstack/salt/kibana/saved_objects.ndjson
done
# Load saved objects # 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 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

@@ -84,6 +84,7 @@ so-kibana-config-load:
- shell: /bin/bash - shell: /bin/bash
- runas: socore - runas: socore
- source: salt://kibana/bin/so-kibana-config-load - source: salt://kibana/bin/so-kibana-config-load
- template: jinja
# Keep the setting correct # Keep the setting correct
#KibanaHappy: #KibanaHappy:

File diff suppressed because one or more lines are too long