bunkerweb icon indicating copy to clipboard operation
bunkerweb copied to clipboard

[FEATURE] Add TLS certificate verification for gRPC upstreams

Open YouKyi opened this issue 2 months ago • 0 comments

What's needed and why?

The gRPC plugin supports TLS upstreams through grpcs:// and provides SNI settings through GRPC_SSL_SNI and GRPC_SSL_SNI_NAME.

However, it does not currently expose NGINX's upstream certificate verification directives:

  • grpc_ssl_verify
  • grpc_ssl_trusted_certificate
  • grpc_ssl_verify_depth

Because grpc_ssl_verify defaults to off in NGINX, a grpcs:// connection is encrypted but the upstream server identity is not verified.

The HTTP/HTTPS reverse proxy plugin already provides equivalent settings:

  • REVERSE_PROXY_SSL_VERIFY
  • REVERSE_PROXY_SSL_TRUSTED_CERTIFICATE_PRIORITY
  • REVERSE_PROXY_SSL_TRUSTED_CERTIFICATE
  • REVERSE_PROXY_SSL_TRUSTED_CERTIFICATE_DATA
  • REVERSE_PROXY_SSL_VERIFY_DEPTH

The gRPC plugin should provide the same certificate validation capability for grpcs:// upstreams.

NGINX documentation: https://nginx.org/en/docs/http/ngx_http_grpc_module.html#grpc_ssl_verify

Existing HTTP implementation: https://github.com/bunkerity/bunkerweb/blob/v1.6.14/src/common/core/reverseproxy/plugin.json

Implementations ideas (optional)

Add the following multisite settings to the gRPC plugin:

  • GRPC_SSL_VERIFY, default no
  • GRPC_SSL_TRUSTED_CERTIFICATE_PRIORITY, values file or data
  • GRPC_SSL_TRUSTED_CERTIFICATE
  • GRPC_SSL_TRUSTED_CERTIFICATE_DATA
  • GRPC_SSL_VERIFY_DEPTH, default 1

When verification is enabled and a valid CA bundle is available, render:

grpc_ssl_verify on;
grpc_ssl_verify_depth <configured depth>;
grpc_ssl_trusted_certificate <cached CA bundle>;

Code of Conduct

  • [x] I agree to follow this project's Code of Conduct

YouKyi avatar Sep 19 '26 11:09 YouKyi