configuring-es.asciidoc 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. [role="xpack"]
  2. [[configuring-security]]
  3. == Configuring security in {es}
  4. ++++
  5. <titleabbrev>Configuring security</titleabbrev>
  6. ++++
  7. The {es} {security-features} enable you to easily secure a cluster. You can
  8. password-protect your data as well as implement more advanced security measures
  9. such as encrypting communications, role-based access control, IP filtering, and
  10. auditing. For more information, see
  11. {stack-ov}/elasticsearch-security.html[Securing the {stack}].
  12. To use {es} {security-features}:
  13. . Verify that you are using a license that includes the {security-features}.
  14. +
  15. --
  16. If you want to try all of the platinum features, you can start a 30-day trial.
  17. At the end of the trial period, you can purchase a subscription to keep using
  18. the full functionality. For more information, see
  19. https://www.elastic.co/subscriptions and
  20. {stack-ov}/license-management.html[License Management].
  21. --
  22. . Verify that the `xpack.security.enabled` setting is `true` on each node in
  23. your cluster. If you are using a trial license, the default value is `false`.
  24. For more information, see {ref}/security-settings.html[Security Settings in {es}].
  25. . If you plan to run {es} in a Federal Information Processing Standard (FIPS)
  26. 140-2 enabled JVM, see <<fips-140-compliance>>.
  27. . Configure Transport Layer Security (TLS/SSL) for internode-communication.
  28. +
  29. --
  30. NOTE: This requirement applies to clusters with more than one node and to
  31. clusters with a single node that listens on an external interface. Single-node
  32. clusters that use a loopback interface do not have this requirement. For more
  33. information, see
  34. {stack-ov}/encrypting-communications.html[Encrypting Communications].
  35. --
  36. .. <<node-certificates,Generate node certificates for each of your {es} nodes>>.
  37. .. <<tls-transport, Enable TLS on each {es} node>>.
  38. . If it is not already running, start {es}.
  39. . Set the passwords for all built-in users.
  40. +
  41. --
  42. The {es} {security-features} provide
  43. {stack-ov}/built-in-users.html[built-in users] to
  44. help you get up and running. The +elasticsearch-setup-passwords+ command is the
  45. simplest method to set the built-in users' passwords for the first time.
  46. For example, you can run the command in an "interactive" mode, which prompts you
  47. to enter new passwords for the `elastic`, `kibana`, `beats_system`,
  48. `logstash_system`, and `apm_system` users:
  49. [source,shell]
  50. --------------------------------------------------
  51. bin/elasticsearch-setup-passwords interactive
  52. --------------------------------------------------
  53. For more information about the command options, see <<setup-passwords>>.
  54. IMPORTANT: The `elasticsearch-setup-passwords` command uses a transient bootstrap
  55. password that is no longer valid after the command runs successfully. You cannot
  56. run the `elasticsearch-setup-passwords` command a second time. Instead, you can
  57. update passwords from the **Management > Users** UI in {kib} or use the security
  58. user API.
  59. --
  60. . Choose which types of realms you want to use to authenticate users.
  61. ** <<configuring-ad-realm,Configure an Active Directory realm>>.
  62. ** <<configuring-file-realm,Configure a file realm>>.
  63. ** <<configuring-ldap-realm,Configure an LDAP realm>>.
  64. ** <<configuring-native-realm,Configure a native realm>>.
  65. ** <<configuring-pki-realm,Configure a PKI realm>>.
  66. ** <<configuring-saml-realm,Configure a SAML realm>>.
  67. ** <<configuring-kerberos-realm,Configure a Kerberos realm>>.
  68. . Set up roles and users to control access to {es}.
  69. For example, to grant _John Doe_ full access to all indices that match
  70. the pattern `events*` and enable him to create visualizations and dashboards
  71. for those indices in {kib}, you could create an `events_admin` role
  72. and assign the role to a new `johndoe` user.
  73. +
  74. --
  75. [source,shell]
  76. ----------------------------------------------------------
  77. curl -XPOST -u elastic 'localhost:9200/_security/role/events_admin' -H "Content-Type: application/json" -d '{
  78. "indices" : [
  79. {
  80. "names" : [ "events*" ],
  81. "privileges" : [ "all" ]
  82. },
  83. {
  84. "names" : [ ".kibana*" ],
  85. "privileges" : [ "manage", "read", "index" ]
  86. }
  87. ]
  88. }'
  89. curl -XPOST -u elastic 'localhost:9200/_security/user/johndoe' -H "Content-Type: application/json" -d '{
  90. "password" : "userpassword",
  91. "full_name" : "John Doe",
  92. "email" : "john.doe@anony.mous",
  93. "roles" : [ "events_admin" ]
  94. }'
  95. ----------------------------------------------------------
  96. // NOTCONSOLE
  97. --
  98. [[enable-auditing]]
  99. . Enable auditing to keep track of attempted and successful interactions with
  100. your {es} cluster:
  101. +
  102. --
  103. .. Add the following setting to `elasticsearch.yml` on all nodes in your cluster:
  104. +
  105. [source,yaml]
  106. ----------------------------
  107. xpack.security.audit.enabled: true
  108. ----------------------------
  109. +
  110. For more information, see {stack-ov}/auditing.html[Auditing Security Events]
  111. and <<auditing-settings>>.
  112. .. Restart {es}.
  113. Events are logged to a dedicated `<clustername>_audit.json` file in
  114. `ES_HOME/logs`, on each cluster node.
  115. --
  116. :edit_url: https://github.com/elastic/elasticsearch/edit/{branch}/docs/reference/security/securing-communications/securing-elasticsearch.asciidoc
  117. include::{es-repo-dir}/security/securing-communications/securing-elasticsearch.asciidoc[]
  118. :edit_url: https://github.com/elastic/elasticsearch/edit/{branch}/docs/reference/security/securing-communications/configuring-tls-docker.asciidoc
  119. include::{es-repo-dir}/security/securing-communications/configuring-tls-docker.asciidoc[]
  120. :edit_url: https://github.com/elastic/elasticsearch/edit/{branch}/docs/reference/security/securing-communications/enabling-cipher-suites.asciidoc
  121. include::{es-repo-dir}/security/securing-communications/enabling-cipher-suites.asciidoc[]
  122. :edit_url: https://github.com/elastic/elasticsearch/edit/{branch}/docs/reference/security/securing-communications/separating-node-client-traffic.asciidoc
  123. include::{es-repo-dir}/security/securing-communications/separating-node-client-traffic.asciidoc[]
  124. :edit_url:
  125. include::authentication/configuring-active-directory-realm.asciidoc[]
  126. include::authentication/configuring-file-realm.asciidoc[]
  127. include::authentication/configuring-ldap-realm.asciidoc[]
  128. include::authentication/configuring-native-realm.asciidoc[]
  129. include::authentication/configuring-pki-realm.asciidoc[]
  130. include::authentication/configuring-saml-realm.asciidoc[]
  131. :edit_url: https://github.com/elastic/elasticsearch/edit/{branch}/x-pack/docs/en/security/authentication/configuring-kerberos-realm.asciidoc
  132. include::authentication/configuring-kerberos-realm.asciidoc[]
  133. :edit_url:
  134. include::fips-140-compliance.asciidoc[]
  135. :edit_url: https://github.com/elastic/elasticsearch/edit/{branch}/docs/reference/settings/security-settings.asciidoc
  136. include::{es-repo-dir}/settings/security-settings.asciidoc[]
  137. :edit_url: https://github.com/elastic/elasticsearch/edit/{branch}/docs/reference/security/reference/files.asciidoc
  138. include::{es-repo-dir}/security/reference/files.asciidoc[]
  139. :edit_url: https://github.com/elastic/elasticsearch/edit/{branch}/docs/reference/settings/audit-settings.asciidoc
  140. include::{es-repo-dir}/settings/audit-settings.asciidoc[]