简体   繁体   中英

Cloudflare SSL Handshake Failed (Error 525)

I have a problem with my website (and host). I am using full(strict) crypto setting for my website. And I don't know why it is encountering error since last month the web just work fine.

Here is the debug

Using curl -sv -o command :

curl -sv -o /dev/null https://<domain>.com/ --resolve <domain>.com:<<port>>:<<ip>>

* Added <domain>.com:<<port>>:<<ip>> to DNS cache
* Hostname <domain>.com was found in DNS cache
*   Trying <<vps_ip>>...
* TCP_NODELAY set
* Connected to <domain>.com (<<vps_ip>>) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
*   CAfile: /usr/local/etc/openssl/cert.pem
  CApath: /usr/local/etc/openssl/certs
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
} [5 bytes data]
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
} [512 bytes data]
* error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
* stopped the pause stream!
* Closing connection 0

Using openssl s_client command :

openssl s_client -connect <<vps_ip>>:443 | openssl x509 -text -noout

52457:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:/BuildRoot/Library/Caches/com.apple.xbs/Sources/OpenSSL098/OpenSSL098-64.50.6/src/ssl/s23_clnt.c:618: unable to load certificate

52458:error:0906D06C:PEM routines:PEM_read_bio:no start line:/BuildRoot/Library/Caches/com.apple.xbs/Sources/OpenSSL098/OpenSSL098-64.50.6/src/crypto/pem/pem_lib.c:648:Expecting: TRUSTED CERTIFICATE

And here is the VHost config :

Listen 80
<VirtualHost *:80>
    ServerName <domain>
    ServerAlias <alias>
    ServerAdmin -alreadyset-
    DocumentRoot -alreadyset-

    SSLEngine      off
    SSLCertificateFile        -alreadyset-/mikata.pem
    SSLCertificateKeyFile     -alreadyset-/mikata.key

    <Directory />
        Options FollowSymLinks
        AllowOverride None
        Order allow,deny
        Allow from all
        Require all granted
    </Directory>

    <Directory /home/emtetour/public_html>
        Options Indexes FollowSymLinks Multiviews
        AllowOverride None
        Order allow,deny
        Allow from all
        Require all granted
    </Directory>

    ErrorLog -alreadyset-
    CustomLog -alreadyset-

</VirtualHost>

Listen 443
<VirtualHost *:443>
    ServerName <domain>
    ServerAlias <alias>
    ServerAdmin -alreadyset-
    DocumentRoot -alreadyset-

    SSLEngine      on
    SSLCertificateFile        -alreadyset-/mikata.pem
    SSLCertificateKeyFile     -alreadyset-/mikata.key

    <Directory />
        Options FollowSymLinks
        AllowOverride None
        Order allow,deny
        Allow from all
        Require all granted
    </Directory>

    <Directory /<directory>/public_html>
        Options Indexes FollowSymLinks Multiviews
        AllowOverride None
        Order allow,deny
        Allow from all
        Require all granted
    </Directory>

</VirtualHost>

Anybody can help me? It's already 4 days and I have no clue what to fix... Thanks..

PS The Server is running Apache2.4.25 with UbuntuOS. Cipher and protocol is compatible with cloudflare SSL.

Found the solution

This is probably a very late edit, but apparently Apache need a default VirtualHost settings for 443 port.

So you must add somethings like 111-default.conf then only write server admin, document root, and the SSL config (since mine is a wild-certificate, I used the same config as the website).

Hope this is helpful for others who encounter similar problem.

根据您提供的错误消息,看来您的证书不正确:

Expecting: TRUSTED CERTIFICATE

I put

<VirtualHost *:443></VirtualHost>

in 000-defaults.conf with only DocumentRoot defined and got the same error. So after removing that, it was totally fine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM