天天看點

Web的加密通路(https)

Web的加密通路(https)

這裡httpd以裝上

拓撲如下:

<a href="http://blog.51cto.com/attachment/201210/194149938.png" target="_blank"></a>

1.實作CA認證中心

編輯/etc/pki/tls/openssl.cnf

<a href="http://blog.51cto.com/attachment/201210/194204717.png" target="_blank"></a>

<a href="http://blog.51cto.com/attachment/201210/194217220.png" target="_blank"></a>

<a href="http://blog.51cto.com/attachment/201210/194240863.png" target="_blank"></a>

Cd /etc/pki/CA 建立上圖中帶箭頭的目錄和檔案,并且給serial檔案一個初始編号“01”

[root@RHEL CA]# mkdir crl certs newcerts

[root@RHEL CA]# touch index.html serial

[root@RHEL CA]# echo "01" &gt;serial

<a href="http://blog.51cto.com/attachment/201210/194304919.png" target="_blank"></a>

産生自己的私鑰

<a href="http://blog.51cto.com/attachment/201210/194323434.png" target="_blank"></a>

<a href="http://blog.51cto.com/attachment/201210/194335564.png" target="_blank"></a>

<a href="http://blog.51cto.com/attachment/201210/194347117.png" target="_blank"></a>

建立自己的證書檔案

<a href="http://blog.51cto.com/attachment/201210/194402830.png" target="_blank"></a>

<a href="http://blog.51cto.com/attachment/201210/194420754.png" target="_blank"></a>

2.安裝mod_ssl

 [root@RHEL yum.repos.d]# yum -y install mod_ssl

在/etc/httpd/conf.d/裡會增加一個ssl.conf檔案

3.産生web的私鑰,并放在/etc/httpd/certs/目錄裡

[root@RHEL ~]# mkdir -pv /etc/httpd/certs

[root@RHEL ~]# cd /etc/httpd/certs/

<a href="http://blog.51cto.com/attachment/201210/194441314.png" target="_blank"></a>

建立請求檔案

<a href="http://blog.51cto.com/attachment/201210/194503362.png" target="_blank"></a>

在CA中心釋出該證書

<a href="http://blog.51cto.com/attachment/201210/194532904.png" target="_blank"></a>

<a href="http://blog.51cto.com/attachment/201210/194547383.png" target="_blank"></a>

會在/etc/httpd/certs/目錄裡産生以上三個檔案

<a href="http://blog.51cto.com/attachment/201210/194557203.png" target="_blank"></a>

4.編輯ssl.conf檔案使證書和web關聯

<a href="http://blog.51cto.com/attachment/201210/194610453.png" target="_blank"></a>

關閉80端口,是網站用443端口及https通路

#Listen 80

5.在客戶機端測試

<a href="http://blog.51cto.com/attachment/201210/194624995.png" target="_blank"></a>

會出現上述情況

單擊"檢視證書"—&gt;"證書路徑"如下:

<a href="http://blog.51cto.com/attachment/201210/194637576.png" target="_blank"></a>

沒用根證書

可以這樣做-編輯vim /etc/httpd/conf.d/ssl.conf(開啟128行)

<a href="http://blog.51cto.com/attachment/201210/194649974.png" target="_blank"></a>

Cacert.pem為根證書

再次單擊"檢視證書"——&gt;"證書路徑"如下:

<a href="http://blog.51cto.com/attachment/201210/194719924.png" target="_blank"></a>

有根證書了

單擊"檢視證書"&gt;"正常"&gt;"安裝證書"&gt;"下一步"如下:

<a href="http://blog.51cto.com/attachment/201210/194731221.png" target="_blank"></a>

"下一步"&gt;"完成"&gt;"是"&gt;"确定"

再次通路該站點

<a href="http://blog.51cto.com/attachment/201210/194745574.png" target="_blank"></a>

已變成對号

<a href="http://blog.51cto.com/attachment/201210/194816983.png" target="_blank"></a>

這裡我們就直接修改一下本機的hosts檔案(為了友善)如下:路徑(C:\WINDOWS\system32\drivers\etc)

<a href="http://blog.51cto.com/attachment/201210/194828882.png" target="_blank"></a>

有域名通路該站點

<a href="http://blog.51cto.com/attachment/201210/194842201.png" target="_blank"></a>

可以了,沒用任何提示了。。結束。。。!

注:上面有幾個地方需要重新開機httpd服務。

本文轉自 abc16810 51CTO部落格,原文連結:http://blog.51cto.com/abc16810/1034802

繼續閱讀