【问题标题】:Configure Nginx to forward client certificate to backend配置 Nginx 将客户端证书转发到后端
【发布时间】:2017-07-04 06:30:02
【问题描述】:

我为两种方式的 ssl 配置了一个 Spring Boot 服务,以使用证书验证客户端。它位于 nginx 代理服务器后面。因此要求配置 nginx 以提供来自客户端的透明 https 连接,并将客户端证书转发到要验证的 web 服务(后端)。还可以为不需要客户端身份验证的其他服务配置一种方式 ssl。

类似:

  1. |客户| -->httpS + 客户端证书--->|NGINX|--->httpS + 客户端证书--->|服务1|

  2. |客户| ------------>httpS------------>|NGINX| ------------>http------------>|服务2|

我的 nginx 配置:

server {
    listen       443;
    server_name  xx.xx.xx.xxx;

     ssl on;
     ssl_certificate      /path/to/server/cert.crt;
     ssl_certificate_key  /path/to/server/key.key;
     ssl_client_certificate /path/to/ca.crt;
     ssl_verify_client optional;

     location /service1/ {
         proxy_pass https://service1:80/;   
         #Config to forward client certificate or to forward ssl connection(handshake) to service1
     }

     location /service2/ {
         proxy_pass http://service2:80/;
         #http connection
     }
}

另外,有没有办法从证书中获取公用名来验证客户端并在 nginx 中做出决定?因为使用 CA 是不够的。

谢谢..

【问题讨论】:

标签: ssl nginx https certificate x509


【解决方案1】:

这是不可能的。您尝试做的是将 nginx 代理变成“中间人”,而 TLS 在设计上不允许这样做。

【讨论】:

    猜你喜欢
    • 2020-08-31
    • 2017-06-08
    • 1970-01-01
    • 1970-01-01
    • 2013-01-20
    • 2018-05-04
    • 1970-01-01
    • 2018-06-09
    • 2013-06-06
    相关资源
    最近更新 更多