Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am trying to setup ssl client authentication in nginx. I crated a self-signed root CA. Using that, I created a sub-CA. I used this sub-CA to create a certificate for a client. I concatenated the sub-CA and the root CA into a new file. I verified the client certificate as follows:

$ openssl verify -purpose sslclient -CAfile auth-root.crt testcert.crt
testcert.crt: OK

auth-root.crt is the concatendated sub and root CA; testcert.crt is the client certificate.

I pointed nginx to the auth-root.crt using ssl_client_certificate.

When I make an HTTP request using the testcert.crt certificate, nginx fails. I turned on debug logs and can see the following:

2012/06/21 22:58:47 [debug] 8901#0: *2 verify:0, error:2, depth:1, subject:"/C=US/ST=Florida/L=Tampa/O=Test org/OU=Test OU/CN=AuthCerts TestCA",issuer: "/C=US/ST=Florida/L=tampa/O=Test org/OU=Test OU/CN=Root TestCA"
2012/06/21 22:58:47 [debug] 8901#0: *2 verify:0, error:27, depth:1, subject:"/C=US/ST=Florida/L=Tampa/O=Test org/OU=Test OU/CN=AuthCerts TestCA",issuer: "/C=US/ST=Florida/L=tampa/O=Test org/OU=Test OU/CN=Root TestCA"
2012/06/21 22:58:47 [debug] 8901#0: *2 verify:1, error:27, depth:0, subject:"/C=US/ST=Florida/L=Tampa/O=Accelerated Concepts/OU=NetBridge/CN=030202",issuer: "/C=US/ST=Florida/L=Tampa/O=Test org/OU=Test OU/CN=AuthCerts TestCA"
share|improve this question

1 Answer 1

up vote 5 down vote accepted

You need to use the ssl_verify_depth directive set to at least 2 since your certificate chain requires two hops. For each other sub-CA between the root and the client certificates, you need to increase that number by one.

share|improve this answer
2  
Thanks for sharing the solution. You may want to mark your own answer as correct, when you get a chance. –  Pothi Jun 22 '12 at 2:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.