使用 acme.sh 申请泛域名证书
Haiya Lv3

安装 acme.sh

建议提前安装 socat

1
2
3
curl https://get.acme.sh | sh -s email=my@example.com
# 或
wget -O - https://get.acme.sh | sh -s email=my@example.com

国内服务器可以使用镜像:

1
2
3
git clone https://gitee.com/neilpang/acme.sh.git
cd acme.sh
./acme.sh --install -m my@example.com

申请证书

以下申请命令对应 your.domain.com 及其泛域名证书,使用 DNS 方式验证,密钥类型为 RSA,长度为 2048。

-k 2048 为 RSA 类型密钥,长度 2048。需要其他类型密钥请自行修改。

Specifies the domain key length: 2048, 3072, 4096, 8192 or ec-256, ec-384, ec-521

1
2
acme.sh --issue -d your.domain.com -d '*.your.domain.cn' -k 2048 --dns \
--yes-I-know-dns-manual-mode-enough-go-ahead-please

执行后,按照提示解析 acme_challenge TXT 记录,注意两条记录都需要解析。

也可以设置 DNS API 自动完成解析和验证,参考:https://github.com/acmesh-official/acme.sh/wiki/dnsapi

创建解析后,执行以下命令

1
2
acme.sh --renew -d your.domain.com -d '*.your.domain.cn' \
--yes-I-know-dns-manual-mode-enough-go-ahead-please

注意将 issue 换成 renew,执行后 acme.sh 会自动执行证书申请流程。

References

由 Hexo 驱动 & 主题 Keep