grpc 1.78.1 → 1.80.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Makefile +22 -8
- data/include/grpc/credentials.h +47 -37
- data/include/grpc/credentials_cpp.h +39 -0
- data/include/grpc/event_engine/event_engine.h +8 -3
- data/include/grpc/grpc.h +4 -0
- data/include/grpc/impl/call.h +9 -0
- data/include/grpc/impl/channel_arg_names.h +7 -0
- data/include/grpc/module.modulemap +2 -0
- data/include/grpc/private_key_signer.h +104 -0
- data/include/grpc/support/port_platform.h +6 -0
- data/src/core/call/call_filters.h +101 -78
- data/src/core/call/call_spine.h +91 -68
- data/src/core/call/call_state.h +60 -4
- data/src/core/call/client_call.cc +9 -9
- data/src/core/call/client_call.h +1 -1
- data/src/core/call/metadata_batch.cc +2 -0
- data/src/core/call/metadata_batch.h +48 -1
- data/src/core/call/metadata_info.cc +35 -0
- data/src/core/call/metadata_info.h +2 -0
- data/src/core/call/simple_slice_based_metadata.h +2 -1
- data/src/core/channelz/channelz.cc +9 -6
- data/src/core/channelz/channelz.h +7 -4
- data/src/core/channelz/property_list.h +5 -0
- data/src/core/channelz/v2tov1/convert.cc +1 -1
- data/src/core/channelz/v2tov1/legacy_api.cc +164 -307
- data/src/core/client_channel/buffered_call.cc +7 -3
- data/src/core/client_channel/buffered_call.h +11 -5
- data/src/core/client_channel/client_channel.cc +106 -44
- data/src/core/client_channel/client_channel.h +3 -6
- data/src/core/client_channel/client_channel_filter.cc +90 -64
- data/src/core/client_channel/client_channel_filter.h +3 -6
- data/src/core/client_channel/client_channel_internal.h +5 -0
- data/src/core/client_channel/config_selector.h +17 -12
- data/src/core/client_channel/dynamic_filters.cc +8 -7
- data/src/core/client_channel/dynamic_filters.h +7 -5
- data/src/core/client_channel/retry_filter.cc +1 -1
- data/src/core/client_channel/retry_filter.h +2 -2
- data/src/core/client_channel/subchannel.cc +1682 -266
- data/src/core/client_channel/subchannel.h +411 -134
- data/src/core/client_channel/subchannel_stream_client.cc +22 -18
- data/src/core/client_channel/subchannel_stream_client.h +8 -9
- data/src/core/client_channel/subchannel_stream_limiter.cc +76 -0
- data/src/core/client_channel/subchannel_stream_limiter.h +51 -0
- data/src/core/config/config_vars.cc +9 -1
- data/src/core/config/config_vars.h +6 -0
- data/src/core/credentials/call/call_creds_registry.h +51 -22
- data/src/core/credentials/call/call_creds_registry_init.cc +86 -2
- data/src/core/credentials/call/external/aws_external_account_credentials.cc +2 -2
- data/src/core/credentials/call/external/external_account_credentials.cc +11 -4
- data/src/core/credentials/call/external/file_external_account_credentials.cc +2 -2
- data/src/core/credentials/transport/channel_creds_registry.h +71 -20
- data/src/core/credentials/transport/channel_creds_registry_init.cc +338 -29
- data/src/core/credentials/transport/ssl/ssl_credentials.cc +43 -24
- data/src/core/credentials/transport/ssl/ssl_credentials.h +7 -1
- data/src/core/credentials/transport/ssl/ssl_security_connector.cc +2 -8
- data/src/core/credentials/transport/ssl/ssl_security_connector.h +4 -3
- data/src/core/credentials/transport/tls/grpc_tls_certificate_distributor.cc +25 -5
- data/src/core/credentials/transport/tls/grpc_tls_certificate_distributor.h +7 -5
- data/src/core/credentials/transport/tls/grpc_tls_certificate_provider.cc +181 -109
- data/src/core/credentials/transport/tls/grpc_tls_certificate_provider.h +55 -42
- data/src/core/credentials/transport/tls/grpc_tls_credentials_options.cc +28 -23
- data/src/core/credentials/transport/tls/grpc_tls_credentials_options.h +26 -23
- data/src/core/credentials/transport/tls/spiffe_utils.cc +2 -2
- data/src/core/credentials/transport/tls/ssl_utils.cc +18 -18
- data/src/core/credentials/transport/tls/ssl_utils.h +12 -10
- data/src/core/credentials/transport/tls/tls_security_connector.cc +106 -74
- data/src/core/credentials/transport/tls/tls_security_connector.h +12 -8
- data/src/core/credentials/transport/xds/xds_credentials.cc +76 -32
- data/src/core/credentials/transport/xds/xds_credentials.h +4 -2
- data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +117 -35
- data/src/core/ext/filters/fault_injection/fault_injection_filter.h +42 -4
- data/src/core/ext/filters/gcp_authentication/gcp_authentication_filter.cc +58 -29
- data/src/core/ext/filters/gcp_authentication/gcp_authentication_filter.h +19 -11
- data/src/core/ext/filters/stateful_session/stateful_session_filter.cc +82 -25
- data/src/core/ext/filters/stateful_session/stateful_session_filter.h +28 -3
- data/src/core/ext/filters/stateful_session/stateful_session_service_config_parser.cc +9 -7
- data/src/core/ext/filters/stateful_session/stateful_session_service_config_parser.h +1 -1
- data/src/core/ext/transport/chttp2/transport/call_tracer_wrapper.h +7 -1
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +117 -67
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +2 -0
- data/src/core/ext/transport/chttp2/transport/flow_control.h +11 -1
- data/src/core/ext/transport/chttp2/transport/frame.cc +2 -15
- data/src/core/ext/transport/chttp2/transport/frame.h +0 -4
- data/src/core/ext/transport/chttp2/transport/goaway.cc +17 -2
- data/src/core/ext/transport/chttp2/transport/goaway.h +27 -6
- data/src/core/ext/transport/chttp2/transport/header_assembler.h +8 -21
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +101 -40
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +95 -0
- data/src/core/ext/transport/chttp2/transport/http2_client_transport.cc +923 -772
- data/src/core/ext/transport/chttp2/transport/http2_client_transport.h +406 -423
- data/src/core/ext/transport/chttp2/transport/http2_settings.cc +1 -0
- data/src/core/ext/transport/chttp2/transport/http2_settings.h +8 -1
- data/src/core/ext/transport/chttp2/transport/http2_settings_promises.h +25 -13
- data/src/core/ext/transport/chttp2/transport/http2_transport.cc +71 -24
- data/src/core/ext/transport/chttp2/transport/http2_transport.h +25 -49
- data/src/core/ext/transport/chttp2/transport/http2_ztrace_collector.h +2 -2
- data/src/core/ext/transport/chttp2/transport/incoming_metadata_tracker.h +29 -9
- data/src/core/ext/transport/chttp2/transport/internal.h +6 -2
- data/src/core/ext/transport/chttp2/transport/keepalive.cc +14 -20
- data/src/core/ext/transport/chttp2/transport/keepalive.h +9 -6
- data/src/core/ext/transport/chttp2/transport/parsing.cc +11 -0
- data/src/core/ext/transport/chttp2/transport/ping_promise.cc +34 -74
- data/src/core/ext/transport/chttp2/transport/ping_promise.h +123 -79
- data/src/core/ext/transport/chttp2/transport/security_frame.h +233 -3
- data/src/core/ext/transport/chttp2/transport/stream.h +152 -73
- data/src/core/ext/transport/chttp2/transport/stream_data_queue.h +155 -85
- data/src/core/ext/transport/chttp2/transport/transport_common.h +0 -5
- data/src/core/ext/transport/chttp2/transport/writable_streams.h +8 -7
- data/src/core/ext/transport/chttp2/transport/write_cycle.cc +86 -0
- data/src/core/ext/transport/chttp2/transport/write_cycle.h +355 -0
- data/src/core/ext/transport/chttp2/transport/writing.cc +31 -29
- data/src/core/ext/upb-gen/cel/expr/checked.upb.h +1875 -0
- data/src/core/ext/upb-gen/cel/expr/checked.upb_minitable.c +409 -0
- data/src/core/ext/upb-gen/cel/expr/checked.upb_minitable.h +56 -0
- data/src/core/ext/upb-gen/cel/expr/syntax.upb.h +2223 -0
- data/src/core/ext/upb-gen/cel/expr/syntax.upb_minitable.c +489 -0
- data/src/core/ext/upb-gen/cel/expr/syntax.upb_minitable.h +60 -0
- data/src/core/ext/upb-gen/envoy/config/accesslog/v3/accesslog.upb.h +2 -1
- data/src/core/ext/upb-gen/envoy/config/bootstrap/v3/bootstrap.upb.h +130 -18
- data/src/core/ext/upb-gen/envoy/config/bootstrap/v3/bootstrap.upb_minitable.c +18 -13
- data/src/core/ext/upb-gen/envoy/config/cluster/v3/cluster.upb.h +70 -38
- data/src/core/ext/upb-gen/envoy/config/cluster/v3/cluster.upb_minitable.c +20 -17
- data/src/core/ext/upb-gen/envoy/config/common/matcher/v3/matcher.upb.h +26 -10
- data/src/core/ext/upb-gen/envoy/config/common/matcher/v3/matcher.upb_minitable.c +8 -7
- data/src/core/ext/upb-gen/envoy/config/common/mutation_rules/v3/mutation_rules.upb.h +495 -0
- data/src/core/ext/upb-gen/envoy/config/common/mutation_rules/v3/mutation_rules.upb_minitable.c +114 -0
- data/src/core/ext/upb-gen/envoy/config/common/mutation_rules/v3/mutation_rules.upb_minitable.h +36 -0
- data/src/core/ext/upb-gen/envoy/config/core/v3/address.upb.h +26 -10
- data/src/core/ext/upb-gen/envoy/config/core/v3/address.upb_minitable.c +8 -7
- data/src/core/ext/upb-gen/envoy/config/core/v3/cel.upb.h +121 -0
- data/src/core/ext/upb-gen/envoy/config/core/v3/cel.upb_minitable.c +54 -0
- data/src/core/ext/upb-gen/envoy/config/core/v3/cel.upb_minitable.h +32 -0
- data/src/core/ext/upb-gen/envoy/config/core/v3/grpc_service.upb.h +143 -9
- data/src/core/ext/upb-gen/envoy/config/core/v3/grpc_service.upb_minitable.c +18 -6
- data/src/core/ext/upb-gen/envoy/config/core/v3/protocol.upb.h +112 -11
- data/src/core/ext/upb-gen/envoy/config/core/v3/protocol.upb_minitable.c +22 -9
- data/src/core/ext/upb-gen/envoy/config/core/v3/proxy_protocol.upb.h +276 -0
- data/src/core/ext/upb-gen/envoy/config/core/v3/proxy_protocol.upb_minitable.c +60 -5
- data/src/core/ext/upb-gen/envoy/config/core/v3/proxy_protocol.upb_minitable.h +4 -0
- data/src/core/ext/upb-gen/envoy/config/endpoint/v3/endpoint_components.upb.h +72 -0
- data/src/core/ext/upb-gen/envoy/config/endpoint/v3/endpoint_components.upb_minitable.c +23 -2
- data/src/core/ext/upb-gen/envoy/config/endpoint/v3/endpoint_components.upb_minitable.h +2 -0
- data/src/core/ext/upb-gen/envoy/config/listener/v3/listener.upb.h +129 -13
- data/src/core/ext/upb-gen/envoy/config/listener/v3/listener.upb_minitable.c +36 -10
- data/src/core/ext/upb-gen/envoy/config/listener/v3/listener.upb_minitable.h +2 -0
- data/src/core/ext/upb-gen/envoy/config/listener/v3/quic_config.upb.h +30 -0
- data/src/core/ext/upb-gen/envoy/config/listener/v3/quic_config.upb_minitable.c +5 -3
- data/src/core/ext/upb-gen/envoy/config/metrics/v3/metrics_service.upb.h +16 -0
- data/src/core/ext/upb-gen/envoy/config/metrics/v3/metrics_service.upb_minitable.c +4 -3
- data/src/core/ext/upb-gen/envoy/config/metrics/v3/stats.upb.h +31 -0
- data/src/core/ext/upb-gen/envoy/config/metrics/v3/stats.upb_minitable.c +5 -3
- data/src/core/ext/upb-gen/envoy/config/overload/v3/overload.upb.h +2 -1
- data/src/core/ext/upb-gen/envoy/config/rbac/v3/rbac.upb.h +63 -0
- data/src/core/ext/upb-gen/envoy/config/rbac/v3/rbac.upb_minitable.c +12 -7
- data/src/core/ext/upb-gen/envoy/config/route/v3/route.upb.h +97 -81
- data/src/core/ext/upb-gen/envoy/config/route/v3/route.upb_minitable.c +40 -23
- data/src/core/ext/upb-gen/envoy/config/route/v3/route_components.upb.h +604 -228
- data/src/core/ext/upb-gen/envoy/config/route/v3/route_components.upb_minitable.c +146 -100
- data/src/core/ext/upb-gen/envoy/config/tap/v3/common.upb.h +30 -0
- data/src/core/ext/upb-gen/envoy/config/tap/v3/common.upb_minitable.c +5 -3
- data/src/core/ext/upb-gen/envoy/config/trace/v3/opentelemetry.upb.h +35 -3
- data/src/core/ext/upb-gen/envoy/config/trace/v3/opentelemetry.upb_minitable.c +7 -4
- data/src/core/ext/upb-gen/envoy/config/trace/v3/zipkin.upb.h +66 -14
- data/src/core/ext/upb-gen/envoy/config/trace/v3/zipkin.upb_minitable.c +22 -11
- data/src/core/ext/upb-gen/envoy/extensions/clusters/aggregate/v3/cluster.upb.h +87 -0
- data/src/core/ext/upb-gen/envoy/extensions/clusters/aggregate/v3/cluster.upb_minitable.c +29 -2
- data/src/core/ext/upb-gen/envoy/extensions/clusters/aggregate/v3/cluster.upb_minitable.h +2 -0
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/rbac/v3/rbac.upb.h +0 -1
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/rbac/v3/rbac.upb_minitable.c +0 -1
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/stateful_session/v3/stateful_session.upb.h +20 -4
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/stateful_session/v3/stateful_session.upb_minitable.c +5 -4
- data/src/core/ext/upb-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +239 -60
- data/src/core/ext/upb-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb_minitable.c +59 -28
- data/src/core/ext/upb-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb_minitable.h +2 -0
- data/src/core/ext/upb-gen/envoy/extensions/grpc_service/call_credentials/access_token/v3/access_token_credentials.upb.h +89 -0
- data/src/core/ext/upb-gen/envoy/extensions/grpc_service/call_credentials/access_token/v3/access_token_credentials.upb_minitable.c +50 -0
- data/src/core/ext/upb-gen/envoy/extensions/grpc_service/call_credentials/access_token/v3/access_token_credentials.upb_minitable.h +32 -0
- data/src/core/ext/upb-gen/envoy/extensions/grpc_service/channel_credentials/tls/v3/tls_credentials.upb.h +135 -0
- data/src/core/ext/upb-gen/envoy/extensions/grpc_service/channel_credentials/tls/v3/tls_credentials.upb_minitable.c +53 -0
- data/src/core/ext/upb-gen/envoy/extensions/grpc_service/channel_credentials/tls/v3/tls_credentials.upb_minitable.h +32 -0
- data/src/core/ext/upb-gen/envoy/extensions/grpc_service/channel_credentials/xds/v3/xds_credentials.upb.h +105 -0
- data/src/core/ext/upb-gen/envoy/extensions/grpc_service/channel_credentials/xds/v3/xds_credentials.upb_minitable.c +51 -0
- data/src/core/ext/upb-gen/envoy/extensions/grpc_service/channel_credentials/xds/v3/xds_credentials.upb_minitable.h +32 -0
- data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3/client_side_weighted_round_robin.upb.h +32 -0
- data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3/client_side_weighted_round_robin.upb_minitable.c +6 -3
- data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/common/v3/common.upb.h +206 -0
- data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/common/v3/common.upb_minitable.c +41 -8
- data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/common/v3/common.upb_minitable.h +2 -0
- data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/common.upb.h +64 -0
- data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/common.upb_minitable.c +4 -3
- data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/secret.upb.h +64 -0
- data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/secret.upb_minitable.c +31 -5
- data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/secret.upb_minitable.h +2 -0
- data/src/core/ext/upb-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upb.h +283 -14
- data/src/core/ext/upb-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upb_minitable.c +48 -11
- data/src/core/ext/upb-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upb_minitable.h +2 -0
- data/src/core/ext/upb-gen/envoy/type/http/v3/cookie.upb.h +144 -6
- data/src/core/ext/upb-gen/envoy/type/http/v3/cookie.upb_minitable.c +35 -7
- data/src/core/ext/upb-gen/envoy/type/http/v3/cookie.upb_minitable.h +2 -0
- data/src/core/ext/upb-gen/envoy/type/tracing/v3/custom_tag.upb.h +42 -21
- data/src/core/ext/upb-gen/envoy/type/tracing/v3/custom_tag.upb_minitable.c +9 -8
- data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/promise.upb.h +164 -1
- data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/promise.upb_minitable.c +37 -6
- data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/promise.upb_minitable.h +2 -0
- data/src/core/ext/upb-gen/xds/type/matcher/v3/cel.upb.h +0 -1
- data/src/core/ext/upb-gen/xds/type/matcher/v3/cel.upb_minitable.c +0 -1
- data/src/core/ext/upb-gen/xds/type/matcher/v3/http_inputs.upb.h +0 -1
- data/src/core/ext/upb-gen/xds/type/matcher/v3/http_inputs.upb_minitable.c +0 -1
- data/src/core/ext/upb-gen/xds/type/matcher/v3/matcher.upb.h +26 -11
- data/src/core/ext/upb-gen/xds/type/matcher/v3/matcher.upb_minitable.c +8 -8
- data/src/core/ext/upb-gen/xds/type/matcher/v3/string.upb.h +33 -0
- data/src/core/ext/upb-gen/xds/type/matcher/v3/string.upb_minitable.c +14 -3
- data/src/core/ext/upb-gen/xds/type/v3/cel.upb.h +90 -10
- data/src/core/ext/upb-gen/xds/type/v3/cel.upb_minitable.c +18 -7
- data/src/core/ext/upbdefs-gen/cel/expr/checked.upbdefs.c +248 -0
- data/src/core/ext/upbdefs-gen/cel/expr/checked.upbdefs.h +97 -0
- data/src/core/ext/upbdefs-gen/cel/expr/syntax.upbdefs.c +283 -0
- data/src/core/ext/upbdefs-gen/cel/expr/syntax.upbdefs.h +107 -0
- data/src/core/ext/upbdefs-gen/envoy/config/accesslog/v3/accesslog.upbdefs.c +213 -211
- data/src/core/ext/upbdefs-gen/envoy/config/bootstrap/v3/bootstrap.upbdefs.c +635 -614
- data/src/core/ext/upbdefs-gen/envoy/config/cluster/v3/cluster.upbdefs.c +1012 -1000
- data/src/core/ext/upbdefs-gen/envoy/config/common/matcher/v3/matcher.upbdefs.c +276 -273
- data/src/core/ext/upbdefs-gen/envoy/config/common/mutation_rules/v3/mutation_rules.upbdefs.c +152 -0
- data/src/core/ext/upbdefs-gen/envoy/config/common/mutation_rules/v3/mutation_rules.upbdefs.h +47 -0
- data/src/core/ext/upbdefs-gen/envoy/config/core/v3/address.upbdefs.c +149 -144
- data/src/core/ext/upbdefs-gen/envoy/config/core/v3/base.upbdefs.c +367 -370
- data/src/core/ext/upbdefs-gen/envoy/config/core/v3/cel.upbdefs.c +63 -0
- data/src/core/ext/upbdefs-gen/envoy/config/core/v3/cel.upbdefs.h +37 -0
- data/src/core/ext/upbdefs-gen/envoy/config/core/v3/grpc_service.upbdefs.c +297 -284
- data/src/core/ext/upbdefs-gen/envoy/config/core/v3/protocol.upbdefs.c +492 -469
- data/src/core/ext/upbdefs-gen/envoy/config/core/v3/proxy_protocol.upbdefs.c +74 -43
- data/src/core/ext/upbdefs-gen/envoy/config/core/v3/proxy_protocol.upbdefs.h +10 -0
- data/src/core/ext/upbdefs-gen/envoy/config/core/v3/substitution_format_string.upbdefs.c +60 -59
- data/src/core/ext/upbdefs-gen/envoy/config/endpoint/v3/endpoint_components.upbdefs.c +202 -184
- data/src/core/ext/upbdefs-gen/envoy/config/endpoint/v3/endpoint_components.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-gen/envoy/config/listener/v3/listener.upbdefs.c +354 -339
- data/src/core/ext/upbdefs-gen/envoy/config/listener/v3/listener.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-gen/envoy/config/listener/v3/quic_config.upbdefs.c +28 -19
- data/src/core/ext/upbdefs-gen/envoy/config/metrics/v3/metrics_service.upbdefs.c +30 -27
- data/src/core/ext/upbdefs-gen/envoy/config/metrics/v3/stats.upbdefs.c +71 -66
- data/src/core/ext/upbdefs-gen/envoy/config/overload/v3/overload.upbdefs.c +94 -91
- data/src/core/ext/upbdefs-gen/envoy/config/rbac/v3/rbac.upbdefs.c +386 -369
- data/src/core/ext/upbdefs-gen/envoy/config/route/v3/route.upbdefs.c +60 -57
- data/src/core/ext/upbdefs-gen/envoy/config/route/v3/route_components.upbdefs.c +1974 -1884
- data/src/core/ext/upbdefs-gen/envoy/config/tap/v3/common.upbdefs.c +119 -112
- data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/opentelemetry.upbdefs.c +62 -51
- data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/zipkin.upbdefs.c +109 -88
- data/src/core/ext/upbdefs-gen/envoy/extensions/clusters/aggregate/v3/cluster.upbdefs.c +54 -36
- data/src/core/ext/upbdefs-gen/envoy/extensions/clusters/aggregate/v3/cluster.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/rbac/v3/rbac.upbdefs.c +78 -84
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/stateful_session/v3/stateful_session.upbdefs.c +48 -46
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.c +1041 -984
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/common.upbdefs.c +304 -290
- data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/secret.upbdefs.c +94 -77
- data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/secret.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upbdefs.c +246 -193
- data/src/core/ext/upbdefs-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-gen/envoy/type/http/v3/cookie.upbdefs.c +37 -23
- data/src/core/ext/upbdefs-gen/envoy/type/http/v3/cookie.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-gen/envoy/type/tracing/v3/custom_tag.upbdefs.c +5 -3
- data/src/core/ext/upbdefs-gen/google/api/http.upbdefs.c +4 -4
- data/src/core/ext/upbdefs-gen/google/api/httpbody.upbdefs.c +4 -5
- data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/promise.upbdefs.c +113 -87
- data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/promise.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-gen/udpa/annotations/migrate.upbdefs.c +5 -5
- data/src/core/ext/upbdefs-gen/udpa/annotations/security.upbdefs.c +6 -5
- data/src/core/ext/upbdefs-gen/udpa/annotations/sensitive.upbdefs.c +5 -5
- data/src/core/ext/upbdefs-gen/udpa/annotations/status.upbdefs.c +5 -5
- data/src/core/ext/upbdefs-gen/udpa/annotations/versioning.upbdefs.c +5 -5
- data/src/core/ext/upbdefs-gen/xds/type/matcher/v3/cel.upbdefs.c +25 -30
- data/src/core/ext/upbdefs-gen/xds/type/matcher/v3/http_inputs.upbdefs.c +14 -20
- data/src/core/ext/upbdefs-gen/xds/type/matcher/v3/matcher.upbdefs.c +180 -183
- data/src/core/ext/upbdefs-gen/xds/type/matcher/v3/string.upbdefs.c +56 -47
- data/src/core/ext/upbdefs-gen/xds/type/v3/cel.upbdefs.c +69 -47
- data/src/core/filter/filter_chain.h +95 -0
- data/src/core/handshaker/http_connect/{http_connect_handshaker.cc → http_connect_client_handshaker.cc} +32 -31
- data/src/core/handshaker/http_connect/{http_connect_handshaker.h → http_connect_client_handshaker.h} +4 -4
- data/src/core/handshaker/http_connect/http_proxy_mapper.cc +1 -1
- data/src/core/handshaker/http_connect/xds_http_proxy_mapper.cc +1 -1
- data/src/core/handshaker/security/pipelined_secure_endpoint.cc +14 -13
- data/src/core/handshaker/security/secure_endpoint.cc +282 -68
- data/src/core/handshaker/security/secure_endpoint.h +0 -7
- data/src/core/lib/channel/channel_args.h +1 -1
- data/src/core/lib/channel/promise_based_filter.cc +17 -4
- data/src/core/lib/channel/promise_based_filter.h +3 -2
- data/src/core/lib/debug/trace_flags.cc +2 -0
- data/src/core/lib/debug/trace_flags.h +1 -0
- data/src/core/lib/event_engine/cf_engine/cfstream_endpoint.cc +35 -8
- data/src/core/lib/event_engine/cf_engine/dns_service_resolver.h +1 -2
- data/src/core/lib/event_engine/event_engine.cc +9 -0
- data/src/core/lib/event_engine/extensions/tcp_trace.h +0 -3
- data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +2 -2
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.h +1 -1
- data/src/core/lib/event_engine/posix_engine/posix_engine.cc +34 -9
- data/src/core/lib/event_engine/posix_engine/posix_engine.h +24 -2
- data/src/core/lib/event_engine/posix_engine/posix_engine_listener.cc +1 -3
- data/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.cc +141 -14
- data/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.h +19 -2
- data/src/core/lib/event_engine/posix_engine/posix_interface.h +7 -0
- data/src/core/lib/event_engine/posix_engine/posix_interface_posix.cc +21 -3
- data/src/core/lib/event_engine/posix_engine/posix_interface_windows.cc +16 -0
- data/src/core/lib/experiments/experiments.cc +309 -201
- data/src/core/lib/experiments/experiments.h +141 -80
- data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +2 -2
- data/src/core/lib/iomgr/resolve_address.h +0 -2
- data/src/core/lib/iomgr/resolved_address.h +0 -2
- data/src/core/lib/iomgr/tcp_posix.cc +13 -5
- data/src/core/lib/iomgr/tcp_server.cc +0 -5
- data/src/core/lib/iomgr/tcp_server.h +0 -7
- data/src/core/lib/iomgr/tcp_server_posix.cc +0 -17
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +0 -3
- data/src/core/lib/iomgr/tcp_server_windows.cc +12 -51
- data/src/core/lib/promise/all_ok.h +17 -12
- data/src/core/lib/promise/cancel_callback.h +12 -13
- data/src/core/lib/promise/detail/join_state.h +626 -0
- data/src/core/lib/promise/detail/promise_factory.h +14 -14
- data/src/core/lib/promise/for_each.h +32 -8
- data/src/core/lib/promise/if.h +9 -7
- data/src/core/lib/promise/loop.h +18 -16
- data/src/core/lib/promise/map.h +54 -47
- data/src/core/lib/promise/mpsc.h +11 -10
- data/src/core/lib/promise/observable.h +6 -6
- data/src/core/lib/promise/party.h +25 -19
- data/src/core/lib/promise/poll.h +5 -5
- data/src/core/lib/promise/prioritized_race.h +10 -7
- data/src/core/lib/promise/promise.h +16 -11
- data/src/core/lib/promise/race.h +6 -5
- data/src/core/lib/promise/seq.h +109 -74
- data/src/core/lib/promise/try_join.h +14 -6
- data/src/core/lib/promise/try_seq.h +76 -60
- data/src/core/lib/resource_quota/api.cc +7 -0
- data/src/core/lib/resource_quota/arena.h +1 -1
- data/src/core/lib/resource_quota/memory_quota.cc +4 -1
- data/src/core/lib/resource_quota/resource_quota.cc +2 -1
- data/src/core/lib/resource_quota/resource_quota.h +3 -0
- data/src/core/lib/resource_quota/stream_quota.cc +77 -1
- data/src/core/lib/resource_quota/stream_quota.h +64 -1
- data/src/core/lib/resource_quota/telemetry.h +1 -1
- data/src/core/lib/surface/call.cc +13 -0
- data/src/core/lib/surface/call_utils.h +58 -43
- data/src/core/lib/surface/channel.h +1 -4
- data/src/core/lib/surface/completion_queue.cc +13 -6
- data/src/core/lib/surface/validate_metadata.cc +20 -15
- data/src/core/lib/surface/validate_metadata.h +3 -1
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/promise_endpoint.cc +1 -1
- data/src/core/lib/transport/promise_endpoint.h +1 -1
- data/src/core/lib/transport/transport.h +5 -0
- data/src/core/load_balancing/health_check_client.cc +1 -15
- data/src/core/load_balancing/health_check_client_internal.h +0 -2
- data/src/core/load_balancing/oob_backend_metric.cc +1 -5
- data/src/core/load_balancing/oob_backend_metric_internal.h +0 -1
- data/src/core/load_balancing/xds/xds_cluster_impl.cc +12 -9
- data/src/core/plugin_registry/grpc_plugin_registry.cc +3 -2
- data/src/core/resolver/xds/xds_resolver.cc +162 -116
- data/src/core/server/server.cc +18 -1
- data/src/core/server/server.h +2 -0
- data/src/core/server/xds_server_config_fetcher.cc +4 -4
- data/src/core/telemetry/call_tracer.cc +87 -2
- data/src/core/telemetry/call_tracer.h +46 -8
- data/src/core/telemetry/instrument.cc +102 -40
- data/src/core/telemetry/instrument.h +246 -65
- data/src/core/tsi/fake_transport_security.cc +3 -1
- data/src/core/tsi/ssl_transport_security.cc +516 -137
- data/src/core/tsi/ssl_transport_security.h +28 -22
- data/src/core/tsi/ssl_transport_security_utils.cc +2 -2
- data/src/core/tsi/ssl_transport_security_utils.h +2 -2
- data/src/core/util/bitset.h +6 -0
- data/src/core/util/function_signature.h +3 -1
- data/src/core/util/http_client/httpcli_security_connector.cc +2 -1
- data/src/core/util/json/json_reader.cc +0 -4
- data/src/core/xds/grpc/certificate_provider_store.cc +2 -1
- data/src/core/xds/grpc/certificate_provider_store.h +3 -17
- data/src/core/xds/grpc/certificate_provider_store_interface.h +61 -0
- data/src/core/xds/grpc/xds_bootstrap_grpc.cc +48 -0
- data/src/core/xds/grpc/xds_bootstrap_grpc.h +18 -0
- data/src/core/xds/grpc/xds_certificate_provider.cc +7 -2
- data/src/core/xds/grpc/xds_certificate_provider.h +13 -2
- data/src/core/xds/grpc/xds_client_grpc.cc +13 -6
- data/src/core/xds/grpc/xds_client_grpc.h +10 -7
- data/src/core/xds/grpc/xds_cluster.cc +18 -4
- data/src/core/xds/grpc/xds_cluster.h +17 -2
- data/src/core/xds/grpc/xds_cluster_parser.cc +36 -11
- data/src/core/xds/grpc/xds_common_types.cc +45 -0
- data/src/core/xds/grpc/xds_common_types.h +31 -0
- data/src/core/xds/grpc/xds_common_types_parser.cc +274 -16
- data/src/core/xds/grpc/xds_common_types_parser.h +12 -0
- data/src/core/xds/grpc/xds_http_fault_filter.cc +128 -24
- data/src/core/xds/grpc/xds_http_fault_filter.h +19 -10
- data/src/core/xds/grpc/xds_http_filter.cc +38 -0
- data/src/core/xds/grpc/xds_http_filter.h +70 -47
- data/src/core/xds/grpc/xds_http_filter_registry.cc +48 -14
- data/src/core/xds/grpc/xds_http_filter_registry.h +29 -15
- data/src/core/xds/grpc/xds_http_gcp_authn_filter.cc +88 -22
- data/src/core/xds/grpc/xds_http_gcp_authn_filter.h +22 -11
- data/src/core/xds/grpc/xds_http_rbac_filter.cc +36 -20
- data/src/core/xds/grpc/xds_http_rbac_filter.h +19 -10
- data/src/core/xds/grpc/xds_http_stateful_session_filter.cc +143 -26
- data/src/core/xds/grpc/xds_http_stateful_session_filter.h +19 -10
- data/src/core/xds/grpc/xds_listener.cc +4 -1
- data/src/core/xds/grpc/xds_listener.h +10 -2
- data/src/core/xds/grpc/xds_listener_parser.cc +23 -18
- data/src/core/xds/grpc/xds_matcher.cc +40 -5
- data/src/core/xds/grpc/xds_matcher.h +13 -0
- data/src/core/xds/grpc/xds_matcher_action.h +1 -1
- data/src/core/xds/grpc/xds_matcher_parse.cc +60 -40
- data/src/core/xds/grpc/xds_matcher_parse.h +2 -1
- data/src/core/xds/grpc/xds_route_config.cc +12 -1
- data/src/core/xds/grpc/xds_route_config.h +15 -2
- data/src/core/xds/grpc/xds_route_config_parser.cc +11 -5
- data/src/core/xds/grpc/xds_routing.cc +181 -6
- data/src/core/xds/grpc/xds_routing.h +57 -0
- data/src/core/xds/grpc/xds_server_grpc.cc +55 -43
- data/src/core/xds/grpc/xds_server_grpc.h +13 -6
- data/src/core/xds/grpc/xds_server_grpc_interface.h +3 -2
- data/src/core/xds/grpc/xds_transport_grpc.cc +12 -6
- data/src/core/xds/grpc/xds_transport_grpc.h +5 -1
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +12 -8
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +18 -12
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/generate_proto_ruby.sh +1 -1
- metadata +42 -6
- data/src/core/ext/transport/chttp2/transport/security_frame.cc +0 -31
- data/src/core/handshaker/security/legacy_secure_endpoint.cc +0 -597
|
@@ -52,20 +52,24 @@ struct grpc_tls_credentials_options
|
|
|
52
52
|
return certificate_verifier_.get();
|
|
53
53
|
}
|
|
54
54
|
bool check_call_host() const { return check_call_host_; }
|
|
55
|
-
// Returns the distributor from certificate_provider_ if it is set, nullptr otherwise.
|
|
56
|
-
grpc_tls_certificate_distributor* certificate_distributor() {
|
|
57
|
-
if (certificate_provider_ != nullptr) { return certificate_provider_->distributor().get(); }
|
|
58
|
-
return nullptr;
|
|
59
|
-
}
|
|
60
|
-
bool watch_root_cert() const { return watch_root_cert_; }
|
|
61
55
|
const std::string& root_cert_name() const { return root_cert_name_; }
|
|
62
|
-
bool watch_identity_pair() const { return watch_identity_pair_; }
|
|
63
56
|
const std::string& identity_cert_name() const { return identity_cert_name_; }
|
|
64
57
|
const std::string& tls_session_key_log_file_path() const { return tls_session_key_log_file_path_; }
|
|
65
58
|
const std::string& crl_directory() const { return crl_directory_; }
|
|
66
59
|
// Returns the CRL Provider
|
|
67
60
|
std::shared_ptr<grpc_core::experimental::CrlProvider> crl_provider() const { return crl_provider_; }
|
|
68
61
|
bool send_client_ca_list() const { return send_client_ca_list_; }
|
|
62
|
+
// Returns the distributor from identity_certificate_provider_ if it is set, nullptr otherwise.
|
|
63
|
+
grpc_tls_certificate_distributor* identity_certificate_distributor() {
|
|
64
|
+
if (identity_certificate_provider_ != nullptr) { return identity_certificate_provider_->distributor().get(); }
|
|
65
|
+
return nullptr;
|
|
66
|
+
}
|
|
67
|
+
// Returns the distributor from root_certificate_provider_ if it is set, nullptr otherwise.
|
|
68
|
+
grpc_tls_certificate_distributor* root_certificate_distributor() {
|
|
69
|
+
if (root_certificate_provider_ != nullptr) { return root_certificate_provider_->distributor().get(); }
|
|
70
|
+
return nullptr;
|
|
71
|
+
}
|
|
72
|
+
const std::optional<std::string>& sni_override() const { return sni_override_; }
|
|
69
73
|
|
|
70
74
|
// Setters for member fields.
|
|
71
75
|
void set_cert_request_type(grpc_ssl_client_certificate_request_type cert_request_type) { cert_request_type_ = cert_request_type; }
|
|
@@ -74,13 +78,8 @@ struct grpc_tls_credentials_options
|
|
|
74
78
|
void set_max_tls_version(grpc_tls_version max_tls_version) { max_tls_version_ = max_tls_version; }
|
|
75
79
|
void set_certificate_verifier(grpc_core::RefCountedPtr<grpc_tls_certificate_verifier> certificate_verifier) { certificate_verifier_ = std::move(certificate_verifier); }
|
|
76
80
|
void set_check_call_host(bool check_call_host) { check_call_host_ = check_call_host; }
|
|
77
|
-
void set_certificate_provider(grpc_core::RefCountedPtr<grpc_tls_certificate_provider> certificate_provider) { certificate_provider_ = std::move(certificate_provider); }
|
|
78
|
-
// If need to watch the updates of root certificates with name |root_cert_name|. The default value is false. If used in tls_credentials, it should always be set to true unless the root certificates are not needed.
|
|
79
|
-
void set_watch_root_cert(bool watch_root_cert) { watch_root_cert_ = watch_root_cert; }
|
|
80
81
|
// Sets the name of root certificates being watched, if |set_watch_root_cert| is called. If not set, an empty string will be used as the name.
|
|
81
82
|
void set_root_cert_name(std::string root_cert_name) { root_cert_name_ = std::move(root_cert_name); }
|
|
82
|
-
// If need to watch the updates of identity certificates with name |identity_cert_name|. The default value is false. If used in tls_credentials, it should always be set to true unless the identity key-cert pairs are not needed.
|
|
83
|
-
void set_watch_identity_pair(bool watch_identity_pair) { watch_identity_pair_ = watch_identity_pair; }
|
|
84
83
|
// Sets the name of identity key-cert pairs being watched, if |set_watch_identity_pair| is called. If not set, an empty string will be used as the name.
|
|
85
84
|
void set_identity_cert_name(std::string identity_cert_name) { identity_cert_name_ = std::move(identity_cert_name); }
|
|
86
85
|
void set_tls_session_key_log_file_path(std::string tls_session_key_log_file_path) { tls_session_key_log_file_path_ = std::move(tls_session_key_log_file_path); }
|
|
@@ -88,6 +87,10 @@ struct grpc_tls_credentials_options
|
|
|
88
87
|
void set_crl_directory(std::string crl_directory) { crl_directory_ = std::move(crl_directory); }
|
|
89
88
|
void set_crl_provider(std::shared_ptr<grpc_core::experimental::CrlProvider> crl_provider) { crl_provider_ = std::move(crl_provider); }
|
|
90
89
|
void set_send_client_ca_list(bool send_client_ca_list) { send_client_ca_list_ = send_client_ca_list; }
|
|
90
|
+
void set_identity_certificate_provider(grpc_core::RefCountedPtr<grpc_tls_certificate_provider> identity_certificate_provider) { identity_certificate_provider_ = std::move(identity_certificate_provider); }
|
|
91
|
+
void set_root_certificate_provider(grpc_core::RefCountedPtr<grpc_tls_certificate_provider> root_certificate_provider) { root_certificate_provider_ = std::move(root_certificate_provider); }
|
|
92
|
+
// If set to nullopt, do not override. If set to empty string, disable sending SNI. Otherwise, override SNI
|
|
93
|
+
void set_sni_override(std::optional<std::string> sni_override) { sni_override_ = std::move(sni_override); }
|
|
91
94
|
|
|
92
95
|
bool operator==(const grpc_tls_credentials_options& other) const {
|
|
93
96
|
return cert_request_type_ == other.cert_request_type_ &&
|
|
@@ -96,15 +99,15 @@ struct grpc_tls_credentials_options
|
|
|
96
99
|
max_tls_version_ == other.max_tls_version_ &&
|
|
97
100
|
(certificate_verifier_ == other.certificate_verifier_ || (certificate_verifier_ != nullptr && other.certificate_verifier_ != nullptr && certificate_verifier_->Compare(other.certificate_verifier_.get()) == 0)) &&
|
|
98
101
|
check_call_host_ == other.check_call_host_ &&
|
|
99
|
-
(certificate_provider_ == other.certificate_provider_ || (certificate_provider_ != nullptr && other.certificate_provider_ != nullptr && certificate_provider_->Compare(other.certificate_provider_.get()) == 0)) &&
|
|
100
|
-
watch_root_cert_ == other.watch_root_cert_ &&
|
|
101
102
|
root_cert_name_ == other.root_cert_name_ &&
|
|
102
|
-
watch_identity_pair_ == other.watch_identity_pair_ &&
|
|
103
103
|
identity_cert_name_ == other.identity_cert_name_ &&
|
|
104
104
|
tls_session_key_log_file_path_ == other.tls_session_key_log_file_path_ &&
|
|
105
105
|
crl_directory_ == other.crl_directory_ &&
|
|
106
106
|
(crl_provider_ == other.crl_provider_) &&
|
|
107
|
-
send_client_ca_list_ == other.send_client_ca_list_
|
|
107
|
+
send_client_ca_list_ == other.send_client_ca_list_ &&
|
|
108
|
+
(identity_certificate_provider_ == other.identity_certificate_provider_ || (identity_certificate_provider_ != nullptr && other.identity_certificate_provider_ != nullptr && identity_certificate_provider_->Compare(other.identity_certificate_provider_.get()) == 0)) &&
|
|
109
|
+
(root_certificate_provider_ == other.root_certificate_provider_ || (root_certificate_provider_ != nullptr && other.root_certificate_provider_ != nullptr && root_certificate_provider_->Compare(other.root_certificate_provider_.get()) == 0)) &&
|
|
110
|
+
sni_override_ == other.sni_override_;
|
|
108
111
|
}
|
|
109
112
|
|
|
110
113
|
grpc_tls_credentials_options(grpc_tls_credentials_options& other) :
|
|
@@ -114,15 +117,15 @@ struct grpc_tls_credentials_options
|
|
|
114
117
|
max_tls_version_(other.max_tls_version_),
|
|
115
118
|
certificate_verifier_(other.certificate_verifier_),
|
|
116
119
|
check_call_host_(other.check_call_host_),
|
|
117
|
-
certificate_provider_(other.certificate_provider_),
|
|
118
|
-
watch_root_cert_(other.watch_root_cert_),
|
|
119
120
|
root_cert_name_(other.root_cert_name_),
|
|
120
|
-
watch_identity_pair_(other.watch_identity_pair_),
|
|
121
121
|
identity_cert_name_(other.identity_cert_name_),
|
|
122
122
|
tls_session_key_log_file_path_(other.tls_session_key_log_file_path_),
|
|
123
123
|
crl_directory_(other.crl_directory_),
|
|
124
124
|
crl_provider_(other.crl_provider_),
|
|
125
|
-
send_client_ca_list_(other.send_client_ca_list_)
|
|
125
|
+
send_client_ca_list_(other.send_client_ca_list_),
|
|
126
|
+
identity_certificate_provider_(other.identity_certificate_provider_),
|
|
127
|
+
root_certificate_provider_(other.root_certificate_provider_),
|
|
128
|
+
sni_override_(other.sni_override_) {}
|
|
126
129
|
|
|
127
130
|
private:
|
|
128
131
|
grpc_ssl_client_certificate_request_type cert_request_type_ = GRPC_SSL_DONT_REQUEST_CLIENT_CERTIFICATE;
|
|
@@ -131,15 +134,15 @@ struct grpc_tls_credentials_options
|
|
|
131
134
|
grpc_tls_version max_tls_version_ = grpc_tls_version::TLS1_3;
|
|
132
135
|
grpc_core::RefCountedPtr<grpc_tls_certificate_verifier> certificate_verifier_;
|
|
133
136
|
bool check_call_host_ = true;
|
|
134
|
-
grpc_core::RefCountedPtr<grpc_tls_certificate_provider> certificate_provider_;
|
|
135
|
-
bool watch_root_cert_ = false;
|
|
136
137
|
std::string root_cert_name_;
|
|
137
|
-
bool watch_identity_pair_ = false;
|
|
138
138
|
std::string identity_cert_name_;
|
|
139
139
|
std::string tls_session_key_log_file_path_;
|
|
140
140
|
std::string crl_directory_;
|
|
141
141
|
std::shared_ptr<grpc_core::experimental::CrlProvider> crl_provider_;
|
|
142
142
|
bool send_client_ca_list_ = false;
|
|
143
|
+
grpc_core::RefCountedPtr<grpc_tls_certificate_provider> identity_certificate_provider_;
|
|
144
|
+
grpc_core::RefCountedPtr<grpc_tls_certificate_provider> root_certificate_provider_;
|
|
145
|
+
std::optional<std::string> sni_override_;
|
|
143
146
|
};
|
|
144
147
|
|
|
145
148
|
#endif // GRPC_SRC_CORE_CREDENTIALS_TRANSPORT_TLS_GRPC_TLS_CREDENTIALS_OPTIONS_H
|
|
@@ -210,7 +210,7 @@ void SpiffeBundleKey::JsonPostLoad(const Json& json, const JsonArgs& args,
|
|
|
210
210
|
if (!x5c->empty()) {
|
|
211
211
|
ValidationErrors::ScopedField field(errors, "[0]");
|
|
212
212
|
std::string pem_cert = AddPemBlockWrapping((*x5c)[0]);
|
|
213
|
-
auto certs = ParsePemCertificateChain(pem_cert);
|
|
213
|
+
auto certs = tsi::ParsePemCertificateChain(pem_cert);
|
|
214
214
|
if (!certs.ok()) {
|
|
215
215
|
errors->AddError(certs.status().ToString());
|
|
216
216
|
} else {
|
|
@@ -310,7 +310,7 @@ absl::Status SpiffeBundle::CreateX509Stack() {
|
|
|
310
310
|
root_stack_ = std::make_unique<STACK_OF(X509)*>(sk_X509_new_null());
|
|
311
311
|
absl::Status status = absl::OkStatus();
|
|
312
312
|
for (const auto& pem_cert : roots_) {
|
|
313
|
-
auto cert = ParsePemCertificateChain(AddPemBlockWrapping(pem_cert));
|
|
313
|
+
auto cert = tsi::ParsePemCertificateChain(AddPemBlockWrapping(pem_cert));
|
|
314
314
|
if (!cert.status().ok()) {
|
|
315
315
|
status = cert.status();
|
|
316
316
|
break;
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
#include "src/core/util/grpc_check.h"
|
|
44
44
|
#include "src/core/util/host_port.h"
|
|
45
45
|
#include "src/core/util/load_file.h"
|
|
46
|
+
#include "src/core/util/match.h"
|
|
46
47
|
#include "src/core/util/ref_counted_ptr.h"
|
|
47
48
|
#include "src/core/util/useful.h"
|
|
48
49
|
#include "absl/log/log.h"
|
|
@@ -152,16 +153,6 @@ grpc_error_handle grpc_ssl_check_peer_name(absl::string_view peer_name,
|
|
|
152
153
|
return absl::OkStatus();
|
|
153
154
|
}
|
|
154
155
|
|
|
155
|
-
void grpc_tsi_ssl_pem_key_cert_pairs_destroy(tsi_ssl_pem_key_cert_pair* kp,
|
|
156
|
-
size_t num_key_cert_pairs) {
|
|
157
|
-
if (kp == nullptr) return;
|
|
158
|
-
for (size_t i = 0; i < num_key_cert_pairs; i++) {
|
|
159
|
-
gpr_free(const_cast<char*>(kp[i].private_key));
|
|
160
|
-
gpr_free(const_cast<char*>(kp[i].cert_chain));
|
|
161
|
-
}
|
|
162
|
-
gpr_free(kp);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
156
|
namespace grpc_core {
|
|
166
157
|
|
|
167
158
|
absl::Status SslCheckCallHost(absl::string_view host,
|
|
@@ -428,7 +419,7 @@ void grpc_shallow_peer_destruct(tsi_peer* peer) {
|
|
|
428
419
|
|
|
429
420
|
grpc_security_status grpc_ssl_tsi_client_handshaker_factory_init(
|
|
430
421
|
tsi_ssl_pem_key_cert_pair* pem_key_cert_pair,
|
|
431
|
-
std::shared_ptr<RootCertInfo> root_cert_info,
|
|
422
|
+
std::shared_ptr<tsi::RootCertInfo> root_cert_info,
|
|
432
423
|
bool skip_server_certificate_verification, tsi_tls_version min_tls_version,
|
|
433
424
|
tsi_tls_version max_tls_version, tsi_ssl_session_cache* ssl_session_cache,
|
|
434
425
|
tsi::TlsSessionKeyLoggerCache::TlsSessionKeyLogger* tls_session_key_logger,
|
|
@@ -450,13 +441,14 @@ grpc_security_status grpc_ssl_tsi_client_handshaker_factory_init(
|
|
|
450
441
|
return GRPC_SECURITY_ERROR;
|
|
451
442
|
}
|
|
452
443
|
root_store = grpc_core::DefaultSslRootStore::GetRootStore();
|
|
453
|
-
options.root_cert_info = std::make_shared<RootCertInfo>(root_certs);
|
|
444
|
+
options.root_cert_info = std::make_shared<tsi::RootCertInfo>(root_certs);
|
|
454
445
|
} else {
|
|
455
446
|
options.root_cert_info = std::move(root_cert_info);
|
|
456
447
|
}
|
|
457
|
-
bool has_key_cert_pair =
|
|
458
|
-
|
|
459
|
-
|
|
448
|
+
bool has_key_cert_pair =
|
|
449
|
+
pem_key_cert_pair != nullptr &&
|
|
450
|
+
!grpc_core::IsPrivateKeyEmpty(pem_key_cert_pair->private_key) &&
|
|
451
|
+
!pem_key_cert_pair->cert_chain.empty();
|
|
460
452
|
options.root_store = root_store;
|
|
461
453
|
options.alpn_protocols =
|
|
462
454
|
grpc_fill_alpn_protocol_strings(&options.num_alpn_protocols);
|
|
@@ -485,8 +477,8 @@ grpc_security_status grpc_ssl_tsi_client_handshaker_factory_init(
|
|
|
485
477
|
}
|
|
486
478
|
|
|
487
479
|
grpc_security_status grpc_ssl_tsi_server_handshaker_factory_init(
|
|
488
|
-
tsi_ssl_pem_key_cert_pair
|
|
489
|
-
std::shared_ptr<RootCertInfo> root_cert_info,
|
|
480
|
+
std::vector<tsi_ssl_pem_key_cert_pair> pem_key_cert_pairs,
|
|
481
|
+
std::shared_ptr<tsi::RootCertInfo> root_cert_info,
|
|
490
482
|
grpc_ssl_client_certificate_request_type client_certificate_request,
|
|
491
483
|
tsi_tls_version min_tls_version, tsi_tls_version max_tls_version,
|
|
492
484
|
tsi::TlsSessionKeyLoggerCache::TlsSessionKeyLogger* tls_session_key_logger,
|
|
@@ -498,7 +490,6 @@ grpc_security_status grpc_ssl_tsi_server_handshaker_factory_init(
|
|
|
498
490
|
grpc_fill_alpn_protocol_strings(&num_alpn_protocols);
|
|
499
491
|
tsi_ssl_server_handshaker_options options;
|
|
500
492
|
options.pem_key_cert_pairs = pem_key_cert_pairs;
|
|
501
|
-
options.num_key_cert_pairs = num_key_cert_pairs;
|
|
502
493
|
options.client_certificate_request =
|
|
503
494
|
grpc_get_tsi_client_certificate_request_type(client_certificate_request);
|
|
504
495
|
options.cipher_suites = grpc_get_ssl_cipher_suites();
|
|
@@ -569,6 +560,15 @@ grpc_arg grpc_ssl_session_cache_create_channel_arg(
|
|
|
569
560
|
|
|
570
561
|
namespace grpc_core {
|
|
571
562
|
|
|
563
|
+
bool IsPrivateKeyEmpty(const PrivateKey& private_key) {
|
|
564
|
+
return Match(
|
|
565
|
+
private_key,
|
|
566
|
+
[&](const std::string& pem_root_certs) { return pem_root_certs.empty(); },
|
|
567
|
+
[&](const std::shared_ptr<PrivateKeySigner> key_signer) {
|
|
568
|
+
return key_signer == nullptr;
|
|
569
|
+
});
|
|
570
|
+
}
|
|
571
|
+
|
|
572
572
|
tsi_ssl_root_certs_store* DefaultSslRootStore::default_root_store_;
|
|
573
573
|
grpc_slice DefaultSslRootStore::default_pem_root_certs_;
|
|
574
574
|
|
|
@@ -24,11 +24,13 @@
|
|
|
24
24
|
#include <grpc/grpc_security_constants.h>
|
|
25
25
|
#include <grpc/slice.h>
|
|
26
26
|
#include <grpc/support/port_platform.h>
|
|
27
|
+
#include <openssl/x509.h>
|
|
27
28
|
#include <stddef.h>
|
|
28
29
|
|
|
29
30
|
#include <memory>
|
|
30
31
|
#include <string>
|
|
31
32
|
#include <utility>
|
|
33
|
+
#include <variant>
|
|
32
34
|
#include <vector>
|
|
33
35
|
|
|
34
36
|
#include "src/core/credentials/transport/security_connector.h"
|
|
@@ -86,7 +88,7 @@ const char** ParseAlpnStringIntoArray(absl::string_view preferred_protocols,
|
|
|
86
88
|
// Initialize TSI SSL server/client handshaker factory.
|
|
87
89
|
grpc_security_status grpc_ssl_tsi_client_handshaker_factory_init(
|
|
88
90
|
tsi_ssl_pem_key_cert_pair* key_cert_pair,
|
|
89
|
-
std::shared_ptr<RootCertInfo> root_cert_info,
|
|
91
|
+
std::shared_ptr<tsi::RootCertInfo> root_cert_info,
|
|
90
92
|
bool skip_server_certificate_verification, tsi_tls_version min_tls_version,
|
|
91
93
|
tsi_tls_version max_tls_version, tsi_ssl_session_cache* ssl_session_cache,
|
|
92
94
|
tsi::TlsSessionKeyLoggerCache::TlsSessionKeyLogger* tls_session_key_logger,
|
|
@@ -95,8 +97,8 @@ grpc_security_status grpc_ssl_tsi_client_handshaker_factory_init(
|
|
|
95
97
|
tsi_ssl_client_handshaker_factory** handshaker_factory);
|
|
96
98
|
|
|
97
99
|
grpc_security_status grpc_ssl_tsi_server_handshaker_factory_init(
|
|
98
|
-
tsi_ssl_pem_key_cert_pair
|
|
99
|
-
std::shared_ptr<RootCertInfo> root_cert_info,
|
|
100
|
+
std::vector<tsi_ssl_pem_key_cert_pair> key_cert_pairs,
|
|
101
|
+
std::shared_ptr<tsi::RootCertInfo> root_cert_info,
|
|
100
102
|
grpc_ssl_client_certificate_request_type client_certificate_request,
|
|
101
103
|
tsi_tls_version min_tls_version, tsi_tls_version max_tls_version,
|
|
102
104
|
tsi::TlsSessionKeyLoggerCache::TlsSessionKeyLogger* tls_session_key_logger,
|
|
@@ -104,9 +106,6 @@ grpc_security_status grpc_ssl_tsi_server_handshaker_factory_init(
|
|
|
104
106
|
std::shared_ptr<grpc_core::experimental::CrlProvider> crl_provider,
|
|
105
107
|
tsi_ssl_server_handshaker_factory** handshaker_factory);
|
|
106
108
|
|
|
107
|
-
// Free the memory occupied by key cert pairs.
|
|
108
|
-
void grpc_tsi_ssl_pem_key_cert_pairs_destroy(tsi_ssl_pem_key_cert_pair* kp,
|
|
109
|
-
size_t num_key_cert_pairs);
|
|
110
109
|
// Exposed for testing only.
|
|
111
110
|
grpc_core::RefCountedPtr<grpc_auth_context> grpc_ssl_peer_to_auth_context(
|
|
112
111
|
const tsi_peer* peer, const char* transport_security_type);
|
|
@@ -118,6 +117,9 @@ int grpc_ssl_host_matches_name(const tsi_peer* peer,
|
|
|
118
117
|
|
|
119
118
|
// --- Default SSL Root Store. ---
|
|
120
119
|
namespace grpc_core {
|
|
120
|
+
using tsi::PrivateKey;
|
|
121
|
+
|
|
122
|
+
bool IsPrivateKeyEmpty(const PrivateKey& private_key);
|
|
121
123
|
|
|
122
124
|
// The class implements default SSL root store.
|
|
123
125
|
class DefaultSslRootStore {
|
|
@@ -152,8 +154,8 @@ class DefaultSslRootStore {
|
|
|
152
154
|
|
|
153
155
|
class PemKeyCertPair {
|
|
154
156
|
public:
|
|
155
|
-
PemKeyCertPair(
|
|
156
|
-
: private_key_(private_key), cert_chain_(cert_chain) {}
|
|
157
|
+
PemKeyCertPair(PrivateKey private_key, absl::string_view cert_chain)
|
|
158
|
+
: private_key_(std::move(private_key)), cert_chain_(cert_chain) {}
|
|
157
159
|
|
|
158
160
|
// Movable.
|
|
159
161
|
PemKeyCertPair(PemKeyCertPair&& other) noexcept {
|
|
@@ -180,11 +182,11 @@ class PemKeyCertPair {
|
|
|
180
182
|
this->cert_chain() == other.cert_chain();
|
|
181
183
|
}
|
|
182
184
|
|
|
183
|
-
const
|
|
185
|
+
const PrivateKey& private_key() const { return private_key_; }
|
|
184
186
|
const std::string& cert_chain() const { return cert_chain_; }
|
|
185
187
|
|
|
186
188
|
private:
|
|
187
|
-
|
|
189
|
+
PrivateKey private_key_;
|
|
188
190
|
std::string cert_chain_;
|
|
189
191
|
};
|
|
190
192
|
|
|
@@ -25,7 +25,9 @@
|
|
|
25
25
|
#include <grpc/support/string_util.h>
|
|
26
26
|
#include <string.h>
|
|
27
27
|
|
|
28
|
+
#include <cstddef>
|
|
28
29
|
#include <memory>
|
|
30
|
+
#include <optional>
|
|
29
31
|
#include <utility>
|
|
30
32
|
#include <vector>
|
|
31
33
|
|
|
@@ -213,22 +215,14 @@ void PendingVerifierRequestDestroy(
|
|
|
213
215
|
}
|
|
214
216
|
}
|
|
215
217
|
|
|
216
|
-
tsi_ssl_pem_key_cert_pair
|
|
218
|
+
std::vector<tsi_ssl_pem_key_cert_pair> ConvertToTsiPemKeyCertPair(
|
|
217
219
|
const PemKeyCertPairList& cert_pair_list) {
|
|
218
|
-
tsi_ssl_pem_key_cert_pair
|
|
219
|
-
size_t
|
|
220
|
-
|
|
221
|
-
GRPC_CHECK_NE(cert_pair_list.data(), nullptr);
|
|
222
|
-
tsi_pairs = static_cast<tsi_ssl_pem_key_cert_pair*>(
|
|
223
|
-
gpr_zalloc(num_key_cert_pairs * sizeof(tsi_ssl_pem_key_cert_pair)));
|
|
224
|
-
}
|
|
225
|
-
for (size_t i = 0; i < num_key_cert_pairs; i++) {
|
|
226
|
-
GRPC_CHECK(!cert_pair_list[i].private_key().empty());
|
|
220
|
+
std::vector<tsi_ssl_pem_key_cert_pair> tsi_pairs;
|
|
221
|
+
for (size_t i = 0; i < cert_pair_list.size(); i++) {
|
|
222
|
+
GRPC_CHECK(!IsPrivateKeyEmpty(cert_pair_list[i].private_key()));
|
|
227
223
|
GRPC_CHECK(!cert_pair_list[i].cert_chain().empty());
|
|
228
|
-
tsi_pairs[i].
|
|
229
|
-
|
|
230
|
-
tsi_pairs[i].private_key =
|
|
231
|
-
gpr_strdup(cert_pair_list[i].private_key().c_str());
|
|
224
|
+
tsi_pairs.emplace_back(cert_pair_list[i].private_key(),
|
|
225
|
+
cert_pair_list[i].cert_chain());
|
|
232
226
|
}
|
|
233
227
|
return tsi_pairs;
|
|
234
228
|
}
|
|
@@ -291,17 +285,20 @@ TlsChannelSecurityConnector::TlsChannelSecurityConnector(
|
|
|
291
285
|
SplitHostPort(target_name, &host, &port);
|
|
292
286
|
target_name_ = std::string(host);
|
|
293
287
|
// Create a watcher.
|
|
294
|
-
auto
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
288
|
+
auto identity_watcher_ptr =
|
|
289
|
+
std::make_unique<TlsChannelCertificateWatcher>(this);
|
|
290
|
+
auto root_watcher_ptr = std::make_unique<TlsChannelCertificateWatcher>(this);
|
|
291
|
+
root_certificate_watcher_ = root_watcher_ptr.get();
|
|
292
|
+
identity_certificate_watcher_ = identity_watcher_ptr.get();
|
|
293
|
+
bool watch_root_cert = options_->root_certificate_distributor() != nullptr;
|
|
294
|
+
bool watch_identity_cert =
|
|
295
|
+
options_->identity_certificate_distributor() != nullptr;
|
|
299
296
|
std::optional<std::string> watched_root_cert_name;
|
|
300
|
-
if (
|
|
297
|
+
if (watch_root_cert) {
|
|
301
298
|
watched_root_cert_name = options_->root_cert_name();
|
|
302
299
|
}
|
|
303
300
|
std::optional<std::string> watched_identity_cert_name;
|
|
304
|
-
if (
|
|
301
|
+
if (watch_identity_cert) {
|
|
305
302
|
watched_identity_cert_name = options_->identity_cert_name();
|
|
306
303
|
}
|
|
307
304
|
// We will use the root certs stored in system default locations if not
|
|
@@ -310,13 +307,19 @@ TlsChannelSecurityConnector::TlsChannelSecurityConnector(
|
|
|
310
307
|
// certs" is a valid case(and hence we will need to call
|
|
311
308
|
// OnCertificatesChanged), but it requires nothing from the provider, and
|
|
312
309
|
// hence no need to register the watcher.
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
watcher_ptr->OnCertificatesChanged(nullptr, std::nullopt);
|
|
310
|
+
if (!watch_root_cert && !watch_identity_cert) {
|
|
311
|
+
root_certificate_watcher_->OnCertificatesChanged(nullptr, std::nullopt);
|
|
316
312
|
} else {
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
313
|
+
if (watch_root_cert) {
|
|
314
|
+
options_->root_certificate_distributor()->WatchTlsCertificates(
|
|
315
|
+
std::move(root_watcher_ptr), watched_root_cert_name,
|
|
316
|
+
watched_identity_cert_name);
|
|
317
|
+
}
|
|
318
|
+
if (watch_identity_cert) {
|
|
319
|
+
options_->identity_certificate_distributor()->WatchTlsCertificates(
|
|
320
|
+
std::move(identity_watcher_ptr), watched_root_cert_name,
|
|
321
|
+
watched_identity_cert_name);
|
|
322
|
+
}
|
|
320
323
|
}
|
|
321
324
|
}
|
|
322
325
|
|
|
@@ -325,10 +328,16 @@ TlsChannelSecurityConnector::~TlsChannelSecurityConnector() {
|
|
|
325
328
|
tsi_ssl_session_cache_unref(ssl_session_cache_);
|
|
326
329
|
}
|
|
327
330
|
// Cancel all the watchers.
|
|
328
|
-
grpc_tls_certificate_distributor*
|
|
329
|
-
options_->
|
|
330
|
-
if (
|
|
331
|
-
|
|
331
|
+
grpc_tls_certificate_distributor* root_distributor =
|
|
332
|
+
options_->root_certificate_distributor();
|
|
333
|
+
if (root_distributor != nullptr) {
|
|
334
|
+
root_distributor->CancelTlsCertificatesWatch(root_certificate_watcher_);
|
|
335
|
+
}
|
|
336
|
+
grpc_tls_certificate_distributor* identity_distributor =
|
|
337
|
+
options_->identity_certificate_distributor();
|
|
338
|
+
if (identity_distributor != nullptr) {
|
|
339
|
+
identity_distributor->CancelTlsCertificatesWatch(
|
|
340
|
+
identity_certificate_watcher_);
|
|
332
341
|
}
|
|
333
342
|
if (client_handshaker_factory_ != nullptr) {
|
|
334
343
|
tsi_ssl_client_handshaker_factory_unref(client_handshaker_factory_);
|
|
@@ -342,10 +351,20 @@ void TlsChannelSecurityConnector::add_handshakers(
|
|
|
342
351
|
tsi_handshaker* tsi_hs = nullptr;
|
|
343
352
|
if (client_handshaker_factory_ != nullptr) {
|
|
344
353
|
// Instantiate TSI handshaker.
|
|
354
|
+
const char* server_name_indication;
|
|
355
|
+
if (options_->sni_override().has_value()) {
|
|
356
|
+
if (options_->sni_override()->empty()) {
|
|
357
|
+
server_name_indication = nullptr;
|
|
358
|
+
} else {
|
|
359
|
+
server_name_indication = options_->sni_override()->c_str();
|
|
360
|
+
}
|
|
361
|
+
} else {
|
|
362
|
+
server_name_indication = overridden_target_name_.empty()
|
|
363
|
+
? target_name_.c_str()
|
|
364
|
+
: overridden_target_name_.c_str();
|
|
365
|
+
}
|
|
345
366
|
tsi_result result = tsi_ssl_client_handshaker_factory_create_handshaker(
|
|
346
|
-
client_handshaker_factory_,
|
|
347
|
-
overridden_target_name_.empty() ? target_name_.c_str()
|
|
348
|
-
: overridden_target_name_.c_str(),
|
|
367
|
+
client_handshaker_factory_, server_name_indication,
|
|
349
368
|
/*network_bio_buf_size=*/0,
|
|
350
369
|
/*ssl_bio_buf_size=*/0,
|
|
351
370
|
args.GetOwnedString(GRPC_ARG_TRANSPORT_PROTOCOLS), &tsi_hs);
|
|
@@ -429,7 +448,7 @@ ArenaPromise<absl::Status> TlsChannelSecurityConnector::CheckCallHost(
|
|
|
429
448
|
}
|
|
430
449
|
|
|
431
450
|
void TlsChannelSecurityConnector::TlsChannelCertificateWatcher::
|
|
432
|
-
OnCertificatesChanged(std::shared_ptr<RootCertInfo> root_certs,
|
|
451
|
+
OnCertificatesChanged(std::shared_ptr<tsi::RootCertInfo> root_certs,
|
|
433
452
|
std::optional<PemKeyCertPairList> key_cert_pairs) {
|
|
434
453
|
GRPC_CHECK_NE(security_connector_, nullptr);
|
|
435
454
|
MutexLock lock(&security_connector_->mu_);
|
|
@@ -439,10 +458,13 @@ void TlsChannelSecurityConnector::TlsChannelCertificateWatcher::
|
|
|
439
458
|
if (key_cert_pairs.has_value()) {
|
|
440
459
|
security_connector_->pem_key_cert_pair_list_ = std::move(key_cert_pairs);
|
|
441
460
|
}
|
|
442
|
-
const bool root_ready =
|
|
443
|
-
|
|
461
|
+
const bool root_ready =
|
|
462
|
+
security_connector_->options_->root_certificate_distributor() ==
|
|
463
|
+
nullptr ||
|
|
464
|
+
security_connector_->root_cert_info_ != nullptr;
|
|
444
465
|
const bool identity_ready =
|
|
445
|
-
|
|
466
|
+
security_connector_->options_->identity_certificate_distributor() ==
|
|
467
|
+
nullptr ||
|
|
446
468
|
security_connector_->pem_key_cert_pair_list_.has_value();
|
|
447
469
|
if (root_ready && identity_ready) {
|
|
448
470
|
if (security_connector_->UpdateHandshakerFactoryLocked() !=
|
|
@@ -525,23 +547,19 @@ TlsChannelSecurityConnector::UpdateHandshakerFactoryLocked() {
|
|
|
525
547
|
if (client_handshaker_factory_ != nullptr) {
|
|
526
548
|
tsi_ssl_client_handshaker_factory_unref(client_handshaker_factory_);
|
|
527
549
|
}
|
|
528
|
-
tsi_ssl_pem_key_cert_pair
|
|
550
|
+
std::vector<tsi_ssl_pem_key_cert_pair> pem_key_cert_pair;
|
|
529
551
|
if (pem_key_cert_pair_list_.has_value()) {
|
|
530
552
|
pem_key_cert_pair = ConvertToTsiPemKeyCertPair(*pem_key_cert_pair_list_);
|
|
531
553
|
}
|
|
532
|
-
bool use_default_roots =
|
|
533
|
-
|
|
534
|
-
pem_key_cert_pair
|
|
554
|
+
bool use_default_roots = options_->root_certificate_distributor() == nullptr;
|
|
555
|
+
return grpc_ssl_tsi_client_handshaker_factory_init(
|
|
556
|
+
pem_key_cert_pair.empty() ? nullptr : &pem_key_cert_pair[0],
|
|
557
|
+
use_default_roots ? nullptr : root_cert_info_,
|
|
535
558
|
skip_server_certificate_verification,
|
|
536
559
|
grpc_get_tsi_tls_version(options_->min_tls_version()),
|
|
537
560
|
grpc_get_tsi_tls_version(options_->max_tls_version()), ssl_session_cache_,
|
|
538
561
|
tls_session_key_logger_.get(), options_->crl_directory().c_str(),
|
|
539
562
|
options_->crl_provider(), &client_handshaker_factory_);
|
|
540
|
-
// Free memory.
|
|
541
|
-
if (pem_key_cert_pair != nullptr) {
|
|
542
|
-
grpc_tsi_ssl_pem_key_cert_pairs_destroy(pem_key_cert_pair, 1);
|
|
543
|
-
}
|
|
544
|
-
return status;
|
|
545
563
|
}
|
|
546
564
|
|
|
547
565
|
// -------------------server security connector-------------------
|
|
@@ -576,30 +594,48 @@ TlsServerSecurityConnector::TlsServerSecurityConnector(
|
|
|
576
594
|
tsi::TlsSessionKeyLoggerCache::Get(tls_session_key_log_file_path);
|
|
577
595
|
}
|
|
578
596
|
// Create a watcher.
|
|
579
|
-
auto
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
597
|
+
auto root_watcher_ptr = std::make_unique<TlsServerCertificateWatcher>(this);
|
|
598
|
+
auto identity_watcher_ptr =
|
|
599
|
+
std::make_unique<TlsServerCertificateWatcher>(this);
|
|
600
|
+
root_certificate_watcher_ = root_watcher_ptr.get();
|
|
601
|
+
identity_certificate_watcher_ = identity_watcher_ptr.get();
|
|
602
|
+
bool watch_root_cert = options_->root_certificate_distributor() != nullptr;
|
|
603
|
+
bool watch_identity_cert =
|
|
604
|
+
options_->identity_certificate_distributor() != nullptr;
|
|
584
605
|
std::optional<std::string> watched_root_cert_name;
|
|
585
|
-
if (
|
|
606
|
+
if (watch_root_cert) {
|
|
586
607
|
watched_root_cert_name = options_->root_cert_name();
|
|
587
608
|
}
|
|
588
609
|
std::optional<std::string> watched_identity_cert_name;
|
|
589
|
-
if (
|
|
610
|
+
if (watch_identity_cert) {
|
|
590
611
|
watched_identity_cert_name = options_->identity_cert_name();
|
|
591
612
|
}
|
|
592
|
-
//
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
613
|
+
// Register the watcher with the distributor.
|
|
614
|
+
if (watch_root_cert) {
|
|
615
|
+
options_->root_certificate_distributor()->WatchTlsCertificates(
|
|
616
|
+
std::move(root_watcher_ptr), watched_root_cert_name,
|
|
617
|
+
watched_identity_cert_name);
|
|
618
|
+
}
|
|
619
|
+
if (watch_identity_cert) {
|
|
620
|
+
options_->identity_certificate_distributor()->WatchTlsCertificates(
|
|
621
|
+
std::move(identity_watcher_ptr), watched_root_cert_name,
|
|
622
|
+
watched_identity_cert_name);
|
|
623
|
+
}
|
|
596
624
|
}
|
|
597
625
|
|
|
598
626
|
TlsServerSecurityConnector::~TlsServerSecurityConnector() {
|
|
599
627
|
// Cancel all the watchers.
|
|
600
|
-
grpc_tls_certificate_distributor*
|
|
601
|
-
options_->
|
|
602
|
-
|
|
628
|
+
grpc_tls_certificate_distributor* root_distributor =
|
|
629
|
+
options_->root_certificate_distributor();
|
|
630
|
+
if (root_distributor != nullptr) {
|
|
631
|
+
root_distributor->CancelTlsCertificatesWatch(root_certificate_watcher_);
|
|
632
|
+
}
|
|
633
|
+
grpc_tls_certificate_distributor* identity_distributor =
|
|
634
|
+
options_->identity_certificate_distributor();
|
|
635
|
+
if (identity_distributor != nullptr) {
|
|
636
|
+
identity_distributor->CancelTlsCertificatesWatch(
|
|
637
|
+
identity_certificate_watcher_);
|
|
638
|
+
}
|
|
603
639
|
if (server_handshaker_factory_ != nullptr) {
|
|
604
640
|
tsi_ssl_server_handshaker_factory_unref(server_handshaker_factory_);
|
|
605
641
|
}
|
|
@@ -681,7 +717,7 @@ int TlsServerSecurityConnector::cmp(
|
|
|
681
717
|
}
|
|
682
718
|
|
|
683
719
|
void TlsServerSecurityConnector::TlsServerCertificateWatcher::
|
|
684
|
-
OnCertificatesChanged(std::shared_ptr<RootCertInfo> roots,
|
|
720
|
+
OnCertificatesChanged(std::shared_ptr<tsi::RootCertInfo> roots,
|
|
685
721
|
std::optional<PemKeyCertPairList> key_cert_pairs) {
|
|
686
722
|
GRPC_CHECK_NE(security_connector_, nullptr);
|
|
687
723
|
MutexLock lock(&security_connector_->mu_);
|
|
@@ -691,10 +727,12 @@ void TlsServerSecurityConnector::TlsServerCertificateWatcher::
|
|
|
691
727
|
if (key_cert_pairs.has_value()) {
|
|
692
728
|
security_connector_->pem_key_cert_pair_list_ = std::move(key_cert_pairs);
|
|
693
729
|
}
|
|
694
|
-
bool root_being_watched =
|
|
730
|
+
bool root_being_watched =
|
|
731
|
+
security_connector_->options_->root_certificate_distributor() != nullptr;
|
|
695
732
|
bool root_has_value = security_connector_->root_cert_info_ != nullptr;
|
|
696
733
|
bool identity_being_watched =
|
|
697
|
-
security_connector_->options_->
|
|
734
|
+
security_connector_->options_->identity_certificate_distributor() !=
|
|
735
|
+
nullptr;
|
|
698
736
|
bool identity_has_value =
|
|
699
737
|
security_connector_->pem_key_cert_pair_list_.has_value();
|
|
700
738
|
if ((root_being_watched && root_has_value && identity_being_watched &&
|
|
@@ -782,21 +820,15 @@ TlsServerSecurityConnector::UpdateHandshakerFactoryLocked() {
|
|
|
782
820
|
// The identity certs on the server side shouldn't be empty.
|
|
783
821
|
GRPC_CHECK(pem_key_cert_pair_list_.has_value());
|
|
784
822
|
GRPC_CHECK(!(*pem_key_cert_pair_list_).empty());
|
|
785
|
-
tsi_ssl_pem_key_cert_pair
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
pem_key_cert_pairs, num_key_cert_pairs, root_cert_info_,
|
|
790
|
-
options_->cert_request_type(),
|
|
823
|
+
std::vector<tsi_ssl_pem_key_cert_pair> pem_key_cert_pairs =
|
|
824
|
+
ConvertToTsiPemKeyCertPair(*pem_key_cert_pair_list_);
|
|
825
|
+
return grpc_ssl_tsi_server_handshaker_factory_init(
|
|
826
|
+
pem_key_cert_pairs, root_cert_info_, options_->cert_request_type(),
|
|
791
827
|
grpc_get_tsi_tls_version(options_->min_tls_version()),
|
|
792
828
|
grpc_get_tsi_tls_version(options_->max_tls_version()),
|
|
793
829
|
tls_session_key_logger_.get(), options_->crl_directory().c_str(),
|
|
794
830
|
options_->send_client_ca_list(), options_->crl_provider(),
|
|
795
831
|
&server_handshaker_factory_);
|
|
796
|
-
// Free memory.
|
|
797
|
-
grpc_tsi_ssl_pem_key_cert_pairs_destroy(pem_key_cert_pairs,
|
|
798
|
-
num_key_cert_pairs);
|
|
799
|
-
return status;
|
|
800
832
|
}
|
|
801
833
|
|
|
802
834
|
} // namespace grpc_core
|