Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1105712
  • 博文数量: 93
  • 博客积分: 1470
  • 博客等级: 上将
  • 技术积分: 2957
  • 用 户 组: 普通用户
  • 注册时间: 2004-10-03 12:26
文章分类

全部博文(93)

文章存档

2011年(17)

2010年(62)

2009年(12)

2008年(2)

分类: 系统运维

2008-11-09 11:19:05

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。
阅读(2723) | 评论(0) | 转发(0) |
0

上一篇:培训讲师的六种死法

下一篇:H.264

给主人留下些什么吧!~~