`
mac.zhao
  • 浏览: 13420 次
  • 性别: Icon_minigender_1
  • 来自: 上海
最近访客 更多访客>>
文章分类
社区版块
存档分类
最新评论

Windows2000 下 APACHE+OpenSSL+MOD_SSL 的安装手册

阅读更多
/********************************************************************************************************************
声明:本文档用于学习与研究可以自由转载,无论以何种形式发布都必须保留完整的版权声明,商业用途不得转载.本人能力有限,如有问题欢迎交流与指正。
网站:http://www.infosecurity.org.cn
论坛:http://www.infosecurity.org.cn/forum/forum.html
邮件:rainbow_zrh@sina.com webmaster@infosecurity.org.cn
*********************************************************************************************************************/
一、OpenSSL的安装 2
   1.1、下载OpenSSL  2
    1.2、下载perl:   2
    1.3、编译 2
    1.4、安装: 2
二、Apache与mod_ssl的安装 3
   2.1、所需资源 3
     2.1.1、下载awk.exe 3
     2.1.2、APACHE下载 3
     2.1.3、mod_ssl的下载 3
   2.2、配置MOD_SSL 3
   2.3、编译apache 3
   2.4、安装apache 3
三、配置证书 4
   3.1、生成自签名的证书 4
   3.2、配置httpd.conf 4
   3.3、测试 6
四、配置客户端认证 6
   4.1 生成客户证书请求 6
   4.2 客户证书的生成 6
   4.3 生成PKCS#12格式的证书 6
   4.4、将生成的zrh.p12导入IE 6
   4.5、配置httpd.conf要求客户端认证 7
   4.6、测试--一次真实的演示过程 7
参考文献 11
----------------------------------------------------------------------------------------------------------------------
一、OpenSSL的安装
1.1、下载OpenSSL 
到OpenSSL的官方主页(http://www.openssl.org)去下载。
1.2、下载perl:
http://aspn.activestate.com/ASPN/Downloads/ActivePerl/Download?OS=Windows&version=5.6.1&build=629\&download=/ActivePerl/Windows/5.6/ActivePerl-5.6.1.629-MSWin32-x86-multi-thread.msi
1.3、编译
设置好环境变量
c:\> cd d:\program files\Microsoft visual studio\vc98\bin
c:\> d:
c:\> VCVARS32.BAT
设置好perl所在路径如D:\Perl\bin\;
cd openssl-0.9.6g
perl Configure VC-WIN32
ms\do_ms
nmake /f ms\ntdll.mak
1.4、安装:
copy out32dll\libeay32.dll c:\windows\system
copy out32dll\ssleay32.dll c:\windows\system
md c:\openssl
md c:\openssl\bin
md c:\openssl\lib
md c:\openssl\include
md c:\openssl\include\openssl
copy /b inc32\openssl\* c:\openssl\include\openssl
copy /b out32dll\ssleay32.lib c:\openssl\lib
copy /b out32dll\libeay32.lib c:\openssl\lib
copy /b out32dll\ssleay32.dll c:\openssl\bin
copy /b out32dll\libeay32.dll c:\openssl\bin
copy /b out32dll\openssl.exe c:\openssl\bin

二、Apache与mod_ssl的安装 
2.1、所需资源
  2.1.1、下载awk.exe
到http://cm.bell-labs.com/cm/cs/awkbook/index.html下载awk95.exe,另存为awk.exe,
设置好路径(拷到你的编译目录或者System32下,或其它能找到的地方),以便VC++可以找到。
  2.1.2、APACHE下载 
http://www.apache.org下载,并解压到F:\apache\1_3_28
  2.1.3、mod_ssl的下载
http://www.modssl.org下载,并解压到F:\apache\mod_ssl-2.8.15-1.3.28

2.2、配置MOD_SSL
cd F:\apache\mod_ssl-2.8.15-1.3.28
configure.bat --with-apache=f:\apache\1_3_28 --with-ssl=f:\opensslpro\openssl_0.9.6eh
注意 这一步不要将mod_ssl的源代码和apache的源代码放在一个目录下,目录也尽量不要带空格。

2.3、编译apache
cd F:\apache\1_3_28\src
nmake /f Makefile.win _apacher
2.4、安装apache
nmake /f Makefile.win installr INSTDIR=f:\apache\1328
f:\apache\1328是Apache的安装目录,可以根据自己的需要进行修改。
三、配置证书
3.1、生成自签名的证书
cd F:\apache\1328\conf
mkdir ssl
cd ssl
copy F:\OpenSSLPro\openssl-engine-0.9.6h\apps\openssl.cnf .
cd %APACHE_HOME%\conf\ssl
openssl req -config openssl.cnf -new -out ces-s.csr
openssl rsa -in privkey.pem -out ces-s.key
openssl x509 -in ces-s.csr -out ces-s.cert -req -signkey ces-s.key -days 365
del *.rnd(这一步没有)

3.2、配置httpd.conf
在194行加入模块加载指令
<IfDefine SSL>
LoadModule ssl_module modules/mod_ssl.so
</IfDefine>
在246行加入AddModule指令与LoadModule对应
<IfDefine SSL>
AddModule mod_ssl.c
</IfDefine>

278行加入要侦听的端口
<IfDefine SSL>
Listen 80
Listen 443
</IfDefine>
最后1035左右加入:虚拟主机及公钥和私钥的路径。
<IfDefine SSL>
AddType application/x-x509-ca-cert .crt
AddType application/x-pkcs7-crl .crl
</IfDefine>

<IfModule mod_ssl.c>
SSLPassPhraseDialog builtin
SSLSessionCache dbm:logs/ssl_scache
SSLSessionCacheTimeout 300
SSLMutex sem
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
SSLLog logs/ssl_engine_log
SSLLogLevel info

</IfModule>

<IfDefine SSL>

<VirtualHost _default_:443>

DocumentRoot "F:\apache\1328\htdocs"
ServerName 127.0.0.1
ServerAdmin you@your.address
ErrorLog logs/error_log
TransferLog logs/access_log

SSLEngine on
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
SSLCertificateFile F:\apache\1328\conf\ssl\ces-s.cert
SSLCertificateKeyFile F:\apache\1328\conf\ssl\ces-s.key

<Files ~ "\.(cgi|shtml|phtml|php3?)$">
SSLOptions +StdEnvVars
</Files>
<Directory "F:\apache\1328\cgi-bin">
SSLOptions +StdEnvVars
</Directory>

SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0

CustomLog logs/ssl_request_log "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
</VirtualHost>

</IfDefine>


3.3、测试
启动命令提示符窗口
cd f:\apache\1328
apache –D SSL
四、配置客户端认证
所有的密码都默认为12345678
4.1 生成客户证书请求
证书请求的名字为zrh.csr,私钥文件名为zrhkey.pem。
CD f:\apache\1328\conf\ssl
F:\apache\1328\conf\ssl>openssl req -config openssl.cnf -new -out zrh.csr -keyout zrhkey.pem
然后输入个人信息
4.2 客户证书的生成
输入证书请求的名字为zrh.csr,生成的证书的名字为zrh.pem。
CA证书的证书名字为ces-s.cert,私钥文件名为ces-s.key
F:\apache\1328\conf\ssl>openssl x509 -req -in zrh.csr -out zrh.pem -CA ces-s.cert -CAkey ces-s.key -CAcreateserial -days 365 -outform PEM
到现在为止你就已经有了一个经CA签过名的证书zrh.pem和一个私钥zrhkey.pem
4.3 生成PKCS#12格式的证书
为了在IE中更好的使用。
F:\apache\1328\conf\ssl>openssl pkcs12 -export -in zrh.pem -out zrh.p12 -inkey zrhkey.pem -name "Zhang RongHua Cert"
这一步将生公钥证书和私打包在一起的zrh.p12用户证书。
4.4、将生成的zrh.p12导入IE
双击zrh.p12按提示进行,即可。如果没有必要不要选择强私钥保护,因为每一次使用私钥的时候都是让你确认一次。
导入受信任的根证书ces-s.cert。
4.5、配置httpd.conf要求客户端认证
<VirtualHost _default_:443>……</VirtualHost>中间加入以下配置
# enable client certificate requirement

SSLVerifyClient require
SSLVerifyDepth 1
SSLCACertificatePath conf\ssl
SSLCACertificateFile conf\ssl\ces-s.cert(为服务器证书/CA证书所在的目录)

4.6、测试--一次真实的演示过程
一次真实的演示过程。
打https://127.0.0.1
点确定按钮
点确定按钮
选择一张证书,然后点确定按钮
点详细信息
点确定按钮
点查看证书按钮,可以看证书的详细信息
点确定按钮
一次访问就成功了。
(点击这里下载演示图片)
参考文献
1、Lajos Moczar mod_ssl安装说明
2、http://www.galatea.com/dist/configure.pl.txt
3、apache的安装文档
4、Rainbow(不经历风雨,怎么见彩虹) Apache的编译及安装过程.doc
5、OpenSSL的安装文档INSTALL.W32  
分享到:
评论

相关推荐

    mod_ssl.zip

    错误:Cannot load D:/Applications/Apache2/modules/mod_ssl.so into server: \xd5\xd2\xb2 \xbb\xb5\xbd\xd6\xb8\xb6\xa8\xb5\xc4\xc4\xa3\xbf\xe9\xa1\xa3 大概的原因是由于当前加载的模块所依赖的一些库文件没有...

    apache_2.2.11-win32-x86-openssl-0.9.8i.msi

    apache2.2.11最新版,win32版本,20个字很难凑啊

    用OpenSSL编写SSL,TLS程序

    如果想用它编程序,除了熟悉已有的文档(包括ssleay,mod_ssl,apachessl的文档)外, 可以到它的maillist上找相关的帖子,许多问题可以在以前的文章中找到答案. 编程: 程序分为两部分,客户端和服务器端,我们的目的是...

    suse11.3 openssl-devel包

    默认最小化安装的suse里面没有openssl-devel这个包,在安装apache,并且编译mod_ssl模块的时候会报错:configure: error: ...No recognized SSL/TLS toolkit detected,此时需要将该包装上去

    Apache Web服务器的完全安装指南

    所需软件 apache_1.3.20.tar.gz 主页: http://www.apache.org  mod_perl-1.26.tar.gz 主页: http://perl.apache.org  openssl-0.9.6b.tar.gz 主页: http://www.openssl.org  mod_ssl-2.8.4-1.3.20.tar.gz 主页: ...

    Apache、SSL、MySQL和PHP平滑无缝地安装

    为了这个任务所需的工具是: Apache-一个网站服务器 Mod_SSL-一个安全套接字层(SSL)的模块 OpenSSL-开放源代码工具箱(mod_ssl所需) RSARef-仅对美国用户 MySQL-一个数据库服务器 PHP-一种脚本语言 ...

    mod_gnutls:mod_gnutls apache模块-开源

    mod_gnutls使用GnuTLS库为Apache HTTPD提供SSL 3.0,TLS 1.0,TLS 1.1和1.2加密。 它的目的类似于mod_ssl,但不使用OpenSSL。

    Shell脚本实现生成SSL自签署证书

    启用 apache 的 mod_ssl 之后需要有证书才能正常运作。写了个脚本来操作。首先要确定机器上已经有 openssl 。 代码如下: #!/bin/sh # # ssl 证书输出的根目录。 sslOutputRoot=”/etc/apache_ssl” if [ $# -eq 1 ]...

    nginx-ssl-variables:用于访问 nginx 中标准(Apache 兼容)SSL 变量的配置

    nginx SSL 变量与 Apache mod_ssl 模块相比,这会在 nginx 中创建向后兼容的 SSL 变量; 访问 SSL 客户端证书特别有趣。 一些变量由 nginx 提供,其他一些变量必须通过带有 Lua-OpenSSL 接口的 nginx-Lua 计算。 ...

    apache https配置详细步骤讲解

    也就是说在SSL下http传输是安全的,我们成为 https. 配置过程如下: 步骤一:安装apache,使其支持SSL,并安装php 1.安装配有SSL模块的apache,apache_2.2.8-win32-x86-openssl-0.9.8g 2.配置apache以支持SSL:打开...

    svn-1.4.3-setup.exe.7z

    安装 Apache 的先决条件是有一台安装了 Windows 2000,Windows XP SP1+,Windows 2003,Vista 或 Windows Server 2008 的计算机。 警告 请注意,Windows XP 如果没有安装 SP1 将会导致不正常的网络传输,从而搞坏...

    NC61+nc中间件+Https配置方案.docx

    NC61+nc中间件+ HTTPS配置方案,Apache安装, 从网上下载带有openssl的Apache: httpd-2.2.22-win32-x86-openssl-0.9.8t.msi ...说明:APACHE安装完后,需要将Apache插件mod_jk.so文件拷贝到Apache_home\modules目录下。

    PHP中file_get_contents函数抓取https地址出错的解决方法(两种方法)

    方法一: ... Warning: file_get_contents&#40;&#41;...extension=php_openssl.dll ,...apache服务器的话,可以同时启用mod_ssl模块测试。 如果不方便修改服务器配置,可以参考使用如下的函数来解决: 代码示例: &lt;?ph

    pro_apache_third_edition..pdf

    Apache and the Internet..............................................1 Apache: The Anatomy of a Web Server.........................................................1 The Apache Source ....................

    NetServer v0.1 Build 3 Beta 5

    Apache v2.0.54 (Win32)mod_perl v1.99_16Perl v5.8.6PHP v4.4.0PHP v5.0.4mod_ssl v2.0.54OpenSSL v0.9.7gMySQL v4.1.13aFileZilla FTP Server v0.9.8chMailServer v4.0 (Build 125)phpMyAdmin v2.6.3-pl1...

    Bulletproof SSL and TLS,PDF , Ivan Ristic

    Bulletproof SSL and TLS by Ivan Ristić Table of Contents Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...

    apache security 安全

    Apache and SSL Section 4.5. Setting Up a Certificate Authority Section 4.6. Performance Considerations Chapter 5. Denial of Service Attacks Section 5.1. Network Attacks Section 5.2. Self-...

    解析Win7 XAMPP apache无法启动的问题

     查看日志信息 [notice] Apache/2.2.17 (Win32) mod_ssl/2.2.17 OpenSSL/0.9.8o PHP/5.3.4 mod_perl/2.0.4 Perl/v5.10.1 configured — resuming normal operations [notice] Server built: Oct 18 2010 01:58:12...

    php网络开发完全手册

    1.4.5 Apache的配置文件httpd.conf与 1.4.5 .htaccess的简介 13 1.4.6 PHP的配置文件php.ini的简介 13 1.4.7 PHP常用参数的配置 14 1.5 几种综合网络服务器系统的安装 14 1.5.1 XAMPP 14 1.5.2 WAMP 16 1.5.3 ...

Global site tag (gtag.js) - Google Analytics