Apache配置SSL证书服务器傻瓜步骤
生活随笔
收集整理的這篇文章主要介紹了
Apache配置SSL证书服务器傻瓜步骤
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
在Linux+Apache+OpenSSL中配置SSL安全證書認證是不難的,我的另一篇工作隨記中曾提到[url]http://www.host01.com/article/server/00070002/0621409075193649.htm[/url]中有所有步驟,不過其中的一些描述有點復雜,并且依賴關系也沒有這些嚴格。這里給出一個傻瓜式步驟,供自己和有心人復用。 首先確保你的Linux有OpenSSL(ls -l /usr/bin/openssl),如果沒有請從[url]http://openssl.org/[/url]下載。 mkdir demoCA
cp /usr/share/ssl/openssl.cnf ./demoCA
vi ./demoCA/openssl.cnf and edit the dir configuration of CA_default from ./demoCA to .
mkdir demoCA/certs
mkdir demoCA/crl
mkdir demoCA/newcerts
mkdir demoCA/private
echo "01" > demoCA/serial
touch demoCA/index.txt
cd demoCA openssl req -new -x509 -keyout ./private/cakey.pem -out ./cacert.pem -days 3650(password input twice, 該密碼多次用到,HTTPD啟動也須用到, 10年有效期)
Country Name (2 letter code) [GB]:US
State or Province Name (full name) [Berkshire]:CA
Locality Name (eg, city) [Newbury]:San Clara
Organization Name (eg, company) [My Company Ltd]:Cisco
Organizational Unit Name (eg, section) []:WebEx
Common Name (eg, your name or your server's hostname) []:ServerDNSName(最好跟你SERVER名字一樣)
Email Address []: openssl genrsa -des3 -out server.key 1024 openssl req -new -key server.key -out server.csr
Country Name (2 letter code) [GB]:US
State or Province Name (full name) [Berkshire]:CA
Locality Name (eg, city) [Newbury]:San Clara
Organization Name (eg, company) [My Company Ltd]:Cisco
Organizational Unit Name (eg, section) []:WebEx
Common Name (eg, your name or your server's hostname) []:ServerDNSName Email Address []: Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:Cisco-WebEx Communication Inc. mv server.csr newreq.pem
openssl ca -config ./openssl.cnf -policy policy_anything -out newcert.pem -infiles newreq.pem mv newcert.pem server.crt vi /etc/httpd/conf.d/ssl.conf并改變以下四行并確保沒被注釋。
SSLCertificateFile /etc/httpd/conf.d/demoCA/server.crt
SSLCertificateKeyFile /etc/httpd/conf.d/demoCA/server.key
SSLCACertificatePath /etc/httpd/conf.d/demoCA
SSLCACertificateFile /etc/httpd/conf.d/demoCA/cacert.pem
#SSLVerifyClient require
#SSLVerifyDepth? 10
#SSLVerifyClient none(by default) 其中上述第五、六行是為client強制需要安裝安全證書的設置。如果需要則需按[url]http://www.host01.com/article/server/00070002/0621409075193649.htm[/url]文章后段所述步驟簽發client證書。這里不再贅述。 如果需要第三方簽你的根證書,需把你的cacert.pem證書交與第三方認證機構進行簽證。 與[url]http://www.host01.com/article/server/00070002/0621409075193649.htm[/url]頗多重疊,只是為了簡單起已,給自己提一個醒。 本文出自 “守望者的技術日記和六味生活” 博客,請務必保留此出處[url]http://dannyyuan.blog.51cto.com/212520/39088[/url]本文出自 51CTO.COM技術博客
cp /usr/share/ssl/openssl.cnf ./demoCA
vi ./demoCA/openssl.cnf and edit the dir configuration of CA_default from ./demoCA to .
mkdir demoCA/certs
mkdir demoCA/crl
mkdir demoCA/newcerts
mkdir demoCA/private
echo "01" > demoCA/serial
touch demoCA/index.txt
cd demoCA openssl req -new -x509 -keyout ./private/cakey.pem -out ./cacert.pem -days 3650(password input twice, 該密碼多次用到,HTTPD啟動也須用到, 10年有效期)
Country Name (2 letter code) [GB]:US
State or Province Name (full name) [Berkshire]:CA
Locality Name (eg, city) [Newbury]:San Clara
Organization Name (eg, company) [My Company Ltd]:Cisco
Organizational Unit Name (eg, section) []:WebEx
Common Name (eg, your name or your server's hostname) []:ServerDNSName(最好跟你SERVER名字一樣)
Email Address []: openssl genrsa -des3 -out server.key 1024 openssl req -new -key server.key -out server.csr
Country Name (2 letter code) [GB]:US
State or Province Name (full name) [Berkshire]:CA
Locality Name (eg, city) [Newbury]:San Clara
Organization Name (eg, company) [My Company Ltd]:Cisco
Organizational Unit Name (eg, section) []:WebEx
Common Name (eg, your name or your server's hostname) []:ServerDNSName Email Address []: Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:Cisco-WebEx Communication Inc. mv server.csr newreq.pem
openssl ca -config ./openssl.cnf -policy policy_anything -out newcert.pem -infiles newreq.pem mv newcert.pem server.crt vi /etc/httpd/conf.d/ssl.conf并改變以下四行并確保沒被注釋。
SSLCertificateFile /etc/httpd/conf.d/demoCA/server.crt
SSLCertificateKeyFile /etc/httpd/conf.d/demoCA/server.key
SSLCACertificatePath /etc/httpd/conf.d/demoCA
SSLCACertificateFile /etc/httpd/conf.d/demoCA/cacert.pem
#SSLVerifyClient require
#SSLVerifyDepth? 10
#SSLVerifyClient none(by default) 其中上述第五、六行是為client強制需要安裝安全證書的設置。如果需要則需按[url]http://www.host01.com/article/server/00070002/0621409075193649.htm[/url]文章后段所述步驟簽發client證書。這里不再贅述。 如果需要第三方簽你的根證書,需把你的cacert.pem證書交與第三方認證機構進行簽證。 與[url]http://www.host01.com/article/server/00070002/0621409075193649.htm[/url]頗多重疊,只是為了簡單起已,給自己提一個醒。 本文出自 “守望者的技術日記和六味生活” 博客,請務必保留此出處[url]http://dannyyuan.blog.51cto.com/212520/39088[/url]本文出自 51CTO.COM技術博客
轉載于:https://blog.51cto.com/gzmaster/59171
總結
以上是生活随笔為你收集整理的Apache配置SSL证书服务器傻瓜步骤的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 固定宽度弹性布局(以适应各种各辨率)
- 下一篇: IT综合管理 新时期的运维管理思路