前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >在Ubuntu16.10上开启docker17.03.0-ce的https认证

在Ubuntu16.10上开启docker17.03.0-ce的https认证

作者头像
cn華少
发布2018-09-11 15:42:51
3190
发布2018-09-11 15:42:51
举报
文章被收录于专栏:IT综合技术分享IT综合技术分享
1、生成CA私钥和公钥:

$ openssl genrsa -aes256 -out ca-key.pem 4096

效果如下:

Generating RSA private key,4096bit long modulus............................................................................................................................................................................................++........++e is65537(0x10001)

Enter pass phraseforca-key.pem: cloud

Verifying - Enter pass phraseforca-key.pem: cloud

需要记住设置的key,下面要用

2、进行证书生成

$ openssl req -new -x509 -days 365 -key ca-key.pem -sha256 -out ca.pem

Enter pass phrase for ca-key.pem:

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) AU:cn

State or Province Name (full name) Some-State:shandong

Locality Name (eg, city) []:jinan

Organization Name (eg, company) Internet Widgits Pty Ltd:zhangyc

Organizational Unit Name (eg, section) []:zhangyc

Common Name (e.g. server FQDN or YOUR name) []:zhangyc

Email Address []:lz2392504@gmail.com

3、根据根证书,生成服务器证书、客户端证书

$ openssl genrsa -out server-key.pem 4096

$ openssl req -subj "/CN=cloudtop" -sha256 -new -key server-key.pem -out server.csr

$ echo subjectAltName = DNS:cloudtop,IP:172.31.142.210,IP:127.0.0.1 > extfile.cnf

$ openssl x509 -req -days 365 -sha256 -in server.csr -CA ca.pem -CAkey ca-key.pem -CAcreateserial -out server-cert.pem -extfile extfile.cnf

$ openssl genrsa -out key.pem 4096

$ openssl req -subj '/CN=client' -new -key key.pem -out client.csr

$ echo extendedKeyUsage = clientAuth > extfile.cnf

$ openssl x509 -req -days 365 -sha256 -in client.csr -CA ca.pem -CAkey ca-key.pem -CAcreateserial -out cert.pem -extfile extfile.cnf

$ rm -v client.csr server.csr

$ chmod -v 0400 ca-key.pem key.pem server-key.pem

$ chmod -v 0444 ca.pem server-cert.pem cert.pem

$ sudo vim /etc/systemd/system/docker.service.d/http-proxy.conf

新版需要编辑/etc/systemd/system/docker.service.d/docker.conf

$ sudo cat /etc/systemd/system/docker.service.d/docker.conf

Service

ExecStart=

ExecStart=/usr/bin/dockerd --tlsverify --tlscacert=/home/zhangyc/ca.pem --tlscert=/home/zhangyc/server-cert.pem --tlskey=/home/zhangyc/server-key.pem -H=172.31.142.111:4096

4、启动配置参考

在ubuntu16.10上开启docker 17.03.0-ce的http远程访问

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2017.08.10 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 1、生成CA私钥和公钥:
  • 2、进行证书生成
相关产品与服务
容器服务
腾讯云容器服务(Tencent Kubernetes Engine, TKE)基于原生 kubernetes 提供以容器为核心的、高度可扩展的高性能容器管理服务,覆盖 Serverless、边缘计算、分布式云等多种业务部署场景,业内首创单个集群兼容多种计算节点的容器资源管理模式。同时产品作为云原生 Finops 领先布道者,主导开源项目Crane,全面助力客户实现资源优化、成本控制。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档