Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ssl 配置Nginx以将客户端证书转发到后端_Ssl_Nginx_Https_Certificate_X509 - Fatal编程技术网

Ssl 配置Nginx以将客户端证书转发到后端

Ssl 配置Nginx以将客户端证书转发到后端,ssl,nginx,https,certificate,x509,Ssl,Nginx,Https,Certificate,X509,我为双向ssl配置了一个spring引导服务,以使用证书验证客户端。它位于nginx代理服务器后面。因此,需要配置nginx以提供来自客户端的透明https连接,并将客户端证书转发到要验证的webservice(后端)。还可以为不需要客户端身份验证的其他服务配置单向ssl 比如: |客户端-->httpS+客户端证书-->|NGINX-->httpS+客户端证书-->|服务1| |客户端----------------->httpS----------------->NGINX---------

我为双向ssl配置了一个spring引导服务,以使用证书验证客户端。它位于nginx代理服务器后面。因此,需要配置nginx以提供来自客户端的透明https连接,并将客户端证书转发到要验证的webservice(后端)。还可以为不需要客户端身份验证的其他服务配置单向ssl

比如:

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

  • |客户端----------------->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是不够的


    谢谢。

    这是不可能的。您试图做的是将nginx代理变成一个“中间人”,这是TLS设计不允许的。

    可能相关: