How do I resolve the error "SSL received a record that exceeded the maximum permissible length" in apache2?

  • 19,000
  • Tác giả: admin
  • Ngày đăng:
  • Lượt xem: 19
  • Tình trạng: Còn hàng

It's possible to tướng get this error if your virtual host configuration is incomplete and relies on ssl.conf (vendor installed) to tướng vì thế the setup for you. For example if you have a something lượt thích this (RHEL7/httpd 2.4):

/etc/httpd/conf.d/confluence.conf


    ServerName  localhost.localdomain
    DocumentRoot /var/www/html

/var/www/html/index.html

helo

Then because confluence.conf is alphabetically before ssl.conf, the SSL virtual host will not yet have been evaluated and httpd will use port 443 to tướng serve unencrypted data, which you can prove lượt thích this:

[root@localhost ~]# curl https://localhost.localdomain 
curl: (35) SSL received a record that exceeded the maximum permissible length.
[root@localhost ~]# curl http://localhost.localdomain:443   
helo

In this case we can see the second curl works because the connection on port 443 is speaking plain http.

If we rename confluence.conf to tướng be alphabetically after ssl.conf, then the SSL port will have been setup and it all starts working, eg:

[root@localhost vagrant]# curl https://localhost.localdomain -k
curl: (35) SSL received a record that exceeded the maximum permissible length.
[root@localhost vagrant]# mv /etc/httpd/conf.d/confluence.conf /etc/httpd/conf.d/t.conf         
[root@localhost vagrant]# systemctl restart httpd
[root@localhost vagrant]# curl https://localhost.localdomain -k
helo

My recommendation to tướng fix this would be to tướng configure mod_ssl within the VirtualHost directive:


    ...
    SSLEngine on
    SSLCertificateFile /etc/pki/tls/certs/localhost.crt
    SSLCertificateKeyFile /etc/pki/tls/private/localhost.key

Alternatively, renaming the tệp tin containing the VirtualHost definition to tướng come alphabetically after ssl.conf will will work but this technique can be easily overlooked.