首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 服务器 > Apache >

apache2.2 SSL双向认证配备

2012-06-30 
apache2.2 SSL双向认证配置一, ?apache ?下载 安装?./configure --prefix/usr/local/apache ?--enable-ss

apache2.2 SSL双向认证配置

一, ?apache ?下载 安装

?

./configure --prefix=/usr/local/apache ?--enable-ssl

make?

make install

?

加入环境变量 ?/etc/profile ?PATH="$PATH":/usr/local/apache/bin

source profile

?

建立CA ?: cd ?/usr/share/ssl/misc

?

? ? ? ? ? ? ? ? ./CA ?-newca ? ?私钥: demoCA/private/cakey.pem ??

? ? ? ? ? ? ? ?crt文件:demoCA/cacert.pem

二 ?. ? 生成服务器证书:

? ? openssl genrsa -des3 ?-out server.key 1024(使用3DES加密并封装为PEM格式)

? ? openssl req -new ?-key server.key -out server.csr使用这个RSA私钥创建一个证书签发请求(CSR)(这里的例子将封装为PEM格式):

?

对服务器端csr签证

? ? ?mv ?server.csr ? /usr/share/ssl/misc ?newreq.pem (改名字)

? ? ?./CA -sign

? ? cp newcert.pem(生成的crt文件) ?/usr/local/apache/conf/server.crt

?

放开:include ?httpd-ssl.conf

开启服务 ?apachectl -k start

访问 ?https://localhost/ ? 默认index.html 在apache/htdocs/

?

?

?

?


三. ? 生成客户端证书:

? ? ? ?mkdir ssl.crt

? ? ? ?cp ?/usr/share/ssl/misc/demoCA/cacert.pem ? ssl.crt/ca.crt

? ? ? ?openssl genrsa -des3 -out client.key 1024

? ? ? ?openssl req -new -key client.key -out client.csr

? ? ? ?cp client.csr ?/usr/share/ssl/misc

? ? ? ?openssl ca -in client.csr -out client.crt

? ? ? ?转换成pkcs12格式,为客户端安装所用

? ? ? openssl pkcs12 -export -clcerts -in client.crt -inkey client.key -out client.pfx

这一步根安装服务器的证书差不多,不同的是签证,最后安装的时候,client.pfx的密码要记住,在客户端安装的时候要用到的。

? ? ?在http-ssl.conf 中:

    SSLCACertificateFile   "/usr/local/apache/conf/ssl.crt/ca.crt"    ? ? ?SSLVerifyClient require
? ? ?SSLVerifyDepth? 10


在浏览器中导入client.pfx

?

?

连接:http://hi.baidu.com/wmsnet/blog/item/79b9710f6d11f6296159f385.html

?

默认以443端口访问 ?--enable-modules=so --enable-ssl=shared ?--enable-rewrite

?

<Directory "/var/www/html/phpMyAdmin">    Options FollowSymLinks    AllowOverride all    Order deny,allow    Deny from all    Allow from 192.168.100.0/24        <IfModule mod_rewrite.c>         RewriteEngine On         RewriteBase /var/www/html/phpMyAdmin         RewriteCond %{SERVER_PORT} !^443$         RewriteRule ^(.*)?$ https://%{SERVER_NAME}/phpMyAdmin/$1 [L,R]         </IfModule></Directory>

在同一个IP地址上增加一个名叫www.otherdomain.tld的虚拟主机,你只需在httpd.conf中加入以下内容:

ServerName www.otherdomain.tldDocumentRoot /www/otherdomain</VirtualHost>

?

?

热点排行