wwwgmo/docker/elasticsearch/create_kibana_user.sh
2025-06-29 20:55:30 +02:00

23 lines
710 B
Bash

!/bin/bash
# create a user on es to allow kibana to connect to es
# from es 8 kibana cannot connect with elastic user.
# elastic user can be use to login form kibana UI
# Wait for elasticsearch to start
echo "--- waiting for elasticsearch to start..."
until curl -u elastic:${ELASTIC_PASSWORD} -s http://localhost:9200 >/dev/null; do
sleep 2
done
echo "--- elasticsearch is ready. Creating the Kibana user..."
# create a user for Kibana
curl -X POST http://localhost:9200/_security/user/kibana_system_user \
-u elastic:${ELASTIC_PASSWORD} \
-H "Content-Type: application/json" \
-d '{
"password" : "kibanapassword",
"roles" : [ "kibana_system" ],
"full_name" : "Kibana System User"
}'