Skip to content

Commit

Permalink
Merge pull request envoyproxy#143 from jwendell/latest-120-commits
Browse files Browse the repository at this point in the history
OSSM-1264: Merge latest commits from Envoy 1.20
  • Loading branch information
maistra-bot authored Mar 24, 2022
2 parents b1ae6b2 + 4495532 commit 61a066d
Show file tree
Hide file tree
Showing 97 changed files with 1,810 additions and 369 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.20.1
1.20.3-dev
41 changes: 35 additions & 6 deletions api/envoy/extensions/transport_sockets/tls/v3/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import "envoy/type/matcher/v3/string.proto";
import "google/protobuf/any.proto";
import "google/protobuf/wrappers.proto";

import "envoy/annotations/deprecation.proto";
import "udpa/annotations/migrate.proto";
import "udpa/annotations/sensitive.proto";
import "udpa/annotations/status.proto";
Expand Down Expand Up @@ -253,7 +254,26 @@ message CertificateProviderPluginInstance {
string certificate_name = 2;
}

// [#next-free-field: 14]
// Matcher for subject alternative names, to match both type and value of the SAN.
message SubjectAltNameMatcher {
// Indicates the choice of GeneralName as defined in section 4.2.1.5 of RFC 5280 to match
// against.
enum SanType {
SAN_TYPE_UNSPECIFIED = 0;
EMAIL = 1;
DNS = 2;
URI = 3;
IP_ADDRESS = 4;
}

// Specification of type of SAN. Note that the default enum value is an invalid choice.
SanType san_type = 1 [(validate.rules).enum = {defined_only: true not_in: 0}];

// Matcher for SAN value.
type.matcher.v3.StringMatcher matcher = 2 [(validate.rules).message = {required: true}];
}

