惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Engineering at Meta
Engineering at Meta
雷峰网
雷峰网
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
B
Blog
Y
Y Combinator Blog
WordPress大学
WordPress大学
Microsoft Azure Blog
Microsoft Azure Blog
小众软件
小众软件
G
Google Developers Blog
云风的 BLOG
云风的 BLOG
罗磊的独立博客
博客园 - 三生石上(FineUI控件)
博客园 - 叶小钗
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
量子位
The Cloudflare Blog
T
The Blog of Author Tim Ferriss
博客园_首页
B
Blog RSS Feed
Hugging Face - Blog
Hugging Face - Blog
IT之家
IT之家
阮一峰的网络日志
阮一峰的网络日志
L
LangChain Blog
宝玉的分享
宝玉的分享

🤪C'est la vie

自建 Tailscale 的 DERP Server 优雅地使用 Python requests 调用 Aria2 JSON-RPC 版权声明 关于 Hello Hugo——记Hugo博客搭建 友链
使用 ACME.SH 申请 Google CA SSL 证书
Jonathan Zhang · 2023-01-01 · via 🤪C'est la vie

前言

最近谷歌开放了自家的 GTS CA(Google Trust Services),谷歌作为全球大厂那不得好好嫖一下!目前该服务进入了 Public Review 阶段,不再需要申请内测资格,而且支持acme.sh快速申请,那不就是嫖他的好日子来了吗!

证书简介

GTS SSL 证书的特点是

  • 支持 IP 地址块持有者申请 IP 地址证书

  • 根 CA 为GlobalSign,根 CA 的支持性和兼容性比Let's Encrypt

  • 支持安全性和性能更好的ECC 证书

  • 支持多域名泛域名证书申请(例如*.cestlavie.moe

  • 有效期为 90 天

  • 支持的 ACME 验证方式为TLS-ALPN-01HTTP-01、和 DNS-01

  • 暂不支持邮箱验证方式申请

  • 暂不支持国际化域名编码的域名

申请步骤

获取注册密钥

打开shell.cloud.google.com,输入以下代码

$ gcloud beta publicca external-account-keys create #创建凭据

回显为

$ gcloud beta publicca external-account-keys create
API [publicca.googleapis.com] not enabled on project [<projectid>]. Would you like to enable and retry (this will take a few minutes)? (y/N)?  y #允许创建 publica API
Enabling service [publicca.googleapis.com] on project [<projectid>]...
Operation "operations/acat.p2-<projectid>-<uuid>" finished successfully.
Created an external account key
[b64MacKey: <hmac_key>
keyId: <keyid>]

保存好输出的<hmac_key><keyid>,接下来要用

安装acme.sh

$ curl  https://get.acme.sh | sh -s   # 请确保已安装 curl

显示Install success!即为安装成功

使用凭据注册

$ acme.sh --set-default-ca --server google #切换默认 CA 为 Google
$ acme.sh --server https://dv.acme-v02.api.pki.goog/directory \
--register-account  --accountemail <Your_Email> --eab-kid <keyid> --eab-hmac-key <hmac_key> # 使用刚刚获取凭据注册账号

签发证书

  1. 使用 TXT 记录手动验证 DNS
$ acme.sh  --issue  --dns   -d yourdomain.com \
--yes-I-know-dns-manual-mode-enough-go-ahead-please

然后根据回显中

Add the following TXT record:
Domain: '_acme-challenge.yourdomain.com'
TXT value: '<TXT_value>'

设置 DNS 记录,完成后输入

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

完成证书申请

显示Cert success即为申请成功

可以在~/.acme.sh/yourdomain.com/下获取证书

  1. 使用 Cloudflare API 自动验证 DNS1

首先获取你的Global API Key可在此处获取

然后在终端中输入

$ export CF_Key='<YourGlobalAPIKey>'
$ export CF_Email="<YourEmail>"

接下来申请证书,输入

$ acme.sh --issue --dns dns_cf -d yourdomain.com #单域名
$ acme.sh --issue --dns dns_cf -d *.yourdomain.com #泛域名
$ acme.sh --issue --dns dns_cf -d sub1.yourdomain.com -d sub2.yourdomain.com #多域名
$ acme.sh --issue --dns dns_cf -d yourdomain.com --ecc #ECC 证书

看到回显Cert success即为申请成功,可以在~/.acme.sh/yourdomain.com/下获取证书

  • 此时 Cloudflare 凭据会自动存储至~/.acme.sh/account.conf用于续期目的

附:申请下的证书路径

文中部分信息已做脱敏处理


参考文献

  1. acme.sh Wiki - github.com

  2. Automate Public Certificates Lifecycle Management via RFC 8555 (ACME) - google.com