| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197 | [[elasticsearch-keystore]]== elasticsearch-keystoreThe `elasticsearch-keystore` command manages <<secure-settings,secure settings>>in the {es} keystore.[discrete][[elasticsearch-keystore-synopsis]]=== Synopsis[source,shell]--------------------------------------------------bin/elasticsearch-keystore([add <setting>] [-f] [--stdin] |[add-file <setting> <path>] | [create] [-p] |[list] | [passwd] | [remove <setting>] | [upgrade])[-h, --help] ([-s, --silent] | [-v, --verbose])--------------------------------------------------[discrete][[elasticsearch-keystore-description]]=== DescriptionIMPORTANT: This command should be run as the user that will run {es}.Currently, all secure settings are node-specific settings that must have thesame value on every node. Therefore you must run this command on every node.When the keystore is password-protected, you must supply the password each time{es} starts.Modifications to the keystore do not take effect until you restart {es}.Only some settings are designed to be read from the keystore. However, thereis no validation to block unsupported settings from the keystore and they cancause {es} to fail to start. To see whether a setting is supported in thekeystore, see the setting reference.[discrete][[elasticsearch-keystore-parameters]]=== Parameters`add <setting>`:: Adds settings to the keystore. By default, you are promptedfor the value of the setting. If the keystore is password protected, you arealso prompted to enter the password. If the setting already exists in thekeystore, you must confirm that you want to overwrite the current value. If thekeystore does not exist, you must confirm that you want to create a keystore. Toavoid these two confirmation prompts, use the `-f` parameter.`add-file <setting> <path>`:: Adds a file to the keystore.`create`:: Creates the keystore.`-f`:: When used with the `add` parameter, the command no longer prompts youbefore overwriting existing entries in the keystore. Also, if you haven'tcreated a keystore yet, it creates a keystore that is obfuscated but notpassword protected.`-h, --help`:: Returns all of the command parameters.`list`:: Lists the settings in the keystore. If the keystore is passwordprotected, you are prompted to enter the password.`-p`:: When used with the `create` parameter, the command prompts you to enter akeystore password. If you don't specify the `-p` flag or if you enter an emptypassword, the keystore is obfuscated but not password protected.`passwd`:: Changes or sets the keystore password. If the keystore is passwordprotected, you are prompted to enter the current password and the new one. Youcan optionally use an empty string to remove the password. If the keystore isnot password protected, you can use this command to set a password.`remove <setting>`:: Removes a setting from the keystore.`-s, --silent`:: Shows minimal output.`--stdin`:: When used with the `add` parameter, you can pass the setting valuethrough standard input (stdin). See <<add-string-to-keystore>>.`upgrade`:: Upgrades the internal format of the keystore.`-v, --verbose`:: Shows verbose output.[discrete][[elasticsearch-keystore-examples]]=== Examples[discrete][[creating-keystore]]==== Create the keystoreTo create the `elasticsearch.keystore`, use the `create` command:[source,sh]----------------------------------------------------------------bin/elasticsearch-keystore create -p----------------------------------------------------------------You are prompted to enter the keystore password. A password-protected`elasticsearch.keystore` file is created alongside the `elasticsearch.yml` file.[discrete][[changing-keystore-password]]==== Change the password of the keystoreTo change the password of the `elasticsearch.keystore`, use the `passwd` command:[source,sh]----------------------------------------------------------------bin/elasticsearch-keystore passwd----------------------------------------------------------------If the {es} keystore is password protected, you are prompted to enter thecurrent password and then enter the new one. If it is not password protected,you are prompted to set a password.[discrete][[list-settings]]==== List settings in the keystoreTo list the settings in the keystore, use the `list` command.[source,sh]----------------------------------------------------------------bin/elasticsearch-keystore list----------------------------------------------------------------If the {es} keystore is password protected, you are prompted to enter thepassword.[discrete][[add-string-to-keystore]]==== Add settings to the keystoreSensitive string settings, like authentication credentials for Cloud plugins,can be added with the `add` command:[source,sh]----------------------------------------------------------------bin/elasticsearch-keystore add the.setting.name.to.set----------------------------------------------------------------You are prompted to enter the value of the setting. If the {es} keystore ispassword protected, you are also prompted to enter the password.To pass the setting value through standard input (stdin), use the `--stdin` flag:[source,sh]----------------------------------------------------------------cat /file/containing/setting/value | bin/elasticsearch-keystore add --stdin the.setting.name.to.set----------------------------------------------------------------[discrete][[add-file-to-keystore]]==== Add files to the keystoreYou can add sensitive files, like authentication key files for Cloud plugins,using the `add-file` command. Be sure to include your file path as an argumentafter the setting name.[source,sh]----------------------------------------------------------------bin/elasticsearch-keystore add-file the.setting.name.to.set /path/example-file.json----------------------------------------------------------------If the {es} keystore is password protected, you are prompted to enter thepassword.[discrete][[remove-settings]]==== Remove settings from the keystoreTo remove a setting from the keystore, use the `remove` command:[source,sh]----------------------------------------------------------------bin/elasticsearch-keystore remove the.setting.name.to.remove----------------------------------------------------------------If the {es} keystore is password protected, you are prompted to enter thepassword.[discrete][[keystore-upgrade]]==== Upgrade the keystoreOccasionally, the internal format of the keystore changes. When {es} isinstalled from a package manager, an upgrade of the on-disk keystore to the newformat is done during package upgrade. In other cases, {es} performs the upgradeduring node startup. This requires that {es} has write permissions to thedirectory that contains the keystore. Alternatively, you can manually performsuch an upgrade by using the `upgrade` command:[source,sh]----------------------------------------------------------------bin/elasticsearch-keystore upgrade----------------------------------------------------------------
 |