gga*_*a24 5 tomcat mod-proxy mod-ssl apache-2.2
我正在尝试为通过 SSL 运行 tomcat 嵌入服务器的应用程序设置反向代理。该应用程序需要在端口 9002 上通过 SSL 运行,因此我无法为此应用程序“禁用 SSL”。当前的设置架构如下所示:
[192.168.0.10:443 - Apache with mod_proxy] --> [192.168.0.10:9002 - Tomcat App]
Run Code Online (Sandbox Code Playgroud)
在谷歌搜索如何进行这样的设置(和测试)之后,我遇到了这个:
https://bugs.launchpad.net/ubuntu/+source/openssl/+bug/861137
这导致我当前的配置(尝试模拟 wget 的 --secure-protocol=sslv3 选项)
/etc/apache2/sites/enabled/default-ssl:
<VirtualHost _default_:443>
SSLEngine On
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
SSLProxyEngine On
SSLProxyProtocol SSLv3
SSLProxyCipherSuite SSLv3
ProxyPass /test/ https://192.168.0.10:9002/
ProxyPassReverse /test/ https://192.168.0.10:9002/
LogLevel debug
ErrorLog /var/log/apache2/error-ssl.log
CustomLog /var/log/apache2/access-ssl.log combined
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
问题是错误日志显示错误:14077102:SSL 例程:SSL23_GET_SERVER_HELLO:不支持的协议
完整的请求日志:
[Wed Mar 13 20:05:57 2013] [debug] mod_proxy.c(1020): Running scheme https handler (attempt 0)
[Wed Mar 13 20:05:57 2013] [debug] mod_proxy_http.c(1973): proxy: HTTP: serving URL https://192.168.0.10:9002/
[Wed Mar 13 20:05:57 2013] [debug] proxy_util.c(2011): proxy: HTTPS: has acquired connection for (192.168.0.10)
[Wed Mar 13 20:05:57 2013] [debug] proxy_util.c(2067): proxy: connecting https://192.168.0.10:9002/ to 192.168.0.10:9002
[Wed Mar 13 20:05:57 2013] [debug] proxy_util.c(2193): proxy: connected / to 192.168.0.10:9002
[Wed Mar 13 20:05:57 2013] [debug] proxy_util.c(2444): proxy: HTTPS: fam 2 socket created to connect to 192.168.0.10
[Wed Mar 13 20:05:57 2013] [debug] proxy_util.c(2576): proxy: HTTPS: connection complete to 192.168.0.10:9002 (192.168.0.10)
[Wed Mar 13 20:05:57 2013] [info] [client 192.168.0.10] Connection to child 0 established (server demo1agrubu01.demo.lab:443)
[Wed Mar 13 20:05:57 2013] [info] Seeding PRNG with 656 bytes of entropy
[Wed Mar 13 20:05:57 2013] [debug] ssl_engine_kernel.c(1866): OpenSSL: Handshake: start
[Wed Mar 13 20:05:57 2013] [debug] ssl_engine_kernel.c(1874): OpenSSL: Loop: before/connect initialization
[Wed Mar 13 20:05:57 2013] [debug] ssl_engine_kernel.c(1874): OpenSSL: Loop: unknown state
[Wed Mar 13 20:05:57 2013] [debug] ssl_engine_io.c(1897): OpenSSL: read 7/7 bytes from BIO#7f122800a100 [mem: 7f1230018f60] (BIO dump follows)
[Wed Mar 13 20:05:57 2013] [debug] ssl_engine_io.c(1830): +-------------------------------------------------------------------------+
[Wed Mar 13 20:05:57 2013] [debug] ssl_engine_io.c(1869): | 0000: 15 03 01 00 02 02 50 ......P |
[Wed Mar 13 20:05:57 2013] [debug] ssl_engine_io.c(1875): +-------------------------------------------------------------------------+
[Wed Mar 13 20:05:57 2013] [debug] ssl_engine_kernel.c(1903): OpenSSL: Exit: error in unknown state
[Wed Mar 13 20:05:57 2013] [info] [client 192.168.0.10] SSL Proxy connect failed
[Wed Mar 13 20:05:57 2013] [info] SSL Library Error: 336032002 error:14077102:SSL routines:SSL23_GET_SERVER_HELLO:unsupported protocol
[Wed Mar 13 20:05:57 2013] [info] [client 192.168.0.10] Connection closed to child 0 with abortive shutdown (server example1.domain.tld:443)
[Wed Mar 13 20:05:57 2013] [error] (502)Unknown error 502: proxy: pass request body failed to 172.31.4.13:9002 (192.168.0.10)
[Wed Mar 13 20:05:57 2013] [error] [client 192.168.0.10] proxy: Error during SSL Handshake with remote server returned by /dsfe/
[Wed Mar 13 20:05:57 2013] [error] proxy: pass request body failed to 192.168.0.10:9002 (172.31.4.13) from 172.31.4.13 ()
[Wed Mar 13 20:05:57 2013] [debug] proxy_util.c(2029): proxy: HTTPS: has released connection for (172.31.4.13)
[Wed Mar 13 20:05:57 2013] [debug] ssl_engine_kernel.c(1884): OpenSSL: Write: SSL negotiation finished successfully
[Wed Mar 13 20:05:57 2013] [info] [client 192.168.0.10] Connection closed to child 6 with standard shutdown (server example1.domain.tld:443)
Run Code Online (Sandbox Code Playgroud)
如果我做一个
wget --secure-protocol=sslv3 --no-check-certificate https://192.168.0.10:9002/
Run Code Online (Sandbox Code Playgroud)
它运行良好,但来自 apache 不起作用。
我在运行 apache2 并启用 mod_proxy 和 mod_ssl 的最新更新的 Ubuntu 服务器上:
~$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=12.04
DISTRIB_CODENAME=precise
DISTRIB_DESCRIPTION="Ubuntu 12.04.2 LTS"
~# dpkg -s apache2
...
Version: 2.2.22-1ubuntu1.2
...
~# dpkg -s openssl
...
Version: 1.0.1-4ubuntu5.7
...
Run Code Online (Sandbox Code Playgroud)
希望任何人都可以提供帮助
听起来您可能想尝试编辑 Tomcat 应用程序的 server.xml,并在定义连接器端口的位置添加如下内容:
proxyName="mysite.example.com" proxyPort="443" scheme="https" secure="true"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4550 次 |
| 最近记录: |