$ openssl verify -CAfile /etc/kubernetes/cert/ca.pem /etc/kubernetes/cert/kubernetes.pem /etc/kubernetes/cert/kubernetes.pem: OK
------------------------------------------------------------------------------html
把生成的ca证书和去除密码的私钥文件部署到web服务器后,执行如下命令验证: nginx
不加CA证书验证git
openssl s_client -connect demo.rancher.com:443 -servername demo.rancher.com
添加CA证书验证web
openssl s_client -connect demo.rancher.com:443 -servername demo.rancher.com -CAfile server-ca.crt
---------------------------------------------------------------------------------算法
Nginx 配置支持HTTPSvim
vim nginx.confwindows
server { listen 80; listen 443 ssl; server_name *.*.com ...
#ssl on; #同时开启http和https时,不须要开启此项! ssl_certificate /data/mysite/htdocs/server.crt; ssl_certificate_key /data/mysite/htdocs/server.key; ... }
http 与https并存 浏览器
nginx配置https的官网连接:http://nginx.org/en/docs/http/configuring_https_servers.html安全
-------------------------------------------------------------------------------------------------服务器
SSL 安全证书能够本身生成,也能够经过第三方的 CA ( Certification Authority )认证中心付费申请颁发。
SSL 安全证书包括:
一、CA 证书,也叫根证书或中间级证书。单向认证的 https , CA 证书是可选的。主要目的是使证书构成一个证书链,以达到浏览器信任证书的目的。若是使用了 CA 证书,服务器证书和客户证书都使用 CA 证书来签名。若是不安装 CA 证书,浏览器默认认为是不安全的。
二、服务器证书。必选。经过服务器私钥,生成证书请求文件 CSR ,再经过 CA 证书签名生成服务器证书。
三、客户证书。可选。若是有客户证书,就是双向认证的 HTTPS ,不然就是单向认证的 HTTPS 。生成步骤和服务器证书相似。
上面几种证书均可以本身生成。商业上,通常本身提供服务器或客户证书端的私钥和证书请求 CSR ,或向第三方机构付费申请获得经过 CA 证书签名的服务器证书和客户证书。
准备工做:
在操做前,最好将openssl.cnf文件打开,查看其dir路径将其修改成dir = /home/wjoyxt/demoCA /,不然下面的步骤会提示路径没法找到。
一、手动在当前目录/home/wjoyxt建立一个CA目录结构:
$ mkdir -p ./demoCA/newcerts
二、建立空文件:
$ touch demoCA/index.txt
三、建立并向文件中写入01:
$ echo 01 > demoCA/serial
三、本身签订根签书
Country Name (2 letter code) [AU]:(国家) ----必填 C
State or Province Name (full name) [Some-State]:(洲/省) ----必填 ST
Locality Name (eg, city) []:(城/镇) ----可为空 L
Organization Name (eg, company) [Internet Widgits Pty Ltd]:(组织名) ----必填 O
Organizational Unit Name (eg, section) []:(单位名) ----可为空 OU
Common Name (eg, YOUR name) []:(httpd-ssl.conf中的ServerName 名称) ----必填 CN (此处签署根证书时可不填,签订服务器端证书时必填)
Email Address []:(邮箱) ----可为空
产生的缘由是:
This thing happens when certificates share common data. You cannot have two certificates that look otherwise the same.
方法一:
修改demoCA下 index.txt.attr
将
unique_subject = yes
改成
unique_subject = no
方法二:
删除demoCA下的index.txt,并再touch下