Resin配置SSL说明

王朝java/jsp·作者佚名  2006-01-31
窄屏简体版  字體: |||超大  

Resin配置SSL说明

Daan

1.0

2004-12-22

说明:

为Resin服务器配置SSL的访问功能,有几种方法[1]

1. 在Unix下使用OpenSSL。(http://www.openssl.org/)

2. 使用SUN的JSSE。(http://java.sun.com/products/jsse

3. ...

我们这里介绍第二种方法,在Windows 2000下的实现。

准备工作:

1. Windows 2000 Server。

2. J2SDK 1.4.x。(已经包括了JSSE)

3. Resin 2.1.x。

4. JSSE中keytool用法[2]

步骤:

1. 创建一个服务器证书

a) 下面讲如何使用Sun的keytool来生成一个服务器证书。看下图:

一般来说,keystore密码和mykey主密码应该设置成一样的。

这时,证书文件已经保存在本例中的C:\resin-2.1.11\keys\server.keystore

2. 配置Resin(resin.conf)

Resin的SSL配置需要对<http-server>进行扩展,增加几个新的元素。下表中红色文字为新增部分。其中,key-store-file为上一步中生成的证书文件存放地址(相对resin根目录),key-store-password为上一步中为证书设置的密码。

<caucho.com>

<security-provider id='com.sun.net.ssl.internal.ssl.Provider'/>

<!-- declare a new HTTP server on port 443 (standard port for HTTPS),

- with SSL enabled -->

<http-server>

<app-dir>doc</app-dir>

<!-- the http port -->

<http port=80/>

<!-- the srun port, read by both JVM and plugin -->

<srun host='localhost' port='6802'/>

<http port=443>

<ssl>true</ssl>

<key-store-file>keys/server.keystore</key-store-file>

<key-store-password>YourPasswordHere</key-store-password>

</http>

测试:

使用上面的配置,启动resin服务,我们可以访问https://localhost

一个最快的测试方式是新建一个内容如下的JSP文件并访问他:

Secure? <%= request.isSecure() %>

运行/bin/httpd.exe,结果如下:

访问https://localhost/,跳出一个安全警报,选择是。

(如果不想跳出这个安全警报,有几点要做:1 将证书安装到客户端的IE中;2 证书生成时的CN(即名字与姓氏)必须使用服务器的机器名,即DNS名。)

浏览器浏览https://localhost/,效果如下:

浏览https://localhost/isSecure.jsp测试文件

这表示我们配置Resin使用SSL成功。

参考资料:

[1] SSL configuration: http://localhost/ref/ssl-quick.xtp

以及SSL with Resin: http://www.caucho.com/resin-3.0/security/ssl.xtp

[2] Java keytool 工具的作用及使用方法: http://www.ccw.com.cn/htm/center/prog/02_7_8_4.asp

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航