// [#next-free-field: 16]
message CertificateValidationContext {
option (udpa.annotations.versioning).previous_message_type =
"envoy.api.v2.auth.CertificateValidationContext";
Expand Down Expand Up @@ -283,8 +303,8 @@ message CertificateValidationContext {
// <envoy_v3_api_field_extensions.transport_sockets.tls.v3.CertificateValidationContext.verify_certificate_spki>`,
// :ref:`verify_certificate_hash
// <envoy_v3_api_field_extensions.transport_sockets.tls.v3.CertificateValidationContext.verify_certificate_hash>`, or
// :ref:`match_subject_alt_names
// <envoy_v3_api_field_extensions.transport_sockets.tls.v3.CertificateValidationContext.match_subject_alt_names>`) is also
// :ref:`match_typed_subject_alt_names
// <envoy_v3_api_field_extensions.transport_sockets.tls.v3.CertificateValidationContext.match_typed_subject_alt_names>`) is also
// specified.
//
// It can optionally contain certificate revocation lists, in which case Envoy will verify
Expand Down Expand Up @@ -388,6 +408,8 @@ message CertificateValidationContext {

// An optional list of Subject Alternative name matchers. If specified, Envoy will verify that the
// Subject Alternative Name of the presented certificate matches one of the specified matchers.
// The matching uses "any" semantics, that is to say, the SAN is verified if at least one matcher is
// matched.
//
// When a certificate has wildcard DNS SAN entries, to match a specific client, it should be
// configured with exact match type in the :ref:`string matcher <envoy_v3_api_msg_type.matcher.v3.StringMatcher>`.
Expand All @@ -396,15 +418,22 @@ message CertificateValidationContext {
//
// .. code-block:: yaml
//
// match_subject_alt_names:
// exact: "api.example.com"
// match_typed_subject_alt_names:
// - san_type: DNS
// matcher:
// exact: "api.example.com"
//
// .. attention::
//
// Subject Alternative Names are easily spoofable and verifying only them is insecure,
// therefore this option must be used together with :ref:`trusted_ca
// <envoy_v3_api_field_extensions.transport_sockets.tls.v3.CertificateValidationContext.trusted_ca>`.
repeated type.matcher.v3.StringMatcher match_subject_alt_names = 9;
repeated SubjectAltNameMatcher match_typed_subject_alt_names = 15;

// This field is deprecated in favor of ref:`match_typed_subject_alt_names
// <envoy_v3_api_field_extensions.transport_sockets.tls.v3.CertificateValidationContext.match_typed_subject_alt_names>`
repeated type.matcher.v3.StringMatcher match_subject_alt_names = 9
[deprecated = true, (envoy.annotations.deprecated_at_minor_version) = "3.0"];

// [#not-implemented-hide:] Must present signed certificate time-stamp.
google.protobuf.BoolValue require_signed_certificate_timestamp = 6;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ option (udpa.annotations.file_status).package_version_status = ACTIVE;
// Note that SPIFFE validator inherits and uses the following options from :ref:`CertificateValidationContext <envoy_v3_api_msg_extensions.transport_sockets.tls.v3.CertificateValidationContext>`.
//
// - :ref:`allow_expired_certificate <envoy_v3_api_field_extensions.transport_sockets.tls.v3.CertificateValidationContext.allow_expired_certificate>` to allow expired certificates.
// - :ref:`match_subject_alt_names <envoy_v3_api_field_extensions.transport_sockets.tls.v3.CertificateValidationContext.match_subject_alt_names>` to match **URI** SAN of certificates. Unlike the default validator, SPIFFE validator only matches **URI** SAN (which equals to SVID in SPIFFE terminology) and ignore other SAN types.
// - :ref:`match_typed_subject_alt_names <envoy_v3_api_field_extensions.transport_sockets.tls.v3.CertificateValidationContext.match_typed_subject_alt_names>` to match **URI** SAN of certificates. Unlike the default validator, SPIFFE validator only matches **URI** SAN (which equals to SVID in SPIFFE terminology) and ignore other SAN types.
//
message SPIFFECertValidatorConfig {
message TrustDomain {
Expand Down
8 changes: 4 additions & 4 deletions bazel/repository_locations.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ REPOSITORY_LOCATIONS_SPEC = dict(
project_name = "Gazelle",
project_desc = "Bazel BUILD file generator for Go projects",
project_url = "https://github.com/bazelbuild/bazel-gazelle",
version = "0.22.3",
sha256 = "222e49f034ca7a1d1231422cdb67066b885819885c356673cb1f72f748a3c9d4",
version = "0.24.0",
sha256 = "de69a09dc70417580aabf20a28619bb3ef60d038470c7cf8442fafcf627c21cb",
urls = ["https://github.com/bazelbuild/bazel-gazelle/releases/download/v{version}/bazel-gazelle-v{version}.tar.gz"],
release_date = "2020-12-23",
release_date = "2021-10-11",
use_category = ["build"],
),
bazel_toolchains = dict(
Expand Down Expand Up @@ -955,7 +955,7 @@ REPOSITORY_LOCATIONS_SPEC = dict(
urls = ["https://github.com/edenhill/librdkafka/archive/v{version}.tar.gz"],
use_category = ["dataplane_ext"],
extensions = ["envoy.filters.network.kafka_mesh"],
release_date = "2021-05-10",
release_date = "2021-05-06",
cpe = "N/A",
),
kafka_server_binary = dict(
Expand Down
2 changes: 2 additions & 0 deletions ci/filter_example_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ sed -e "s|{ENVOY_SRCDIR}|${ENVOY_SRCDIR}|" "${ENVOY_SRCDIR}"/ci/WORKSPACE.filter
mkdir -p "${ENVOY_FILTER_EXAMPLE_SRCDIR}"/bazel
ln -sf "${ENVOY_SRCDIR}"/bazel/get_workspace_status "${ENVOY_FILTER_EXAMPLE_SRCDIR}"/bazel/
cp -f "${ENVOY_SRCDIR}"/.bazelrc "${ENVOY_FILTER_EXAMPLE_SRCDIR}"/
rm -f "${ENVOY_FILTER_EXAMPLE_SRCDIR}"/.bazelversion
cp -f "${ENVOY_SRCDIR}"/.bazelversion "${ENVOY_FILTER_EXAMPLE_SRCDIR}"/
cp -f "$(bazel info workspace)"/*.bazelrc "${ENVOY_FILTER_EXAMPLE_SRCDIR}"/

export FILTER_WORKSPACE_SET=1
12 changes: 8 additions & 4 deletions configs/envoy_double_proxy.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,10 @@ static_resources:
validation_context:
trusted_ca:
filename: certs/cacert.pem
match_subject_alt_names:
exact: "front-proxy.yourcompany.net"
match_typed_subject_alt_names:
- san_type: DNS
matcher:
exact: "front-proxy.yourcompany.net"
typed_extension_protocol_options:
envoy.extensions.upstreams.http.v3.HttpProtocolOptions:
"@type": type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions
Expand Down Expand Up @@ -188,8 +190,10 @@ static_resources:
validation_context:
trusted_ca:
filename: certs/cacert.pem
match_subject_alt_names:
exact: "collector-grpc.lightstep.com"
match_typed_subject_alt_names:
- san_type: DNS
matcher:
exact: "collector-grpc.lightstep.com"
flags_path: "/etc/envoy/flags"
stats_sinks:
- name: envoy.stat_sinks.statsd
Expand Down
12 changes: 8 additions & 4 deletions configs/envoy_service_to_service.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,10 @@ static_resources:
trusted_ca:
filename: certs/cacert.pem
{% if host.get('verify_subject_alt_name', False) %}
match_subject_alt_names:
exact: "{{host['verify_subject_alt_name'] }}"
match_typed_subject_alt_names:
- san_type: DNS
matcher:
exact: "{{host['verify_subject_alt_name'] }}"
{% endif %}
{% if host.get('sni', False) %}
sni: "{{ host['sni'] }}"
Expand Down Expand Up @@ -520,8 +522,10 @@ static_resources:
validation_context:
trusted_ca:
filename: certs/cacert.pem
match_subject_alt_names:
exact: "collector-grpc.lightstep.com"
match_typed_subject_alt_names:
- san_type: DNS
matcher:
exact: "collector-grpc.lightstep.com"
- name: cds_cluster
connect_timeout: 0.25s
type: STRICT_DNS
Expand Down
6 changes: 4 additions & 2 deletions docs/root/intro/arch_overview/security/_include/ssl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ static_resources:
private_key: {"filename": "certs/serverkey.pem"}
ocsp_staple: {"filename": "certs/server_ocsp_resp.der"}
validation_context:
match_subject_alt_names:
- exact: "foo"
match_typed_subject_alt_names:
- san_type: DNS
matcher:
exact: "foo"
trusted_ca:
filename: /etc/ssl/certs/ca-certificates.crt
2 changes: 1 addition & 1 deletion docs/root/intro/arch_overview/security/ssl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Example configuration

*/etc/ssl/certs/ca-certificates.crt* is the default path for the system CA bundle on Debian systems.
:ref:`trusted_ca <envoy_v3_api_field_extensions.transport_sockets.tls.v3.CertificateValidationContext.trusted_ca>` along with
:ref:`match_subject_alt_names <envoy_v3_api_field_extensions.transport_sockets.tls.v3.CertificateValidationContext.match_subject_alt_names>`
:ref:`match_typed_subject_alt_names <envoy_v3_api_field_extensions.transport_sockets.tls.v3.CertificateValidationContext.match_typed_subject_alt_names>`
makes Envoy verify the server identity of *127.0.0.1:1234* as "foo" in the same way as e.g. cURL
does on standard Debian installations. Common paths for system CA bundles on Linux and BSD are:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ static_resources:
validation_context:
trusted_ca:
filename: certs/cacert.pem
match_subject_alt_names:
- exact: proxy-postgres-frontend.example.com
match_typed_subject_alt_names:
- san_type: DNS
matcher:
exact: proxy-postgres-frontend.example.com
tls_certificates:
- certificate_chain:
filename: certs/servercert.pem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,7 @@ static_resources:
validation_context:
trusted_ca:
filename: certs/cacert.pem
match_subject_alt_names:
- exact: proxy-postgres-backend.example.com
match_typed_subject_alt_names:
- san_type: DNS
matcher:
exact: proxy-postgres-backend.example.com
12 changes: 6 additions & 6 deletions docs/root/start/quick-start/securing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ certificate is valid for.
.. note::

If the "Subject Alternative Names" for a certificate are for a wildcard domain, eg ``*.example.com``,
this is what you should use when matching with ``match_subject_alt_names``.
this is what you should use when matching with ``match_typed_subject_alt_names``.

.. note::

Expand All @@ -122,20 +122,20 @@ and specify a mutually trusted certificate authority:
:language: yaml
:linenos:
:lineno-start: 27
:lines: 27-39
:lines: 27-41
:emphasize-lines: 6, 8-10
:caption: :download:`envoy-demo-tls-client-auth.yaml <_include/envoy-demo-tls-client-auth.yaml>`

You can further restrict the authentication of connecting clients by specifying the allowed
"Subject Alternative Names" in
:ref:`match_subject_alt_names <envoy_v3_api_field_extensions.transport_sockets.tls.v3.CertificateValidationContext.match_subject_alt_names>`,
:ref:`match_typed_subject_alt_names <envoy_v3_api_field_extensions.transport_sockets.tls.v3.CertificateValidationContext.match_typed_subject_alt_names>`,
similar to validating upstream certificates :ref:`described above <start_quick_start_securing_validation>`.

.. literalinclude:: _include/envoy-demo-tls-client-auth.yaml
:language: yaml
:linenos:
:lineno-start: 27
:lines: 27-39
:lines: 27-41
:emphasize-lines: 7, 11-12
:caption: :download:`envoy-demo-tls-client-auth.yaml <_include/envoy-demo-tls-client-auth.yaml>`

Expand All @@ -154,8 +154,8 @@ When connecting to an upstream with client certificates you can set them as foll
.. literalinclude:: _include/envoy-demo-tls-client-auth.yaml
:language: yaml
:linenos:
:lineno-start: 44
:lines: 44-68
:lineno-start: 46
:lines: 46-70
:emphasize-lines: 20-25
:caption: :download:`envoy-demo-tls-client-auth.yaml <_include/envoy-demo-tls-client-auth.yaml>`

Expand Down
12 changes: 3 additions & 9 deletions docs/root/version_history/current.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
1.20.1 (November 30, 2021)
==========================
1.20.3 (Pending)
========================

Incompatible Behavior Changes
-----------------------------
Expand All @@ -9,18 +9,12 @@ Minor Behavior Changes
----------------------
*Changes that may cause incompatibilities for some users, but should not for most*

* config: the log message for "gRPC config stream closed" now uses the most recent error message, and reports seconds instead of milliseconds for how long the most recent status has been received.
* perf: ssl contexts are now tracked without scan based garbage collection and greatly improved the performance on secret update.

Bug Fixes
---------
*Changes expected to improve the state of the world and are unlikely to have negative effects*

* http: remove redundant Warn log in HTTP codec.
* listener: fix a crash when updating any listener that does not bind to port.
* listener: listener add can reuse the listener socket of a draining filter chain listener and fix the request lost.
* mac: fix crash on startup on macOS 12 by changing the default allocator.
* tcp: fixed a bug where upstream circuit breakers applied HTTP per-request bounds to TCP connections.

Removed Config or Runtime
-------------------------
*Normally occurs at the end of the* :ref:`deprecation period <deprecated>`
Expand Down
32 changes: 32 additions & 0 deletions docs/root/version_history/v1.20.1.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
1.20.1 (November 30, 2021)
==========================

Incompatible Behavior Changes
-----------------------------
*Changes that are expected to cause an incompatibility if applicable; deployment changes are likely required*

Minor Behavior Changes
----------------------
*Changes that may cause incompatibilities for some users, but should not for most*

* config: the log message for "gRPC config stream closed" now uses the most recent error message, and reports seconds instead of milliseconds for how long the most recent status has been received.

Bug Fixes
---------
*Changes expected to improve the state of the world and are unlikely to have negative effects*

* http: remove redundant Warn log in HTTP codec.
* listener: fix a crash when updating any listener that does not bind to port.
* listener: listener add can reuse the listener socket of a draining filter chain listener and fix the request lost.
* mac: fix crash on startup on macOS 12 by changing the default allocator.
* tcp: fixed a bug where upstream circuit breakers applied HTTP per-request bounds to TCP connections.

Removed Config or Runtime
-------------------------
*Normally occurs at the end of the* :ref:`deprecation period <deprecated>`

New Features
------------

Deprecated
----------
34 changes: 34 additions & 0 deletions docs/root/version_history/v1.20.2.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
1.20.2 (February 22, 2022)
==========================

Incompatible Behavior Changes
-----------------------------
*Changes that are expected to cause an incompatibility if applicable; deployment changes are likely required*

Minor Behavior Changes
----------------------
*Changes that may cause incompatibilities for some users, but should not for most*

Bug Fixes
---------
*Changes expected to improve the state of the world and are unlikely to have negative effects*

* data plane: fix crash when internal redirect selects a route configured with direct response or redirect actions.
* jwt_authn: fixed the crash when a CONNECT request is sent to JWT filter configured with regex match on the Host header.
* tcp_proxy: fix a crash that occurs when configured for :ref:`upstream tunneling <envoy_v3_api_field_extensions.filters.network.tcp_proxy.v3.TcpProxy.tunneling_config>` and the downstream connection disconnects while the the upstream connection or http/2 stream is still being established.
* upstream: fix stack overflow when a cluster with large number of idle connections is removed.

Removed Config or Runtime
-------------------------
*Normally occurs at the end of the* :ref:`deprecation period <deprecated>`

New Features
------------

+* tls: added support for :ref:`match_typed_subject_alt_names <envoy_v3_api_field_extensions.transport_sockets.tls.v3.CertificateValidationContext.match_typed_subject_alt_names>` for subject alternative names to enforce specifying the subject alternative name type for the matcher to prevent matching against an unintended type in the certificate.


Deprecated
----------

+* tls: :ref:`match_subject_alt_names <envoy_v3_api_field_extensions.transport_sockets.tls.v3.CertificateValidationContext.match_subject_alt_names>` has been deprecated in favor of the :ref:`match_typed_subject_alt_names <envoy_v3_api_field_extensions.transport_sockets.tls.v3.CertificateValidationContext.match_typed_subject_alt_names>`.
2 changes: 2 additions & 0 deletions docs/root/version_history/version_history.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Version history
:titlesonly:

current
v1.20.2
v1.20.1
v1.20.0
v1.19.1
v1.19.0
Expand Down
3 changes: 2 additions & 1 deletion envoy/ssl/certificate_validation_context_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "envoy/api/api.h"
#include "envoy/common/pure.h"
#include "envoy/extensions/transport_sockets/tls/v3/cert.pb.h"
#include "envoy/extensions/transport_sockets/tls/v3/common.pb.h"
#include "envoy/type/matcher/v3/string.pb.h"

#include "absl/types/optional.h"
Expand Down Expand Up @@ -43,7 +44,7 @@ class CertificateValidationContextConfig {
/**
* @return The subject alt name matchers to be verified, if enabled.
*/
virtual const std::vector<envoy::type::matcher::v3::StringMatcher>&
virtual const std::vector<envoy::extensions::transport_sockets::tls::v3::SubjectAltNameMatcher>&
subjectAltNameMatchers() const PURE;

/**
Expand Down
Loading

0 comments on commit 61a066d

Please sign in to comment.