mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-06 09:12:45 +01:00
fix var, quote vars
This commit is contained in:
@@ -2,24 +2,29 @@
|
|||||||
# {%- set MANAGER = salt['pillar.get']('global:url_base', '') %}
|
# {%- set MANAGER = salt['pillar.get']('global:url_base', '') %}
|
||||||
|
|
||||||
. /usr/sbin/so-common
|
. /usr/sbin/so-common
|
||||||
if $1; then
|
if [ ! -z "$1" ]; then
|
||||||
ndjson_template_file=$1
|
ndjson_template_file=$1
|
||||||
else
|
else
|
||||||
ndjson_template_file='/opt/so/conf/kibana/saved_objects.ndjson.template'
|
ndjson_template_file='/opt/so/conf/kibana/saved_objects.ndjson.template'
|
||||||
fi
|
fi
|
||||||
ndjson_file=$(echo $ndjson_template | sed -e "s/\.template$//")
|
|
||||||
# Copy template file
|
|
||||||
#cp /opt/so/conf/kibana/saved_objects.ndjson.template /opt/so/conf/kibana/saved_objects.ndjson
|
|
||||||
cp $ndjson_template $ndjson_file
|
|
||||||
|
|
||||||
# SOCtopus and Manager
|
if [ -f "$ndjson_template_file" ]; then
|
||||||
if grep -lq 'PLACEHOLDER' $ndjson_file; then
|
ndjson_file=$(echo $ndjson_template_file | sed -e "s/\.template$//")
|
||||||
sed -i "s/PLACEHOLDER/{{ MANAGER }}/g" $ndjson_file
|
# Copy template file
|
||||||
|
#cp /opt/so/conf/kibana/saved_objects.ndjson.template /opt/so/conf/kibana/saved_objects.ndjson
|
||||||
|
cp "$ndjson_template_file" "$ndjson_file"
|
||||||
|
|
||||||
|
# SOCtopus and Manager
|
||||||
|
if grep -lq 'PLACEHOLDER' "$ndjson_file"; then
|
||||||
|
sed -i "s/PLACEHOLDER/{{ MANAGER }}/g" "$ndjson_file"
|
||||||
|
fi
|
||||||
|
|
||||||
|
wait_for_web_response "http://localhost:5601/app/kibana" "Elastic" 300 "{{ ELASTICCURL }}"
|
||||||
|
|
||||||
|
SESSIONCOOKIE=$({{ ELASTICCURL }} -c - -X GET http://localhost:5601/ | grep sid | awk '{print $7}')
|
||||||
|
|
||||||
|
# Load saved objects
|
||||||
|
{{ ELASTICCURL }} -b "sid=$SESSIONCOOKIE" -L -X POST "localhost:5601/api/saved_objects/_import?overwrite=true" -H "kbn-xsrf: true" --form file=@"$ndjson_file" >> /opt/so/log/kibana/misc.log
|
||||||
|
else
|
||||||
|
echo "File $ndjson_template_file does not exist."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
wait_for_web_response "http://localhost:5601/app/kibana" "Elastic" 300 "{{ ELASTICCURL }}"
|
|
||||||
|
|
||||||
SESSIONCOOKIE=$({{ ELASTICCURL }} -c - -X GET http://localhost:5601/ | grep sid | awk '{print $7}')
|
|
||||||
|
|
||||||
# Load saved objects
|
|
||||||
{{ ELASTICCURL }} -b "sid=$SESSIONCOOKIE" -L -X POST "localhost:5601/api/saved_objects/_import?overwrite=true" -H "kbn-xsrf: true" --form file=@$ndjson_file >> /opt/so/log/kibana/misc.log
|
|
||||||
|
|||||||
Reference in New Issue
Block a user