I have created Elasticsearch built-in users password with:
bin/elasticsearch-setup-passwords interactive
I set for every user password asdfasdf
. All successfuly:
Initiating the setup of passwords for reserved users elastic,apm_system,kibana,kibana_system,logstash_system,beats_system,remote_monitoring_user.
You will be prompted to enter passwords as the process progresses.
Please confirm that you would like to continue [y/N]y
Enter password for [elastic]:
Reenter password for [elastic]:
Enter password for [apm_system]:
Reenter password for [apm_system]:
Enter password for [kibana_system]:
Reenter password for [kibana_system]:
Enter password for [logstash_system]:
Reenter password for [logstash_system]:
Enter password for [beats_system]:
Reenter password for [beats_system]:
Enter password for [remote_monitoring_user]:
Reenter password for [remote_monitoring_user]:
asdfasdfChanged password for user [apm_system]
Changed password for user [kibana_system]
Changed password for user [kibana]
Changed password for user [logstash_system]
Changed password for user [beats_system]
Changed password for user [remote_monitoring_user]
Changed password for user [elastic]
Now, I should be able to get response from Elasticsearch but it does not work:
curl -u elstic:asdfasdf localhost:9200
{"error":{"root_cause":[{"type":"security_exception","reason":"unable to authenticate user [elstic] for REST request [/]","header":{"WWW-Authenticate":"Basic realm=\"security\" charset=\"UTF-8\""}}],"type":"security_exception","reason":"unable to authenticate user [elstic] for REST request [/]","header":{"WWW-Authenticate":"Basic realm=\"security\" charset=\"UTF-8\""}},"status":401}
I running it in docker and mount port to localhost. I used default configuration of ES, this is my compose file:
version: '3.7'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.9.2
ports:
- 9300:9300
- 9200:9200
environment:
- discovery.type=single-node
- "xpack.security.enabled=true"
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
Maybe I am missing something but cant see what, in my opinion, it should work.