2

Google Trust Services 免费90天SSL证书 ACME.sh 申请教程

 2 years ago
source link: https://blog.skyju.cc/post/google-cert-acme/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Google Trust Services 免费90天SSL证书 ACME.sh 申请教程

分享

Google Trust Services 免费90天SSL证书 ACME.sh 申请教程

谷歌近期开始提供免费SSL证书申请,证书有效期最长为90天。可在填表加入测试计划后,通过acme.sh脚本申请签发。

Apr 22, 2022   By  居正

阅读时长: 4 分钟

Google 提供免费公共证书服务

该功能处于内测阶段,Google 公告 (https://cloud.google.com/blog/products/identity-security/automate-public-certificate-lifecycle-management-via--acme-client-api)说证书管理器预览版的增强功能现在可以用于 Google Cloud 客户网络负载均衡器的 TLS 终止或者跨云和内部部署的工作负载。

证书服务的特性如下(V2EX ZeroClover 提供)

  1. 免费,且仅支持 ACME 协议进行申请
  2. 和 Let’s Encrypt 一样支持多域名和泛域名
  3. 支持 IP 证书,但是目前仅限 IP Block 的所有者进行验证
  4. 目前不提供完整 ECDSA 链,只有叶证书是 ECDSA 的
  5. 目前不支持 Punycode 域名
  6. 证书有效期在 1 - 90 天内可选,但是目前 ACME 客户端似乎都还不支持设置证书有效期

1.申请开通API

目前该服务处于Preview期,需要填表申请测试。

该服务为Google Cloud下的一个API,需先在谷歌云控制台创建一个服务后方可使用。

谷歌云控制台:https://console.cloud.google.com

8b71508337e3a3d2.png

创建项目,记录项目ID。本例中为exalted-shape-348002

打开谷歌官方的申请表单:https://docs.google.com/forms/d/e/1FAIpQLSd8zUIww_ztyT9a56OPq9NXISiyw6Y9g8S7LBtRQjxPhsHz5A/viewform?ts=620a6854

292a90f6492a1688.png

填入必要的信息,其中Project ID即为方才创建项目时显示的项目ID。

邮箱建议填写自己的域名邮箱或谷歌邮箱,确保能收到谷歌官方的邮件。

e4ddabea23647635.png

约1~2天内,即可收到回复邮件。

此时进入谷歌云控制台,点击该项目,在侧边栏选择「API和服务」,「已启用的API和服务」。在页面中点击「+启用API和服务」按钮。

1716c97a6a01e3bc.png

选择图中的项目打开,点击「启用」。

2.获取EAB

acme.sh通过ACME方式与谷歌的签发服务通信,需要提供自己账户的EAB(External Account Binding)。

10357838e432b5c1.png

在谷歌云控制台右上角点击「激活Cloud Shell」按钮。

在其中输入如下命令:

gcloud config set project exalted-shape-348002
# exalted-shape-348002 修改为你的实际项目ID

gcloud projects add-iam-policy-binding exalted-shape-348002 \
  --member=user:[email protected] \
  --role=roles/publicca.externalAccountKeyCreator
# exalted-shape-348002 修改为你的实际项目ID,[email protected] 修改为你的谷歌邮箱地址

gcloud alpha publicca external-account-keys create
# 创建EAB

45c69cde825995e2.png

共三条命令,最后一条命令执行后会显示Key的ID(keyId)与密钥(b64MacKey)。

3.使用acme.sh申请证书

谷歌ACME API在国内机器无法连接,请使用国外VPS。或配置proxychains等。

acme.sh详细使用教程请参见wiki:https://github.com/acmesh-official/acme.sh/wiki

在VPS上运行:

acme.sh --register-account -m [email protected] --server google \
    --eab-kid aaaaaaaaaa \
    --eab-hmac-key bbbbbbbb
# [email protected] 修改为你的谷歌邮箱地址,aaaaaaaaaa修改为刚刚申请的keyId,bbbbbbbb修改为刚刚申请的b64MacKey

最后根据acme.sh的基础使用操作签发证书即可。在签发时,使用--server google指定证书签发机构为谷歌。

13cd856b46662b6f.png

4d1df05a4c51efd1.png

4.参考资料

acme.sh的文档:https://github.com/acmesh-official/acme.sh/wiki/Google-Public-CA

谷歌官方的文档:https://cloud.google.com/blog/products/identity-security/automate-public-certificate-lifecycle-management-via--acme-client-api

Licensed under CC BY-NC-SA 4.0


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK