Configure Mutual Authentication on Kubernetes

4/14/2020

I am trying to implement Mutual Authentication in Kubernetes, I am able to create the certificate and able to configure it into the cluster too, But I am getting error when I send certificate from client side.

So here is the problem

When I create the certificate I have to give Common Name. This field must contain a fully qualified domain name. Since my domain name is very long 93 characters, it is not allowing me to enter my domain name,

My doubt is, is it mandatory to have full domain Name in Common Name field while generating the certificate, or do we have any workaround for this.

TIA

-- Rigsby
kubernetes
mutual-authentication
ssl

1 Answer

4/14/2020

You can provide the Fully Qualified Domain Named(FQDN) in Subject Alternative Name instead of Common Name. Subject Alternative Name don't have the limitation of 64 characters.

The general rule is that the domain is checked against all SANs and the common name. If the domain is found there, then the certificate is ok for connection.

RFC 5280, section 4.1.2.6 says "The subject name MAY be carried in the subject field and/or the subjectAltName extension". This means that the domain name must be checked against both SubjectAltName extension and Subject property (namely it's common name parameter) of the certificate. These two places complement each other, and not duplicate it. And SubjectAltName is a proper place to put additional names, such as www.domain.com or www2.domain.com

As per RFC 6125, published in '2011 the validator must check SAN first, and if SAN exists, then CN should not be checked. Note, that the RFC 6125 is relatively recent and there still exist certificates and CAs that issue certificates, which include the "main" domain name in CN and alternative domain names in SAN. I.e. by excluding CN from validation if SAN is present, you can deny some otherwise valid certificate

-- Arghya Sadhu
Source: StackOverflow