common.proto 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  1. syntax = "proto3";
  2. package envoy.api.v2.auth;
  3. import "envoy/api/v2/core/base.proto";
  4. import "envoy/type/matcher/string.proto";
  5. import "google/protobuf/any.proto";
  6. import "google/protobuf/struct.proto";
  7. import "google/protobuf/wrappers.proto";
  8. import "udpa/annotations/migrate.proto";
  9. import "udpa/annotations/sensitive.proto";
  10. import "udpa/annotations/status.proto";
  11. import "validate/validate.proto";
  12. option java_package = "io.envoyproxy.envoy.api.v2.auth";
  13. option java_outer_classname = "CommonProto";
  14. option java_multiple_files = true;
  15. option go_package = "github.com/envoyproxy/go-control-plane/envoy/api/v2/auth";
  16. option (udpa.annotations.file_migrate).move_to_package =
  17. "envoy.extensions.transport_sockets.tls.v3";
  18. option (udpa.annotations.file_status).package_version_status = FROZEN;
  19. // [#protodoc-title: Common TLS configuration]
  20. message TlsParameters {
  21. enum TlsProtocol {
  22. // Envoy will choose the optimal TLS version.
  23. TLS_AUTO = 0;
  24. // TLS 1.0
  25. TLSv1_0 = 1;
  26. // TLS 1.1
  27. TLSv1_1 = 2;
  28. // TLS 1.2
  29. TLSv1_2 = 3;
  30. // TLS 1.3
  31. TLSv1_3 = 4;
  32. }
  33. // Minimum TLS protocol version. By default, it's ``TLSv1_2`` for both clients and servers.
  34. TlsProtocol tls_minimum_protocol_version = 1 [(validate.rules).enum = {defined_only: true}];
  35. // Maximum TLS protocol version. By default, it's ``TLSv1_2`` for clients and ``TLSv1_3`` for
  36. // servers.
  37. TlsProtocol tls_maximum_protocol_version = 2 [(validate.rules).enum = {defined_only: true}];
  38. // If specified, the TLS listener will only support the specified `cipher list
  39. // <https://commondatastorage.googleapis.com/chromium-boringssl-docs/ssl.h.html#Cipher-suite-configuration>`_
  40. // when negotiating TLS 1.0-1.2 (this setting has no effect when negotiating TLS 1.3). If not
  41. // specified, the default list will be used.
  42. //
  43. // In non-FIPS builds, the default cipher list is:
  44. //
  45. // .. code-block:: none
  46. //
  47. // [ECDHE-ECDSA-AES128-GCM-SHA256|ECDHE-ECDSA-CHACHA20-POLY1305]
  48. // [ECDHE-RSA-AES128-GCM-SHA256|ECDHE-RSA-CHACHA20-POLY1305]
  49. // ECDHE-ECDSA-AES128-SHA
  50. // ECDHE-RSA-AES128-SHA
  51. // AES128-GCM-SHA256
  52. // AES128-SHA
  53. // ECDHE-ECDSA-AES256-GCM-SHA384
  54. // ECDHE-RSA-AES256-GCM-SHA384
  55. // ECDHE-ECDSA-AES256-SHA
  56. // ECDHE-RSA-AES256-SHA
  57. // AES256-GCM-SHA384
  58. // AES256-SHA
  59. //
  60. // In builds using :ref:`BoringSSL FIPS <arch_overview_ssl_fips>`, the default cipher list is:
  61. //
  62. // .. code-block:: none
  63. //
  64. // ECDHE-ECDSA-AES128-GCM-SHA256
  65. // ECDHE-RSA-AES128-GCM-SHA256
  66. // ECDHE-ECDSA-AES128-SHA
  67. // ECDHE-RSA-AES128-SHA
  68. // AES128-GCM-SHA256
  69. // AES128-SHA
  70. // ECDHE-ECDSA-AES256-GCM-SHA384
  71. // ECDHE-RSA-AES256-GCM-SHA384
  72. // ECDHE-ECDSA-AES256-SHA
  73. // ECDHE-RSA-AES256-SHA
  74. // AES256-GCM-SHA384
  75. // AES256-SHA
  76. repeated string cipher_suites = 3;
  77. // If specified, the TLS connection will only support the specified ECDH
  78. // curves. If not specified, the default curves will be used.
  79. //
  80. // In non-FIPS builds, the default curves are:
  81. //
  82. // .. code-block:: none
  83. //
  84. // X25519
  85. // P-256
  86. //
  87. // In builds using :ref:`BoringSSL FIPS <arch_overview_ssl_fips>`, the default curve is:
  88. //
  89. // .. code-block:: none
  90. //
  91. // P-256
  92. repeated string ecdh_curves = 4;
  93. }
  94. // BoringSSL private key method configuration. The private key methods are used for external
  95. // (potentially asynchronous) signing and decryption operations. Some use cases for private key
  96. // methods would be TPM support and TLS acceleration.
  97. message PrivateKeyProvider {
  98. // Private key method provider name. The name must match a
  99. // supported private key method provider type.
  100. string provider_name = 1 [(validate.rules).string = {min_bytes: 1}];
  101. // Private key method provider specific configuration.
  102. oneof config_type {
  103. google.protobuf.Struct config = 2 [deprecated = true, (udpa.annotations.sensitive) = true];
  104. google.protobuf.Any typed_config = 3 [(udpa.annotations.sensitive) = true];
  105. }
  106. }
  107. // [#next-free-field: 7]
  108. message TlsCertificate {
  109. // The TLS certificate chain.
  110. core.DataSource certificate_chain = 1;
  111. // The TLS private key.
  112. core.DataSource private_key = 2 [(udpa.annotations.sensitive) = true];
  113. // BoringSSL private key method provider. This is an alternative to :ref:`private_key
  114. // <envoy_api_field_auth.TlsCertificate.private_key>` field. This can't be
  115. // marked as ``oneof`` due to API compatibility reasons. Setting both :ref:`private_key
  116. // <envoy_api_field_auth.TlsCertificate.private_key>` and
  117. // :ref:`private_key_provider
  118. // <envoy_api_field_auth.TlsCertificate.private_key_provider>` fields will result in an
  119. // error.
  120. PrivateKeyProvider private_key_provider = 6;
  121. // The password to decrypt the TLS private key. If this field is not set, it is assumed that the
  122. // TLS private key is not password encrypted.
  123. core.DataSource password = 3 [(udpa.annotations.sensitive) = true];
  124. // [#not-implemented-hide:]
  125. core.DataSource ocsp_staple = 4;
  126. // [#not-implemented-hide:]
  127. repeated core.DataSource signed_certificate_timestamp = 5;
  128. }
  129. message TlsSessionTicketKeys {
  130. // Keys for encrypting and decrypting TLS session tickets. The
  131. // first key in the array contains the key to encrypt all new sessions created by this context.
  132. // All keys are candidates for decrypting received tickets. This allows for easy rotation of keys
  133. // by, for example, putting the new key first, and the previous key second.
  134. //
  135. // If :ref:`session_ticket_keys <envoy_api_field_auth.DownstreamTlsContext.session_ticket_keys>`
  136. // is not specified, the TLS library will still support resuming sessions via tickets, but it will
  137. // use an internally-generated and managed key, so sessions cannot be resumed across hot restarts
  138. // or on different hosts.
  139. //
  140. // Each key must contain exactly 80 bytes of cryptographically-secure random data. For
  141. // example, the output of ``openssl rand 80``.
  142. //
  143. // .. attention::
  144. //
  145. // Using this feature has serious security considerations and risks. Improper handling of keys
  146. // may result in loss of secrecy in connections, even if ciphers supporting perfect forward
  147. // secrecy are used. See https://www.imperialviolet.org/2013/06/27/botchingpfs.html for some
  148. // discussion. To minimize the risk, you must:
  149. //
  150. // * Keep the session ticket keys at least as secure as your TLS certificate private keys
  151. // * Rotate session ticket keys at least daily, and preferably hourly
  152. // * Always generate keys using a cryptographically-secure random data source
  153. repeated core.DataSource keys = 1
  154. [(validate.rules).repeated = {min_items: 1}, (udpa.annotations.sensitive) = true];
  155. }
  156. // [#next-free-field: 11]
  157. message CertificateValidationContext {
  158. // Peer certificate verification mode.
  159. enum TrustChainVerification {
  160. // Perform default certificate verification (e.g., against CA / verification lists)
  161. VERIFY_TRUST_CHAIN = 0;
  162. // Connections where the certificate fails verification will be permitted.
  163. // For HTTP connections, the result of certificate verification can be used in route matching. (
  164. // see :ref:`validated <envoy_api_field_route.RouteMatch.TlsContextMatchOptions.validated>` ).
  165. ACCEPT_UNTRUSTED = 1;
  166. }
  167. // TLS certificate data containing certificate authority certificates to use in verifying
  168. // a presented peer certificate (e.g. server certificate for clusters or client certificate
  169. // for listeners). If not specified and a peer certificate is presented it will not be
  170. // verified. By default, a client certificate is optional, unless one of the additional
  171. // options (:ref:`require_client_certificate
  172. // <envoy_api_field_auth.DownstreamTlsContext.require_client_certificate>`,
  173. // :ref:`verify_certificate_spki
  174. // <envoy_api_field_auth.CertificateValidationContext.verify_certificate_spki>`,
  175. // :ref:`verify_certificate_hash
  176. // <envoy_api_field_auth.CertificateValidationContext.verify_certificate_hash>`, or
  177. // :ref:`match_subject_alt_names
  178. // <envoy_api_field_auth.CertificateValidationContext.match_subject_alt_names>`) is also
  179. // specified.
  180. //
  181. // It can optionally contain certificate revocation lists, in which case Envoy will verify
  182. // that the presented peer certificate has not been revoked by one of the included CRLs.
  183. //
  184. // See :ref:`the TLS overview <arch_overview_ssl_enabling_verification>` for a list of common
  185. // system CA locations.
  186. core.DataSource trusted_ca = 1;
  187. // An optional list of base64-encoded SHA-256 hashes. If specified, Envoy will verify that the
  188. // SHA-256 of the DER-encoded Subject Public Key Information (SPKI) of the presented certificate
  189. // matches one of the specified values.
  190. //
  191. // A base64-encoded SHA-256 of the Subject Public Key Information (SPKI) of the certificate
  192. // can be generated with the following command:
  193. //
  194. // .. code-block:: bash
  195. //
  196. // $ openssl x509 -in path/to/client.crt -noout -pubkey
  197. // | openssl pkey -pubin -outform DER
  198. // | openssl dgst -sha256 -binary
  199. // | openssl enc -base64
  200. // NvqYIYSbgK2vCJpQhObf77vv+bQWtc5ek5RIOwPiC9A=
  201. //
  202. // This is the format used in HTTP Public Key Pinning.
  203. //
  204. // When both:
  205. // :ref:`verify_certificate_hash
  206. // <envoy_api_field_auth.CertificateValidationContext.verify_certificate_hash>` and
  207. // :ref:`verify_certificate_spki
  208. // <envoy_api_field_auth.CertificateValidationContext.verify_certificate_spki>` are specified,
  209. // a hash matching value from either of the lists will result in the certificate being accepted.
  210. //
  211. // .. attention::
  212. //
  213. // This option is preferred over :ref:`verify_certificate_hash
  214. // <envoy_api_field_auth.CertificateValidationContext.verify_certificate_hash>`,
  215. // because SPKI is tied to a private key, so it doesn't change when the certificate
  216. // is renewed using the same private key.
  217. repeated string verify_certificate_spki = 3
  218. [(validate.rules).repeated = {items {string {min_bytes: 44 max_bytes: 44}}}];
  219. // An optional list of hex-encoded SHA-256 hashes. If specified, Envoy will verify that
  220. // the SHA-256 of the DER-encoded presented certificate matches one of the specified values.
  221. //
  222. // A hex-encoded SHA-256 of the certificate can be generated with the following command:
  223. //
  224. // .. code-block:: bash
  225. //
  226. // $ openssl x509 -in path/to/client.crt -outform DER | openssl dgst -sha256 | cut -d" " -f2
  227. // df6ff72fe9116521268f6f2dd4966f51df479883fe7037b39f75916ac3049d1a
  228. //
  229. // A long hex-encoded and colon-separated SHA-256 (a.k.a. "fingerprint") of the certificate
  230. // can be generated with the following command:
  231. //
  232. // .. code-block:: bash
  233. //
  234. // $ openssl x509 -in path/to/client.crt -noout -fingerprint -sha256 | cut -d"=" -f2
  235. // DF:6F:F7:2F:E9:11:65:21:26:8F:6F:2D:D4:96:6F:51:DF:47:98:83:FE:70:37:B3:9F:75:91:6A:C3:04:9D:1A
  236. //
  237. // Both of those formats are acceptable.
  238. //
  239. // When both:
  240. // :ref:`verify_certificate_hash
  241. // <envoy_api_field_auth.CertificateValidationContext.verify_certificate_hash>` and
  242. // :ref:`verify_certificate_spki
  243. // <envoy_api_field_auth.CertificateValidationContext.verify_certificate_spki>` are specified,
  244. // a hash matching value from either of the lists will result in the certificate being accepted.
  245. repeated string verify_certificate_hash = 2
  246. [(validate.rules).repeated = {items {string {min_bytes: 64 max_bytes: 95}}}];
  247. // An optional list of Subject Alternative Names. If specified, Envoy will verify that the
  248. // Subject Alternative Name of the presented certificate matches one of the specified values.
  249. //
  250. // .. attention::
  251. //
  252. // Subject Alternative Names are easily spoofable and verifying only them is insecure,
  253. // therefore this option must be used together with :ref:`trusted_ca
  254. // <envoy_api_field_auth.CertificateValidationContext.trusted_ca>`.
  255. repeated string verify_subject_alt_name = 4 [deprecated = true];
  256. // An optional list of Subject Alternative name matchers. Envoy will verify that the
  257. // Subject Alternative Name of the presented certificate matches one of the specified matches.
  258. //
  259. // When a certificate has wildcard DNS SAN entries, to match a specific client, it should be
  260. // configured with exact match type in the :ref:`string matcher <envoy_api_msg_type.matcher.StringMatcher>`.
  261. // For example if the certificate has "\*.example.com" as DNS SAN entry, to allow only "api.example.com",
  262. // it should be configured as shown below.
  263. //
  264. // .. code-block:: yaml
  265. //
  266. // match_subject_alt_names:
  267. // exact: "api.example.com"
  268. //
  269. // .. attention::
  270. //
  271. // Subject Alternative Names are easily spoofable and verifying only them is insecure,
  272. // therefore this option must be used together with :ref:`trusted_ca
  273. // <envoy_api_field_auth.CertificateValidationContext.trusted_ca>`.
  274. repeated type.matcher.StringMatcher match_subject_alt_names = 9;
  275. // [#not-implemented-hide:] Must present a signed time-stamped OCSP response.
  276. google.protobuf.BoolValue require_ocsp_staple = 5;
  277. // [#not-implemented-hide:] Must present signed certificate time-stamp.
  278. google.protobuf.BoolValue require_signed_certificate_timestamp = 6;
  279. // An optional `certificate revocation list
  280. // <https://en.wikipedia.org/wiki/Certificate_revocation_list>`_
  281. // (in PEM format). If specified, Envoy will verify that the presented peer
  282. // certificate has not been revoked by this CRL. If this DataSource contains
  283. // multiple CRLs, all of them will be used.
  284. core.DataSource crl = 7;
  285. // If specified, Envoy will not reject expired certificates.
  286. bool allow_expired_certificate = 8;
  287. // Certificate trust chain verification mode.
  288. TrustChainVerification trust_chain_verification = 10
  289. [(validate.rules).enum = {defined_only: true}];
  290. }