forked from elastic/stack-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup-users.sh
More file actions
executable file
·36 lines (31 loc) · 1 KB
/
setup-users.sh
File metadata and controls
executable file
·36 lines (31 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
set -euo pipefail
cacert=/config/elasticsearch/ca/ca.crt
# Wait for ca file to exist before we continue. If the ca file doesn't exist
# then something went wrong.
while [ ! -f $cacert ]
do
sleep 2
done
ls -l $cacert
es_url=https://elastic:${ELASTIC_PASSWORD}@elasticsearch:9200
# Wait for Elasticsearch to start up before doing anything.
until curl -s --cacert $cacert $es_url -o /dev/null; do
sleep 1
done
# Set the password for the kibana user.
# REF: https://www.elastic.co/guide/en/x-pack/6.0/setting-up-authentication.html#set-built-in-user-passwords
until curl --cacert $cacert -s -H 'Content-Type:application/json' \
-XPUT $es_url/_xpack/security/user/kibana/_password \
-d "{\"password\": \"${ELASTIC_PASSWORD}\"}"
do
sleep 2
echo Retrying...
done
until curl --cacert $cacert -s -H 'Content-Type:application/json' \
-XPUT $es_url/_xpack/security/user/logstash_system/_password \
-d "{\"password\": \"${ELASTIC_PASSWORD}\"}"
do
sleep 2
echo Retrying...
done