web-dev-qa-db-ja.com

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ゲスト内から)からのリクエストのみです。私は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経由の通信を妨げるファイアウォールルールはありません。

何が欠けていますか?

[〜#〜] edit [〜#〜]どうやら、これはVirtualBoxネットワークの設定と関係があるようです。 127.0.0.1としてローカルにサイトにアクセスしようとすると、すべてが期待どおりに動作します。他のNAT対応インターフェイス(192.168.56.10)を介して(ローカルでも)接続しようとすると、要求が拒否されます。それを解決する方法のヒントはありますか?

5

私のケースはuser242156と同じだと思います。おそらく、元のポスターです。ディストリビューションのApache2.confにはsite-enabled/*。confしか含まれておらず、私のファイルはその拡張子を使用していなかったため、問題がありました。例:Ubuntu。

したがって、正しい解決策は、ssltest.intraの名前をssltest.intra.confに変更するか、それが実際に受け入れられない場合は、Apache2.confを変更してIncludeOptional sites-enabled/*

4
matt2000

同じ問題があった。私の状況では、次の解決策が機能しました(Apache 2.2/Debian Squeeze)

リスニングの瞬間にssl configがロードされなかったようです。仮想ホスト構成で何度も試行錯誤を繰り返した後、仮想ホストディレクティブ部分ではなく、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>
2
user242156