Update Root Certificate | “server certificate verification failed” error
When upgrading packages on non-upgraded systems, an error can sometimes occur if old certificates are present:
server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crtTo renew certificates, do the following:.
Centos:
Install if not:
yum install ca-certificatesAnd update:
update-ca-trust force-enableUbuntu\Debian:
Reconfiguring certificates:
dpkg-reconfigure ca-certificatesUncheck DST Root CA X3 and execute:
update-ca-certificatesAlso, we can add a specific certificate. To do this, run the command:
echo | openssl s_client -showcerts -servername www.example.com -connect example.com:443 2>/dev/null | awk '/-----BEGIN CERTIFICATE-----/, /-----END CERTIFICATE-----/' >> /usr/local/share/ca-certificates/ca-certificates.crtAnd update the certificate:
update-ca-certificatesWhere: www.example.com and example.com — is the host from which to add the certificate.
If the error appears when updating packages, we simply solve:
Add the following lines to the /etc/apt/apt.conf.d/80ssl-exceptions file:
Acquire::https::Verify-Peer "false";
Acquire::https::Verify-Host "false";Next update:
apt-get update
apt-get upgrade