ssl.asciidoc 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. [role="xpack"]
  2. [[security-api-ssl]]
  3. === SSL certificate API
  4. ++++
  5. <titleabbrev>SSL certificate</titleabbrev>
  6. ++++
  7. The `certificates` API enables you to retrieve information about the X.509
  8. certificates that are used to encrypt communications in your {es} cluster.
  9. [[security-api-ssl-request]]
  10. ==== {api-request-title}
  11. `GET /_ssl/certificates`
  12. [[security-api-ssl-prereqs]]
  13. ==== {api-prereq-title}
  14. * If the {security-features} are enabled, you must have `monitor` cluster
  15. privileges to use this API. For more information, see
  16. <<security-privileges>>.
  17. [[security-api-ssl-desc]]
  18. ==== {api-description-title}
  19. For more information about how certificates are configured in conjunction with
  20. Transport Layer Security (TLS), see
  21. <<encrypt-internode-communication>>.
  22. The API returns a list that includes certificates from all TLS contexts
  23. including:
  24. * Settings for transport and HTTP interfaces
  25. * TLS settings that are used within authentication realms
  26. * TLS settings for remote monitoring exporters
  27. The list includes certificates that are used for configuring trust, such as
  28. those configured in the `xpack.security.transport.ssl.truststore` and
  29. `xpack.security.transport.ssl.certificate_authorities` settings. It also
  30. includes certificates that are used for configuring server identity, such as
  31. `xpack.security.http.ssl.keystore` and
  32. `xpack.security.http.ssl.certificate` settings.
  33. The list does not include certificates that are sourced from the default SSL
  34. context of the Java Runtime Environment (JRE), even if those certificates are in
  35. use within {es}.
  36. NOTE: When a PKCS#11 token is configured as the truststore of the JRE, the API
  37. will return all the certificates that are included in the PKCS#11 token
  38. irrespectively to whether these are used in the {es} TLS configuration or not.
  39. If {es} is configured to use a keystore or truststore, the API output
  40. includes all certificates in that store, even though some of the certificates
  41. might not be in active use within the cluster.
  42. [[security-api-ssl-response-body]]
  43. ==== {api-response-body-title}
  44. The response is an array of objects, with each object representing a
  45. single certificate. The fields in each object are:
  46. `path`:: (string) The path to the certificate, as configured in the
  47. `elasticsearch.yml` file.
  48. `format`:: (string) The format of the file. One of: `jks`, `PKCS12`, `PEM`.
  49. `alias`:: (string) If the path refers to a container file (a jks keystore, or a
  50. PKCS#12 file), the alias of the certificate. Otherwise, null.
  51. `subject_dn`:: (string) The Distinguished Name of the certificate's subject.
  52. `serial_number`:: (string) The hexadecimal representation of the certificate's
  53. serial number.
  54. `has_private_key`:: (Boolean) Indicates whether {es} has access to the private
  55. key for this certificate.
  56. `expiry`:: (string) The ISO formatted date of the certificate's expiry
  57. (not-after) date.
  58. `issuer`:: (string) The Distinguished Name of the certificate's issuer.
  59. [[security-api-ssl-example]]
  60. ==== {api-examples-title}
  61. The following example provides information about the certificates on a single
  62. node of {es}:
  63. [source,console]
  64. --------------------------------------------------
  65. GET /_ssl/certificates
  66. --------------------------------------------------
  67. The API returns the following results:
  68. [source,js]
  69. ----
  70. [
  71. {
  72. "path": "certs/elastic-certificates.p12",
  73. "format": "PKCS12",
  74. "alias": "instance",
  75. "subject_dn": "CN=Elastic Certificate Tool Autogenerated CA",
  76. "serial_number": "a20f0ee901e8f69dc633ff633e5cd5437cdb4137",
  77. "has_private_key": false,
  78. "expiry": "2021-01-15T20:42:49.000Z"
  79. },
  80. {
  81. "path": "certs/elastic-certificates.p12",
  82. "format": "PKCS12",
  83. "alias": "ca",
  84. "subject_dn": "CN=Elastic Certificate Tool Autogenerated CA",
  85. "serial_number": "a20f0ee901e8f69dc633ff633e5cd5437cdb4137",
  86. "has_private_key": false,
  87. "expiry": "2021-01-15T20:42:49.000Z"
  88. },
  89. {
  90. "path": "certs/elastic-certificates.p12",
  91. "format": "PKCS12",
  92. "alias": "instance",
  93. "subject_dn": "CN=instance",
  94. "serial_number": "fc1905e1494dc5230218d079c47a617088f84ce0",
  95. "has_private_key": true,
  96. "expiry": "2021-01-15T20:44:32.000Z"
  97. }
  98. ]
  99. ----
  100. // NOTCONSOLE