mirror of https://github.com/certd/certd
chore:
parent
3220b87457
commit
bbb032344b
19
README.md
19
README.md
|
@ -70,13 +70,12 @@ https://certd.handsfree.work/
|
|||
|
||||
3. 安装完成后在应用商店中找到`certd`,点击安装,配置域名等基本信息即可完成安装
|
||||
|
||||
### 4.2 Docker部署
|
||||
### 4.2 Docker部署【推荐】
|
||||
#### 1. 安装docker、docker-compose
|
||||
|
||||
1.1 准备一台云服务器
|
||||
* 【阿里云】云服务器2核2G,新老用户同享,99元/年,续费同价!【 [立即购买](https://www.aliyun.com/benefit?scm=20140722.M_10244282._.V_1&source=5176.11533457&userCode=qya11txb )】
|
||||
* 【腾讯云】云服务器2核2G,新老用户同享,99元/年,续费同价!【 [立即购买](https://cloud.tencent.com/act/cps/redirect?redirect=6094&cps_key=b3ef73330335d7a6efa4a4bbeeb6b2c9&from=console)】
|
||||
|
||||
|
||||
1.2 安装docker
|
||||
|
||||
|
@ -110,7 +109,7 @@ docker compose up -d
|
|||
> 如果提示 没有compose命令,请安装docker-compose
|
||||
> https://docs.docker.com/compose/install/linux/
|
||||
|
||||
#### 镜像说明:
|
||||
#### 3. 镜像说明:
|
||||
* 国内镜像地址:
|
||||
* `registry.cn-shenzhen.aliyuncs.com/handsfree/certd:latest`
|
||||
* `registry.cn-shenzhen.aliyuncs.com/handsfree/certd:armv7`、`[version]-armv7`
|
||||
|
@ -124,13 +123,19 @@ docker compose up -d
|
|||
|
||||

|
||||
|
||||
#### 3. 访问
|
||||
#### 4. 访问测试
|
||||
|
||||
http://your_server_ip:7001
|
||||
默认账号密码:admin/123456
|
||||
记得修改密码
|
||||
|
||||
|
||||
### 4.3 源码部署
|
||||
```shell
|
||||
# 克隆代码
|
||||
git clone https://github.com/certd/certd
|
||||
cd certd
|
||||
./start.sh
|
||||
```
|
||||
|
||||
|
||||
## 五、 升级
|
||||
|
@ -223,11 +228,13 @@ https://afdian.com/a/greper
|
|||
|
||||
## 十一、贡献代码
|
||||
|
||||
1. [贡献插件教程](./plugin.md)
|
||||
1. 本地开发 [贡献插件教程](./dev/development.md)
|
||||
2. 作为贡献者,代表您同意您贡献的代码如下许可:
|
||||
1. 可以调整开源协议以使其更严格或更宽松。
|
||||
2. 可以用于商业用途。
|
||||
|
||||
|
||||
|
||||
## 十二、 开源许可
|
||||
* 本项目遵循 GNU Affero General Public License(AGPL)开源协议。
|
||||
* 允许个人和公司使用、复制、修改和分发本项目,禁止任何形式的商业用途
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# 贡献插件
|
||||
# 本地开发
|
||||
欢迎贡献插件
|
||||
|
||||
## 1.本地调试运行
|
||||
|
||||
|
@ -11,9 +12,6 @@ git clone https://github.com/certd/certd
|
|||
#进入项目目录
|
||||
cd certd
|
||||
|
||||
# 切换到最新的版本tag,v2分支可能不稳定
|
||||
checkout tags/vx.x.x # x.x.x为最新的版本号
|
||||
|
||||
# 安装依赖
|
||||
npm install -g pnpm@8.15.7
|
||||
pnpm install
|
|
@ -34,6 +34,15 @@ export class CopyCertToLocalPlugin extends AbstractTaskPlugin {
|
|||
})
|
||||
keyPath!: string;
|
||||
|
||||
@TaskInput({
|
||||
title: '中间证书保存路径',
|
||||
helper: '需要有写入权限,路径要包含私钥文件名,文件名不能用*?!等特殊符号,例如:/tmp/intermediate.crt',
|
||||
component: {
|
||||
placeholder: '/root/deploy/nginx/intermediate.crt',
|
||||
},
|
||||
})
|
||||
icPath!: string;
|
||||
|
||||
@TaskInput({
|
||||
title: 'PFX证书保存路径',
|
||||
helper: '用于IIS证书部署,路径要包含文件名,文件名不能用*?!等特殊符号\n推荐使用相对路径,将写入与数据库同级目录,无需映射,例如:./tmp/cert.pfx',
|
||||
|
@ -76,6 +85,12 @@ export class CopyCertToLocalPlugin extends AbstractTaskPlugin {
|
|||
})
|
||||
hostKeyPath!: string;
|
||||
|
||||
@TaskOutput({
|
||||
title: '中间证书保存路径',
|
||||
type: 'HostKeyPath',
|
||||
})
|
||||
hostIcPath!: string;
|
||||
|
||||
@TaskOutput({
|
||||
title: 'PFX保存路径',
|
||||
type: 'HostPfxPath',
|
||||
|
@ -99,7 +114,7 @@ export class CopyCertToLocalPlugin extends AbstractTaskPlugin {
|
|||
fs.copyFileSync(srcFile, destFile);
|
||||
}
|
||||
async execute(): Promise<void> {
|
||||
let { crtPath, keyPath, pfxPath, derPath } = this;
|
||||
let { crtPath, keyPath, icPath, pfxPath, derPath } = this;
|
||||
const certReader = new CertReader(this.cert);
|
||||
|
||||
const handle = async ({ reader, tmpCrtPath, tmpKeyPath, tmpDerPath, tmpPfxPath }) => {
|
||||
|
@ -114,6 +129,11 @@ export class CopyCertToLocalPlugin extends AbstractTaskPlugin {
|
|||
this.copyFile(tmpKeyPath, keyPath);
|
||||
this.hostKeyPath = keyPath;
|
||||
}
|
||||
if (icPath) {
|
||||
icPath = icPath.startsWith('/') ? icPath : path.join(Constants.dataDir, icPath);
|
||||
this.copyFile(tmpPfxPath, icPath);
|
||||
this.hostIcPath = icPath;
|
||||
}
|
||||
if (pfxPath) {
|
||||
pfxPath = pfxPath.startsWith('/') ? pfxPath : path.join(Constants.dataDir, pfxPath);
|
||||
this.copyFile(tmpPfxPath, pfxPath);
|
||||
|
|
|
@ -79,7 +79,7 @@ export class UploadCertToHostPlugin extends AbstractTaskPlugin {
|
|||
name: 'pi-access-selector',
|
||||
type: 'ssh',
|
||||
},
|
||||
rules: [{ required: false, message: '' }],
|
||||
required: true,
|
||||
})
|
||||
accessId!: string;
|
||||
|
||||
|
@ -106,18 +106,6 @@ export class UploadCertToHostPlugin extends AbstractTaskPlugin {
|
|||
})
|
||||
script!: string;
|
||||
|
||||
@TaskInput({
|
||||
title: '仅复制到当前主机',
|
||||
helper:
|
||||
'注意:本配置即将废弃\n' +
|
||||
'开启后,将直接复制到当前主机某个目录,不上传到主机,由于是docker启动,实际上是复制到docker容器内的“证书保存路径”\n' +
|
||||
'你需要事先在docker-compose.yaml中配置主机目录映射: volumes: /your_target_path:/your_target_path',
|
||||
value: false,
|
||||
component: {
|
||||
name: 'a-switch',
|
||||
vModel: 'checked',
|
||||
},
|
||||
})
|
||||
copyToThisHost!: boolean;
|
||||
|
||||
@TaskOutput({
|
||||
|
@ -168,68 +156,70 @@ export class UploadCertToHostPlugin extends AbstractTaskPlugin {
|
|||
const { tmpCrtPath, tmpKeyPath, tmpDerPath, tmpPfxPath, tmpIcPath } = opts;
|
||||
if (this.copyToThisHost) {
|
||||
this.logger.info('复制到目标路径');
|
||||
this.copyFile(tmpCrtPath, crtPath);
|
||||
this.copyFile(tmpKeyPath, keyPath);
|
||||
this.copyFile(tmpIcPath, this.icPath);
|
||||
this.copyFile(tmpPfxPath, this.pfxPath);
|
||||
this.copyFile(tmpDerPath, this.derPath);
|
||||
} else {
|
||||
if (!accessId) {
|
||||
throw new Error('主机登录授权配置不能为空');
|
||||
}
|
||||
this.logger.info('准备上传文件到服务器');
|
||||
|
||||
const transports: any = [];
|
||||
if (crtPath) {
|
||||
transports.push({
|
||||
localPath: tmpCrtPath,
|
||||
remotePath: crtPath,
|
||||
});
|
||||
this.logger.info(`上传证书到主机:${crtPath}`);
|
||||
}
|
||||
if (keyPath) {
|
||||
transports.push({
|
||||
localPath: tmpKeyPath,
|
||||
remotePath: keyPath,
|
||||
});
|
||||
this.logger.info(`上传私钥到主机:${keyPath}`);
|
||||
}
|
||||
if (this.icPath) {
|
||||
transports.push({
|
||||
localPath: tmpIcPath,
|
||||
remotePath: this.icPath,
|
||||
});
|
||||
this.logger.info(`上传中间证书到主机:${this.icPath}`);
|
||||
}
|
||||
if (this.pfxPath) {
|
||||
transports.push({
|
||||
localPath: tmpPfxPath,
|
||||
remotePath: this.pfxPath,
|
||||
});
|
||||
this.logger.info(`上传PFX证书到主机:${this.pfxPath}`);
|
||||
}
|
||||
if (this.derPath) {
|
||||
transports.push({
|
||||
localPath: tmpDerPath,
|
||||
remotePath: this.derPath,
|
||||
});
|
||||
this.logger.info(`上传DER证书到主机:${this.derPath}`);
|
||||
}
|
||||
this.logger.info('开始上传文件到服务器');
|
||||
await sshClient.uploadFiles({
|
||||
connectConf,
|
||||
transports,
|
||||
mkdirs: this.mkdirs,
|
||||
});
|
||||
this.logger.info('上传文件到服务器成功');
|
||||
//输出
|
||||
this.hostCrtPath = crtPath;
|
||||
this.hostKeyPath = keyPath;
|
||||
this.hostIcPath = this.icPath;
|
||||
this.hostPfxPath = this.pfxPath;
|
||||
this.hostDerPath = this.derPath;
|
||||
throw new Error('复制到当前主机功能已迁移到 “复制到本机”插件');
|
||||
// this.copyFile(tmpCrtPath, crtPath);
|
||||
// this.copyFile(tmpKeyPath, keyPath);
|
||||
// this.copyFile(tmpIcPath, this.icPath);
|
||||
// this.copyFile(tmpPfxPath, this.pfxPath);
|
||||
// this.copyFile(tmpDerPath, this.derPath);
|
||||
}
|
||||
|
||||
if (!accessId) {
|
||||
throw new Error('主机登录授权配置不能为空');
|
||||
}
|
||||
this.logger.info('准备上传文件到服务器');
|
||||
|
||||
const transports: any = [];
|
||||
if (crtPath) {
|
||||
transports.push({
|
||||
localPath: tmpCrtPath,
|
||||
remotePath: crtPath,
|
||||
});
|
||||
this.logger.info(`上传证书到主机:${crtPath}`);
|
||||
}
|
||||
if (keyPath) {
|
||||
transports.push({
|
||||
localPath: tmpKeyPath,
|
||||
remotePath: keyPath,
|
||||
});
|
||||
this.logger.info(`上传私钥到主机:${keyPath}`);
|
||||
}
|
||||
if (this.icPath) {
|
||||
transports.push({
|
||||
localPath: tmpIcPath,
|
||||
remotePath: this.icPath,
|
||||
});
|
||||
this.logger.info(`上传中间证书到主机:${this.icPath}`);
|
||||
}
|
||||
if (this.pfxPath) {
|
||||
transports.push({
|
||||
localPath: tmpPfxPath,
|
||||
remotePath: this.pfxPath,
|
||||
});
|
||||
this.logger.info(`上传PFX证书到主机:${this.pfxPath}`);
|
||||
}
|
||||
if (this.derPath) {
|
||||
transports.push({
|
||||
localPath: tmpDerPath,
|
||||
remotePath: this.derPath,
|
||||
});
|
||||
this.logger.info(`上传DER证书到主机:${this.derPath}`);
|
||||
}
|
||||
this.logger.info('开始上传文件到服务器');
|
||||
await sshClient.uploadFiles({
|
||||
connectConf,
|
||||
transports,
|
||||
mkdirs: this.mkdirs,
|
||||
});
|
||||
this.logger.info('上传文件到服务器成功');
|
||||
//输出
|
||||
this.hostCrtPath = crtPath;
|
||||
this.hostKeyPath = keyPath;
|
||||
this.hostIcPath = this.icPath;
|
||||
this.hostPfxPath = this.pfxPath;
|
||||
this.hostDerPath = this.derPath;
|
||||
};
|
||||
|
||||
await certReader.readCertFile({
|
||||
logger: this.logger,
|
||||
handle,
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
|
||||
echo "删除packages下除ui之外的其他目录"
|
||||
rm -rf packages/!(ui)
|
||||
|
||||
echo "安装pnpm 8.15.7, 前提是已经安装了nodejs"
|
||||
npm install -g pnpm@8.15.7
|
||||
echo "安装依赖"
|
||||
pnpm install
|
||||
|
||||
echo "开始构建"
|
||||
echo "构建certd-client"
|
||||
cd packages/ui/certd-client
|
||||
npm run build
|
||||
cp -r dist ../certd-server
|
||||
|
||||
echo "构建certd-server"
|
||||
cd ../certd-server
|
||||
npm run build
|
||||
echo "构建完成"
|
||||
echo "启动服务"
|
||||
npm run start
|
||||
|
||||
|
Loading…
Reference in New Issue