1
0

keystore.asciidoc 9.7 KB

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