pull/213/head
xiaojunnuo 2024-10-10 15:12:39 +08:00
parent e85c47744c
commit 99387ee32b
2 changed files with 15 additions and 33 deletions

View File

@ -8,8 +8,8 @@ https://console.cloud.google.com/apis/library/publicca.googleapis.com
打开该链接后点击“启用”随后等待右侧出现“API已启用”则可以关闭该页。 打开该链接后点击“启用”随后等待右侧出现“API已启用”则可以关闭该页。
## 2、 获取授权 ## 2、 获取授权
以下两种方式任选其一,有代理的话,推荐选第二种 以下两种方式任选其一
### 2.1 直接获取一次性EAB ### 2.1 直接获取EAB
1. 打开“Google Cloud Shell”在右上角点击激活CloudShell图标 1. 打开“Google Cloud Shell”在右上角点击激活CloudShell图标
等待分配完成后在 Shell 窗口内输入如下命令: 等待分配完成后在 Shell 窗口内输入如下命令:
@ -29,9 +29,8 @@ keyId: xxxxxxxxxxxxx]
3. 到Certd中创建一条EAB授权记录填写keyId(=kid) 和 b64MacKey 信息 3. 到Certd中创建一条EAB授权记录填写keyId(=kid) 和 b64MacKey 信息
注意keyId没有`]`结尾,不要把`]`也复制了 注意keyId没有`]`结尾,不要把`]`也复制了
注意此方式获取的EAB是一次性的只能用于申请一次证书优势是无需代理。
### 2.2 通过服务账号获取EAB【推荐】 ### 2.2 通过服务账号获取EAB
此方式可以自动EAB需要配置代理 此方式可以自动EAB需要配置代理

View File

@ -145,38 +145,19 @@ export class CertApplyPlugin extends CertApplyBasePlugin {
type: "eab", type: "eab",
}, },
maybeNeed: true, maybeNeed: true,
required: true, required: false,
helper: "需要提供EAB授权\nZeroSSL请前往[zerossl开发者中心](https://app.zerossl.com/developer),生成 'EAB Credentials'", helper:
"需要提供EAB授权\nZeroSSL请前往[zerossl开发者中心](https://app.zerossl.com/developer),生成 'EAB Credentials'\n Google:请查看[google获取eab帮助文档](https://gitee.com/certd/certd/blob/v2/doc/google/google.md)",
mergeScript: ` mergeScript: `
return { return {
show: ctx.compute(({form})=>{ show: ctx.compute(({form})=>{
return form.sslProvider === 'zerossl' return form.sslProvider === 'zerossl' || form.sslProvider === 'google'
}) })
} }
`, `,
}) })
eabAccessId!: number; eabAccessId!: number;
@TaskInput({
title: "临时EAB授权",
component: {
name: "access-selector",
type: "eab",
},
maybeNeed: true,
required: false,
helper:
"请查看[google获取eab帮助文档](https://gitee.com/certd/certd/blob/v2/doc/google/google.md)\n注意此方式获取的EAB授权是一次性的下次申请需要重新获取授权\n推荐使用Google服务账号授权自动获取EAB",
mergeScript: `
return {
show: ctx.compute(({form})=>{
return form.sslProvider === 'google'
})
}
`,
})
googleEabAccessId!: number;
@TaskInput({ @TaskInput({
title: "服务账号授权", title: "服务账号授权",
component: { component: {
@ -186,7 +167,7 @@ export class CertApplyPlugin extends CertApplyBasePlugin {
maybeNeed: true, maybeNeed: true,
required: false, required: false,
helper: helper:
"google服务账号授权与google一次性EAB授权选填其中一个[服务账号授权获取方法](https://gitee.com/certd/certd/blob/v2/doc/google/google.md)\n服务账号授权需要配置代理或者服务器本身在海外", "google服务账号授权与EAB授权选填其中一个[服务账号授权获取方法](https://gitee.com/certd/certd/blob/v2/doc/google/google.md)\n服务账号授权需要配置代理或者服务器本身在海外",
mergeScript: ` mergeScript: `
return { return {
show: ctx.compute(({form})=>{ show: ctx.compute(({form})=>{
@ -248,25 +229,27 @@ export class CertApplyPlugin extends CertApplyBasePlugin {
if (this.sslProvider === "google") { if (this.sslProvider === "google") {
if (this.googleAccessId) { if (this.googleAccessId) {
this.logger.info("您正在使用google服务账号授权");
const googleAccess = await this.ctx.accessService.getById(this.googleAccessId); const googleAccess = await this.ctx.accessService.getById(this.googleAccessId);
const googleClient = new GoogleClient({ const googleClient = new GoogleClient({
access: googleAccess, access: googleAccess,
logger: this.logger, logger: this.logger,
}); });
eab = await googleClient.getEab(); eab = await googleClient.getEab();
} else if (this.googleEabAccessId || this.eabAccessId) { } else if (this.eabAccessId) {
this.logger.warn("您正在使用google一次性EAB授权下次申请证书需要重新获取"); this.logger.info("您正在使用google EAB授权");
eab = await this.ctx.accessService.getById(this.googleEabAccessId); eab = await this.ctx.accessService.getById(this.eabAccessId);
} else { } else {
this.logger.error("google需要配置EAB授权或服务账号授权"); this.logger.error("google需要配置EAB授权或服务账号授权");
return; return;
} }
} else if (this.sslProvider === "zerossl") { } else if (this.sslProvider === "zerossl") {
if (this.eabAccessId) { if (this.eabAccessId) {
this.logger.error("zerossl需要EAB授权"); eab = await this.ctx.accessService.getById(this.eabAccessId);
} else {
this.logger.error("zerossl需要配置EAB授权");
return; return;
} }
eab = await this.ctx.accessService.getById(this.eabAccessId);
} }
this.acme = new AcmeService({ this.acme = new AcmeService({