Apache SSL 구성 - 요청 \x16\x03\x01의 잘못된 메소드

Apache SSL 구성 - 요청 \x16\x03\x01의 잘못된 메소드

Debian Squeeze 및 Apache 2를 실행하는 VirtualBox 게스트 인스턴스에 https 서비스를 설정하려고 합니다.

Win7 호스트 컴퓨터의 브라우저에서 가상 호스트의 테스트 페이지를 로드하려고 하면 "ssl_error_rx_record_too_long". 동시에 Apache 오류 로그에는 "\x16\x03\x01 요청의 메서드가 잘못되었습니다." 이 요청에 대한 문제입니다. 이 문제는 제가 VirtualBox 게스트 내에서 Apache를 실행하고 있다는 사실과 관련이 없지만 전체 그림을 보여주고 싶었습니다.

정말 흥미로운 부분은 사이트가 제대로 로드되는 지점에 이미 도달했지만, localhost(예: VirtualBox Debian Guest 내에서)에서 오는 요청에만 해당된다는 것입니다. Lynx와 wget으로 이것을 확인했는데 예상대로 작동합니다.

wget https://ssltest.intra/ssl.html
--2013-09-13 07:26:49--  https://ssltest.intra/ssl.html
Resolving ssltest.intra (ssltest.intra)... 127.0.0.1
Connecting to ssltest.intra (ssltest.intra)|127.0.0.1|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 122 [text/html]
Saving to: `ssl.html.1'

100%[======================================>] 122         --.-K/s   in 0s

2013-09-13 07:26:49 (1.94 MB/s) - `ssl.html.1' saved [122/122]

저장된 파일의 내용이 예상한 것과 정확히 일치합니다. 게다가 일반 텍스트 HTTP를 통해 서버와 통신하려고 하면 서버는 나를 더 나은 곳으로 정당하게 보냅니다.

telnet ssltest.intra 443
Trying 127.0.0.1...
Connected to ssltest.intra.
Escape character is '^]'.
GET /ssl.html
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
Reason: You're speaking plain HTTP to an SSL-enabled server port.<br />
Instead use the HTTPS scheme to access this URL, please.<br />
<blockquote>Hint: <a href="https://ssltest.intra/"><b>https://ssltest.intra/</b></a></blockquote></p>
<hr>
<address>Apache/2.2.22 (Debian) Server at ssltest.intra Port 443</address>
</body></html>
Connection closed by foreign host.

아래 구성 파일(이 SSL 사이트가 작동하기 위한 최소한의 항목을 제외하고 구성에서 모든 것을 제거했습니다)

ports.conf:

Listen 443

httpd.conf: 비어 있음

ssltest.intra: (가상호스트 구성)

<VirtualHost *:443>

        ServerName ssltest.intra
        ServerAdmin [email protected]

        SSLEngine On
        SSLCertificateFile /etc/ssl/certs/ssltest.intra.crt
        SSLCertificateKeyFile /etc/ssl/certs/ssltest.intra.key

        DocumentRoot /var/www/ssltest.intra
        Options FollowSymLinks

        <Directory /var/www/ssltest.intra/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>

        php_value error_log /var/www/ssltest.intra/php_errors.log
        ErrorLog /var/log/apache2/ssltest.intra.error.log
        LogLevel warn
        CustomLog /var/log/apache2/ssltest.intra.access.log combined

</VirtualHost>

인증서 키가 표시된 위치에 있고 도메인에 대해 유효한(만료되지 않은) 키인지 확인했습니다. 위의 가상 호스트 구성은 에 의해 활성화되었습니다 a2ensite ssltest.intra. mod_ssl이 활성화되었고 apache2가 다시 시작되었습니다(여러 번). Apache를 시작하면 로그에 다음 항목이 표시됩니다.

Apache/2.2.22 (Debian) PHP/5.3.3-7+squeeze14 with Suhosin-Patch mod_ssl/2.2.22
OpenSSL/1.0.1e mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations

443을 통한 통신을 차단하는 방화벽 규칙은 없습니다.

내가 무엇을 놓치고 있나요?

편집하다분명히 이것은 VirtualBox 네트워크 설정과 관련이 있습니다. 127.0.0.1로 로컬 사이트에 접속하려고 하면 모든 것이 예상대로 작동합니다. 다른 NAT 인터페이스(192.168.56.10)를 통해 (로컬에서도) 연결을 시도하면 요청이 거부됩니다. 이 문제를 해결하는 방법에 대한 조언이 있습니까?

답변1

내 사례는 user242156과 동일하며 아마도 원본 포스터일 가능성이 높습니다. 문제는 배포판의 apache2.conf에 sites-enabled/*.conf만 포함되어 있고 내 파일이 필요하지 않기 때문에 해당 확장을 사용하지 않았기 때문에 sites-enabled/의 내 구성 파일이 실제로 읽혀지지 않았다는 것입니다. 예를 들어 우분투.

따라서 올바른 해결 방법은 ssltest.intra의 이름을 ssltest.intra.conf로 바꾸는 것입니다. 또는 이것이 실제로 허용되지 않는 경우 apache2.conf를 수정하여 행을 추가합니다 IncludeOptional sites-enabled/*.

답변2

같은 문제가있었습니다. 내 상황에서는 다음 솔루션이 작동했습니다 (Apache 2.2/Debian Squeeze)

듣는 순간 SSL 구성이 로드되지 않은 것 같습니다. 가상 호스트 구성에 대한 많은 시도와 오류 후에 가상 호스트 지시문 부분 대신 apache2.conf에 SSL 구성을 추가했습니다. 포트는 ports.conf에서 구성됩니다. 그 후 내 SSL이 제대로 작동했습니다. 구성 부분을 로드할 때 순서 문제가 있는 것 같습니다.

apache2.conf 하단에 SSL 부분을 추가했습니다.

SSLEngine on
SSLCertificateFile /etc/apache2/ssl/<server certificate filename>
SSLCertificateKeyFile /etc/apache2/ssl/<privatekey filename>
SSLCACertificateFile /etc/apache2/ssl/CaCert.crt

ports.conf에 이미 항목이 있습니다.

# If you just change the port or add more ports here, you will likely also
 have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default
# This is also true if you have upgraded from before 2.2.9-3 (i.e. from
# Debian etch). See /usr/share/doc/apache2.2-common/NEWS.Debian.gz and
# README.Debian.gz
Listen 80
<IfModule mod_ssl.c>
    # SSL name based virtual hosts are not yet supported, therefore no
    # NameVirtualHost statement here
Listen 443
</IfModule>

관련 정보