client authentication when using nginx proxy_pass

2019-07-29 04:01发布

My question is about nginx directive "proxy_pass".

I have an http server and I need to redirect requests using https. I'm using the following statement: proxy_pass https://secure.server In wireshark I see that there is a SSL handshake, but client (nginx proxy_pass https:) did not send certificate on server's SSL certificate request. Verifying client certificate is necessary by server. How can I force proxy_pass to send client certificate when using https ? Below is part of nginx.conf configuration file:

server {
    listen  8888;
    server_name     _;
    error_page 405 =200 $uri;
    ssl_certificate       /usr/local/cert.pem;
    ssl_certificate_key   /usr/local/cert.pem                                          
    ssl_client_certificate  /usr/local/ca.cer;       

    location ~ /uri/(.+) {

                    proxy_pass https://secure.server;
                    break;
            }

    }

标签: nginx
3条回答
兄弟一词,经得起流年.
2楼-- · 2019-07-29 04:07

You need to enable SSL client certificate verification.

Add this under the other SSL configurations:

ssl_verify_client on;

See more information here.

查看更多
家丑人穷心不美
3楼-- · 2019-07-29 04:21

During ssl handshake, the server will send "client certificate ca names". (ie) The server will accept the client certificates only from those CAs. Client will send send client certificate only if it has a cert signed by those CA.

So in your case, verify 1. The CA names send by server for client cert request. This will be the CAs you have configured in the truststore of the server. (ie) During ssl handshake look for CertificateRequest message

  1. Make sure you client cert is signed by one of those CA

  2. Best option is to verify with curl, both your client and server certificates are configured properly curl -vvv --cert /usr/local/cert.pem https://secure.server If you are not able to figure out with the curl output, please paste the curl output

查看更多
倾城 Initia
4楼-- · 2019-07-29 04:29

I'm looking for the same solution as well.

I found SEnginx, which has a module called "Proxy HTTPS Client Certificate". From the description it seems that is should allow for client certificates, but I could not get it to work for me. The backend server simply would not prompt the client for a certificate.

Following is the link to SEnginx.

Also: Here is a possible explanation as to why this might not be possible.

查看更多
登录 后发表回答