secure-settings.asciidoc 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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. to fail to start. See documentation for each setting to see if it is supported
  11. as part of the keystore.
  12. NOTE: All the modifications to the keystore take affect only after restarting
  13. Elasticsearch.
  14. NOTE: The elasticsearch keystore currently only provides obfuscation. In the future,
  15. password protection will be added.
  16. These settings, just like the regular ones in the `elasticsearch.yml` config file,
  17. need to be specified on each node in the cluster. Currently, all secure settings
  18. are node-specific settings that must have the same value on every node.
  19. [float]
  20. [[creating-keystore]]
  21. === Creating the keystore
  22. To create the `elasticsearch.keystore`, use the `create` command:
  23. [source,sh]
  24. ----------------------------------------------------------------
  25. bin/elasticsearch-keystore create
  26. ----------------------------------------------------------------
  27. The file `elasticsearch.keystore` will be created alongside `elasticsearch.yml`.
  28. [float]
  29. [[list-settings]]
  30. === Listing settings in the keystore
  31. A list of the settings in the keystore is available with the `list` command:
  32. [source,sh]
  33. ----------------------------------------------------------------
  34. bin/elasticsearch-keystore list
  35. ----------------------------------------------------------------
  36. [float]
  37. [[add-string-to-keystore]]
  38. === Adding string settings
  39. Sensitive string settings, like authentication credentials for cloud
  40. plugins, can be added using the `add` command:
  41. [source,sh]
  42. ----------------------------------------------------------------
  43. bin/elasticsearch-keystore add the.setting.name.to.set
  44. ----------------------------------------------------------------
  45. The tool will prompt for the value of the setting. To pass the value
  46. through stdin, use the `--stdin` flag:
  47. [source,sh]
  48. ----------------------------------------------------------------
  49. cat /file/containing/setting/value | bin/elasticsearch-keystore add --stdin the.setting.name.to.set
  50. ----------------------------------------------------------------
  51. [float]
  52. [[add-file-to-keystore]]
  53. === Adding file settings
  54. You can add sensitive files, like authentication key files for cloud plugins,
  55. using the `add-file` command. Be sure to include your file path as an argument
  56. after the setting name.
  57. [source,sh]
  58. ----------------------------------------------------------------
  59. bin/elasticsearch-keystore add-file the.setting.name.to.set /path/example-file.json
  60. ----------------------------------------------------------------
  61. [float]
  62. [[remove-settings]]
  63. === Removing settings
  64. To remove a setting from the keystore, use the `remove` command:
  65. [source,sh]
  66. ----------------------------------------------------------------
  67. bin/elasticsearch-keystore remove the.setting.name.to.remove
  68. ----------------------------------------------------------------
  69. [float]
  70. [[keystore-upgrade]]
  71. === Upgrading the keystore
  72. Occasionally, the internal format of the keystore changes. When Elasticsearch is
  73. installed from a package manager, an upgrade of the on-disk keystore to the new
  74. format is done during package upgrade. In other cases, Elasticsearch will
  75. perform such an upgrade during node startup. This requires that Elasticsearch
  76. have write permissions to the directory that contains the keystore.
  77. Alternatively, you can manually perform such an upgrade by using the `upgrade`
  78. command:
  79. [source,sh]
  80. ----------------------------------------------------------------
  81. bin/elasticsearch-keystore upgrade
  82. ----------------------------------------------------------------
  83. [float]
  84. [[reloadable-secure-settings]]
  85. === Reloadable secure settings
  86. Just like the settings values in `elasticsearch.yml`, changes to the
  87. keystore contents are not automatically applied to the running
  88. elasticsearch node. Re-reading settings requires a node restart.
  89. However, certain secure settings are marked as *reloadable*. Such settings
  90. can be re-read and applied on a running node.
  91. The values of all secure settings, *reloadable* or not, must be identical
  92. across all cluster nodes. After making the desired secure settings changes,
  93. using the `bin/elasticsearch-keystore add` command, call:
  94. [source,console]
  95. ----
  96. POST _nodes/reload_secure_settings
  97. ----
  98. This API will decrypt and re-read the entire keystore, on every cluster node,
  99. but only the *reloadable* secure settings will be applied. Changes to other
  100. settings will not go into effect until the next restart. Once the call returns,
  101. the reload has been completed, meaning that all internal datastructures dependent
  102. on these settings have been changed. Everything should look as if the settings
  103. had the new value from the start.
  104. When changing multiple *reloadable* secure settings, modify all of them, on
  105. each cluster node, and then issue a `reload_secure_settings` call, instead
  106. of reloading after each modification.
  107. There are reloadable secure settings for:
  108. * {plugins}/repository-azure-client-settings.html[The Azure repository plugin]
  109. * {plugins}/discovery-ec2-usage.html#_configuring_ec2_discovery[The EC2 discovery plugin]
  110. * {plugins}/repository-gcs-client.html[The GCS repository plugin]
  111. * {plugins}/repository-s3-client.html[The S3 repository plugin]