From 22ef28f6338a78465bd52ccbad13e66e80263b2f Mon Sep 17 00:00:00 2001 From: xiaojunnuo Date: Fri, 20 Sep 2024 10:23:20 +0800 Subject: [PATCH 01/24] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E6=94=B6?= =?UTF-8?q?=E4=BB=B6=E9=82=AE=E7=AE=B1=E8=BE=93=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/notification-form/pi-notification-form-email.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/ui/certd-client/src/views/certd/pipeline/pipeline/component/notification-form/pi-notification-form-email.vue b/packages/ui/certd-client/src/views/certd/pipeline/pipeline/component/notification-form/pi-notification-form-email.vue index 00f689e9..358ed0a4 100644 --- a/packages/ui/certd-client/src/views/certd/pipeline/pipeline/component/notification-form/pi-notification-form-email.vue +++ b/packages/ui/certd-client/src/views/certd/pipeline/pipeline/component/notification-form/pi-notification-form-email.vue @@ -8,7 +8,8 @@ component: { name: 'a-select', vModel: 'value', - mode: 'tags' + mode: 'tags', + open: false }, rules: [{ required: true, message: '此项必填' }] }" From ab41eea7a9495413115e159c2b47879050fa17ef Mon Sep 17 00:00:00 2001 From: xiaojunnuo Date: Fri, 20 Sep 2024 10:26:48 +0800 Subject: [PATCH 02/24] chore: --- .../component/notification-form/pi-notification-form-email.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/ui/certd-client/src/views/certd/pipeline/pipeline/component/notification-form/pi-notification-form-email.vue b/packages/ui/certd-client/src/views/certd/pipeline/pipeline/component/notification-form/pi-notification-form-email.vue index 358ed0a4..03aef201 100644 --- a/packages/ui/certd-client/src/views/certd/pipeline/pipeline/component/notification-form/pi-notification-form-email.vue +++ b/packages/ui/certd-client/src/views/certd/pipeline/pipeline/component/notification-form/pi-notification-form-email.vue @@ -11,6 +11,7 @@ mode: 'tags', open: false }, + helper: '输入你的收件邮箱地址,支持多个邮箱', rules: [{ required: true, message: '此项必填' }] }" /> From 9de77b327d39cff5ed6660ec53b58ba0eea18e5a Mon Sep 17 00:00:00 2001 From: xiaojunnuo Date: Fri, 20 Sep 2024 11:11:25 +0800 Subject: [PATCH 03/24] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E4=B8=BB?= =?UTF-8?q?=E6=9C=BA=E7=99=BB=E5=BD=95=E5=A4=B1=E8=B4=A5=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../certd-server/src/plugins/plugin-host/lib/ssh.ts | 11 ++++++++++- .../plugin-host/plugin/copy-to-local/index.ts | 13 ++++++++----- .../plugin-host/plugin/host-shell-execute/index.ts | 2 +- .../plugin-host/plugin/upload-to-host/index.ts | 6 +++--- 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/packages/ui/certd-server/src/plugins/plugin-host/lib/ssh.ts b/packages/ui/certd-server/src/plugins/plugin-host/lib/ssh.ts index f24da216..5533e2fa 100644 --- a/packages/ui/certd-server/src/plugins/plugin-host/lib/ssh.ts +++ b/packages/ui/certd-server/src/plugins/plugin-host/lib/ssh.ts @@ -286,7 +286,16 @@ export class SshClient { async _call(options: { connectConf: SshAccess; callable: any }): Promise { const { connectConf, callable } = options; const conn = new AsyncSsh2Client(connectConf, this.logger); - await conn.connect(); + try { + await conn.connect(); + } catch (e: any) { + if (e.message?.indexOf('All configured authentication methods failed') > -1) { + this.logger.error(e); + throw new Error('登录失败,请检查用户名/密码/密钥是否正确'); + } + throw e; + } + try { return await callable(conn); } finally { diff --git a/packages/ui/certd-server/src/plugins/plugin-host/plugin/copy-to-local/index.ts b/packages/ui/certd-server/src/plugins/plugin-host/plugin/copy-to-local/index.ts index 3cebb713..d07f24da 100644 --- a/packages/ui/certd-server/src/plugins/plugin-host/plugin/copy-to-local/index.ts +++ b/packages/ui/certd-server/src/plugins/plugin-host/plugin/copy-to-local/index.ts @@ -8,6 +8,7 @@ import path from 'path'; name: 'CopyToLocal', title: '复制到本机', icon: 'solar:copy-bold-duotone', + desc: '实际上是复制证书到docker容器内的某个路径,需要做目录映射到宿主机', group: pluginGroups.host.key, default: { strategy: { @@ -18,7 +19,7 @@ import path from 'path'; export class CopyCertToLocalPlugin extends AbstractTaskPlugin { @TaskInput({ title: '证书保存路径', - helper: '需要有写入权限,路径要包含文件名,文件名不能用*?!等特殊符号\n推荐使用相对路径,将写入与数据库同级目录,无需映射,例如:./tmp/cert.pem', + helper: '路径要包含文件名,文件名不能用*?!等特殊符号' + '\n推荐使用相对路径,将写入与数据库同级目录,无需映射,例如:./tmp/cert.pem', component: { placeholder: './tmp/cert.pem', }, @@ -26,7 +27,7 @@ export class CopyCertToLocalPlugin extends AbstractTaskPlugin { crtPath!: string; @TaskInput({ title: '私钥保存路径', - helper: '需要有写入权限,路径要包含文件名,文件名不能用*?!等特殊符号\n推荐使用相对路径,将写入与数据库同级目录,无需映射,例如:./tmp/cert.key', + helper: '路径要包含文件名,文件名不能用*?!等特殊符号\n推荐使用相对路径,将写入与数据库同级目录,无需映射,例如:./tmp/cert.key', component: { placeholder: './tmp/cert.key', }, @@ -35,7 +36,7 @@ export class CopyCertToLocalPlugin extends AbstractTaskPlugin { @TaskInput({ title: 'PFX证书保存路径', - helper: '需要有写入权限,路径要包含文件名,文件名不能用*?!等特殊符号\n推荐使用相对路径,将写入与数据库同级目录,无需映射,例如:./tmp/cert.pfx', + helper: '用于IIS证书部署,路径要包含文件名,文件名不能用*?!等特殊符号\n推荐使用相对路径,将写入与数据库同级目录,无需映射,例如:./tmp/cert.pfx', component: { placeholder: './tmp/cert.pfx', }, @@ -45,7 +46,7 @@ export class CopyCertToLocalPlugin extends AbstractTaskPlugin { @TaskInput({ title: 'DER证书保存路径', helper: - '需要有写入权限,路径要包含文件名,文件名不能用*?!等特殊符号\n推荐使用相对路径,将写入与数据库同级目录,无需映射,例如:./tmp/cert.der\n.der和.cer是相同的东西,改个后缀名即可', + '用户Apache证书部署,路径要包含文件名,文件名不能用*?!等特殊符号\n推荐使用相对路径,将写入与数据库同级目录,无需映射,例如:./tmp/cert.der\n.der和.cer是相同的东西,改个后缀名即可', component: { placeholder: './tmp/cert.der 或 ./tmp/cert.cer', }, @@ -124,7 +125,9 @@ export class CopyCertToLocalPlugin extends AbstractTaskPlugin { this.hostDerPath = derPath; } this.logger.info('请注意,如果使用的是相对路径,那么文件就在你的数据库同级目录下,默认是/data/certd/下面'); - this.logger.info('请注意,如果使用的是绝对路径,文件在容器内的目录下,你需要给容器做目录映射才能复制到宿主机'); + this.logger.info( + '请注意,如果使用的是绝对路径,文件在容器内的目录下,你需要给容器做目录映射才能复制到宿主机,需要在docker-compose.yaml中配置主机目录映射: volumes: /你宿主机的路径:/任务配置的证书路径' + ); }; await certReader.readCertFile({ logger: this.logger, handle }); diff --git a/packages/ui/certd-server/src/plugins/plugin-host/plugin/host-shell-execute/index.ts b/packages/ui/certd-server/src/plugins/plugin-host/plugin/host-shell-execute/index.ts index 06ba96a9..3be6679d 100644 --- a/packages/ui/certd-server/src/plugins/plugin-host/plugin/host-shell-execute/index.ts +++ b/packages/ui/certd-server/src/plugins/plugin-host/plugin/host-shell-execute/index.ts @@ -4,7 +4,7 @@ import { SshClient } from '../../lib/ssh.js'; @IsTaskPlugin({ name: 'hostShellExecute', title: '执行远程主机脚本命令', - icon:"tabler:brand-powershell", + icon: 'tabler:brand-powershell', group: pluginGroups.host.key, input: {}, default: { diff --git a/packages/ui/certd-server/src/plugins/plugin-host/plugin/upload-to-host/index.ts b/packages/ui/certd-server/src/plugins/plugin-host/plugin/upload-to-host/index.ts index ee32610e..8065bb18 100644 --- a/packages/ui/certd-server/src/plugins/plugin-host/plugin/upload-to-host/index.ts +++ b/packages/ui/certd-server/src/plugins/plugin-host/plugin/upload-to-host/index.ts @@ -7,7 +7,7 @@ import { SshAccess } from '../../access/index.js'; @IsTaskPlugin({ name: 'uploadCertToHost', title: '上传证书到主机', - icon:"line-md:uploading-loop", + icon: 'line-md:uploading-loop', group: pluginGroups.host.key, desc: '也支持复制证书到本机', default: { @@ -36,7 +36,7 @@ export class UploadCertToHostPlugin extends AbstractTaskPlugin { @TaskInput({ title: 'PFX证书保存路径', - helper: '需要有写入权限,路径要包含私钥文件名,文件名不能用*?!等特殊符号,例如:/tmp/cert.pfx', + helper: '用于IIS证书部署,需要有写入权限,路径要包含私钥文件名,文件名不能用*?!等特殊符号,例如:/tmp/cert.pfx', component: { placeholder: '/root/deploy/nginx/cert.pfx', }, @@ -45,7 +45,7 @@ export class UploadCertToHostPlugin extends AbstractTaskPlugin { @TaskInput({ title: 'DER证书保存路径', - helper: '需要有写入权限,路径要包含私钥文件名,文件名不能用*?!等特殊符号,例如:/tmp/cert.der', + helper: '用于Apache证书部署,需要有写入权限,路径要包含私钥文件名,文件名不能用*?!等特殊符号,例如:/tmp/cert.der', component: { placeholder: '/root/deploy/nginx/cert.der', }, From d331fea47789122650e057ec7c9e85ee8e66f09b Mon Sep 17 00:00:00 2001 From: xiaojunnuo Date: Fri, 20 Sep 2024 12:34:41 +0800 Subject: [PATCH 04/24] =?UTF-8?q?perf:=20=E6=94=AF=E6=8C=81=E9=98=BF?= =?UTF-8?q?=E9=87=8C=E4=BA=91ACK=E8=AF=81=E4=B9=A6=E9=83=A8=E7=BD=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/pipeline/src/dt/pipeline.ts | 1 + .../certd-client/src/views/certd/pipeline/certd-form/crud.tsx | 3 ++- packages/ui/certd-client/src/views/certd/pipeline/crud.tsx | 1 + .../certd-client/src/views/certd/pipeline/pipeline/index.vue | 2 +- 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/core/pipeline/src/dt/pipeline.ts b/packages/core/pipeline/src/dt/pipeline.ts index c9532327..f436d30a 100644 --- a/packages/core/pipeline/src/dt/pipeline.ts +++ b/packages/core/pipeline/src/dt/pipeline.ts @@ -46,6 +46,7 @@ export type Stage = Runnable & { tasks: Task[]; concurrency: ConcurrencyStrategy; next: NextStrategy; + maxTaskCount?: number; }; export type Trigger = { diff --git a/packages/ui/certd-client/src/views/certd/pipeline/certd-form/crud.tsx b/packages/ui/certd-client/src/views/certd/pipeline/certd-form/crud.tsx index 8f6d5855..7d249398 100644 --- a/packages/ui/certd-client/src/views/certd/pipeline/certd-form/crud.tsx +++ b/packages/ui/certd-client/src/views/certd/pipeline/certd-form/crud.tsx @@ -83,7 +83,8 @@ export default function (certPluginGroup: PluginGroup, formWrapperRef: any): Cre vModel: "modelValue", placeholder: "0 0 4 * * *" }, - helper: "点击上面的按钮,选择每天几点几分定时执行, 例如:0 0 4 * * *,每天凌晨4点0分0秒触发\n建议设置为每天触发一次,证书未到期之前任务会跳过,不会重复执行", + helper: + "点击上面的按钮,选择每天几点几分定时执行, 例如:0 0 4 * * *,每天凌晨4点0分0秒触发\n建议设置为每天触发一次,证书未到期之前任务会跳过,不会重复执行", order: 100 } }, diff --git a/packages/ui/certd-client/src/views/certd/pipeline/crud.tsx b/packages/ui/certd-client/src/views/certd/pipeline/crud.tsx index eaf59228..b1563744 100644 --- a/packages/ui/certd-client/src/views/certd/pipeline/crud.tsx +++ b/packages/ui/certd-client/src/views/certd/pipeline/crud.tsx @@ -113,6 +113,7 @@ export default function ({ crudExpose, context: { certdFormRef } }: CreateCrudOp stages: [ { title: "证书申请阶段", + maxTaskCount: 1, tasks: [ { title: "证书申请任务", diff --git a/packages/ui/certd-client/src/views/certd/pipeline/pipeline/index.vue b/packages/ui/certd-client/src/views/certd/pipeline/pipeline/index.vue index 15c85b91..f9dd3f4b 100644 --- a/packages/ui/certd-client/src/views/certd/pipeline/pipeline/index.vue +++ b/packages/ui/certd-client/src/views/certd/pipeline/pipeline/index.vue @@ -123,7 +123,7 @@