ssl.asciidoc 3.8 KB

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