ssl.asciidoc 4.2 KB

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