태그 보관물: apache-2.4

apache-2.4

Apache SSL-로컬 발급자 인증서를 가져올 수 없음 정확히 같은 오류를

어쨌든 오늘 갑자기 내 Seafile 클라이언트 가이 오류를 던졌습니다. openssl이 정확히 같은 오류를 발생시키기 때문에 Seafile 문제를 믿지 않습니다.

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

나를 위해 체인 부분은 정확히 무엇을해야합니다. 아파치 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>

내 문제가 무엇인지 찾을 수 없습니다 … (ca 인증서는 lubuntu 14.04에 설치되어 있습니다). 클래스 1 인증서를 연결했기 때문에 해당 사이트 는 적용되지 않지만 광산은 클래스 2에서 발급됩니다.



답변

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

OpenSSL에 의한이 오류는 프로그램이 인증서 발행자 또는 제공된 체인의 최상위 인증서를 확인할 수 없음을 의미합니다. 이는 다음과 같은 경우에 발생할 수 있습니다.

  • 인증서의 인증서 체인이 다른 쪽에서 제공되지 않았거나 인증서 체인이 없습니다 (자체 서명되어 있음).
  • 루트 인증서가 신뢰할 수있는 루트 인증서의 로컬 데이터베이스에 없습니다.
  • 신뢰할 수있는 루트 인증서의 로컬 데이터베이스가 제공되지 않아 OpenSSL에서 쿼리하지 않았습니다. 인증서 경로를 명시 적으로 지정하려면 -CApath또는 -CAfile옵션을 사용하십시오 . 데비안과 우분투의 경우는 다음과 같습니다.

    -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
    

후자는 더 많은 정보가 필요합니다. 가 우분투에서 OpenSSL을 오픈 버그 리포트 2009은 :

-CApath를 사용하면 -CAfile이 기본값 인 /etc/ssl/certs/ca-certificates.crt로 설정됩니다.

에 의해 path로 제공 한 것이 무엇이든간에 기본 값 (사전 비어 있음)으로 설정되어 -CApath있기 때문에 작동 할 수 있습니다 -CAfile. 따라서 로컬 인증서 데이터베이스로 인증서를 확인하는 데 OpenSSL의 기본 동작에 의존하지 마십시오 . 가짜 일 수 있습니다!


답변