elastic/elasticsearch

setup-passwords exit code always 0

Open

#30,103 opened on Sep 22, 2017

View on GitHub
 (5 comments) (0 reactions) (0 assignees)Java (76,700 stars) (25,882 forks)batch import
:Security/Authentication>bugTeam:Securityhelp wanted

Description

Original comment by @Mpdreamz:

setup-passwords always exits with exit code 0, atleast on windows.

PS C:\Program Files\Elastic\Elasticsearch\bin\x-pack> .\setup-passwords interactive Initiating the setup of reserved user [elastic, kibana, logstash_system] passwords. 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]: Exception making http rest request for user [elastic] Exception in thread "main" java.io.IOException: {"error":{"root_cause":[{"type":"security_exception", authenticate user [elastic]","header":{"WWW-Authenticate":"Basic realm="security" charset="UTF-8
ity_exception","reason":"failed to authenticate user [elastic]","header":{"WWW-Authenticate":"Basic r harset="UTF-8""}},"status":401} at org.elasticsearch.xpack.security.authc.esnative.tool.CommandLineHttpClient.postURL(Command :116) at org.elasticsearch.xpack.security.authc.esnative.tool.SetupPasswordTool$SetupCommand.change ordTool.java:249) at org.elasticsearch.xpack.security.authc.esnative.tool.SetupPasswordTool$SetupCommand.change wordTool.java:237) at org.elasticsearch.xpack.security.authc.esnative.tool.SetupPasswordTool$InteractiveSetup.ex Tool.java:166) at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:69) at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:134) at org.elasticsearch.cli.MultiCommand.execute(MultiCommand.java:69) at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:134) at org.elasticsearch.cli.Command.main(Command.java:90) at org.elasticsearch.xpack.security.authc.esnative.tool.SetupPasswordTool.main(SetupPasswordT Caused by: java.io.IOException: Server returned HTTP response code: 401 for URL: http://127.0.0.1:920 ser/elastic/_password at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at org.elasticsearch.xpack.security.authc.esnative.tool.CommandLineHttpClient.postURL(Command :110) ... 9 more PS C:\Program Files\Elastic\Elasticsearch\bin\x-pack> $lastexitcode 0

Contributor guide