Articles in this section

Error "failed to verify certificate: x509: certificate relies on legacy Common Name field" observed when running Aerospike Prometheus Eexporter with SSL

Problem Description

Using SSL while configuring Aerospike Prometheus exporter is causing error:
aerospike-prometheus-exporter: time="2023-12-19T09:28:45Z" level=error msg="ResultCode: NETWORK_ERROR, Iteration: 0, InDoubt: false, Node: <nil>: network error.
Following error can be seen in the wrapped content:
ntls: failed to verify certificate: x509: certificate relies on legacy Common Name field, use SANs instead

Explanation

Pre-requisite to install Aerospike Prometheus Exporter is to install Go v1.17+ and from Go v1.15, the use of Common Name (CN) is deprecated and has been replaced with Subject Alternative Name (SAN).
The deprecated, legacy behavior of treating the CommonName field on X.509 certificates as a host name when no Subject Alternative Names are present is now disabled by default. This is causing the Network error.

Solution

Creating a cert with the CN and SAN set to be the same should resolve the issue and the SAN can then be used in the certificate.

Notes

https://go.dev/doc/go1.15

Applies To Earliest Version

Pre 4.9

Applies To Latest Version

Current Version
Was this article helpful?
0 out of 0 found this helpful