This commit is contained in:
xiaojunnuo
2024-10-10 13:57:30 +08:00
parent 2ba94d03aa
commit 0a9ec06fe7
2 changed files with 32 additions and 14 deletions
+27 -10
View File
@@ -7,16 +7,17 @@ https://console.cloud.google.com/apis/library/publicca.googleapis.com
打开该链接后点击“启用”,随后等待右侧出现“API已启用”则可以关闭该页。
## 2、 申请Key
随后打开“Google Cloud Shell”(在右上角点击激活CloudShell图标)。
## 2、 获取授权
以下两种方式任选其一,有代理的话,推荐选第二种
### 2.1 直接获取一次性EAB
1. 打开“Google Cloud Shell”(在右上角点击激活CloudShell图标)。
等待分配完成后在 Shell 窗口内输入如下命令:
```shell
gcloud beta publicca external-account-keys create
```
此时会弹出“为 Cloud Shell 提供授权”,点击授权即可。
2. 此时会弹出“为 Cloud Shell 提供授权”,点击授权即可。
执行完成后会返回类似如下输出;注意不要在没有收到 Google 的邮件时执行该命令,会返回命令不存在。
```shell
@@ -24,14 +25,30 @@ Created an external account key
[b64MacKey: xxxxxxxxxxxxxxxx
keyId: xxxxxxxxxxxxx]
```
记录以上信息备用(注意keyId是不带中括号的)
3. 到Certd中,创建一条EAB授权记录,填写keyId(=kid) 和 b64MacKey 信息
注意:keyId没有`]`结尾,不要把`]`也复制了
注意:此方式获取的EAB是一次性的,只能用于申请一次证书,优势是无需代理。
### 2.2 通过服务账号获取EAB【推荐】
此方式可以自动EAB,需要配置代理
1. 创建服务账号
https://console.cloud.google.com/projectselector2/iam-admin/serviceaccounts/create?walkthrough_id=iam--create-service-account&hl=zh-cn#step_index=1
2. 选择一个项目,进入创建服务账号页面
3. 给服务账号起一个名字,点击`创建并继续`
4. 向此服务账号授予对项目的访问权限: `选择角色`->`基本`->`Owner`
5. 点击完成
6. 点击服务账号,进入服务账号详情页面
7. 点击`添加密钥`->`创建新密钥`->`JSON`,下载密钥文件
8. 将json文件内容粘贴到 certd中 Google服务授权输入框中
## 3、 创建证书流水线
选择证书提供商为google 开启使用代理
选择证书提供商为google 选择EAB授权 或 服务账号授权
## 4、 将key信息作为EAB授权信息
google证书需要EAB授权, 使用第二步中的 keyId 和 b64MacKey 信息创建一条EAB授权记录
注意:keyId没有`]`结尾,不要把`]`也复制了
## 5、 其他就跟正常申请证书一样了
## 4、 其他就跟正常申请证书一样了
@@ -158,7 +158,7 @@ export class CertApplyPlugin extends CertApplyBasePlugin {
eabAccessId!: number;
@TaskInput({
title: "GoogleEAB授权",
title: "临时EAB授权",
component: {
name: "access-selector",
type: "eab",
@@ -166,7 +166,7 @@ export class CertApplyPlugin extends CertApplyBasePlugin {
maybeNeed: true,
required: false,
helper:
"请查看[google获取eab帮助文档](https://github.com/certd/certd/blob/v2/doc/google/google.md)\n注意此方式获取的EAB授权是一次性的,下次申请需要重新获取授权\n推荐使用Google服务账号授权自动获取EAB",
"请查看[google获取eab帮助文档](https://gitee.com/certd/certd/blob/v2/doc/google/google.md)\n注意此方式获取的EAB授权是一次性的,下次申请需要重新获取授权\n推荐使用Google服务账号授权自动获取EAB",
mergeScript: `
return {
show: ctx.compute(({form})=>{
@@ -178,14 +178,15 @@ export class CertApplyPlugin extends CertApplyBasePlugin {
googleEabAccessId!: number;
@TaskInput({
title: "Google服务账号授权",
title: "服务账号授权",
component: {
name: "access-selector",
type: "google",
},
maybeNeed: true,
required: false,
helper: "google服务账号授权,需要配置代理或者服务器本身在海外\n代理配置方法:配置环境变量https_proxy",
helper:
"google服务账号授权与google一次性EAB授权选填其中一个,[服务账号授权获取方法](https://gitee.com/certd/certd/blob/v2/doc/google/google.md)\n服务账号授权需要配置代理或者服务器本身在海外",
mergeScript: `
return {
show: ctx.compute(({form})=>{