Apache1.3.27+mod_ssl+自定义SSL证书
http://tech.ddvip.com 2006年04月01日 社区交流
本文详细介绍Apache1.3.27+mod_ssl+自定义SSL证书
4、编译和安装Apache 1.3.27
刚才提到为什么我们不按照指示去做呢,就是因为我们要把Apache 1.3.27编译成DSO模式。如果你单单想编译成静态模式的话,就直接在apache 1.3.27 目录下make 就OK了。
下面是把apache 1.3.27 编译成DSO模式。
FBSD# ./configure --prefix=/usr/local --enable-module=so --enable-module=ssl(--enable-module=ssl 这个很重要,就是要加如mod_ssl 模块)到此,apache 1.3.27+mod_ssl 已经编译完成,下面的是生成CA证书。
…
…
FBSD# make
….
FBSD# make certificate到此,CA证书正式生成。
SSL Certificate Generation Utility (mkcert.sh)
Copyright (c) 1998-2000 Ralf S. Engelschall, All Rights Reserved.
Generating test certificate signed by Snake Oil CA [TEST]
WARNING: Do not use this for real-life/production systems
______________________________________________________________________
STEP 0: Decide the signature algorithm used for certificate
The generated X.509 CA certificate can contain either
RSA or DSA based ingredients. Select the one you want to use.
Signature Algorithm ((R)SA or (D)SA) [R]:R (选择加密方式)
______________________________________________________________________
STEP 1: Generating RSA private key (1024 bit) [server.key]
4493119 semi-random bytes loaded
Generating RSA private key, 1024 bit long modulus
..++++++
...........................................................................++++++
e is 65537 (0x10001)
______________________________________________________________________
STEP 2: Generating X.509 certificate signing request [server.csr]
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
1. Country Name (2 letter code) [XY]:CN
2. State or Province Name (full name) [Snake Desert]:Guang Dong
3. Locality Name (eg, city) [Snake Town]:Guang Zhou
4. Organization Name (eg, company) [Snake Oil, Ltd]:Kingisme.com xBSD Studio
5. Organizational Unit Name (eg, section) [Webserver Team]:cnfug.org
6. Common Name (eg, FQDN) [www.snakeoil.dom]:www.cnfug.org
7. Email Address (eg, name@FQDN) [www@snakeoil.dom]:ihweb@cnfug.org
8. Certificate Validity (days) [365]:365
______________________________________________________________________
STEP 3: Generating X.509 certificate signed by Snake Oil CA [server.crt]
Certificate Version (1 or 3) [3]:3
Signature ok
subject=/C=CN/ST=Guang Dong/L=Guang Zhou/O=Kingisme.com xBSD Studio/OU=cnfug.org/CN=www.cnfug.org/emailAddress=ihweb@cnfug.org
Getting CA Private Key
Verify: matching certificate & key modulus
Verify: matching certificate signature
../conf/ssl.crt/server.crt: /C=XY/ST=Snake Desert/L=Snake Town/O=Snake Oil, Ltd/OU=Certificate Authority/CN=Snake Oil CA/emailAddress=ca@snakeoil.dom
error 10 at 1 depth lookup:certificate has expired
OK
______________________________________________________________________
STEP 4: Enrypting RSA private key with a pass phrase for security [server.key]
The contents of the server.key file (the generated private key) has to be
kept secret. So we strongly recommend you to encrypt the server.key file
with a Triple-DES cipher and a Pass Phrase.
Encrypt the private key now? [Y/n]: n
Warning, you're using an unencrypted RSA private key.
Please notice this fact and do this on your own risk.
______________________________________________________________________
RESULT: Server Certification Files
o conf/ssl.key/server.key
The PEM-encoded RSA private key file which you configure
with the 'SSLCertificateKeyFile' directive (automatically done
when you install via APACI). KEEP THIS FILE PRIVATE!
o conf/ssl.crt/server.crt
The PEM-encoded X.509 certificate file which you configure
with the 'SSLCertificateFile' directive (automatically done
when you install via APACI).
o conf/ssl.csr/server.csr
The PEM-encoded X.509 certificate signing request file which
you can send to an official Certificate Authority (CA) in order
to request a real server certificate (signed by this CA instead
of our demonstration-only Snake Oil CA) which later can replace
the conf/ssl.crt/server.crt file.
WARNING: Do not use this for real-life/production systems
FBSD#
然后安装apache 1.3.275、启动并测试
FBSD# make install
…
FBSD# /usr/local/apache/bin/apachectl startssl 在IE中输入地址
https://192.168.168.168/ (请更换你的APACHE服务器IP) 你将会看到需要
1)询问是否要通过安全连接查看网页

2)接收到证书

6、关于自定义SSL的证书
大家可以查看我的《Apache1.3.27+mod_ssl+SSL》中提到方法去做,只是此是的sign.sh 在
/tmp/install/mod_ssl-2.8.14-1.3.27/pkg.contrib/sign.sh 那里,这是签署证书生成server.crt需要的。
7、小结
此文章虽然是在 FreeBSD 4.8 stable 平台上实现的,但是由于Unix Like ,基本上适用于Linux、Solaris、AIX、HP-UX等。其实这样的安装不难,多看点文档,尤其是mod_ssl 本身自带的文档,因为这个mod_ssl-2.8.14-1.3.27 本身就是for Apache 1.3.27 所以mod_ssl.org Code team 们肯定经过测试的,安装的时候只要认真看提示就可以了!
希望大家能顺利完成自己的apache+mod_ssl。
责编:豆豆技术应用