About this question
I am trying to set up a certificate chain for a lab server. I have created my own root CA, an intermediate CA, and a server certificate. I supplied these certificates along with the server key to the OpenSSL s_server command. When I run OpenSSL s_client and connect to that server, OpenSSL complains that there is a self-signed certificate in the certificate chain.
When I connect to a public web server using s_client, however, not only does the server not send all of the certificates in the chain (just the intermediate parent certificate of the server certificate) but OpenSSL doesn't complain about a self-signed certificate, let alone an incomplete certificate chain.
If I use s_server with a CA file containing just the server's parent intermediate certificate, s_client complains that it can't get the local issuer certificate. I never see this error with public web servers even though they don't send the entire certificate chain.
In none of these tests (using my own certificates or public web servers) I am using the -CApath, -CAfile or -verify options with the s_client command.
I don't know what I'm doing wrong. Why does s_client complain about my self-signed certificate in the certificate chain even though I don't use -verify? Why is it complaining about my (I assume) root certificate being self-signed when all root certificates are self-signed? For example, this is what I get with a public web server:
openssl s_client -showcerts -servername security.stackexchange.com -connect security.stackexchange.com:443 CONNECTED(00000004) depth=2 O = Digital Signature Trust Co., CN = DST Root CA X3 verify return:1 depth=1 C = US, O = Let's Encrypt, CN = Let's Encrypt Authority X3 verify return:1 depth=0 CN = *.stackexchange.com verify return:1 ---
But using s_server with my full certificate chain, I get this:
openssl s_client -showcerts -servername server.domain.com -connect server.domain.com:443 CONNECTED(00000004) depth=2 C = US, ST = State, L = City, O = Company, OU = Company CA verify error:num=19:self signed certificate in certificate chain
Here are my certificates. And yes, I have the constraints CA=TRUE, Digital Signature and Certificate Sign set in my root CA.
root CA:
intermediate CA:
server certificate: