Let's Encrypt 泛域名证书

2018年3月 Let's Encrpt 宣布支持使用  ACMEv2和泛域名证书,在此之前仅支持提供单域名证书,因此新的子域名需要申请签发新的证书。而通常情况下一些域名下依附的 API 较多,每次改动子域名都是一套麻烦的操作,签发后再维护一大堆碎片化的证书实在是很令人头疼。

下面看一段Let's Encrpt 社区对 ACMEv2和泛域名证书的说法: 

ACMEv2 9.1k is an updated version of our ACME protocol which has gone through the IETF standards process, taking into account feedback from industry experts and other organizations that might want to use the ACME protocol for certificate issuance and management some day.

Wildcard certificates 16.7k allow you to secure all subdomains of a domain with a single certificate. Wildcard certificates can make certificate management easier in some cases, and we want to address those cases in order to help get the Web to 100% HTTPS. We still recommend non-wildcard certificates for most use cases.

Wildcard certificates are only available via ACMEv2. In order to use ACMEv2 for wildcard or non-wildcard certificates you’ll need a client that has been updated to support ACMEv2 22.9k. It is our intent to transition all clients and subscribers to ACMEv2, though we have not set an end-of-life date for our ACMEv1 API yet.

Additionally, wildcard domains must be validated using the DNS-01 challenge type. This means that you’ll need to modify DNS TXT records in order to demonstrate control over a domain for the purpose of obtaining a wildcard certificate.

ACMEv2是ACME协议的最新版本,该协议已经过了IETF标准流程,并且考虑到了行业专家和其他组织可能希望有一天使用ACME协议进行证书颁发和管理的反馈。

泛域名证书允许您使用单个证书保护域的所有子域。 在某些情况下,泛域名证书可以使证书管理更容易,我们希望解决这些问题,以帮助使Web达到100%HTTPS。 对于大多数用例,我们仍然建议使用非泛域名证书。

泛域名证书仅可通过ACMEv2获得。 为了将ACMEv2用于泛域名或非泛域名证书,您需要一个已更新为支持ACMEv2的客户端。 我们的目的是将所有客户端和订阅用户转换为ACMEv2,尽管我们还没有为我们的ACMEv1 API设置废止日期。

此外,必须使用DNS-01 challenge 类型验证通配符域。 这意味着您需要修改DNS TXT记录,以证明对域名的控制权以获取泛域名证书。

安装 

首先,按照官方所述,我们需要一个支持 ACMEv2 的客户端,这里我们就选用 acme.sh

按照 README 中的指导,我们只需要在终端中执行:

curl https://get.acme.sh | sh

即可完成安装。普通户和 root 用户都可以安装使用,.此时新建终端会话或是手动 acme.sh=~/.acme.sh/acme.sh 之后,执行 acme.sh 应该就可以看到输出的帮助信息了。

生成证书

这里使用 dns 方式, 在域名上添加一条 txt 解析记录, 验证域名所有权.

这种方式的好处是, 你不需要任何服务器, 不需要任何公网 ip, 只需要 dns 的解析记录即可完成验证. 坏处是,如果不同时配置 Automatic DNS API,使用这种方式 acme.sh 将无法自动更新证书,每次都需要手动再次重新解析验证域名所有权。

因为这种方式带来的缺点是无法自动更新证书所以需要携带
 --yes-I-know-dns-manual-mode-enough-go-ahead-please 这么一个逗比参数,

以example.com为例:

acme.sh --issue -d example --dns \
 --yes-I-know-dns-manual-mode-enough-go-ahead-please

 

这段话的意思上,你要为你的域名做一条txt 解析,

 

等待解析完成之后, 重新生成证书:

acme.sh  --renew   -d example.com \
   --yes-I-know-dns-manual-mode-enough-go-ahead-please

出了一大堆,提示安装成功,其实这种方式已经不推荐了,因为不能自动更新

 

copy/安装 证书

acme.sh  --installcert  -d  ppmall.store   \
        --key-file   /usr/local/nginx/ssl/key.pem \
        --fullchain-file /usr/local/nginx/ssl/cert.pem \
        --reloadcmd  "service nginx force-reload"

 

配置nginx,因为所有的子域名公用一份证书文件,所以单独提取出来了 ssl.conf,仅供参考

listen              443 ssl;
ssl_certificate     /usr/local/nginx/ssl/cert.pem;
ssl_certificate_key /usr/local/nginx/ssl/key.pem;
ssl_protocols       TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers         HIGH:!aNULL:!MD5;

 

参考链接:

https://github.com/Neilpang/acme.sh/wiki/dns-manual-mode

利用Let’s Encrypt 通配符证书实现全站SSL

Nginx 配置 HTTPS 服务器

ACME 官方文档

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值