ssl.asciidoc 3.9 KB

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