openssl: não é possível obter o certificado do emissor local com algumas versões

0

Com o OpenSSL 1.0.2g (MacPorts no OS X) eu posso verificar o certificado do Google (eu tenho que especificar o pacote de certificado como o OS X geralmente armazena no certificado)

$ echo Q |  /opt/local/bin/openssl s_client   -connect www.google.com:443 -servername www.google.com -verify 6 -CAfile test/cabundle.crt > /dev/null 
verify depth is 6
depth=2 C = US, O = GeoTrust Inc., CN = GeoTrust Global CA
verify return:1
depth=1 C = US, O = Google Inc, CN = Google Internet Authority G2
verify return:1
depth=0 C = US, ST = California, L = Mountain View, O = Google Inc, CN = www.google.com
verify return:1
DONE

Tudo bem. Agora, se eu usar a versão do sistema (0.9.8zg) com o mesmo pacote do CA , recebo um erro:

$ echo Q |  /usr/bin/openssl s_client   -connect www.google.com:443 -servername www.google.com -verify 6 -CAfile test/cabundle.crt > /dev/null 
verify depth is 6
depth=2 /C=US/O=GeoTrust Inc./CN=GeoTrust Global CA
verify error:num=20:unable to get local issuer certificate
verify return:1
depth=2 /C=US/O=GeoTrust Inc./CN=GeoTrust Global CA
verify error:num=27:certificate not trusted
verify return:1
depth=1 /C=US/O=Google Inc/CN=Google Internet Authority G2
verify return:1
depth=0 /C=US/ST=California/L=Mountain View/O=Google Inc/CN=www.google.com
verify return:1
DONE

Eu não entendi onde o problema poderia estar, já que estou especificando o pacote da CA manualmente.

    
por Matteo 21.03.2016 / 12:53

1 resposta

0

De link

The problem is that Apple removed a 1024-bit root in Yosemite, that was used as a trust anchor for Google's (and possible other sites) certificates. Normally, this would not affect certificate validity, because one of the intermediate certificates in its chain is not a trusted root CA in OS X (in the case of Google, it's GeoTrust Global CA).

However, OpenSSL before 1.0.2 does not detect this situation as it should (by checking whether any of the intermediates is a trusted root CA) and always follows the chain of trust to the end. In this situation, it fails to verify the certificate, because the end of the chain of certificates is actually not trusted. OpenSSL 1.0.2 added a switch to fix that (activated by -trusted_first in openssl s_client), but this option needs to be enabled by each software separately.

    
por 21.03.2016 / 13:12

Tags