HTTPS全稱:Hypertext Transfer Protocol over Secure Socket Layer),是以安全為目標的HTTP通道,簡單講是HTTP的安全版。即HTTP下加入SSL層,HTTPS的安全基礎是SSL,因此加密的詳細內容 就需要SSL。 它是一個URI scheme抽象標識符體系),句法類同http:體系。用於安全的HTTP資料轉送。https:URL表明它使用了HTTP,但HTTPS存在不同 於HTTP的預設連接埠及一個加密/身分識別驗證層在HTTP與TCP之間)。這個系統的最初研發由網景公司進行,提供了身分識別驗證與加密通訊方法,現在它被廣 泛用於全球資訊網上安全敏感的通訊,例如交易支付方面。簡介它是由Netscape開發並內建於其瀏覽器中,用於對資料進行壓縮和解壓操作,並返回網路上傳送回的結果。HTTPS實際上應用了 Netscape的安全通訊端層SSL)作為HTTP應用程式層的子層。HTTPS使用連接埠443,而不是像HTTP那樣使用連接埠80來和TCP/IP進 行通訊。)SSL使用40 位關鍵字作為RC4流密碼編譯演算法,這對於商業資訊的加密是合適的。HTTPS和SSL支援使用X.509數字認證,如果需要的話使用者可以確認寄件者是誰。
也就是說它的主要作用可以分為兩種:一種是建立一個資訊安全通道,來保證資料轉送的安全;另一種就是確認網站的真實性。Centos 6.2下配置https伺服器的步驟,需要的朋友可以參考下。HTTPS和HTTP的區別一、https協議需要到ca申請認證,一般免費認證很少,需要交費。
二、http是超文字傳輸通訊協定 (HTTP),資訊是明文傳輸,https 則是具有安全性的ssl加密傳輸協議。
三、http和https使用的是完全不同的串連方式,用的連接埠也不一樣,前者是80,後者是443。
四、http的串連很簡單,是無狀態的;HTTPS協議是由SSL+HTTP協議構建的可進行加密傳輸、身份認證的網路通訊協定,比http協議安全。HTTPS解決的問題一、信任主機的問題.採用https的伺服器必須從CA Certificate Authority)申請一個用於證明伺服器用途類型的認證。該認證只有用於對應的伺服器的時候,用戶端才信任此主機。所以目前所有的銀行系統網站,關鍵 部分應用都是https 的。客戶通過信任該認證,從而信任了該主機。其實這樣做效率很低,但是銀行更側重安全。這一點對我們沒有任何異議,我們的伺服器,採用的認證不管是自己發 布的還是從公眾的地方發布的,其用戶端都是自己人,所以我們也就肯定信任該伺服器。 二、通訊過程中的資料的泄密和被篡改
1. 一般意義上的https,就是伺服器有一個認證。
a) 主要目的是保證伺服器就是他聲稱的伺服器,這個跟第一點一樣。
b) 服務端和用戶端之間的所有通訊,都是加密的。
i. 具體講,是用戶端產生一個對稱的密鑰,通過伺服器的認證來交換密鑰,即一般意義上的握手過程。
ii. 接下來所有的資訊往來就都是加密的。第三方即使截獲,也沒有任何意義,因為他沒有密鑰,當然篡改也就沒有什麼意義了。
2. 少許對用戶端有要求的情況下,會要求用戶端也必須有一個認證。
a) 這裡用戶端認證,其實就類似表示個人資訊的時候,除了使用者名稱/密碼,還有一個CA 認證過的身份。因為個人認證一般來說是別人無法類比的,所有這樣能夠更深的確認自己的身份。
b) 目前少數個人銀行的專業版是這種做法,具體認證可能是拿隨身碟即U盾)作為一個備份的載體
如果關注俺比較多,你肯定會比較眼熟,這上面的介紹來自RPM版安裝。同樣你可以借鑒CentOS 6.2下配置https並實現SSL虛擬機器主機)
註:這裡使用的編譯參數是用於LDAP的架構服務,如果你單純的只需要SSL服務,或者web架構的話,一定要刪減相應參數安裝Openssl
[root@chenyi ldmp]# tar zxf openssl-1.0.0e.tar.gz [root@chenyi ldmp]# cd openssl-1.0.0e[root@chenyi openssl-1.0.0e]# ./config --prefix=/software/ssl --openssldir=/software/openssl shared[root@chenyi openssl-1.0.0e]# make && make test &&make install
安裝apr
[root@chenyi ldmp]# tar zxf apr-1.4.5.tar.gz [root@chenyi ldmp]# cd apr-1.4.5[root@chenyi apr-1.4.5]# ./configure --prefix=/software/apr[root@chenyi apr-1.4.5]# make && make install
安裝apr-util
[root@chenyi apr-util-1.3.12]# tar zxf apr-util-1.3.12.tar.gz[root@chenyi apr-util-1.3.12]# cd apr-util-1.3.12[root@chenyi apr-util-1.3.12]# ./configure --prefix=/software/apr-util --with-apr=/software/apr/ --with-ldap-include=/software/openldap/include/ --with-ldap-lib=/software/openldap/lib/ --with-berkeley-db=/software/BerkeleyDB.5.2/ [root@chenyi apr-util-1.3.12]# make && make install
安裝apache
[root@chenyi httpd-2.2.21]# tar zxf httpd-2.2.21.tar.gz[root@chenyi httpd-2.2.21]# cd httpd-2.2.21[root@chenyi httpd-2.2.21]# ./configure --prefix=/software/apache2 --sysconfdir=/etc/httpd --enable-ssl --with-ssl=/software/openssl/ --with-z=/software/zlib/ --enable-rewrite=shared --enable-static-support --enable-deflate=shared --enable-so --enable-dav --enable-dav-fs --enable-ldap --enable-authnz-ldap --with-included-apr --with-ldap --with-ldap-include=/software/openldap/include/ --with-ldap-lib=/software/openldap/lib --with-apr=/software/apr/bin/apr-1-config --with-apr-util=/software/apr-util/bin/apu-1-config[root@chenyi httpd-2.2.21]# make && make install
配置支援SSL
[root@chenyi httpd-2.2.21]# cd /etc/httpd/[root@chenyi httpd]# mkdir ssl ssl.key ssl.crt[root@chenyi httpd]# openssl req -new -out server.csr[root@chenyi httpd]# openssl genrsa -out www.itchenyi.com.key 1024Generating RSA private key, 1024 bit long modulus........++++++............................++++++e is 65537 (0x10001)
[root@chenyi httpd]# openssl req -new -key www.itchenyi.com.key -out www.itchenyi.com.csrYou are about to be asked to enter information that will be incorporatedinto your certificate request.What you are about to enter is what is called a Distinguished Name or a DN.There are quite a few fields but you can leave some blankFor some fields there will be a default value,If you enter '.', the field will be left blank.-----Country Name (2 letter code) [XX]:CNState or Province Name (full name) []:shanghaiLocality Name (eg, city) [Default City]:pudongOrganization Name (eg, company) [Default Company Ltd]:chenyiOrganizational Unit Name (eg, section) []:wwwCommon Name (eg, your name or your server's hostname) []:www.itchenyi.comEmail Address []:itchenyi@gmail.comPlease enter the following 'extra' attributesto be sent with your certificate requestA challenge password []:An optional company name []:
[root@chenyi httpd]# openssl x509 -req -days 365 -in www.itchenyi.com.csr -signkey www.itchenyi.com.key -out www.itchenyi.com.crtSignature oksubject=/C=CN/ST=shanghai/L=pudong/O=chenyi/OU=ww/CN=www.itchenyi.com/emailAddress=itchenyi@gmail.comGetting Private key
查看相關配置這裡也是需要你修改的地方)
[root@chenyi extra]# cat httpd-ssl.conf | grep SSLCertificateFile# Point SSLCertificateFile at a PEM encoded certificate. IfSSLCertificateFile "/etc/httpd/www.itchenyi.com.crt"#SSLCertificateFile "/etc/httpd/server-dsa.crt"# the referenced file can be the same as SSLCertificateFile[root@chenyi extra]# cat httpd-ssl.conf | grep SSLCertificateFile# Point SSLCertificateFile at a PEM encoded certificate. IfSSLCertificateFile "/etc/httpd/www.itchenyi.com.crt"#SSLCertificateFile "/etc/httpd/server-dsa.crt"# the referenced file can be the same as SSLCertificateFile
修改http-ssl.conf 註:[Directory如果設定不當,那麼是不能訪問的]
DocumentRoot "/home/wwwroot "<Directory /home/wwwroot> Order deny,allow Allow from all</Directory>ServerName www.itchenyi.com:443ServerAdmin itchenyi@gmail.comErrorLog "/software/apache2/logs/error_log"TransferLog "/software/apache2/logs/access_log"
修改/etc/httpd/httpd.conf 取消注釋 大約408行
Include /etc/httpd/extra/httpd-ssl.conf
重啟http服務 通過netstat查看如下:
[root@chenyi extra]# netstat -pant | grep httpdtcp 0 0 :::80 :::* LISTEN 6124/httpd tcp 0 0 :::443 :::* LISTEN 6124/httpd
到此通過https:www.itchenyi.com 即可訪問650) this.width=650;" src="../attachment/201304/112901732.jpg" alt="" border="0" />
本文出自 “IT辰逸” 部落格,請務必保留此出處http://itchenyi.blog.51cto.com/4745638/1189006