mirror of
https://github.com/certd/certd.git
synced 2026-04-27 23:37:29 +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;
|
certId = certIdRes.certId as any;
|
||||||
}else if (casCert.certId){
|
}else if (casCert.certId){
|
||||||
certId = 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;
|
const casCert = this.cert as CasCertId;
|
||||||
if (casCert.certId) {
|
if (casCert.certId) {
|
||||||
certId = casCert.certId;
|
certId = casCert.certId;
|
||||||
} else {
|
} else if (certInfo.crt) {
|
||||||
certId = await sslClient.uploadCert({
|
certId = await sslClient.uploadCert({
|
||||||
name: this.buildCertName(CertReader.getMainDomain(certInfo.crt)),
|
name: this.buildCertName(CertReader.getMainDomain(certInfo.crt)),
|
||||||
cert: certInfo,
|
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;
|
const casCert = this.cert as CasCertId;
|
||||||
if (casCert.certId) {
|
if (casCert.certId) {
|
||||||
certId = casCert.certId;
|
certId = casCert.certId;
|
||||||
} else {
|
} else if (certInfo.crt) {
|
||||||
certName = this.buildCertName(CertReader.getMainDomain(certInfo.crt))
|
certName = this.buildCertName(CertReader.getMainDomain(certInfo.crt))
|
||||||
const certIdRes = await sslClient.uploadCertificate({
|
const certIdRes = await sslClient.uploadCertificate({
|
||||||
name:certName,
|
name:certName,
|
||||||
cert: certInfo,
|
cert: certInfo,
|
||||||
});
|
});
|
||||||
certId = certIdRes.certId as any;
|
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
|
let certId: any = this.cert
|
||||||
if (typeof this.cert === 'object') {
|
if (typeof this.cert === 'object') {
|
||||||
const certInfo = this.cert as CertInfo;
|
const certInfo = this.cert as CertInfo;
|
||||||
|
const casCertId = this.cert as CasCertId;
|
||||||
if (certInfo.crt) {
|
if (certInfo.crt) {
|
||||||
this.logger.info('上传证书:', CertName);
|
this.logger.info('上传证书:', CertName);
|
||||||
const cert: any = this.cert;
|
const cert: any = this.cert;
|
||||||
@@ -117,6 +118,10 @@ export class DeployCertToAliyunDCDN extends AbstractTaskPlugin {
|
|||||||
SSLPub: cert.crt,
|
SSLPub: cert.crt,
|
||||||
SSLPri: cert.key,
|
SSLPri: cert.key,
|
||||||
};
|
};
|
||||||
|
}else if (casCertId.certId){
|
||||||
|
certId = casCertId.certId;
|
||||||
|
}else{
|
||||||
|
throw new Error('证书格式错误'+JSON.stringify(this.cert));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.logger.info('使用已上传的证书:', certId);
|
this.logger.info('使用已上传的证书:', certId);
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ export class AliyunDeployCertToESA extends AbstractTaskPlugin {
|
|||||||
if (casCert.certId) {
|
if (casCert.certId) {
|
||||||
certId = casCert.certId;
|
certId = casCert.certId;
|
||||||
certName = casCert.certName;
|
certName = casCert.certName;
|
||||||
} else {
|
} else if (certInfo.crt) {
|
||||||
certName = this.buildCertName(CertReader.getMainDomain(certInfo.crt));
|
certName = this.buildCertName(CertReader.getMainDomain(certInfo.crt));
|
||||||
|
|
||||||
const certIdRes = await sslClient.uploadCertificate({
|
const certIdRes = await sslClient.uploadCertificate({
|
||||||
@@ -131,6 +131,8 @@ export class AliyunDeployCertToESA extends AbstractTaskPlugin {
|
|||||||
});
|
});
|
||||||
certId = certIdRes.certId as any;
|
certId = certIdRes.certId as any;
|
||||||
this.logger.info("上传证书成功", certId, certName);
|
this.logger.info("上传证书成功", certId, certName);
|
||||||
|
}else{
|
||||||
|
throw new Error('证书格式错误'+JSON.stringify(this.cert));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ export class DeployCertToAliyunOSS extends AbstractTaskPlugin {
|
|||||||
<PrivateKey>${certInfo.key}</PrivateKey>
|
<PrivateKey>${certInfo.key}</PrivateKey>
|
||||||
<Certificate>${certInfo.crt}</Certificate>
|
<Certificate>${certInfo.crt}</Certificate>
|
||||||
`
|
`
|
||||||
}else{
|
}else {
|
||||||
const casCert = this.cert as CasCertId;
|
const casCert = this.cert as CasCertId;
|
||||||
certStr = `<CertId>${casCert.certIdentifier}</CertId>`
|
certStr = `<CertId>${casCert.certIdentifier}</CertId>`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -153,15 +153,17 @@ export class AliyunDeployCertToWaf extends AbstractTaskPlugin {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const cert = this.cert as CertInfo;
|
const cert = this.cert as CertInfo;
|
||||||
|
const casCert = this.cert as CasCertInfo;
|
||||||
if (cert.crt) {
|
if (cert.crt) {
|
||||||
const certIdRes = await sslClient.uploadCertificate({
|
const certIdRes = await sslClient.uploadCertificate({
|
||||||
name: this.buildCertName(CertReader.getMainDomain(cert.crt)),
|
name: this.buildCertName(CertReader.getMainDomain(cert.crt)),
|
||||||
cert: cert,
|
cert: cert,
|
||||||
});
|
});
|
||||||
certId = certIdRes.certId as any;
|
certId = certIdRes.certId as any;
|
||||||
}else {
|
} else if (casCert.certId) {
|
||||||
const casCert = this.cert as CasCertInfo;
|
|
||||||
certId = casCert.certId;
|
certId = casCert.certId;
|
||||||
|
} else {
|
||||||
|
throw new Error('证书格式错误'+JSON.stringify(this.cert));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ export class UploadCertToAliyun extends AbstractTaskPlugin {
|
|||||||
let certName = ""
|
let certName = ""
|
||||||
if (this.name){
|
if (this.name){
|
||||||
certName = this.appendTimeSuffix(this.name)
|
certName = this.appendTimeSuffix(this.name)
|
||||||
}else{
|
}else {
|
||||||
certName = this.buildCertName(CertReader.getMainDomain(this.cert.crt))
|
certName = this.buildCertName(CertReader.getMainDomain(this.cert.crt))
|
||||||
}
|
}
|
||||||
const certIdRes = await client.uploadCertificate({
|
const certIdRes = await client.uploadCertificate({
|
||||||
|
|||||||
Reference in New Issue
Block a user