chore: 暂时移除jks

pull/229/head
xiaojunnuo 2024-10-30 10:24:53 +08:00
parent b1cc6f2a9c
commit d35ad50254
5 changed files with 25 additions and 22 deletions

View File

@ -48,14 +48,15 @@ export abstract class CertApplyBasePlugin extends AbstractTaskPlugin {
email!: string; email!: string;
@TaskInput({ @TaskInput({
title: "证书密码", title: "PFX证书密码",
component: { component: {
name: "input-password", name: "input-password",
vModel: "value", vModel: "value",
}, },
required: false, required: false,
order: 100, order: 100,
helper: "PFX、jks格式证书是否加密jks必须设置密码不传则默认123456", // helper: "PFX、jks格式证书是否加密jks必须设置密码不传则默认123456",
helper: "PFX证书是否加密",
}) })
pfxPassword!: string; pfxPassword!: string;
@ -150,7 +151,7 @@ export abstract class CertApplyBasePlugin extends AbstractTaskPlugin {
} }
this._result.pipelinePrivateVars.cert = cert; this._result.pipelinePrivateVars.cert = cert;
if (cert.pfx == null || cert.der == null || cert.jks == null) { if (cert.pfx == null || cert.der == null) {
try { try {
const converter = new CertConverter({ logger: this.logger }); const converter = new CertConverter({ logger: this.logger });
const res = await converter.convert({ const res = await converter.convert({
@ -161,22 +162,24 @@ export abstract class CertApplyBasePlugin extends AbstractTaskPlugin {
const pfxBuffer = fs.readFileSync(res.pfxPath); const pfxBuffer = fs.readFileSync(res.pfxPath);
cert.pfx = pfxBuffer.toString("base64"); cert.pfx = pfxBuffer.toString("base64");
fs.unlinkSync(res.pfxPath); fs.unlinkSync(res.pfxPath);
isNew = true;
} }
if (res.derPath) { if (res.derPath) {
const derBuffer = fs.readFileSync(res.derPath); const derBuffer = fs.readFileSync(res.derPath);
cert.der = derBuffer.toString("base64"); cert.der = derBuffer.toString("base64");
fs.unlinkSync(res.derPath); fs.unlinkSync(res.derPath);
isNew = true;
} }
if (res.jksPath) { if (res.jksPath) {
const jksBuffer = fs.readFileSync(res.jksPath); const jksBuffer = fs.readFileSync(res.jksPath);
cert.jks = jksBuffer.toString("base64"); cert.jks = jksBuffer.toString("base64");
fs.unlinkSync(res.jksPath); fs.unlinkSync(res.jksPath);
isNew = true;
} }
this.logger.info("转换证书格式成功"); this.logger.info("转换证书格式成功");
isNew = true;
} catch (e) { } catch (e) {
this.logger.error("转换证书格式失败", e); this.logger.error("转换证书格式失败", e);
} }

View File

@ -30,7 +30,7 @@ export class CertConverter {
// 转der // 转der
derPath = await this.convertDer(ctx); derPath = await this.convertDer(ctx);
jksPath = await this.convertJks(ctx, pfxPath, opts.pfxPassword); // jksPath = await this.convertJks(ctx, pfxPath, opts.pfxPassword);
}; };
await certReader.readCertFile({ logger: this.logger, handle }); await certReader.readCertFile({ logger: this.logger, handle });

View File

@ -13,7 +13,7 @@ RUN cd /workspace/certd-server && pnpm install && npm run build-on-docker
FROM node:18-alpine FROM node:18-alpine
RUN apk add --no-cache openssl RUN apk add --no-cache openssl
RUN apk add --no-cache openjdk11 RUN #apk add --no-cache openjdk11-jdk
WORKDIR /app/ WORKDIR /app/
COPY --from=builder /workspace/certd-server/ /app/ COPY --from=builder /workspace/certd-server/ /app/
RUN chmod +x /app/tools/linux/* RUN chmod +x /app/tools/linux/*

View File

@ -67,14 +67,14 @@ export class CopyCertToLocalPlugin extends AbstractTaskPlugin {
}) })
derPath!: string; derPath!: string;
@TaskInput({ // @TaskInput({
title: 'jks证书保存路径', // title: 'jks证书保存路径',
helper: '用于java路径要包含文件名例如tmp/cert.jks', // helper: '用于java路径要包含文件名例如tmp/cert.jks',
component: { // component: {
placeholder: 'tmp/cert.jks', // placeholder: 'tmp/cert.jks',
}, // },
rules: [{ type: 'filepath' }], // rules: [{ type: 'filepath' }],
}) // })
jksPath!: string; jksPath!: string;
@TaskInput({ @TaskInput({

View File

@ -67,14 +67,14 @@ export class UploadCertToHostPlugin extends AbstractTaskPlugin {
}) })
derPath!: string; derPath!: string;
@TaskInput({ // @TaskInput({
title: 'jks证书保存路径', // title: 'jks证书保存路径',
helper: '需要有写入权限,路径要包含证书文件名,例如:/tmp/cert.jks', // helper: '需要有写入权限,路径要包含证书文件名,例如:/tmp/cert.jks',
component: { // component: {
placeholder: '/root/deploy/nginx/cert.jks', // placeholder: '/root/deploy/nginx/cert.jks',
}, // },
rules: [{ type: 'filepath' }], // rules: [{ type: 'filepath' }],
}) // })
jksPath!: string; jksPath!: string;
@TaskInput({ @TaskInput({