apache ssl-无法获取本地发行者证书


10

不知何故,今天,我的seafile客户端突然抛出了此错误。我不相信这是一个seafile问题,因为我的openssl引发了完全相同的错误:

user@nb-user:~$ echo |openssl s_client -connect seafile.mydomain.ch:443
CONNECTED(00000003)
depth=1 C = IL, O = StartCom Ltd., OU = Secure Digital Certificate Signing, CN = StartCom Class 2 Primary Intermediate Server CA
verify error:num=20:unable to get local issuer certificate
verify return:0
---
Certificate chain
 0 s:/description=5RygJ9fx8e2SBLzw/C=CH/ST=Thurgau/L=Frauenfeld/O=mydomain GmbH/CN=*.mydomain.ch/emailAddress=postmaster@mydomain.ch
   i:/C=IL/O=StartCom Ltd./OU=Secure Digital Certificate Signing/CN=StartCom Class 2 Primary Intermediate Server CA
 1 s:/C=IL/O=StartCom Ltd./OU=Secure Digital Certificate Signing/CN=StartCom Class 2 Primary Intermediate Server CA
   i:/C=IL/O=StartCom Ltd./OU=Secure Digital Certificate Signing/CN=StartCom Certification Authority
---
Server certificate
-----BEGIN CERTIFICATE-----
MIIGqzCCBZOgAwIBAgIDAjmGMA0GCSqGSIb3DQEBBQUAMIGMMQswCQYDVQQGEwJJ
TDEWMBQGA1UEChMNU3RhcnRDb20gTHRkLjErMCkGA1UECxMiU2VjdXJlIERpZ2l0
[... some more lines]
-----END CERTIFICATE-----
subject=/description=5RygJ9fx8e2SBLzw/C=CH/ST=Thurgau/L=Frauenfeld/O=mydomain GmbH/CN=*.mydomain.ch/emailAddress=postmaster@mydomain.ch
issuer=/C=IL/O=StartCom Ltd./OU=Secure Digital Certificate Signing/CN=StartCom Class 2 Primary Intermediate Server CA
---
No client certificate CA names sent
---
SSL handshake has read 3997 bytes and written 431 bytes
---
New, TLSv1/SSLv3, Cipher is ECDHE-RSA-AES256-GCM-SHA384
Server public key is 2048 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
SSL-Session:
    Protocol  : TLSv1.2
    Cipher    : ECDHE-RSA-AES256-GCM-SHA384
    Session-ID: 96E1F6B9E123F8F8C1C1E8FB0DBACDBBE76ECB3E2CF5C46C1FD2CF46833C8212
    Session-ID-ctx: 
    Master-Key: 25837E1786B0CC60E676D0694319641CD0887F9CAF48A820F1C0D6ABA6FDE0742551816ACD2A4885B0D3FC143716B1F6
    Key-Arg   : None
    PSK identity: None
    PSK identity hint: None
    SRP username: None
    TLS session ticket lifetime hint: 300 (seconds)
    TLS session ticket:
    0000 - 88 15 c0 c5 30 04 63 d6-ff 7c 72 c4 12 84 7b d6   ....0.c..|r...{.
    0010 - 73 33 8d 91 7c da ce 22-23 d0 31 fb c1 7f 1c 9c   s3..|.."#.1.....
    [... some more lines]

    Start Time: 1424953937
    Timeout   : 300 (sec)
    Verify return code: 20 (unable to get local issuer certificate)
---
DONE

对我来说,链条部分看起来应该是什么。apache conf也应该可以:

root@i-can-haz-data ~ # cat /etc/apache2/sites-enabled/seafile.conf

<VirtualHost *:443>

    ServerName seafile.mydomain.ch
    DocumentRoot /opt/seafile/www

    [... seafile specific things]

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    SSLEngine on
    SSLCertificateFile      /etc/ssl/custom/wildcardmydomain.ch.crt
    SSLCertificateKeyFile   /etc/ssl/custom/wildcardmydomain.ch.key
    SSLCertificateChainFile /etc/ssl/custom/wildcardmydomain.ch.chain.crt

    [... seafile specific things]

</VirtualHost>

我找不到我的问题是什么...(我的lubuntu 14.04上安装了ca-certificates)。他们的网站不适用,因为他们链接了1类证书,但是我的网站是由2类颁发的。


哪个操作系统?最近更新了ca证书吗?Ubuntu于2015-02-23更新。如果添加-CApath /etc/ssl/certs/或存储证书怎么办?您可能缺少链中的根证书吗?
sebix

哇,您为我指明了正确的方向。谢谢!echo | openssl s_client -connect seafile.mydomain.ch:443 -CApath / etc / ssl / certs /->验证返回码:0(确定)DISTRIB_DESCRIPTION =“ Ubuntu 14.04.2 LTS”。系统最新:0升级,0新安装,0删除和0未升级。封装:ii ca证书20141019ubuntu0.14.04.1
Dionysius

Answers:


19
verify error:num=20:unable to get local issuer certificate

OpenSSL的此错误表示程序无法验证证书的颁发者或所提供链的最高证书。在某些情况下可能会发生这种情况,例如:

  • 另一方未提供该证书的证书链,或者该证书链没有一个(它是自签名的)。
  • 根证书不在受信任的根证书的本地数据库中。
  • 未提供受信任的根证书的本地数据库,因此OpenSSL不对其进行查询。要明确给出证书的路径,请使用-CApath-CAfile选项。对于Debian和Ubuntu,例如:

    -CApath /etc/ssl/certs/
    -CAfile /etc/ssl/certs/ca-certificates.crt
    

    因此导致

    openssl s_client -connect example.com:443 -CApath /etc/ssl/certs/
    openssl s_client -connect example.com:443 -CAfile /etc/ssl/certs/ca-certificates.crt
    

后者需要更多信息。自2009年以来,Ubuntu中有一个针对OpenSSL开放错误报告

使用-CApath似乎将-CAfile设置为默认的/etc/ssl/certs/ca-certificates.crt。

不管您通过给出什么作为路径-CApath,它都可能起作用,因为-CAfile还将其设置为默认值(之前为空)。因此,不要将OpenSSL的默认行为依赖于本地证书数据库来验证证书,这可能是虚假的!


因此,您的意思是我的服务器和笔记本电脑的系统配置都没有错(因为使用-CApath选项可以正常工作)?那么,seafile-client通知我该错误是一个错误吗?也许是这个问题:github.com/haiwen/seafile-client/issues/93-但是,谢谢,标记为已解决:)
Dionysius

我进一步研究了OpenSSL的行为,请参阅更新后的文章。您也可以考虑投票;)
sebix 2015年
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.