mirror of
https://github.com/certd/certd.git
synced 2026-04-03 14:10:54 +08:00
fix: 修复阿里云dcdn使用上传到cas的id引用错误的bug
This commit is contained in:
@@ -316,6 +316,8 @@ export class AliyunDeployCertToALB extends AbstractTaskPlugin {
|
||||
certId = certIdRes.certId as any;
|
||||
}else if (casCert.certId){
|
||||
certId = casCert.certId;
|
||||
}else{
|
||||
throw new Error('证书格式错误'+JSON.stringify(this.cert));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -141,11 +141,13 @@ export class DeployCertToAliyunApig extends AbstractTaskPlugin {
|
||||
const casCert = this.cert as CasCertId;
|
||||
if (casCert.certId) {
|
||||
certId = casCert.certId;
|
||||
} else {
|
||||
} else if (certInfo.crt) {
|
||||
certId = await sslClient.uploadCert({
|
||||
name: this.buildCertName(CertReader.getMainDomain(certInfo.crt)),
|
||||
cert: certInfo,
|
||||
});
|
||||
}else{
|
||||
throw new Error('证书格式错误'+JSON.stringify(this.cert));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -117,13 +117,15 @@ export class DeployCertToAliyunCDN extends AbstractTaskPlugin {
|
||||
const casCert = this.cert as CasCertId;
|
||||
if (casCert.certId) {
|
||||
certId = casCert.certId;
|
||||
} else {
|
||||
} else if (certInfo.crt) {
|
||||
certName = this.buildCertName(CertReader.getMainDomain(certInfo.crt))
|
||||
const certIdRes = await sslClient.uploadCertificate({
|
||||
name:certName,
|
||||
cert: certInfo,
|
||||
});
|
||||
certId = certIdRes.certId as any;
|
||||
}else{
|
||||
throw new Error('证书格式错误'+JSON.stringify(this.cert));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -106,6 +106,7 @@ export class DeployCertToAliyunDCDN extends AbstractTaskPlugin {
|
||||
let certId: any = this.cert
|
||||
if (typeof this.cert === 'object') {
|
||||
const certInfo = this.cert as CertInfo;
|
||||
const casCertId = this.cert as CasCertId;
|
||||
if (certInfo.crt) {
|
||||
this.logger.info('上传证书:', CertName);
|
||||
const cert: any = this.cert;
|
||||
@@ -117,6 +118,10 @@ export class DeployCertToAliyunDCDN extends AbstractTaskPlugin {
|
||||
SSLPub: cert.crt,
|
||||
SSLPri: cert.key,
|
||||
};
|
||||
}else if (casCertId.certId){
|
||||
certId = casCertId.certId;
|
||||
}else{
|
||||
throw new Error('证书格式错误'+JSON.stringify(this.cert));
|
||||
}
|
||||
}
|
||||
this.logger.info('使用已上传的证书:', certId);
|
||||
|
||||
@@ -122,7 +122,7 @@ export class AliyunDeployCertToESA extends AbstractTaskPlugin {
|
||||
if (casCert.certId) {
|
||||
certId = casCert.certId;
|
||||
certName = casCert.certName;
|
||||
} else {
|
||||
} else if (certInfo.crt) {
|
||||
certName = this.buildCertName(CertReader.getMainDomain(certInfo.crt));
|
||||
|
||||
const certIdRes = await sslClient.uploadCertificate({
|
||||
@@ -131,6 +131,8 @@ export class AliyunDeployCertToESA extends AbstractTaskPlugin {
|
||||
});
|
||||
certId = certIdRes.certId as any;
|
||||
this.logger.info("上传证书成功", certId, certName);
|
||||
}else{
|
||||
throw new Error('证书格式错误'+JSON.stringify(this.cert));
|
||||
}
|
||||
}
|
||||
return {
|
||||
|
||||
@@ -175,7 +175,7 @@ export class DeployCertToAliyunOSS extends AbstractTaskPlugin {
|
||||
<PrivateKey>${certInfo.key}</PrivateKey>
|
||||
<Certificate>${certInfo.crt}</Certificate>
|
||||
`
|
||||
}else{
|
||||
}else {
|
||||
const casCert = this.cert as CasCertId;
|
||||
certStr = `<CertId>${casCert.certIdentifier}</CertId>`
|
||||
}
|
||||
|
||||
@@ -153,15 +153,17 @@ export class AliyunDeployCertToWaf extends AbstractTaskPlugin {
|
||||
});
|
||||
|
||||
const cert = this.cert as CertInfo;
|
||||
const casCert = this.cert as CasCertInfo;
|
||||
if (cert.crt) {
|
||||
const certIdRes = await sslClient.uploadCertificate({
|
||||
name: this.buildCertName(CertReader.getMainDomain(cert.crt)),
|
||||
cert: cert,
|
||||
});
|
||||
certId = certIdRes.certId as any;
|
||||
}else {
|
||||
const casCert = this.cert as CasCertInfo;
|
||||
} else if (casCert.certId) {
|
||||
certId = casCert.certId;
|
||||
} else {
|
||||
throw new Error('证书格式错误'+JSON.stringify(this.cert));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ export class UploadCertToAliyun extends AbstractTaskPlugin {
|
||||
let certName = ""
|
||||
if (this.name){
|
||||
certName = this.appendTimeSuffix(this.name)
|
||||
}else{
|
||||
}else {
|
||||
certName = this.buildCertName(CertReader.getMainDomain(this.cert.crt))
|
||||
}
|
||||
const certIdRes = await client.uploadCertificate({
|
||||
|
||||
Reference in New Issue
Block a user