Chinaunix首页 | 论坛 | 博客
  • 博客访问: 734882
  • 博文数量: 140
  • 博客积分: 5097
  • 博客等级: 大校
  • 技术积分: 991
  • 用 户 组: 普通用户
  • 注册时间: 2006-01-05 19:13
文章分类

全部博文(140)

文章存档

2018年(1)

2015年(5)

2014年(5)

2013年(2)

2011年(16)

2010年(6)

2009年(9)

2008年(45)

2007年(26)

2006年(25)

分类: 网络与安全

2008-05-11 01:10:03

SSL 配置(本机安装的是 apache 的带 openssl的 版本)
(1)复制apahce2/conf目录openssl.cnf 文件到bin目录(带路径可忽略这一步)
(2)生成RSA密钥 (private key) 下面两个命令都可以生成密钥,
    openssl genrsa -des3 -out ca.key    
    openssl genrsa -out ca.key
    -des3选项可以加密生成的密钥, 但是Win32平台不支持加密密钥,启动Apache时会产生
以下错误信息, "SSLPassPhraseDialog builtin is not supported on Win32"
(当时不清楚我就加了-des3参数,且出现这个错误时apache启动不报错,查看日志才发现以上错误。)
   openssl genrsa -out ca.key 1024
(3) 产生 CA require cert,按提示填入相应的内容
  openssl req -config openssl.cnf -new -key ca.key -out ca.csr
(4) 产生 CA public cert
  openssl x509 -days 3650 -req -signkey ca.key -in ca.csr -out ca.crt
(5) 产生 Server private key
  openSSL genrsa -out server.key 1024
(6) 产生 Server require cert,按提示填入和上边相同的内容
  openssl req -config openssl.cnf -new -key server.key -out server.csr
(7) 产生 Server public key
  openssl ca -config openssl.cnf -days 3650 -cert ca.crt -keyfile ca.key -in server.csr -out server.crt
运行这个命令会出错:I am unable to access the ./demoCA/newcerts directory....
  错误原因是没有手动创建一个CA目录结构
└─ssl
    ├─newcerts
    ├─index.txt
    ├─serial   
在demoCA中建立 index.txt 空文件, serial文件 , serial文件 中可输入01
  此时再运行以上的命令即可生成server.crt
   将生成的 ca.crt、server.crt 和 server.key 放入apache的 conf 目录中
 
(8) 编辑apache的配置文件httpd.conf
去掉以下语句的注释, Include conf/extra/httpd-ssl.conf
开启: LoadModule ssl_module modules/mod_ssl.so
# Secure (SSL/TLS) connections
Include conf/extra/httpd-ssl.conf
#   
(9) 编辑 conf/extra/httpd-ssl.conf

 
  SSLEngine On
  SSLCertificateFile conf/ssl/server.crt
  SSLCertificateKeyFile conf/ssl/server.key
  SSLCertificateChainFile conf/ssl/ca.crt
 

 

(10) 重启apahce 打开
一切OK。
阅读(1350) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~