Checking the code, the --password CLI flag only supports stdin and env in 6.6. The env method does not read from the keystore, but expects you to use an environment variable.
# ES_PWD=changeme
# filebeat enroll https://X.X.X:443 --username elastic --password env:ES_PWD
Error creating a new enrollment token: [security_exception] failed to authenticate user [elastic], with { header={ WWW-Authenticate="Basic realm=\"security\" charset=\"UTF-8\"" } }
# curl -s -I https://elastic:$ES_PWD@X.X.X:443 | grep ^HTTP
HTTP/1.1 200 OK
#
yet, following works as expected:
# filebeat enroll https://X.X.X:443 --username elastic --password stdin
Enter password:
This will replace your current settings. Do you want to continue? [Y/n]:y
Saving a copy of current settings to /etc/filebeat/filebeat.yml.bak
Enrolled and ready to retrieve settings from Kibana
#
When you do ES_PWD=change the environment variable will be only valid for the current command, if precede the command with the variable like in the next example it will correctly take the environment variable:
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.