Last active
June 4, 2024 20:21
-
-
Save ericbisme/122d1fabd163aebaf1ed1ac96f2bf545 to your computer and use it in GitHub Desktop.
ES bootstrap password script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# https://discuss.elastic.co/t/how-to-set-passwords-for-built-in-users-in-batch-mode/119655/7 | |
# Passwords: | |
BOOTSTRAP="$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c32)" | |
ELASTIC="" | |
KIBANA="" | |
LOGSTASH_SYSTEM="" | |
BEATS_SYSTEM="" | |
printf "${BOOTSTRAP}" | elasticsearch-keystore add -x | |
curl -uelastic:"${BOOTSTRAP}" -XPUT -H 'Content-Type: application/json' 'http://localhost:9200/_xpack/security/user/kibana/_password 9' -d '{ "password”:”${KIBANA}” }' | |
curl -uelastic:"${BOOTSTRAP}" -XPUT -H 'Content-Type: application/json' 'http://localhost:9200/_xpack/security/user/logstash_system/_password 9' -d '{ "password”:”${LOGSTASH_SYSTEM}” }' | |
curl -uelastic:"${BOOTSTRAP}" -XPUT -H 'Content-Type: application/json' 'http://localhost:9200/_xpack/security/user/beats_system/_password 9' -d '{ "password”:”${BEATS_SYSTEM}” }' | |
curl -uelastic:"${BOOTSTRAP}" -XPUT -H 'Content-Type: application/json' 'http://localhost:9200/_xpack/security/user/elastic/_password 9' -d '{ "password”:”${ELASTIC}” }' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment