Modules

Jan 24, 2021

x509 Certificate Relies on Legacy Common Name Field

When Trying to deploy my Kubernetes app, image pull is getting failed with x509

Error

certificate relies on legacy Common Name field, use SANs or temporarily enable Common Name matching with GODEBUG=x509ignoreCN=0 error.

Why is This Error?

The error “x509: certificate relies on legacy Common Name field” typically occurs in the context of SSL/TLS certificates. It indicates that the certificate in question is using the deprecated Common Name (CN) field for identity verification, rather than relying on the Subject Alternative Name (SAN) field.

Here’s a breakdown of the error message

x509: Refers to the X.509 standard, which defines the format for public key certificates.

certificate relies on legacy Common Name field: Indicates that the SSL/TLS certificate is using the Common Name (CN) field for identifying the entity, and this practice is considered legacy or deprecated.

To address this error, consider the following

Update the Certificate: If you have control over the certificate generation process, consider updating the certificate to use the Subject Alternative Name (SAN) extension instead of relying solely on the Common Name (CN) field.

Use SAN Extension: When generating or renewing certificates, make sure to include the Subject Alternative Name (SAN) extension with the appropriate DNS names or IP addresses for the entities the certificate is securing.

Review Certificate Authority (CA) Documentation: If you obtained the certificate from a Certificate Authority (CA), check their documentation or guidelines for generating certificates. They may provide recommendations or requirements for using SAN over CN.

Check Server Configuration: Ensure that your server or application is configured to present the correct certificate with the SAN extension.

Security Considerations: Keep in mind that relying solely on the Common Name field for certificate validation is considered insecure, and modern best practices involve using the Subject Alternative Name extension.

By addressing these points, you can update your SSL/TLS certificates to use the recommended Subject Alternative Name (SAN) extension and mitigate the “x509: certificate relies on legacy Common Name field” error.

Comments

  • Avatar

    Danielle Carline

    Posted on

    As a temporary solution, try to add insecure-registries in your daemon.json file.

    Linux: /etc/docker/daemon.json
    Windows:C:\ProgramData\docker\config\daemon.json

    {"insecure-registries" : ["http://<yourdomain>:<port>"]}
    

    In prod, try to follow the procedure mentioned here.

Write a comment

You can use the Markdown syntax to format your comment.

Tags: docker