secure-settings.asciidoc 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. [[secure-settings]]
  2. === Secure settings
  3. Some settings are sensitive, and relying on filesystem permissions to protect
  4. their values is not sufficient. For this use case, Elasticsearch provides a
  5. keystore and the `elasticsearch-keystore` tool to manage the settings in the keystore.
  6. NOTE: All commands here should be run as the user which will run Elasticsearch.
  7. IMPORTANT: Only some settings are designed to be read from the keystore. However,
  8. the keystore has no validation to block unsupported settings.
  9. Adding unsupported settings to the keystore will cause {es}
  10. Additional unsupported settings being added to the keystore will cause Elasticsearch
  11. to fail to start. See documentation for each setting to see if it is supported
  12. as part of the keystore.
  13. NOTE: All the modifications to the keystore take affect only after restarting
  14. Elasticsearch.
  15. NOTE: The elasticsearch keystore currently only provides obfuscation. In the future,
  16. password protection will be added.
  17. These settings, just like the regular ones in the `elasticsearch.yml` config file,
  18. need to be specified on each node in the cluster. Currently, all secure settings
  19. are node-specific settings that must have the same value on every node.
  20. [float]
  21. [[creating-keystore]]
  22. === Creating the keystore
  23. To create the `elasticsearch.keystore`, use the `create` command:
  24. [source,sh]
  25. ----------------------------------------------------------------
  26. bin/elasticsearch-keystore create
  27. ----------------------------------------------------------------
  28. The file `elasticsearch.keystore` will be created alongside `elasticsearch.yml`.
  29. [float]
  30. [[list-settings]]
  31. === Listing settings in the keystore
  32. A list of the settings in the keystore is available with the `list` command:
  33. [source,sh]
  34. ----------------------------------------------------------------
  35. bin/elasticsearch-keystore list
  36. ----------------------------------------------------------------
  37. [float]
  38. [[add-string-to-keystore]]
  39. === Adding string settings
  40. Sensitive string settings, like authentication credentials for cloud
  41. plugins, can be added using the `add` command:
  42. [source,sh]
  43. ----------------------------------------------------------------
  44. bin/elasticsearch-keystore add the.setting.name.to.set
  45. ----------------------------------------------------------------
  46. The tool will prompt for the value of the setting. To pass the value
  47. through stdin, use the `--stdin` flag:
  48. [source,sh]
  49. ----------------------------------------------------------------
  50. cat /file/containing/setting/value | bin/elasticsearch-keystore add --stdin the.setting.name.to.set
  51. ----------------------------------------------------------------
  52. [float]
  53. [[add-file-to-keystore]]
  54. === Adding file settings
  55. You can add sensitive files, like authentication key files for cloud plugins,
  56. using the `add-file` command. Be sure to include your file path as an argument
  57. after the setting name.
  58. [source,sh]
  59. ----------------------------------------------------------------
  60. bin/elasticsearch-keystore add-file the.setting.name.to.set /path/example-file.json
  61. ----------------------------------------------------------------
  62. [float]
  63. [[remove-settings]]
  64. === Removing settings
  65. To remove a setting from the keystore, use the `remove` command:
  66. [source,sh]
  67. ----------------------------------------------------------------
  68. bin/elasticsearch-keystore remove the.setting.name.to.remove
  69. ----------------------------------------------------------------
  70. [float]
  71. [[reloadable-secure-settings]]
  72. === Reloadable secure settings
  73. Just like the settings values in `elasticsearch.yml`, changes to the
  74. keystore contents are not automatically applied to the running
  75. elasticsearch node. Re-reading settings requires a node restart.
  76. However, certain secure settings are marked as *reloadable*. Such settings
  77. can be re-read and applied on a running node.
  78. The values of all secure settings, *reloadable* or not, must be identical
  79. across all cluster nodes. After making the desired secure settings changes,
  80. using the `bin/elasticsearch-keystore add` command, call:
  81. [source,js]
  82. ----
  83. POST _nodes/reload_secure_settings
  84. ----
  85. // CONSOLE
  86. This API will decrypt and re-read the entire keystore, on every cluster node,
  87. but only the *reloadable* secure settings will be applied. Changes to other
  88. settings will not go into effect until the next restart. Once the call returns,
  89. the reload has been completed, meaning that all internal datastructures dependent
  90. on these settings have been changed. Everything should look as if the settings
  91. had the new value from the start.
  92. When changing multiple *reloadable* secure settings, modify all of them, on
  93. each cluster node, and then issue a `reload_secure_settings` call, instead
  94. of reloading after each modification.