Nginx client authentication using multiple client certificates


Jonathan Nagin

I'm trying to setup NGINX to perform client authentication for multiple clients. My problem is that those clients will have different certificates, basically different root CAs:

[clientA.crt] ClientA > IntermediateA > RootA
[clientB.crt] ClientB > IntermediateB1 > IntermediateB2 > RootB

I looked at the NGINX documentation and noticed this ssl_client_certificatedirective. However, if I now configure it to only work with clientA, for example, the property doesn't seem to work on its own:

ssl_client_certificate /etc/nginx/ssl/clientA.crt;   
ssl_verify_client on;

Then I got a 400 error code. By looking at other questions I found that I have to use too ssl_verify_depth: 3. So if I want to connect both clientA and clientB in bundled PEM to allow both clients, do I need to use a higher value? What is the purpose of this directive? What are the implications of setting the bundled PEM to a high number?

cnst

The http://nginx.org/r/ssl_client_certificate directive is used to specify a certificate to trust for client-based authentication. Note that basically every time you try to connect, the whole list is sent ( if you don't need it, use ssl_trusted_certificateit as per the documentation ).

As mentioned above, note that ssl_verify_depthyou can basically control how easy it is to get into the system - if you set it to a high enough value and someone is able to get a certificate through a CA you trust or through a CA. An intermediary they trust generates their own certificate, then they can authenticate to your nginx whether you want to or not.

Therefore, it is common practice that all certificates used for client-based authentication are generated by privately recognized CAs, so in general, the length of the chain should not be too large. If you want to equalize the number of depths between two CAs so you get the best protection out of them ssl_verify_depth, you can think of creating an extra CA to add to the depth, and then adding that CA to the trusted list instead of the actual intermediary now . (Note that once some intermediaries are involved, it gets complicated, the browser will need to be aware of their existence, usually cache them, and can cause many ghosting issues when not cached.)

Also, note that you don't actually have to have only one CA in the specified file, it can contain multiple unrelated "root" CAs, so if you're adding multiple independent CAs, you don't really have to bother creating another CA Authenticate it - you can include such an independent CA as is.

Related


Nginx client authentication using multiple client certificates

Jonathan Nagin I'm trying to setup NGINX to perform client authentication for multiple clients. My problem is that those clients will have different certificates, basically different root CAs: [clientA.crt] ClientA > IntermediateA > RootA [clientB.crt] ClientB

Nginx client authentication using multiple client certificates

Jonathan Nagin I'm trying to setup NGINX to perform client authentication for multiple clients. My problem is that those clients will have different certificates, basically different root CAs: [clientA.crt] ClientA > IntermediateA > RootA [clientB.crt] ClientB

WSDL client authentication and multiple certificates

other: So I'm having issues with wsdls here, with multiple certificates selected in Java. For example, a smart card has multiple certificates on it for signing, encryption and identification. I have a WSDL that generates code for client auth connections, but a

WSDL client authentication and multiple certificates

other: So I'm having issues with wsdls here, with multiple certificates selected in Java. For example, a smart card has multiple certificates on it for signing, encryption and identification. I have a WSDL that generates code for client auth connections, but a

WSDL client authentication and multiple certificates

other: So I'm having issues with wsdls here, with multiple certificates selected in Java. For example, a smart card has multiple certificates on it for signing, encryption and identification. I have a WSDL that generates code for client auth connections, but a

AWS Multiple VPN Client Certificates

Ludo21 South With AWS, I need to make sure I have multiple clients using the VPN network. Each client will use the same server certificate I created earlier. Now, using this document, I managed to set up my own VPN and was able to connect to it using the gener

AWS Multiple VPN Client Certificates

Ludo21 South With AWS, I need to make sure I have multiple clients using the VPN network. Each client will use the same server certificate I created earlier. Now, using this document, I managed to set up my own VPN and was able to connect to it using the gener

AWS Multiple VPN Client Certificates

Ludo21 South With AWS, I need to make sure I have multiple clients using the VPN network. Each client will use the same server certificate I created earlier. Now, using this document, I managed to set up my own VPN and was able to connect to it using the gener

AWS Multiple VPN Client Certificates

Ludo21 South With AWS, I need to make sure I have multiple clients using the VPN network. Each client will use the same server certificate I created earlier. Now, using this document, I managed to set up my own VPN and was able to connect to it using the gener

Using multiple SSL client certificates with the same host in Java

cwick: In my Java application, I need to connect to the same host using SSL, but using a different certificate each time. The reason I need to use a different certificate is that the remote site uses the userid attribute embedded in the certificate to identify

Using multiple SSL client certificates with the same host in Java

cwick: In my Java application, I need to connect to the same host using SSL, but using a different certificate each time. The reason I need to use a different certificate is that the remote site uses the userid attribute embedded in the certificate to identify

Using Client Certificates in Curl Commands

sunsin1985 : curl command: curl -k -vvvv --request POST --header "Content-Type: application/json" --cert client.pem:password --key key.pem "https://test.com:8443/testing" I am trying to send a client certificate using the Curl command specified above. I would

Using Client Certificates in Alamofire 2.0

Paul On Alamofire 1 and Swift 1.2, I use the following code to make a request and submit my own client certificate: Alamofire.request(.POST, url!, parameters: params, encoding: .JSON) .authenticate(usingCredential: credential) .responseJSON { (request,

Using Client Certificates in Curl Commands

sunsin1985 : curl command: curl -k -vvvv --request POST --header "Content-Type: application/json" --cert client.pem:password --key key.pem "https://test.com:8443/testing" I am trying to send a client certificate using the Curl command specified above. I would

Using Client Certificates in Alamofire 2.0

Paul On Alamofire 1 and Swift 1.2, I use the following code to make a request and submit my own client certificate: Alamofire.request(.POST, url!, parameters: params, encoding: .JSON) .authenticate(usingCredential: credential) .responseJSON { (request,

Using Client Certificates in Curl Commands

sunsin1985 : curl command: curl -k -vvvv --request POST --header "Content-Type: application/json" --cert client.pem:password --key key.pem "https://test.com:8443/testing" I am trying to send a client certificate using the Curl command specified above. I would

Using Client Certificates in Alamofire 2.0

Paul On Alamofire 1 and Swift 1.2, I use the following code to make a request and submit my own client certificate: Alamofire.request(.POST, url!, parameters: params, encoding: .JSON) .authenticate(usingCredential: credential) .responseJSON { (request,

Using Client Certificates in Alamofire 2.0

Paul On Alamofire 1 and Swift 1.2, I use the following code to make a request and submit my own client certificate: Alamofire.request(.POST, url!, parameters: params, encoding: .JSON) .authenticate(usingCredential: credential) .responseJSON { (request,

How to allow specific SSL client certificates in Nginx?

Joe White Nginx ssl_client_certificateand ssl_trusted_certificatedirectives can be used to allow client certificates signed by a given authority. But how to allow specific certificates? I want to filter by certificate thumbprint or by certificate authority + c