keystore.asciidoc 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. [[elasticsearch-keystore]]
  2. == elasticsearch-keystore
  3. The `elasticsearch-keystore` command manages <<secure-settings,secure settings>>
  4. in the {es} keystore.
  5. [discrete]
  6. [[elasticsearch-keystore-synopsis]]
  7. === Synopsis
  8. [source,shell]
  9. --------------------------------------------------
  10. bin/elasticsearch-keystore
  11. ([add <settings>] [-f] [--stdin] |
  12. [add-file (<setting> <path>)+] | [create] [-p] |
  13. [list] | [passwd] | [remove <setting>] | [upgrade])
  14. [-h, --help] ([-s, --silent] | [-v, --verbose])
  15. --------------------------------------------------
  16. [discrete]
  17. [[elasticsearch-keystore-description]]
  18. === Description
  19. IMPORTANT: This command should be run as the user that will run {es}.
  20. Currently, all secure settings are node-specific settings that must have the
  21. same value on every node. Therefore you must run this command on every node.
  22. When the keystore is password-protected, you must supply the password each time
  23. {es} starts.
  24. Modifications to the keystore do not take effect until you restart {es}.
  25. Only some settings are designed to be read from the keystore. However, there
  26. is no validation to block unsupported settings from the keystore and they can
  27. cause {es} to fail to start. To see whether a setting is supported in the
  28. keystore, see the setting reference.
  29. [discrete]
  30. [[elasticsearch-keystore-parameters]]
  31. === Parameters
  32. `add <settings>`:: Adds settings to the keystore. Multiple setting names can be
  33. specified as arguments to the `add` command. By default, you are prompted for
  34. the values of the settings. If the keystore is password protected, you are also
  35. prompted to enter the password. If a setting already exists in the keystore, you
  36. must confirm that you want to overwrite the current value. If the keystore does
  37. not exist, you must confirm that you want to create a keystore. To avoid these
  38. two confirmation prompts, use the `-f` parameter.
  39. `add-file (<setting> <path>)+`:: Adds files to the keystore.
  40. `create`:: Creates the keystore.
  41. `-f, --force`:: When used with the `add` parameter, the command no longer prompts you
  42. before overwriting existing entries in the keystore. Also, if you haven't
  43. created a keystore yet, it creates a keystore that is obfuscated but not
  44. password protected.
  45. `-h, --help`:: Returns all of the command parameters.
  46. `list`:: Lists the settings in the keystore. If the keystore is password
  47. protected, you are prompted to enter the password.
  48. `-p`:: When used with the `create` parameter, the command prompts you to enter a
  49. keystore password. If you don't specify the `-p` flag or if you enter an empty
  50. password, the keystore is obfuscated but not password protected.
  51. `passwd`:: Changes or sets the keystore password. If the keystore is password
  52. protected, you are prompted to enter the current password and the new one. You
  53. can optionally use an empty string to remove the password. If the keystore is
  54. not password protected, you can use this command to set a password.
  55. `remove <settings>`:: Removes settings from the keystore. Multiple setting
  56. names can be specified as arguments to the `remove` command.
  57. `-s, --silent`:: Shows minimal output.
  58. `-x, --stdin`:: When used with the `add` parameter, you can pass the settings values
  59. through standard input (stdin). Separate multiple values with carriage returns
  60. or newlines. See <<add-string-to-keystore>>.
  61. `upgrade`:: Upgrades the internal format of the keystore.
  62. `-v, --verbose`:: Shows verbose output.
  63. [discrete]
  64. [[elasticsearch-keystore-examples]]
  65. === Examples
  66. [discrete]
  67. [[creating-keystore]]
  68. ==== Create the keystore
  69. To create the `elasticsearch.keystore`, use the `create` command:
  70. [source,sh]
  71. ----------------------------------------------------------------
  72. bin/elasticsearch-keystore create -p
  73. ----------------------------------------------------------------
  74. You are prompted to enter the keystore password. A password-protected
  75. `elasticsearch.keystore` file is created alongside the `elasticsearch.yml` file.
  76. [discrete]
  77. [[changing-keystore-password]]
  78. ==== Change the password of the keystore
  79. To change the password of the `elasticsearch.keystore`, use the `passwd` command:
  80. [source,sh]
  81. ----------------------------------------------------------------
  82. bin/elasticsearch-keystore passwd
  83. ----------------------------------------------------------------
  84. If the {es} keystore is password protected, you are prompted to enter the
  85. current password and then enter the new one. If it is not password protected,
  86. you are prompted to set a password.
  87. [discrete]
  88. [[list-settings]]
  89. ==== List settings in the keystore
  90. To list the settings in the keystore, use the `list` command.
  91. [source,sh]
  92. ----------------------------------------------------------------
  93. bin/elasticsearch-keystore list
  94. ----------------------------------------------------------------
  95. If the {es} keystore is password protected, you are prompted to enter the
  96. password.
  97. [discrete]
  98. [[add-string-to-keystore]]
  99. ==== Add settings to the keystore
  100. Sensitive string settings, like authentication credentials for Cloud plugins,
  101. can be added with the `add` command:
  102. [source,sh]
  103. ----------------------------------------------------------------
  104. bin/elasticsearch-keystore add the.setting.name.to.set
  105. ----------------------------------------------------------------
  106. You are prompted to enter the value of the setting. If the {es} keystore is
  107. password protected, you are also prompted to enter the password.
  108. You can also add multiple settings with the `add` command:
  109. [source,sh]
  110. ----------------------------------------------------------------
  111. bin/elasticsearch-keystore add \
  112. the.setting.name.to.set \
  113. the.other.setting.name.to.set
  114. ----------------------------------------------------------------
  115. You are prompted to enter the values of the settings. If the {es} keystore is
  116. password protected, you are also prompted to enter the password.
  117. To pass the settings values through standard input (stdin), use the `--stdin`
  118. flag:
  119. [source,sh]
  120. ----------------------------------------------------------------
  121. cat /file/containing/setting/value | bin/elasticsearch-keystore add --stdin the.setting.name.to.set
  122. ----------------------------------------------------------------
  123. Values for multiple settings must be separated by carriage returns or newlines.
  124. [discrete]
  125. [[add-file-to-keystore]]
  126. ==== Add files to the keystore
  127. You can add sensitive files, like authentication key files for Cloud plugins,
  128. using the `add-file` command. Settings and file paths are specified in pairs
  129. consisting of `setting path`.
  130. [source,sh]
  131. ----------------------------------------------------------------
  132. bin/elasticsearch-keystore add-file the.setting.name.to.set /path/example-file.json
  133. ----------------------------------------------------------------
  134. You can add multiple files with the `add-file` command:
  135. [source,sh]
  136. ----------------------------------------------------------------
  137. bin/elasticsearch-keystore add-file \
  138. the.setting.name.to.set /path/example-file.json \
  139. the.other.setting.name.to.set /path/other-example-file.json
  140. ----------------------------------------------------------------
  141. If the {es} keystore is password protected, you are prompted to enter the
  142. password.
  143. [discrete]
  144. [[remove-settings]]
  145. ==== Remove settings from the keystore
  146. To remove a setting from the keystore, use the `remove` command:
  147. [source,sh]
  148. ----------------------------------------------------------------
  149. bin/elasticsearch-keystore remove the.setting.name.to.remove
  150. ----------------------------------------------------------------
  151. You can also remove multiple settings with the `remove` command:
  152. [source,sh]
  153. ----------------------------------------------------------------
  154. bin/elasticsearch-keystore remove \
  155. the.setting.name.to.remove \
  156. the.other.setting.name.to.remove
  157. ----------------------------------------------------------------
  158. If the {es} keystore is password protected, you are prompted to enter the
  159. password.
  160. [discrete]
  161. [[keystore-upgrade]]
  162. ==== Upgrade the keystore
  163. Occasionally, the internal format of the keystore changes. When {es} is
  164. installed from a package manager, an upgrade of the on-disk keystore to the new
  165. format is done during package upgrade. In other cases, {es} performs the upgrade
  166. during node startup. This requires that {es} has write permissions to the
  167. directory that contains the keystore. Alternatively, you can manually perform
  168. such an upgrade by using the `upgrade` command:
  169. [source,sh]
  170. ----------------------------------------------------------------
  171. bin/elasticsearch-keystore upgrade
  172. ----------------------------------------------------------------