Class AutoConfigGenerateElasticPasswordHash

java.lang.Object
org.elasticsearch.cli.Command
org.elasticsearch.common.cli.EnvironmentAwareCommand
org.elasticsearch.common.cli.KeyStoreAwareCommand
org.elasticsearch.xpack.security.enrollment.tool.AutoConfigGenerateElasticPasswordHash
All Implemented Interfaces:
Closeable, AutoCloseable

public class AutoConfigGenerateElasticPasswordHash extends org.elasticsearch.common.cli.KeyStoreAwareCommand
This tool is not meant to be used in user facing CLI tools. It is called by the package installers only upon installation. It
  • generates a random strong password for the elastic user/li>
  • stores a salted hash of that password in the elasticsearch keystore, in the autoconfiguration.password_hash setting
This password is subsequently picked up by the node on startup and is set as the password of the elastic user in the security index. There is currently no way to set the password of the elasticsearch keystore during package installation. This tool is called by the package installer only on installation (not on upgrades) so we can be certain that the keystore has an empty password (obfuscated). The generated password is written to stdout upon success. Error messages are printed to stderr.
  • Field Summary

    Fields inherited from class org.elasticsearch.cli.Command

    description, parser
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    execute(org.elasticsearch.cli.Terminal terminal, joptsimple.OptionSet options, org.elasticsearch.env.Environment env)
     
    static void
    main(String[] args)
     

    Methods inherited from class org.elasticsearch.common.cli.KeyStoreAwareCommand

    decryptKeyStore, readPassword

    Methods inherited from class org.elasticsearch.common.cli.EnvironmentAwareCommand

    createEnv, createEnv, execute

    Methods inherited from class org.elasticsearch.cli.Command

    addShutdownHook, close, exit, main, mainWithoutErrorHandling, printAdditionalHelp, printUserException

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AutoConfigGenerateElasticPasswordHash

      public AutoConfigGenerateElasticPasswordHash()
  • Method Details

    • main

      public static void main(String[] args) throws Exception
      Throws:
      Exception
    • execute

      protected void execute(org.elasticsearch.cli.Terminal terminal, joptsimple.OptionSet options, org.elasticsearch.env.Environment env) throws Exception
      Specified by:
      execute in class org.elasticsearch.common.cli.KeyStoreAwareCommand
      Throws:
      Exception