[FEATURE] Add TLS certificate verification for gRPC upstreams
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_verifygrpc_ssl_trusted_certificategrpc_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_VERIFYREVERSE_PROXY_SSL_TRUSTED_CERTIFICATE_PRIORITYREVERSE_PROXY_SSL_TRUSTED_CERTIFICATEREVERSE_PROXY_SSL_TRUSTED_CERTIFICATE_DATAREVERSE_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, defaultnoGRPC_SSL_TRUSTED_CERTIFICATE_PRIORITY, valuesfileordataGRPC_SSL_TRUSTED_CERTIFICATEGRPC_SSL_TRUSTED_CERTIFICATE_DATAGRPC_SSL_VERIFY_DEPTH, default1
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