keystore.asciidoc 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  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 <setting>] [-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 <setting>`:: Adds settings to the keystore. By default, you are prompted
  33. for the value of the setting. If the keystore is password protected, you are
  34. also prompted to enter the password. If the setting already exists in the
  35. keystore, you must confirm that you want to overwrite the current value. If the
  36. keystore does not exist, you must confirm that you want to create a keystore. To
  37. avoid these two confirmation prompts, use the `-f` parameter.
  38. `add-file <setting> <path>`:: Adds a file to the keystore.
  39. `create`:: Creates the keystore.
  40. `-f`:: When used with the `add` parameter, the command no longer prompts you
  41. before overwriting existing entries in the keystore. Also, if you haven't
  42. created a keystore yet, it creates a keystore that is obfuscated but not
  43. password protected.
  44. `-h, --help`:: Returns all of the command parameters.
  45. `list`:: Lists the settings in the keystore. If the keystore is password
  46. protected, you are prompted to enter the password.
  47. `-p`:: When used with the `create` parameter, the command prompts you to enter a
  48. keystore password. If you don't specify the `-p` flag or if you enter an empty
  49. password, the keystore is obfuscated but not password protected.
  50. `passwd`:: Changes or sets the keystore password. If the keystore is password
  51. protected, you are prompted to enter the current password and the new one. You
  52. can optionally use an empty string to remove the password. If the keystore is
  53. not password protected, you can use this command to set a password.
  54. `remove <setting>`:: Removes a setting from the keystore.
  55. `-s, --silent`:: Shows minimal output.
  56. `--stdin`:: When used with the `add` parameter, you can pass the setting value
  57. through standard input (stdin). See <<add-string-to-keystore>>.
  58. `upgrade`:: Upgrades the internal format of the keystore.
  59. `-v, --verbose`:: Shows verbose output.
  60. [discrete]
  61. [[elasticsearch-keystore-examples]]
  62. === Examples
  63. [discrete]
  64. [[creating-keystore]]
  65. ==== Create the keystore
  66. To create the `elasticsearch.keystore`, use the `create` command:
  67. [source,sh]
  68. ----------------------------------------------------------------
  69. bin/elasticsearch-keystore create -p
  70. ----------------------------------------------------------------
  71. You are prompted to enter the keystore password. A password-protected
  72. `elasticsearch.keystore` file is created alongside the `elasticsearch.yml` file.
  73. [discrete]
  74. [[changing-keystore-password]]
  75. ==== Change the password of the keystore
  76. To change the password of the `elasticsearch.keystore`, use the `passwd` command:
  77. [source,sh]
  78. ----------------------------------------------------------------
  79. bin/elasticsearch-keystore passwd
  80. ----------------------------------------------------------------
  81. If the {es} keystore is password protected, you are prompted to enter the
  82. current password and then enter the new one. If it is not password protected,
  83. you are prompted to set a password.
  84. [discrete]
  85. [[list-settings]]
  86. ==== List settings in the keystore
  87. To list the settings in the keystore, use the `list` command.
  88. [source,sh]
  89. ----------------------------------------------------------------
  90. bin/elasticsearch-keystore list
  91. ----------------------------------------------------------------
  92. If the {es} keystore is password protected, you are prompted to enter the
  93. password.
  94. [discrete]
  95. [[add-string-to-keystore]]
  96. ==== Add settings to the keystore
  97. Sensitive string settings, like authentication credentials for Cloud plugins,
  98. can be added with the `add` command:
  99. [source,sh]
  100. ----------------------------------------------------------------
  101. bin/elasticsearch-keystore add the.setting.name.to.set
  102. ----------------------------------------------------------------
  103. You are prompted to enter the value of the setting. If the {es} keystore is
  104. password protected, you are also prompted to enter the password.
  105. To pass the setting value through standard input (stdin), use the `--stdin` flag:
  106. [source,sh]
  107. ----------------------------------------------------------------
  108. cat /file/containing/setting/value | bin/elasticsearch-keystore add --stdin the.setting.name.to.set
  109. ----------------------------------------------------------------
  110. [discrete]
  111. [[add-file-to-keystore]]
  112. ==== Add files to the keystore
  113. You can add sensitive files, like authentication key files for Cloud plugins,
  114. using the `add-file` command. Be sure to include your file path as an argument
  115. after the setting name.
  116. [source,sh]
  117. ----------------------------------------------------------------
  118. bin/elasticsearch-keystore add-file the.setting.name.to.set /path/example-file.json
  119. ----------------------------------------------------------------
  120. If the {es} keystore is password protected, you are prompted to enter the
  121. password.
  122. [discrete]
  123. [[remove-settings]]
  124. ==== Remove settings from the keystore
  125. To remove a setting from the keystore, use the `remove` command:
  126. [source,sh]
  127. ----------------------------------------------------------------
  128. bin/elasticsearch-keystore remove the.setting.name.to.remove
  129. ----------------------------------------------------------------
  130. If the {es} keystore is password protected, you are prompted to enter the
  131. password.
  132. [discrete]
  133. [[keystore-upgrade]]
  134. ==== Upgrade the keystore
  135. Occasionally, the internal format of the keystore changes. When {es} is
  136. installed from a package manager, an upgrade of the on-disk keystore to the new
  137. format is done during package upgrade. In other cases, {es} performs the upgrade
  138. during node startup. This requires that {es} has write permissions to the
  139. directory that contains the keystore. Alternatively, you can manually perform
  140. such an upgrade by using the `upgrade` command:
  141. [source,sh]
  142. ----------------------------------------------------------------
  143. bin/elasticsearch-keystore upgrade
  144. ----------------------------------------------------------------