Compare commits

...

34 Commits

Author SHA1 Message Date
xiaojunnuo
6fe2d2c328 v1.24.4 2024-09-09 17:30:04 +08:00
xiaojunnuo
20f5865bb9 build: prepare to build 2024-09-09 17:29:13 +08:00
xiaojunnuo
2b224c712f chore: 2024-09-09 17:29:09 +08:00
xiaojunnuo
c446e24f1a build: prepare to build 2024-09-09 17:27:50 +08:00
xiaojunnuo
2623f45a3b chore: 2024-09-09 17:03:46 +08:00
xiaojunnuo
52e7208e8f chore: 2024-09-09 17:01:00 +08:00
xiaojunnuo
d1498a7160 perf: 插件选择支持搜索 2024-09-09 16:55:14 +08:00
xiaojunnuo
5c270b6b9d perf: 支持群晖 2024-09-09 16:01:42 +08:00
xiaojunnuo
18718f6a25 chore: 2024-09-09 10:39:29 +08:00
xiaojunnuo
653f409d91 fix: 修复腾讯云tke证书部署报错的bug
https://github.com/certd/certd/issues/162
2024-09-09 10:24:20 +08:00
xiaojunnuo
0f0af2f309 perf: 群晖部署教程 2024-09-09 10:17:40 +08:00
xiaojunnuo
7908ab79da fix: 修复腾讯云cdn证书部署后会自动关闭hsts,http2.0等配置的bug
https://github.com/certd/certd/issues/161
2024-09-09 10:17:25 +08:00
xiaojunnuo
ae3daa9bcf perf: 前置任务步骤增加错误提示 2024-09-09 09:27:38 +08:00
xiaojunnuo
01df4d0f1d chore: 1 2024-09-07 11:45:46 +08:00
xiaojunnuo
25ff6906c6 chore: 1 2024-09-07 11:44:52 +08:00
xiaojunnuo
695548eade chore: 支持armv7 2024-09-07 11:43:21 +08:00
xiaojunnuo
6221a4e464 chore: node版本设置为18 2024-09-07 11:40:45 +08:00
xiaojunnuo
115b819c66 chore: 测试armv7 2024-09-07 11:35:02 +08:00
xiaojunnuo
bceb8cce0d chore: 测试armv7 2024-09-07 11:34:10 +08:00
xiaojunnuo
8d2cf2095c chore: 测试armv7 2024-09-07 11:30:28 +08:00
xiaojunnuo
1b1a1a5bc2 chore: 测试armv7 2024-09-07 11:21:10 +08:00
xiaojunnuo
935ebe022a chore: 测试armv7 2024-09-06 23:48:40 +08:00
xiaojunnuo
ff356571c8 chore: 测试armv7 2024-09-06 23:48:01 +08:00
xiaojunnuo
76fb2141e4 chore: 测试armv7 2024-09-06 23:44:43 +08:00
xiaojunnuo
b220500f40 chore: 测试armv7 2024-09-06 23:39:37 +08:00
xiaojunnuo
1cbf70fb6a chore: 测试armv7 2024-09-06 23:39:22 +08:00
xiaojunnuo
52ec48656d chore: 测试armv7 2024-09-06 23:33:29 +08:00
xiaojunnuo
fddf3a0f68 chore: 2024-09-06 23:31:47 +08:00
xiaojunnuo
98520a1213 build: trigger build image 2024-09-06 23:21:50 +08:00
xiaojunnuo
d65d94b784 v1.24.3 2024-09-06 23:21:11 +08:00
xiaojunnuo
00f1e0da59 build: prepare to build 2024-09-06 23:19:58 +08:00
xiaojunnuo
65ef685729 perf: 支持多吉云cdn证书部署 2024-09-06 23:19:34 +08:00
xiaojunnuo
6e344140c6 chore: 1 2024-09-06 22:45:08 +08:00
xiaojunnuo
97a01b6f6d build: trigger build image 2024-09-06 22:35:27 +08:00
53 changed files with 564 additions and 135 deletions

View File

@@ -40,7 +40,7 @@ jobs:
# cache: 'npm'
# working-directory: ./packages/ui/certd-client
- run: |
npm install -g pnpm
npm install -g pnpm@8.15.7
pnpm install
npm run build
working-directory: ./packages/ui/certd-client

View File

