天天看點

Apache 站點安全

編輯:vim /etc/httpd/conf/httpd.conf

Apache 站點安全
Apache 站點安全

Listen  80 監聽端口

Apache 站點安全
Apache 站點安全

建立一個網頁

Apache 站點安全

1.身份驗證

Apache 站點安全

b.  在站點的主目錄下面    

說明檔案  .htaccess

Apache 站點安全

c.産生帳号檔案

htpasswd   -c  張号檔案   帳号

Apache 站點安全
Apache 站點安全
Apache 站點安全

下面我們來測試通路效果

Apache 站點安全
Apache 站點安全

2.來源控制  

基于ip位址的通路

下面示範的是拒絕ip位址是192.168.30.200的主機通路192.168.30.100

Apache 站點安全
Apache 站點安全
Apache 站點安全

3.https

【原理】

HTTPS(全稱:Hypertext Transfer Protocol over Secure Socket Layer),是以安全為目标的HTTP通道,提供了身份驗證與加密通訊方法,現在它被廣泛用于網際網路上安全敏感的通訊,例如交易支付方面。它的主要作用可以分為兩種:一種是建立一個資訊安全通道,來保證資料傳輸的安全;另一種就是确認網站的真實性。

【拓撲圖】

Apache 站點安全

【環境】

Linux虛拟機    rhel5.4  

客服端        windows  xp的虛拟機

安裝的服務httpd-2.2.3-31.el5.i386.rpm

mod_ssl-2.2.3-31.el5.i386.rpm

             distcache-1.4.5-14.1.i386.rpm

【建立CA認證】

首先檢查實驗環境是否安裝了openssl

Apache 站點安全

建立目錄abc 拷貝一個檔案

mkdir abc

cp  /etc/inittab  .

安裝的有openssl可以看看裡面有什麼内容

rpm -ql openssl |less

Apache 站點安全

建立兩個使用者并且給予密碼123

Apache 站點安全
Apache 站點安全

檢視加密的結果

Apache 站點安全
Apache 站點安全

加密檔案

Apache 站點安全

檢視加密後的檔案

Apache 站點安全

解密

Apache 站點安全

産生私鑰

Apache 站點安全

由于産生的是私鑰為了安全要修改權限

Apache 站點安全

公鑰是可以由私鑰檔案産生的

Apache 站點安全
Apache 站點安全

在虛拟機上設定CA隻需編輯openssl.cnf 檔案

Apache 站點安全
Apache 站點安全
Apache 站點安全
Apache 站點安全

建立三個目錄兩個檔案

Apache 站點安全

給serial一個初始值

Apache 站點安全

建立私鑰并且為了安全更改權限

Apache 站點安全

産生出公鑰

為自己頒發證書

Apache 站點安全

【安裝Web Server】

安裝服務

Apache 站點安全
Apache 站點安全
Apache 站點安全
Apache 站點安全
Apache 站點安全

給自己頒發證書

Apache 站點安全

檢視httpd.req檔案

Apache 站點安全
Apache 站點安全

檢視資料庫檔案夾

Apache 站點安全

将CA 與web server進行捆綁

Apache 站點安全
Apache 站點安全

建立一個首頁

Apache 站點安全

身份驗證

a.【directory   站點主目錄】

alloworverride all

【/directory  】

vim /etc/httpd/conf/httpd.conf

Apache 站點安全
Apache 站點安全
Apache 站點安全
Apache 站點安全

重新啟動

Apache 站點安全
Apache 站點安全

測試:

Apache 站點安全
Apache 站點安全

測試二

Apache 站點安全

解決方法:

Apache 站點安全

重新開機

Apache 站點安全

打開浏覽器

Apache 站點安全
Apache 站點安全
Apache 站點安全
Apache 站點安全
Apache 站點安全
Apache 站點安全
Apache 站點安全
Apache 站點安全

繼續閱讀