mirror of
https://github.com/certd/certd.git
synced 2026-04-24 04:17:25 +08:00
chore: 1
This commit is contained in:
@@ -67,6 +67,16 @@ export class UploadCertToHostPlugin extends AbstractTaskPlugin {
|
||||
})
|
||||
derPath!: string;
|
||||
|
||||
@TaskInput({
|
||||
title: 'p12证书保存路径',
|
||||
helper: '需要有写入权限,路径要包含证书文件名,例如:/tmp/cert.p12',
|
||||
component: {
|
||||
placeholder: '/root/deploy/nginx/cert.p12',
|
||||
},
|
||||
rules: [{ type: 'filepath' }],
|
||||
})
|
||||
p12Path!: string;
|
||||
|
||||
@TaskInput({
|
||||
title: '域名证书',
|
||||
helper: '请选择前置任务输出的域名证书',
|
||||
@@ -147,6 +157,10 @@ export class UploadCertToHostPlugin extends AbstractTaskPlugin {
|
||||
title: 'DER保存路径',
|
||||
})
|
||||
hostDerPath!: string;
|
||||
@TaskOutput({
|
||||
title: 'P12保存路径',
|
||||
})
|
||||
hostP12Path!: string;
|
||||
|
||||
async onInstance() {}
|
||||
|
||||
@@ -167,7 +181,7 @@ export class UploadCertToHostPlugin extends AbstractTaskPlugin {
|
||||
const certReader = new CertReader(cert);
|
||||
|
||||
const handle = async (opts: CertReaderHandleContext) => {
|
||||
const { tmpCrtPath, tmpKeyPath, tmpDerPath, tmpPfxPath, tmpIcPath } = opts;
|
||||
const { tmpCrtPath, tmpKeyPath, tmpDerPath, tmpP12Path, tmpPfxPath, tmpIcPath } = opts;
|
||||
// if (this.copyToThisHost) {
|
||||
// this.logger.info('复制到目标路径');
|
||||
// this.copyFile(tmpCrtPath, crtPath);
|
||||
@@ -227,6 +241,13 @@ export class UploadCertToHostPlugin extends AbstractTaskPlugin {
|
||||
});
|
||||
this.logger.info(`上传DER证书到主机:${this.derPath}`);
|
||||
}
|
||||
if (this.p12Path) {
|
||||
transports.push({
|
||||
localPath: tmpP12Path,
|
||||
remotePath: this.p12Path,
|
||||
});
|
||||
this.logger.info(`上传p12证书到主机:${this.p12Path}`);
|
||||
}
|
||||
this.logger.info('开始上传文件到服务器');
|
||||
await sshClient.uploadFiles({
|
||||
connectConf,
|
||||
@@ -240,6 +261,7 @@ export class UploadCertToHostPlugin extends AbstractTaskPlugin {
|
||||
this.hostIcPath = this.icPath;
|
||||
this.hostPfxPath = this.pfxPath;
|
||||
this.hostDerPath = this.derPath;
|
||||
this.hostP12Path = this.p12Path;
|
||||
};
|
||||
|
||||
await certReader.readCertFile({
|
||||
|
||||
Reference in New Issue
Block a user