@@ -3,6 +3,26 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.24.4](https://github.com/certd/certd/compare/v1.24.3...v1.24.4) (2024-09-09)
### Bug Fixes
* 修复腾讯云cdn证书部署后会自动关闭hstshttp2.0等配置的bug ([7908ab7](https://github.com/certd/certd/commit/7908ab79da624c94fa05849925b15e480e3317c4))
* 修复腾讯云tke证书部署报错的bug ([653f409](https://github.com/certd/certd/commit/653f409d91a441850d6381f89a8dd390831f0d5e))
### Performance Improvements
* 插件选择支持搜索 ([d1498a7](https://github.com/certd/certd/commit/d1498a71601b74d38343b1d070eadd03705dd9d5))
* 前置任务步骤增加错误提示 ([ae3daa9](https://github.com/certd/certd/commit/ae3daa9bcf4fc363825aad9b77f5d3879aeeff70))
* 群晖部署教程 ([0f0af2f](https://github.com/certd/certd/commit/0f0af2f309390f388e7a272cea3a1dd30c01977d))
* 支持群晖 ([5c270b6](https://github.com/certd/certd/commit/5c270b6b9d45a2152f9fdb3c07bd98b7c803cb8e))
## [1.24.3](https://github.com/certd/certd/compare/v1.24.2...v1.24.3) (2024-09-06)
### Performance Improvements
* 支持多吉云cdn证书部署 ([65ef685](https://github.com/certd/certd/commit/65ef6857296784ca765926e09eafcb6fc8b6ecde))
## [1.24.2](https://github.com/certd/certd/compare/v1.24.1...v1.24.2) (2024-09-06)
### Bug Fixes

View File

@@ -157,17 +157,18 @@ docker compose up -d
* [腾讯云](./doc/tencent/tencent.md)
* [windows主机](./doc/host/host.md)
* [google证书](./doc/google/google.md)
* [群晖部署certd及证书更新教程](./doc/synology/index.md)
## 八、问题处理
### 7.1 忘记管理员密码
解决方法如下:
1. 修改docker-compose.yaml文件将环境变量`certd_system_resetAdminPassword`改为`true`
1. 修改docker-compose.yaml文件将环境变量`certd_system_resetAdminPasswd`改为`true`
```yaml
services:
certd:
environment: # 环境变量
- certd_system_resetAdminPassword=false
- certd_system_resetAdminPasswd=false
```
2. 重启容器
```shell
@@ -175,7 +176,7 @@ docker compose up -d
docker logs -f --tail 500 certd
# 观察日志当日志中输出“重置1号管理员用户的密码完成”即可操作下一步
```
3. 修改docker-compose.yaml`certd_system_resetAdminPassword`改回`false`
3. 修改docker-compose.yaml`certd_system_resetAdminPasswd`改回`false`
4. 再次重启容器
```shell
docker compose up -d

View File

@@ -1 +1 @@
23:58
7

BIN
doc/synology/images/1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 KiB

BIN
doc/synology/images/2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

BIN
doc/synology/images/3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

BIN
doc/synology/images/4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

BIN
doc/synology/images/5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

BIN
doc/synology/images/6.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

41
doc/synology/index.md Normal file
View File

@@ -0,0 +1,41 @@
# 群晖部署和证书更新
## 一、群晖系统上部署Certd教程
### 1. 打开Container Manager
![](./images/1.png)
### 2. 新增项目
![](./images/2.png)
### 3. 配置Certd项目
![](./images/3.png)
### 4. 外网访问设置
![](./images/4.png)
### 5. 确认项目信息
![](./images/5.png)
点击完成安装等待certd启动完成即可
### 6. 门户配置向导【可选】
![](./images/6.png)
## 二、更新群晖证书
## 1. 前提条件
* 已经部署了certd
* 群晖上已经设置好了证书(证书建议设置好描述,插件需要根据描述查找证书)
## 2. 在certd上配置自动更新群晖证书插件
![](./images/deploy.png)

View File

@@ -9,5 +9,5 @@
}
},
"npmClient": "pnpm",
"version": "1.24.2"
"version": "1.24.4"
}

View File

@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.24.4](https://github.com/publishlab/node-acme-client/compare/v1.24.3...v1.24.4) (2024-09-09)
**Note:** Version bump only for package @certd/acme-client
## [1.24.3](https://github.com/publishlab/node-acme-client/compare/v1.24.2...v1.24.3) (2024-09-06)
**Note:** Version bump only for package @certd/acme-client
## [1.24.2](https://github.com/publishlab/node-acme-client/compare/v1.24.1...v1.24.2) (2024-09-06)
### Performance Improvements

View File

@@ -3,13 +3,13 @@
"description": "Simple and unopinionated ACME client",
"private": false,
"author": "nmorsman",
"version": "1.24.2",
"version": "1.24.4",
"main": "src/index.js",
"types": "types/index.d.ts",
"license": "MIT",
"homepage": "https://github.com/publishlab/node-acme-client",
"engines": {
"node": ">= 16"
"node": ">= 18"
},
"files": [
"src",
@@ -59,5 +59,5 @@
"bugs": {
"url": "https://github.com/publishlab/node-acme-client/issues"
},
"gitHead": "bef6b981e26a010a797734e508de6822de8564f5"
"gitHead": "c49ccbde93dbad7062ac39d4f18eca7d561f573f"
}

View File

@@ -3,6 +3,20 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.24.4](https://github.com/certd/certd/compare/v1.24.3...v1.24.4) (2024-09-09)
### Performance Improvements
* 前置任务步骤增加错误提示 ([ae3daa9](https://github.com/certd/certd/commit/ae3daa9bcf4fc363825aad9b77f5d3879aeeff70))
* 群晖部署教程 ([0f0af2f](https://github.com/certd/certd/commit/0f0af2f309390f388e7a272cea3a1dd30c01977d))
* 支持群晖 ([5c270b6](https://github.com/certd/certd/commit/5c270b6b9d45a2152f9fdb3c07bd98b7c803cb8e))
## [1.24.3](https://github.com/certd/certd/compare/v1.24.2...v1.24.3) (2024-09-06)
### Performance Improvements
* 支持多吉云cdn证书部署 ([65ef685](https://github.com/certd/certd/commit/65ef6857296784ca765926e09eafcb6fc8b6ecde))
## [1.24.2](https://github.com/certd/certd/compare/v1.24.1...v1.24.2) (2024-09-06)
### Performance Improvements

View File

@@ -1 +1 @@
22:33
17:29

View File

@@ -1,7 +1,7 @@
{
"name": "@certd/pipeline",
"private": false,
"version": "1.24.2",
"version": "1.24.4",
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
@@ -57,5 +57,5 @@
"vite": "^4.3.8",
"vue-tsc": "^1.6.5"
},
"gitHead": "bef6b981e26a010a797734e508de6822de8564f5"
"gitHead": "c49ccbde93dbad7062ac39d4f18eca7d561f573f"
}

View File

@@ -1,6 +1,4 @@
import { AxiosInstance } from "axios";
import { IContext } from "../core/index.js";
export type HttpClient = AxiosInstance;
export type UserContext = IContext;
export type PipelineContext = IContext;

View File

@@ -93,7 +93,7 @@ export class Executor {
await this.notification("success");
} catch (e: any) {
await this.notification("error", e);
this.logger.error("pipeline 执行失败", e.stack);
this.logger.error("pipeline 执行失败", e);
} finally {
clearInterval(intervalFlushLogId);
await this.onChanged(this.runtime);
@@ -217,11 +217,17 @@ export class Executor {
if (item.component?.name === "pi-output-selector") {
const contextKey = input[key];
if (contextKey != null) {
if (typeof contextKey !== "string") {
throw new Error(`步骤${step.title}${item.title}属性必须为String类型请重新配置该属性`);
}
// "cert": "step.-BNFVPMKPu2O-i9NiOQxP.cert",
const arr = contextKey.split(".");
const id = arr[1];
const outputKey = arr[2];
input[key] = this.currentStatusMap.get(id)?.status?.output[outputKey] ?? this.lastStatusMap.get(id)?.status?.output[outputKey];
if (input[key] == null) {
this.logger.warn(`${item.title}的配置未找到对应的输出值,请确认对应的前置任务是否存在或者是否执行正确`);
}
}
}
});
@@ -231,14 +237,13 @@ export class Executor {
//判断是否需要跳过
const lastNode = this.lastStatusMap.get(step.id);
const lastResult = lastNode?.status?.status;
let inputChanged = true;
const lastInputHash = lastNode?.status?.inputHash;
if (lastInputHash && newInputHash && lastInputHash === newInputHash) {
//参数有变化
inputChanged = false;
}
if (step.strategy?.runStrategy === RunStrategy.SkipWhenSucceed) {
//如果是成功后跳过策略
let inputChanged = true;
const lastInputHash = lastNode?.status?.inputHash;
if (lastInputHash && newInputHash && lastInputHash === newInputHash) {
//参数有变化
inputChanged = false;
}
if (lastResult != null && lastResult === ResultType.success && !inputChanged) {
step.status!.output = lastNode?.status?.output;
step.status!.files = lastNode?.status?.files;
@@ -253,6 +258,7 @@ export class Executor {
lastStatus,
http,
logger: currentLogger,
inputChanged,
accessService: this.options.accessService,
emailService: this.options.emailService,
pipelineContext: this.pipelineContext,

View File

@@ -107,8 +107,8 @@ export class RunHistory {
logError(runnable: Runnable, e: Error) {
// @ts-ignore
const errorInfo = runnable.runnableType == "step" ? e.stack : e.message;
this._loggers[runnable.id].error(`[${runnable.runnableType}] [${runnable.title}]<id:${runnable.id}> ${errorInfo}`);
const errorInfo = runnable.runnableType === "step" ? e : e.message;
this._loggers[runnable.id].error(`[${runnable.runnableType}] [${runnable.title}]<id:${runnable.id}> `, errorInfo);
}
finally(runnable: Runnable) {

View File

@@ -5,8 +5,8 @@ import { Logger } from "log4js";
import { IAccessService } from "../access/index.js";
import { IEmailService } from "../service/index.js";
import { IContext } from "../core/index.js";
import { AxiosInstance } from "axios";
import { ILogger, logger } from "../utils/index.js";
import { HttpClient } from "../utils/util.request";
export enum ContextScope {
global,
@@ -60,11 +60,12 @@ export type TaskInstanceContext = {
pipeline: Pipeline;
step: Step;
logger: Logger;
inputChanged: boolean;
accessService: IAccessService;
emailService: IEmailService;
pipelineContext: IContext;
userContext: IContext;
http: AxiosInstance;
http: HttpClient;
fileStore: FileStore;
lastStatus?: Runnable;
signal: AbortSignal;

View File

@@ -21,5 +21,6 @@ export const pluginGroups = {
huawei: new PluginGroup("huawei", "华为云", 3),
tencent: new PluginGroup("tencent", "腾讯云", 4),
host: new PluginGroup("host", "主机", 5),
cdn: new PluginGroup("cdn", "CDN", 6),
other: new PluginGroup("other", "其他", 7),
};

View File

@@ -1,5 +1,6 @@
import sleep from "./util.sleep.js";
import { request } from "./util.request.js";
import { http } from "./util.request.js";
export * from "./util.request.js";
export * from "./util.log.js";
export * from "./util.file.js";
export * from "./util.sp.js";
@@ -7,5 +8,5 @@ export * as promises from "./util.promise.js";
export * from "./util.hash.js";
export const utils = {
sleep,
http: request,
http,
};

View File

@@ -1,29 +1,39 @@
import axios from "axios";
import axios, { AxiosRequestConfig } from "axios";
import { logger } from "./util.log.js";
import { Logger } from "log4js";
export class HttpError extends Error {
request?: { url: string; method: string; data?: any };
response?: { data: any };
status?: number;
statusText?: string;
code?: string;
request?: { url: string; method: string; params?: any; data?: any };
response?: { data: any };
cause?: any;
constructor(error: any) {
if (!error) {
return;
}
super(error.message);
this.name = error.name;
this.stack = error.stack;
this.status = error?.response?.status;
this.statusText = error?.response?.statusText;
this.code = error.code;
this.cause = error.cause;
this.status = error.response?.status;
this.statusText = error.response?.statusText;
this.request = {
url: error?.response?.config?.url,
method: error?.response?.config?.method,
data: error?.response?.config?.data,
url: error.config?.url,
method: error.config?.method,
params: error.config?.params,
data: error.config?.data,
};
this.response = {
data: error?.response?.data,
data: error.response?.data,
};
delete error.response;
delete error.config;
delete error.request;
logger.error(error);
}
}
/**
@@ -35,7 +45,7 @@ export function createAxiosService({ logger }: { logger: Logger }) {
// 请求拦截
service.interceptors.request.use(
(config: any) => {
logger.info(`http request:${config.url}method:${config.method}`);
logger.info(`http request:${config.url}method:${config.method}params:${JSON.stringify(config.params)}`);
return config;
},
(error: Error) => {
@@ -67,9 +77,13 @@ export function createAxiosService({ logger }: { logger: Logger }) {
// default: break
// }
logger.error(
`请求出错status:${error?.response?.status},statusText:${error?.response?.statusText},url:${error?.config?.url},method:${error?.config?.method}`
`请求出错status:${error.response?.status},statusText:${error.response?.statusText},url:${error.config?.url},method:${error.config?.method}`
);
logger.error("返回数据:", JSON.stringify(error?.response?.data));
logger.error("返回数据:", JSON.stringify(error.response?.data));
if (error instanceof AggregateError) {
logger.error(error);
}
const err = new HttpError(error);
return Promise.reject(err);
}
@@ -77,4 +91,8 @@ export function createAxiosService({ logger }: { logger: Logger }) {
return service;
}
export const request = createAxiosService({ logger });
export const http = createAxiosService({ logger }) as HttpClient;
export type HttpClientResponse<R> = any;
export type HttpClient = {
request<D = any, R = any>(config: AxiosRequestConfig<D>): Promise<HttpClientResponse<R>>;
};

View File

@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.24.3](https://github.com/certd/certd/compare/v1.24.2...v1.24.3) (2024-09-06)
**Note:** Version bump only for package @certd/lib-huawei
## [1.24.2](https://github.com/certd/certd/compare/v1.24.1...v1.24.2) (2024-09-06)
**Note:** Version bump only for package @certd/lib-huawei

View File

@@ -1,7 +1,7 @@
{
"name": "@certd/lib-huawei",
"private": false,
"version": "1.24.2",
"version": "1.24.3",
"main": "./dist/bundle.js",
"module": "./dist/bundle.js",
"types": "./dist/d/index.d.ts",
@@ -16,5 +16,5 @@
"axios": "^1.7.2",
"rollup": "^3.7.4"
},
"gitHead": "bef6b981e26a010a797734e508de6822de8564f5"
"gitHead": "c49ccbde93dbad7062ac39d4f18eca7d561f573f"
}

View File

@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.24.4](https://github.com/certd/certd/compare/v1.24.3...v1.24.4) (2024-09-09)
**Note:** Version bump only for package @certd/lib-k8s
## [1.24.3](https://github.com/certd/certd/compare/v1.24.2...v1.24.3) (2024-09-06)
**Note:** Version bump only for package @certd/lib-k8s
## [1.24.2](https://github.com/certd/certd/compare/v1.24.1...v1.24.2) (2024-09-06)
**Note:** Version bump only for package @certd/lib-k8s

View File

@@ -1,7 +1,7 @@
{
"name": "@certd/lib-k8s",
"private": false,
"version": "1.24.2",
"version": "1.24.4",
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
@@ -16,7 +16,7 @@
"@kubernetes/client-node": "0.21.0"
},
"devDependencies": {
"@certd/pipeline": "^1.24.2",
"@certd/pipeline": "^1.24.4",
"@rollup/plugin-commonjs": "^23.0.4",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.0.1",
@@ -37,5 +37,5 @@
"tslib": "^2.5.2",
"typescript": "^4.8.4"
},
"gitHead": "bef6b981e26a010a797734e508de6822de8564f5"
"gitHead": "c49ccbde93dbad7062ac39d4f18eca7d561f573f"
}

View File

@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.24.4](https://github.com/certd/certd/compare/v1.24.3...v1.24.4) (2024-09-09)
**Note:** Version bump only for package @certd/midway-flyway-js
## [1.22.6](https://github.com/certd/certd/compare/v1.22.5...v1.22.6) (2024-08-03)
**Note:** Version bump only for package @certd/midway-flyway-js

View File

@@ -1,6 +1,6 @@
{
"name": "@certd/midway-flyway-js",
"version": "1.22.6",
"version": "1.24.4",
"description": "midway with flyway, sql upgrade way ",
"private": false,
"type": "module",
@@ -33,7 +33,7 @@
"@rollup/plugin-terser": "^0.4.3",
"@rollup/plugin-typescript": "^11.0.0",
"@types/chai": "^4.3.3",
"@types/node": "16",
"@types/node": "^18",
"@typescript-eslint/eslint-plugin": "^5.38.1",
"@typescript-eslint/parser": "^5.38.1",
"better-sqlite3": "^11.1.2",

View File

@@ -3,6 +3,16 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.24.4](https://github.com/certd/certd/compare/v1.24.3...v1.24.4) (2024-09-09)
### Performance Improvements
* 支持群晖 ([5c270b6](https://github.com/certd/certd/commit/5c270b6b9d45a2152f9fdb3c07bd98b7c803cb8e))
## [1.24.3](https://github.com/certd/certd/compare/v1.24.2...v1.24.3) (2024-09-06)
**Note:** Version bump only for package @certd/plugin-cert
## [1.24.2](https://github.com/certd/certd/compare/v1.24.1...v1.24.2) (2024-09-06)
### Performance Improvements

View File

@@ -1,7 +1,7 @@
{
"name": "@certd/plugin-cert",
"private": false,
"version": "1.24.2",
"version": "1.24.4",
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
@@ -13,8 +13,8 @@
"preview": "vite preview"
},
"dependencies": {
"@certd/acme-client": "^1.24.2",
"@certd/pipeline": "^1.24.2",
"@certd/acme-client": "^1.24.4",
"@certd/pipeline": "^1.24.4",
"jszip": "^3.10.1",
"node-forge": "^0.10.0",
"psl": "^1.9.0"
@@ -53,5 +53,5 @@
"vite": "^3.1.0",
"vue-tsc": "^0.38.9"
},
"gitHead": "bef6b981e26a010a797734e508de6822de8564f5"
"gitHead": "c49ccbde93dbad7062ac39d4f18eca7d561f573f"
}

View File

@@ -311,7 +311,7 @@ export class AcmeService {
private async testDirectory(directoryUrl: string) {
try {
await utils.http({
await utils.http.request({
url: directoryUrl,
method: "GET",
timeout: 10000,

View File

@@ -45,7 +45,7 @@ export abstract class CertApplyBasePlugin extends AbstractTaskPlugin {
email!: string;
@TaskInput({
title: "PFX密码",
title: "PFX证书密码",
component: {
name: "a-input-password",
vModel: "value",
@@ -191,14 +191,14 @@ export abstract class CertApplyBasePlugin extends AbstractTaskPlugin {
*/
async condition() {
if (this.forceUpdate) {
this.logger.info("强制更新证书选项已勾选,准备申请新证书");
return null;
}
let inputChanged = false;
const oldInput = JSON.stringify(this.lastStatus?.input?.domains);
const thisInput = JSON.stringify(this.domains);
if (oldInput !== thisInput) {
inputChanged = true;
const inputChanged = this.ctx.inputChanged;
if (inputChanged) {
this.logger.info("输入参数变更,准备申请新证书");
return null;
}
let oldCert: CertReader | undefined = undefined;
@@ -212,11 +212,6 @@ export abstract class CertApplyBasePlugin extends AbstractTaskPlugin {
return null;
}
if (inputChanged) {
this.logger.info("输入参数变更,申请新证书");
return null;
}
const ret = this.isWillExpire(oldCert.expires, this.renewDays);
if (!ret.isWillExpire) {
this.logger.info(`证书还未过期:过期时间${dayjs(oldCert.expires).format("YYYY-MM-DD HH:mm:ss")},剩余${ret.leftDays}`);

View File

@@ -69,13 +69,15 @@ export class CertReader {
const tmpDerPath = this.saveToFile("der");
logger.info("本地文件写入成功");
try {
await opts.handle({
return await opts.handle({
reader: this,
tmpCrtPath: tmpCrtPath,
tmpKeyPath: tmpKeyPath,
tmpPfxPath: tmpPfxPath,
tmpDerPath: tmpDerPath,
});
} catch (err) {
throw err;
} finally {
//删除临时文件
logger.info("删除临时文件");

View File

@@ -1,15 +1,17 @@
FROM node:20-alpine AS builder
FROM node:18-alpine AS builder
EXPOSE 7001
WORKDIR /workspace/
COPY . /workspace/
RUN npm install -g pnpm
# armv7 目前只能用node18 pnpm9不支持node18,所以pnpm只能用8.15.7版本
# https://github.com/nodejs/docker-node/issues/1946
RUN npm install -g pnpm@8.15.7
#RUN cd /workspace/certd-client && pnpm install && npm run build
RUN cp /workspace/certd-client/dist/* /workspace/certd-server/public/ -rf
RUN cd /workspace/certd-server && pnpm install && npm run build-on-docker
RUN cd /workspace/certd-server && yarn install && npm run build-on-docker
FROM node:20-alpine
FROM node:18-alpine
RUN apk add --no-cache openssl
WORKDIR /app/
COPY --from=builder /workspace/certd-server/ /app/

View File

@@ -3,6 +3,16 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.24.4](https://github.com/certd/certd/compare/v1.24.3...v1.24.4) (2024-09-09)
### Performance Improvements
* 插件选择支持搜索 ([d1498a7](https://github.com/certd/certd/commit/d1498a71601b74d38343b1d070eadd03705dd9d5))
## [1.24.3](https://github.com/certd/certd/compare/v1.24.2...v1.24.3) (2024-09-06)
**Note:** Version bump only for package @certd/ui-client
## [1.24.2](https://github.com/certd/certd/compare/v1.24.1...v1.24.2) (2024-09-06)
### Bug Fixes

View File

@@ -1,6 +1,6 @@
{
"name": "@certd/ui-client",
"version": "1.24.2",
"version": "1.24.4",
"private": true,
"scripts": {
"dev": "vite --open",
@@ -58,13 +58,13 @@
"vuedraggable": "^4.1.0"
},
"devDependencies": {
"@certd/pipeline": "^1.24.2",
"@certd/pipeline": "^1.24.4",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-node-resolve": "^15.2.3",
"@types/chai": "^4.3.12",
"@types/lodash-es": "^4.17.12",
"@types/mocha": "^10.0.6",
"@types/node": "^20.11.28",
"@types/node": "^18",
"@types/nprogress": "^0.2.3",
"@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "^7.2.0",

View File

@@ -68,6 +68,17 @@ h1, h2, h3, h4, h5, h6 {
flex: 1;
}
.flex-col{
display: flex;
flex-direction: column;
}
.scroll-y{
overflow-y: auto;
}
.mb-2 {
margin-bottom: 2px;
}
@@ -137,6 +148,13 @@ h1, h2, h3, h4, h5, h6 {
.w-100 {
width: 100%;
}
.h-100 {
height: 100%;
}
.overflow-hidden {
overflow: hidden;
}
.block-header {
margin: 3px;

View File

@@ -8,43 +8,61 @@
</template>
<template v-if="currentStep">
<pi-container v-if="currentStep._isAdd" class="pi-step-form">
<a-tabs tab-position="left">
<a-tab-pane v-for="group of pluginGroups.groups" :key="group.key" :tab="group.title">
<a-row :gutter="10">
<a-col v-for="item of group.plugins" :key="item.key" class="step-plugin" :span="12">
<a-card
hoverable
:class="{ current: item.name === currentStep.type }"
@click="stepTypeSelected(item)"
@dblclick="
stepTypeSelected(item);
stepTypeSave();
"
>
<a-card-meta>
<template #title>
<a-avatar :src="item.icon || '/images/plugin.png'" />
<span class="title">{{ item.title }}</span>
<vip-button v-if="item.needPlus" mode="icon" />
</template>
<template #description>
<span :title="item.desc">{{ item.desc }}</span>
</template>
</a-card-meta>
</a-card>
</a-col>
</a-row>
</a-tab-pane>
</a-tabs>
<div style="padding: 20px; margin-left: 100px">
<a-button v-if="editMode" type="primary" @click="stepTypeSave"> 确定 </a-button>
<template #header>
<a-row :gutter="10" class="mb-10">
<a-col :span="24" style="padding-left: 20px">
<a-input-search v-model:value="pluginSearch.keyword" placeholder="搜索插件" :allow-clear="true" :show-search="true"></a-input-search>
</a-col>
</a-row>
</template>
<div class="flex-col h-100 w-100 overflow-hidden">
<a-tabs v-model:active-key="pluginGroupActive" tab-position="left" class="flex-1 overflow-hidden">
<a-tab-pane v-for="group of computedPluginGroups" :key="group.key" :tab="group.title" class="scroll-y">
<a-row v-if="!group.plugins || group.plugins.length === 0" :gutter="10">
<a-col class="flex-o">
<div class="flex-o m-10">没有找到插件</div>
</a-col>
</a-row>
<a-row v-else :gutter="10">
<a-col v-for="item of group.plugins" :key="item.key" class="step-plugin" :span="12">
<a-card
hoverable
:class="{ current: item.name === currentStep.type }"
@click="stepTypeSelected(item)"
@dblclick="
stepTypeSelected(item);
stepTypeSave();
"
>
<a-card-meta>
<template #title>
<a-avatar :src="item.icon || '/images/plugin.png'" />
<span class="title">{{ item.title }}</span>
<vip-button v-if="item.needPlus" mode="icon" />
</template>
<template #description>
<span :title="item.desc">{{ item.desc }}</span>
</template>
</a-card-meta>
</a-card>
</a-col>
</a-row>
</a-tab-pane>
</a-tabs>
</div>
<template #footer>
<div style="padding: 20px; margin-left: 100px">
<a-button v-if="editMode" type="primary" @click="stepTypeSave"> 确定 </a-button>
</div>
</template>
</pi-container>
<pi-container v-else class="pi-step-form">
<a-form ref="stepFormRef" class="step-form" :model="currentStep" :label-col="labelCol" :wrapper-col="wrapperCol">
<template #header>
<div class="mb-10">
<a-alert type="info" :message="currentPlugin.title" :description="currentPlugin.desc"> </a-alert>
</div>
</template>
<a-form ref="stepFormRef" class="step-form" :model="currentStep" :label-col="labelCol" :wrapper-col="wrapperCol">
<fs-form-item
v-model="currentStep.title"
:item="{
@@ -66,9 +84,9 @@
</a-form>
<template #footer>
<a-form-item v-if="editMode" :wrapper-col="{ span: 14, offset: 4 }">
<div v-if="editMode" class="bottom-button">
<a-button type="primary" @click="stepSave"> 确定 </a-button>
</a-form-item>
</div>
</template>
</pi-container>
</template>
@@ -77,7 +95,7 @@
<script lang="tsx">
import { message, Modal } from "ant-design-vue";
import { computed, inject, Ref, ref } from "vue";
import { computed, inject, Ref, ref, watch } from "vue";
import _ from "lodash-es";
import { nanoid } from "nanoid";
import { CopyOutlined } from "@ant-design/icons-vue";
@@ -263,7 +281,45 @@ export default {
const blankFn = () => {
return {};
};
const pluginSearch = ref({
keyword: "",
result: []
});
const pluginGroupActive = ref("all");
const computedPluginGroups: any = computed(() => {
const groups = pluginGroups.groups;
if (pluginSearch.value.keyword) {
const keyword = pluginSearch.value.keyword.toLowerCase();
const list = groups.all.plugins.filter((plugin) => {
return (
plugin.title?.toLowerCase().includes(keyword) || plugin.desc?.toLowerCase().includes(keyword) || plugin.name?.toLowerCase().includes(keyword)
);
});
return {
search: { key: "search", title: "搜索结果", plugins: list }
};
} else {
return groups;
}
});
watch(
() => {
return pluginSearch.value.keyword;
},
(val: any) => {
if (val) {
pluginGroupActive.value = "search";
} else {
pluginGroupActive.value = "all";
}
}
);
return {
pluginGroupActive,
computedPluginGroups,
pluginSearch,
stepTypeSelected,
stepTypeSave,
pluginGroups,
@@ -321,8 +377,23 @@ export default {
<style lang="less">
.pi-step-form {
.bottom-button {
padding: 20px;
padding-bottom: 5px;
margin-left: 100px;
}
.body {
padding: 10px;
padding: 0px;
.ant-tabs-content {
height: 100%;
}
.ant-tabs-tabpane {
padding-right: 10px;
overflow-y: auto;
overflow-x: hidden;
}
.ant-card {
margin-bottom: 10px;

View File

@@ -3,6 +3,23 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.24.4](https://github.com/certd/certd/compare/v1.24.3...v1.24.4) (2024-09-09)
### Bug Fixes
* 修复腾讯云cdn证书部署后会自动关闭hstshttp2.0等配置的bug ([7908ab7](https://github.com/certd/certd/commit/7908ab79da624c94fa05849925b15e480e3317c4))
* 修复腾讯云tke证书部署报错的bug ([653f409](https://github.com/certd/certd/commit/653f409d91a441850d6381f89a8dd390831f0d5e))
### Performance Improvements
* 支持群晖 ([5c270b6](https://github.com/certd/certd/commit/5c270b6b9d45a2152f9fdb3c07bd98b7c803cb8e))
## [1.24.3](https://github.com/certd/certd/compare/v1.24.2...v1.24.3) (2024-09-06)
### Performance Improvements
* 支持多吉云cdn证书部署 ([65ef685](https://github.com/certd/certd/commit/65ef6857296784ca765926e09eafcb6fc8b6ecde))
## [1.24.2](https://github.com/certd/certd/compare/v1.24.1...v1.24.2) (2024-09-06)
### Bug Fixes

View File

@@ -1,6 +1,6 @@
{
"name": "@certd/ui-server",
"version": "1.24.2",
"version": "1.24.4",
"description": "fast-server base midway",
"private": true,
"type": "module",
@@ -21,13 +21,13 @@
"dependencies": {
"@alicloud/cs20151215": "^3.0.3",
"@alicloud/pop-core": "^1.7.10",
"@certd/acme-client": "^1.24.2",
"@certd/lib-huawei": "^1.24.2",
"@certd/lib-k8s": "^1.24.2",
"@certd/midway-flyway-js": "^1.22.6",
"@certd/pipeline": "^1.24.2",
"@certd/plugin-cert": "^1.24.2",
"@certd/plugin-plus": "^1.24.2",
"@certd/acme-client": "^1.24.4",
"@certd/lib-huawei": "^1.24.3",
"@certd/lib-k8s": "^1.24.4",
"@certd/midway-flyway-js": "^1.24.4",
"@certd/pipeline": "^1.24.4",
"@certd/plugin-cert": "^1.24.4",
"@certd/plugin-plus": "^1.24.4",
"@koa/cors": "^5.0.0",
"@midwayjs/bootstrap": "^3.16.2",
"@midwayjs/cache": "^3.14.0",
@@ -47,6 +47,7 @@
"cache-manager": "^3.6.3",
"cron-parser": "^4.9.0",
"dayjs": "^1.11.7",
"form-data": "^4.0.0",
"glob": "^10.4.5",
"https-proxy-agent": "^7.0.5",
"iconv-lite": "^0.6.3",
@@ -62,10 +63,12 @@
"nanoid": "^4.0.0",
"nodemailer": "^6.9.3",
"pg": "^8.12.0",
"querystring": "^0.2.1",
"reflect-metadata": "^0.1.13",
"ssh2": "^1.15.0",
"strip-ansi": "^7.1.0",
"svg-captcha": "^1.4.0",
"syno": "^2.2.0",
"tencentcloud-sdk-nodejs": "^4.0.44",
"typeorm": "^0.3.20"
},
@@ -77,7 +80,7 @@
"@types/koa": "2.13.4",
"@types/lodash-es": "^4.17.12",
"@types/mocha": "^10.0.1",
"@types/node": "16",
"@types/node": "^18",
"@types/nodemailer": "^6.4.8",
"@types/ssh2": "^1.15.0",
"c8": "^8.0.1",
@@ -89,7 +92,7 @@
"typescript": "~5.1.0"
},
"engines": {
"node": ">=16.0.0"
"node": ">=18.0.0"
},
"repository": {
"type": "git",

View File

@@ -7,3 +7,4 @@ export * from './plugin-huawei/index.js';
export * from './plugin-demo/index.js';
export * from './plugin-other/index.js';
export * from './plugin-west/index.js';
export * from './plugin-doge/index.js';

View File

@@ -0,0 +1,39 @@
import { IsAccess, AccessInput } from '@certd/pipeline';
/**
* 这个注解将注册一个授权配置
* 在certd的后台管理系统中用户可以选择添加此类型的授权
*/
@IsAccess({
name: 'dogecloud',
title: '多吉云',
desc: '',
})
export class DogeCloudAccess {
/**
* 授权属性配置
*/
@AccessInput({
title: 'AccessKey',
component: {
placeholder: 'AccessKey',
},
helper: '请前往[多吉云-密钥管理](https://console.dogecloud.com/user/keys)获取',
required: true,
encrypt: false,
})
accessKey = '';
@AccessInput({
title: 'SecretKey',
component: {
placeholder: 'SecretKey',
},
helper: '请前往[多吉云-密钥管理](https://console.dogecloud.com/user/keys)获取',
required: true,
encrypt: true,
})
secretKey = '';
}
new DogeCloudAccess();

View File

@@ -0,0 +1,3 @@
export * from './access.js';
export * from './lib/index.js';
export * from './plugins/index.js';

View File

@@ -0,0 +1,44 @@
import crypto from 'crypto';
import querystring from 'querystring';
import { DogeCloudAccess } from '../access.js';
import { HttpClient } from '@certd/pipeline';
export class DogeClient {
accessKey: string;
secretKey: string;
http: HttpClient;
constructor(access: DogeCloudAccess, http: HttpClient) {
this.accessKey = access.accessKey;
this.secretKey = access.secretKey;
this.http = http;
}
async request(apiPath: string, data: any = {}, jsonMode = false, ignoreResNullCode = false) {
// 这里替换为你的多吉云永久 AccessKey 和 SecretKey可在用户中心 - 密钥管理中查看
// 请勿在客户端暴露 AccessKey 和 SecretKey那样恶意用户将获得账号完全控制权
const body = jsonMode ? JSON.stringify(data) : querystring.encode(data);
const sign = crypto
.createHmac('sha1', this.secretKey)
.update(Buffer.from(apiPath + '\n' + body, 'utf8'))
.digest('hex');
const authorization = 'TOKEN ' + this.accessKey + ':' + sign;
const res: any = await this.http.request({
url: 'https://api.dogecloud.com' + apiPath,
method: 'POST',
data: body,
responseType: 'json',
headers: {
'Content-Type': jsonMode ? 'application/json' : 'application/x-www-form-urlencoded',
Authorization: authorization,
},
});
if (res.code == null && ignoreResNullCode) {
//ignore
} else if (res.code !== 200) {
throw new Error('API Error: ' + res.msg);
}
return res.data;
}
}

View File

@@ -0,0 +1,90 @@
import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput } from '@certd/pipeline';
import { CertInfo, CertReader } from '@certd/plugin-cert';
import { DogeClient } from '../../lib/index.js';
import dayjs from 'dayjs';
@IsTaskPlugin({
name: 'DogeCloudDeployToCDN',
title: '部署证书到多吉云CDN',
group: pluginGroups.cdn.key,
default: {
strategy: {
runStrategy: RunStrategy.SkipWhenSucceed,
},
},
})
export class DogeCloudDeployToCDNPlugin extends AbstractTaskPlugin {
@TaskInput({
title: '域名',
helper: 'CDN域名',
required: true,
})
domain!: string;
//证书选择,此项必须要有
@TaskInput({
title: '证书',
helper: '请选择前置任务输出的域名证书',
component: {
name: 'pi-output-selector',
from: 'CertApply',
},
required: true,
})
cert!: CertInfo;
//授权选择框
@TaskInput({
title: '多吉云授权',
helper: '多吉云AccessKey',
component: {
name: 'pi-access-selector',
type: 'dogecloud',
},
rules: [{ required: true, message: '此项必填' }],
})
accessId!: string;
@TaskInput({
title: '忽略部署接口报错',
helper: '当该域名部署后报错,但是实际上已经部署成功时,可以勾选',
value: false,
component: {
name: 'a-switch',
type: 'checked',
},
})
ignoreDeployNullCode = false;
dogeClient!: DogeClient;
async onInstance() {
const access = await this.accessService.getById(this.accessId);
this.dogeClient = new DogeClient(access, this.ctx.http);
}
async execute(): Promise<void> {
const certId: number = await this.updateCert();
await this.bindCert(certId);
}
async updateCert() {
const certReader = new CertReader(this.cert);
const data = await this.dogeClient.request('/cdn/cert/upload.json', {
note: 'certd-' + dayjs().format('YYYYMMDDHHmmss'),
cert: certReader.crt,
private: certReader.key,
});
return data.id;
}
async bindCert(certId: number) {
await this.dogeClient.request(
'/cdn/cert/bind.json',
{
id: certId,
domain: this.domain,
},
this.ignoreDeployNullCode
);
}
}
new DogeCloudDeployToCDNPlugin();

View File

@@ -0,0 +1 @@
export * from './deploy-to-cdn/index.js';

View File

@@ -93,20 +93,20 @@ export class DeployToCdnPlugin extends AbstractTaskPlugin {
buildParams() {
return {
Https: {
Switch: 'on',
CertInfo: {
Domain: this.domainName,
Route: 'Https.CertInfo',
Value: JSON.stringify({
update: {
Certificate: this.cert.crt,
PrivateKey: this.cert.key,
},
},
Domain: this.domainName,
}),
};
}
async doRequest(params: any) {
const client = await this.getClient();
const ret = await client.UpdateDomainConfig(params);
const ret = await client.ModifyDomainConfig(params);
this.checkRet(ret);
this.logger.info('设置腾讯云CDN证书成功:', ret.RequestId);
return ret.RequestId;

View File

@@ -6,7 +6,7 @@ import dayjs from 'dayjs';
name: 'DeployCertToTencentCLB',
title: '部署到腾讯云CLB',
group: pluginGroups.tencent.key,
desc: '暂时只支持单向认证证书,暂时只支持通用负载均衡',
desc: '暂时只支持单向认证证书,暂时只支持通用负载均衡必须开启sni',
default: {
strategy: {
runStrategy: RunStrategy.SkipWhenSucceed,
@@ -93,14 +93,13 @@ export class DeployToClbPlugin extends AbstractTaskPlugin {
accessId!: string;
client: any;
ClbClient: any;
async onInstance() {
this.client = await this.getClient();
}
async getClient() {
const sdk = await import('tencentcloud-sdk-nodejs/tencentcloud/services/clb/v20180317/index.js');
this.ClbClient = sdk.v20180317.Client;
const ClbClient = sdk.v20180317.Client;
const accessProvider = (await this.accessService.getById(this.accessId)) as TencentAccess;
@@ -118,7 +117,7 @@ export class DeployToClbPlugin extends AbstractTaskPlugin {
},
};
return new this.ClbClient(clientConfig);
return new ClbClient(clientConfig);
}
async execute(): Promise<void> {

View File

@@ -89,19 +89,16 @@ export class DeployCertToTencentTKEIngressPlugin extends AbstractTaskPlugin {
})
cert!: any;
TkeClient: any;
K8sClient: any;
async onInstance() {
// const TkeClient = this.tencentcloud.tke.v20180525.Client;
const sdk = await import('tencentcloud-sdk-nodejs/tencentcloud/services/tke/v20220501/index.js');
this.TkeClient = sdk.v20220501.Client;
const k8sSdk = await import('@certd/lib-k8s');
this.K8sClient = k8sSdk.K8sClient;
}
async execute(): Promise<void> {
const accessProvider = await this.accessService.getById(this.accessId);
const tkeClient = this.getTkeClient(accessProvider, this.region);
const tkeClient = await this.getTkeClient(accessProvider, this.region);
const kubeConfigStr = await this.getTkeKubeConfig(tkeClient, this.clusterId);
this.logger.info('kubeconfig已成功获取');
@@ -127,7 +124,9 @@ export class DeployCertToTencentTKEIngressPlugin extends AbstractTaskPlugin {
await this.restartIngress({ k8sClient });
}
getTkeClient(accessProvider: any, region = 'ap-guangzhou') {
async getTkeClient(accessProvider: any, region = 'ap-guangzhou') {
const sdk = await import('tencentcloud-sdk-nodejs/tencentcloud/services/tke/v20180525/index.js');
const TkeClient = sdk.v20180525.Client;
const clientConfig = {
credential: {
secretId: accessProvider.secretId,
@@ -141,7 +140,7 @@ export class DeployCertToTencentTKEIngressPlugin extends AbstractTaskPlugin {
},
};
return new this.TkeClient(clientConfig);
return new TkeClient(clientConfig);
}
async getTkeKubeConfig(client: any, clusterId: string) {

View File

@@ -2,7 +2,7 @@ import { utils } from '@certd/pipeline';
export async function request(config: any): Promise<any> {
try {
return await utils.http(config);
return await utils.http.request(config);
} catch (e) {
const data = e.data || e.response?.data;
if (data) {