LinuxSSL證書(shū)安裝過(guò)程
SSL 證書(shū)安裝過(guò)程第一步:安裝mod_ssl[root@300second ~]# yum -y install mod_ssl第二步:HTTP 服務(wù)器上配置mod_ssl[1] 建立服務(wù)器密鑰[r
SSL 證書(shū)安裝過(guò)程
第一步:安裝mod_ssl
[root@300second ~]# yum -y install mod_ssl
第二步:HTTP 服務(wù)器上配置mod_ssl
[1] 建立服務(wù)器密鑰
[root@300second ~]# cd /etc/pki/tls/certs/ ← 進(jìn)入HTTP 服務(wù)器配置文件所在目錄
[root@300second certs]# make server.key ← 建立服務(wù)器密鑰 umask 77 ;
/usr/bin/openssl genrsa -des3 1024 > server.key Generating RSA private key, 1024 bit long modulus ................ ...... e is 65537 (0x10001)
Enter pass phrase: ← 在這里輸入口令
Verifying - Enter pass phrase: ← 確認(rèn)口令,再次輸入
[root@300second certs]# openssl rsa -in server.key -out server.key ← 從密鑰中刪除密碼(以避免系統(tǒng)啟動(dòng)后被詢(xún)問(wèn)口令)
Enter pass phrase for server.key: ← 輸入口令
writing RSA key
[2] 建立服務(wù)器公鑰
[root@300second certs]# make server.csr ← 建立服務(wù)器密鑰 umask 77 ;
/usr/bin/openssl req -utf8 -new -key server.key -out server.csr You are about to be asked to enter information that will be incorporated into 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 blank For some fields there will be a default value,
If you enter '.', the field will be left blank.
----- Country Name (2 letter code) [GB]:CN ← 輸入國(guó)名 State or Province Name (full name) [Berkshire]:Fujian ← 輸入省名 Locality Name (eg, city) [Newbury]:Quanzhou ← 輸入城市名
Organization Name (eg, company) [My Company Ltd]:www.51cto.com ← 輸入組織名(任意)
,Organizational Unit Name (eg, section) []: ← 不輸入,直接回車(chē)
Common Name (eg, your name or your server's hostname) []:www.51cto.com ← 輸入通稱(chēng)(任意)
Email Address []:300second@163.com ← 輸入電子郵箱地址 Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []: ← 不輸入,直接回車(chē)
An optional company name []: ← 不輸入,直接回車(chē)
[3] 建立服務(wù)器證書(shū)
[root@300second certs]# openssl x509 -in server.csr -out server.pem -req -signkey server.key -days 365 ← 建立服務(wù)器證書(shū) Signature ok subject=/C=CN/ST=Fujian/L=Quanzhou/O=www.51cto.com/CN=www.51cto.com/emailAddress=300second@163.com
Getting Private key
[root@300second certs]# chmod 400 server.* ← 修改權(quán)限為400
[4] 設(shè)置SSL
[root@300second certs]# vi /etc/httpd/conf.d/ssl.conf ← 修改SSL 的設(shè)置文件
#DocumentRoot "/var/www/html" ← 找到這一行,將行首的“#”去掉
↓
DocumentRoot "/var/www/html" ← 變?yōu)榇藸顟B(tài)
[5] 重新啟動(dòng)HTTP 服務(wù),讓SSL 生效
[root@300second certs]# /etc/rc.d/init.d/httpd restart ← 重新啟動(dòng)HTTP 服務(wù)器
停止 httpd: [ 確定 ]
啟動(dòng) httpd: [ 確定]
第三步:到StartSSL 申請(qǐng)免費(fèi)證書(shū): StartSSL 免費(fèi)SSL 證書(shū)成功申請(qǐng)-HTTPS 讓訪(fǎng)問(wèn)網(wǎng)站更安全
一、StartSSL 個(gè)人證書(shū)登錄申請(qǐng)
1、StartSSL 官網(wǎng):
,2、第一次用StartSSL ,先進(jìn)入控制面板,先點(diǎn)擊注冊(cè)。
3、然后是填寫(xiě)你的個(gè)人基本信息,以部落的經(jīng)驗(yàn),主要地址填寫(xiě)詳細(xì),StartSSL 會(huì)根據(jù)你的IP 自動(dòng)填入你所在的地址。
4、提交后你的郵箱會(huì)收到一個(gè)驗(yàn)證碼。
,5、用這個(gè)驗(yàn)證碼輸入填寫(xiě)驗(yàn)證。
6、驗(yàn)證成功后,要么是等待人工審核開(kāi)通,要么是直接提示下載個(gè)人操作證書(shū)。
二、通過(guò)StartSSL 審核下載安裝個(gè)人操作證書(shū)
1、一般情況下幾分鐘后就可以收到StartSSL 審核通過(guò)的郵件了,沒(méi)有通過(guò)的話(huà)會(huì)問(wèn)你一些問(wèn)題,隨便回復(fù)一下就OK 了。像部落是直接開(kāi)通,提示讓我下載證書(shū)。
,2、點(diǎn)擊安裝,稍等幾分鐘就會(huì)自動(dòng)在瀏覽器上安裝StartSSL 操作證書(shū)了。
3、部落用了是Chrome 瀏覽器,提示安裝成功。
4、安裝好了個(gè)人操作證書(shū)后,就可以返回到控制面板,點(diǎn)擊Authenticate 憑證書(shū)登錄了。
三、StartSSL 免費(fèi)SSL 通過(guò)域名驗(yàn)證
,1、上面是獲得了StartSSL 的個(gè)人操作登錄使用權(quán),接下來(lái)我們要用自己的域名來(lái)申請(qǐng)一個(gè)StartSSL 免費(fèi)SSL 證書(shū)了。
2、點(diǎn)擊Validations Wizard,選擇Domain name validation,點(diǎn)擊Continue 。
3、輸入你想要使用SSL 的域名,點(diǎn)擊繼續(xù)。
4、接下來(lái)選擇你的域名所有者的郵箱,如果你的域名設(shè)置了Whois 保護(hù),可能還要先進(jìn)入域名注冊(cè)商那里取消保護(hù),否則無(wú)法使用域名管理員郵箱通過(guò)域名所有權(quán)驗(yàn)證。
,5、提交了域名后,到郵箱中收取激活郵件,填入驗(yàn)證碼,通過(guò)驗(yàn)證。
四、申請(qǐng)StartSSL 生成域名的SSL 證書(shū)
1、上面已經(jīng)提交了域名并通過(guò)了所有權(quán)驗(yàn)證,點(diǎn)擊Certificates Wizard,選擇WEB Server SSL/TSL Certifites 。
2、生成私鑰,為私鑰提供一個(gè)密碼,最少10位,最大32位。
,3、將顯示內(nèi)容保存為freehao123.key (這個(gè)私鑰是加密的),繼續(xù)點(diǎn)擊下一步。
4、輸入你要綁定的二級(jí)域名,一般是www 。
5、提交后還得再等待StartSSL 審核,一般是幾分鐘后就可以收到郵件通知。當(dāng)然也有審核不通過(guò)的,例如部落的因?yàn)橛蛎年P(guān)系,直接被拒絕了,只好換一個(gè)域名了。The domain s0su.com could be easily
,mistaken with the domain sosu.com in which case our policy doesn’t allow it to be issued. Sorry for the inconvenience!
第四步:以下是在Linux 上配置過(guò)程: 1、修改httpd.conf 文件
**RPM安裝的情況下,不需要修改httpd.conf 文件,因?yàn)樵趆ttpd.conf 文件中默認(rèn)添加了 include conf.d/*.conf。而在rpm 安裝時(shí),conf.d 文件夾中已含有ssl.conf 文件。所以只要修改ssl.conf 文件就可以了。**
**RPM安裝的Apahce 時(shí),可能一開(kāi)始沒(méi)有mod-ssl ,需要安裝。方法為:yum install mod_ssl 或者用rpm 包安裝,需要mod_ssl arp_util distcache httpd postgresql-libs等伊來(lái)關(guān)系。**
需要修改時(shí)可在httpd.conf 文件中加上include conf.d/ssl.conf(用于ssl 模塊使用的conf 文件的路徑即可) 。
2、修改ssl.conf 文件
[root@localhost conf.d]#cp -p ssl.conf ssl.conf.bk
[root@localhost conf.d]#vi ssl.conf
---------------------------------------
Listen 443 //可以改成其他端口
SSLPassPhraseDialog builtin //每次重啟Apache 時(shí)需要輸入密碼
SSLSessionCache shmcb:/var/cache/mod_ssl/scache(512000)
SSLSessionCacheTimeout 300
SSLMutex default
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
SSLEngine on
SSLCertificateFile /etc/httpd/conf/ssl.crt/server.crt(在startssl 申請(qǐng)的crt ,將文件copy 到對(duì)應(yīng)的文件夾下)
SSLCertificateKeyFile /etc/httpd/conf/ssl.crt/server.key(在startssl 申請(qǐng)的key 將文件copy 到對(duì)應(yīng)的文件夾下)
SSLCACertificateFile /etc/httpd/conf/ssl.crt/ca.crt //雙向時(shí)使用
SSLVerifyClient require //雙向時(shí)使用, 強(qiáng)制客戶(hù)必須持有SSL 證書(shū)請(qǐng)求
SSLVerifyDepth 10 //雙向時(shí)使用
,3、重啟Apache
[root@localhost ssl.crt]#service httpd restart
此時(shí)可能需要密碼:此時(shí)密碼就是你在申請(qǐng)證書(shū)時(shí),生成私鑰時(shí)輸入的密碼。
4、開(kāi)啟防火墻端口