secure-settings.asciidoc 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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. [[keystore-upgrade]]
  72. === Upgrading the keystore
  73. Occasionally, the internal format of the keystore changes. When Elasticsearch is
  74. installed from a package manager, an upgrade of the on-disk keystore to the new
  75. format is done during package upgrade. In other cases, Elasticsearch will
  76. perform such an upgrade during node startup. This requires that Elasticsearch
  77. have write permissions to the directory that contains the keystore.
  78. Alternatively, you can manually perform such an upgrade by using the `upgrade`
  79. command:
  80. [source,sh]
  81. ----------------------------------------------------------------
  82. bin/elasticsearch-keystore upgrade
  83. ----------------------------------------------------------------
  84. [float]
  85. [[reloadable-secure-settings]]
  86. === Reloadable secure settings
  87. Just like the settings values in `elasticsearch.yml`, changes to the
  88. keystore contents are not automatically applied to the running
  89. elasticsearch node. Re-reading settings requires a node restart.
  90. However, certain secure settings are marked as *reloadable*. Such settings
  91. can be re-read and applied on a running node.
  92. The values of all secure settings, *reloadable* or not, must be identical
  93. across all cluster nodes. After making the desired secure settings changes,
  94. using the `bin/elasticsearch-keystore add` command, call:
  95. [source,console]
  96. ----
  97. POST _nodes/reload_secure_settings
  98. ----
  99. This API will decrypt and re-read the entire keystore, on every cluster node,
  100. but only the *reloadable* secure settings will be applied. Changes to other
  101. settings will not go into effect until the next restart. Once the call returns,
  102. the reload has been completed, meaning that all internal datastructures dependent
  103. on these settings have been changed. Everything should look as if the settings
  104. had the new value from the start.
  105. When changing multiple *reloadable* secure settings, modify all of them, on
  106. each cluster node, and then issue a `reload_secure_settings` call, instead
  107. of reloading after each modification.
  108. There are reloadable secure settings for:
  109. * {plugins}/repository-azure-client-settings.html[The Azure repository plugin]
  110. * {plugins}/discovery-ec2-usage.html#_configuring_ec2_discovery[The EC2 discovery plugin]
  111. * {plugins}/repository-gcs-client.html[The GCS repository plugin]
  112. * {plugins}/repository-s3-client.html[The S3 repository plugin]