configuring-es.asciidoc 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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. <<elasticsearch-security>>.
  12. . Verify that you are using a license that includes the specific
  13. {security-features} you want.
  14. +
  15. --
  16. For more information, see https://www.elastic.co/subscriptions and
  17. {stack-ov}/license-management.html[License management].
  18. --
  19. . Verify that the `xpack.security.enabled` setting is `true` on each node in
  20. your cluster. If you are using basic or trial licenses, the default value is `false`.
  21. For more information, see <<security-settings>>.
  22. . If you plan to run {es} in a Federal Information Processing Standard (FIPS)
  23. 140-2 enabled JVM, see <<fips-140-compliance>>.
  24. . <<configuring-tls,Configure Transport Layer Security (TLS/SSL) for internode-communication>>.
  25. +
  26. --
  27. NOTE: This requirement applies to clusters with more than one node and to
  28. clusters with a single node that listens on an external interface. Single-node
  29. clusters that use a loopback interface do not have this requirement. For more
  30. information, see
  31. <<encrypting-communications>>.
  32. --
  33. . If it is not already running, start {es}.
  34. . Set the passwords for all built-in users.
  35. +
  36. --
  37. The {es} {security-features} provide
  38. <<built-in-users,built-in users>> to
  39. help you get up and running. The +elasticsearch-setup-passwords+ command is the
  40. simplest method to set the built-in users' passwords for the first time.
  41. For example, you can run the command in an "interactive" mode, which prompts you
  42. to enter new passwords for the built-in users:
  43. [source,shell]
  44. --------------------------------------------------
  45. bin/elasticsearch-setup-passwords interactive
  46. --------------------------------------------------
  47. For more information about the command options, see <<setup-passwords>>.
  48. IMPORTANT: The `elasticsearch-setup-passwords` command uses a transient bootstrap
  49. password that is no longer valid after the command runs successfully. You cannot
  50. run the `elasticsearch-setup-passwords` command a second time. Instead, you can
  51. update passwords from the **Management > Users** UI in {kib} or use the security
  52. user API.
  53. --
  54. . Choose which types of realms you want to use to authenticate users.
  55. +
  56. --
  57. TIP: The types of authentication realms that you can enable varies according to
  58. your subscription. For more information, see https://www.elastic.co/subscriptions.
  59. --
  60. ** <<configuring-ad-realm,Active Directory realms>>
  61. ** <<file-realm,File realms>>
  62. ** <<kerberos-realm,Kerberos realms>>
  63. ** <<ldap-realm,LDAP realms>>
  64. ** <<native-realm,Native realms>>
  65. ** <<pki-realm,PKI realms>>
  66. ** <<saml-realm,SAML realms>>
  67. . Set up roles and users to control access to {es}.
  68. +
  69. --
  70. For example, to grant _John Doe_ full access to all indices that match
  71. the pattern `events*` and enable them to create visualizations and dashboards
  72. for those indices in {kib}, you could create an `events_admin` role
  73. and assign the role to a new `johndoe` user.
  74. [source,shell]
  75. ----------------------------------------------------------
  76. curl -XPOST -u elastic 'localhost:9200/_security/role/events_admin' -H "Content-Type: application/json" -d '{
  77. "indices" : [
  78. {
  79. "names" : [ "events*" ],
  80. "privileges" : [ "all" ]
  81. },
  82. {
  83. "names" : [ ".kibana*" ],
  84. "privileges" : [ "manage", "read", "index" ]
  85. }
  86. ]
  87. }'
  88. curl -XPOST -u elastic 'localhost:9200/_security/user/johndoe' -H "Content-Type: application/json" -d '{
  89. "password" : "userpassword",
  90. "full_name" : "John Doe",
  91. "email" : "john.doe@anony.mous",
  92. "roles" : [ "events_admin" ]
  93. }'
  94. ----------------------------------------------------------
  95. // NOTCONSOLE
  96. --
  97. . [[enable-auditing]](Optional) Enable auditing to keep track of attempted and
  98. successful interactions with your {es} cluster:
  99. +
  100. --
  101. TIP: Audit logging is available with specific subscriptions. For more
  102. information, see https://www.elastic.co/subscriptions.
  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 <<auditing>> and <<auditing-settings>>.
  111. .. Restart {es}.
  112. Events are logged to a dedicated `<clustername>_audit.json` file in
  113. `ES_HOME/logs`, on each cluster node.
  114. --
  115. To walk through the configuration of {security-features} in {es}, {kib}, {ls}, and {metricbeat}, see <<security-getting-started>>.
  116. include::authentication/configuring-active-directory-realm.asciidoc[]
  117. include::reference/files.asciidoc[]
  118. include::fips-140-compliance.asciidoc[]