Bug 205011 - openssl: verify error:num=20:unable to get local issuer certificate
Summary: openssl: verify error:num=20:unable to get local issuer certificate
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 10.1-RELEASE
Hardware: amd64 Any
: --- Affects Many People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-12-04 08:58 UTC by Oliver Schonrock
Modified: 2021-11-19 14:57 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Oliver Schonrock 2015-12-04 08:58:07 UTC
The openssl in 10.1 release fails to verify some server certificates using 
/usr/local/share/certs/ca-root-nss.crt. FreeBSD 10 & 10.2 both work fine. This may be an upstream issue with openssl, but I have not been able to find any reported issues. 

To Reproduce:
$ openssl s_client -connect api.textmarketer.co.uk:443
depth=2 C = US, O = "thawte, Inc.", OU = Certification Services
Division, OU = "(c) 2006 thawte, Inc. - For authorized use only", CN =
thawte Primary Root CA
verify error:num=20:unable to get local issuer certificate
...

The same command on 10.2 (or 10) results in:
$ openssl s_client -connect api.textmarketer.co.uk:443
depth=2 C = US, O = "thawte, Inc.", OU = Certification Services Division, OU = "(c) 2006 thawte, Inc. - For authorized use only", CN = thawte Primary Root CA
verify return:1
...

This error message is widely reported as being due to path issues to the CA bundle. In fact on 10.1 a similar command even fails to verify other server certs with a different root CA:

$openssl s_client -connect google.com:443
depth=3 C = US, O = Equifax, OU = Equifax Secure Certificate Authority
verify error:num=20:unable to get local issuer certificate

However the google.com Equifax secure root CA can be made to work with 10.1 if you specify the -CAfile

$ openssl s_client -CAfile /usr/local/share/certs/ca-root-nss.crt -connect
google.com:443
depth=3 C = US, O = Equifax, OU = Equifax Secure Certificate Authority
verify return:1

This is NOT the case for the original Thawte example:

$ openssl s_client -CAfile /usr/local/share/certs/ca-root-nss.crt -connect api.textmarketer.co.uk:443
depth=2 C = US, O = "thawte, Inc.", OU = Certification Services
Division, OU = "(c) 2006 thawte, Inc. - For authorized use only", CN =
thawte Primary Root CA
verify error:num=20:unable to get local issuer certificate

On FreeBSD 10 or 10.2 all CA root certs tested verify fine, with the default install without the need for CAfile. 

Having to pass -CAfile might be acceptable, as this is just a "packaging and OS integration issue on paths", however the fact that even with the correct -CAfile SOME root certs do NOT verify, leads me to believe that something more fundamental is broken with the openssl version in FreeBSD 10.1, which is:
OpenSSL 1.0.1l-freebsd 15 Jan 2015

This was tested and verified on a clean install of 10.1-RELEASE. 

(NOTE: openssl from ports also works fine, even on 10.1, this report is about the openssl in the base system).
Comment 1 Oliver Schonrock 2015-12-04 08:59:25 UTC
This problem obviously cascades down into all base system and userland applications which rely on openssl, eg: fetch or curl.
Comment 2 Bernard Spil freebsd_committer freebsd_triage 2020-03-17 19:41:53 UTC
Hi Oliver,

Working through old reports, I found this one. Is it still relevant?
Comment 3 Allan Jude freebsd_committer freebsd_triage 2021-11-19 14:57:19 UTC
This problem has not been reported on modern versions of FreeBSD, which now include the certificate bundle in base as well.