Skip to content


网络安全通讯(1)—-给你的Webserver启用SSL

互联网很危险,你还是回火星吧。
好吧,我们还有SSL,你可以等一下了。

先说一下这里面用到的库
OpenSSL 0.9.8g
Apache Httpd 2.2

SSL是一个可以保证你的通讯安全的机制,采用公钥私钥的非对加密机制,具体机制我就不说了,网上一抓一大把。
你可以使用openssl建立自己的密钥,并使用在Apache Webserver上,让你的服务器支持https。

  1. 建立你自己的服务器私钥,一个1024位的就够了
    openssl genrsa -des3 -out server.key 1024
  2. 生成CSR文件,Certificate Signing Request
    openssl req -new -key server.key -out server.csr
  3. 生成证书CRT文件,X509协议
    openssl x509 -req -in server.csr -signkey server.key -out server.crt
    注意,这是一个自签名的证书
  4. 修改你apache的ssl配置,
    SSLCertificateFile “/path-to/server.crt”
    SSLCertificateKeyFile “/path-to/server.key”
  5. 启动你的apache,使用https访问试试看,是不是要你确认是否允许证书通过

这时候,你的服务器已经支持SSL了,刚才浏览器问你是否通过你服务器提供的证书是表示客户端(浏览器)信任了你的服务器,这里也就是服务器认证。你们之间的通讯已经是加密的了。

Posted in 安全.

Tagged with , , .


0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.