mirror of
https://github.com/certd/certd.git
synced 2026-04-28 07:57:25 +08:00
Compare commits
3 Commits
02859cc270
...
d4653678b2
| Author | SHA1 | Date | |
|---|---|---|---|
| d4653678b2 | |||
| a4ce752e58 | |||
| f6649398ef |
@@ -155,10 +155,14 @@ export class AliyunDeployCertToALB extends AbstractTaskPlugin {
|
||||
const client = await this.getLBClient(access, this.regionId);
|
||||
await this.deployDefaultCert(certId, client);
|
||||
}
|
||||
|
||||
await this.ctx.utils.sleep(10000)
|
||||
this.logger.info(`准备开始清理过期证书`);
|
||||
await this.ctx.utils.sleep(20000)
|
||||
for (const listener of this.listeners) {
|
||||
await this.clearInvalidCert(albClientV2, listener);
|
||||
try{
|
||||
await this.clearInvalidCert(albClientV2, listener);
|
||||
}catch(e){
|
||||
this.logger.error(`清理监听器${listener}的过期证书失败`, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -236,6 +240,7 @@ export class AliyunDeployCertToALB extends AbstractTaskPlugin {
|
||||
|
||||
const certIds = [];
|
||||
for (const item of list) {
|
||||
this.logger.info(`监听器${listener}绑定的证书${item.CertificateId},status:${item.Status},IsDefault:${item.IsDefault}`);
|
||||
if (item.Status !== "Associated") {
|
||||
continue;
|
||||
}
|
||||
@@ -244,10 +249,12 @@ export class AliyunDeployCertToALB extends AbstractTaskPlugin {
|
||||
}
|
||||
certIds.push( parseInt(item.CertificateId));
|
||||
}
|
||||
this.logger.info(`监听器${listener}绑定的证书${certIds}`);
|
||||
//检查是否过期,过期则删除
|
||||
const invalidCertIds = [];
|
||||
for (const certId of certIds) {
|
||||
const res = await sslClient.getCertInfo(certId);
|
||||
this.logger.info(`证书${certId}过期时间:${res.notAfter}`);
|
||||
if (res.notAfter < new Date().getTime()) {
|
||||
invalidCertIds.push(certId);
|
||||
}
|
||||
@@ -256,7 +263,7 @@ export class AliyunDeployCertToALB extends AbstractTaskPlugin {
|
||||
this.logger.info(`监听器${listener}没有过期的证书`);
|
||||
return
|
||||
}
|
||||
this.logger.info(`开始解绑过期的证书:${invalidCertIds}`);
|
||||
this.logger.info(`开始解绑过期的证书:${invalidCertIds},listener:${listener}`);
|
||||
await client.doRequest({
|
||||
// 接口名称
|
||||
action: "DissociateAdditionalCertificatesFromListener",
|
||||
|
||||
@@ -152,9 +152,14 @@ export class AliyunDeployCertToNLB extends AbstractTaskPlugin {
|
||||
await this.deployDefaultCert(certId, client);
|
||||
}
|
||||
|
||||
await this.ctx.utils.sleep(10000)
|
||||
this.logger.info(`准备开始清理过期证书`);
|
||||
await this.ctx.utils.sleep(20000)
|
||||
for (const listener of this.listeners) {
|
||||
await this.clearInvalidCert(nlbClientV2, listener);
|
||||
try{
|
||||
await this.clearInvalidCert(nlbClientV2, listener);
|
||||
}catch(e){
|
||||
this.logger.error(`清理监听器${listener}的过期证书失败`, e);
|
||||
}
|
||||
}
|
||||
|
||||
this.logger.info('执行完成');
|
||||
@@ -232,6 +237,7 @@ export class AliyunDeployCertToNLB extends AbstractTaskPlugin {
|
||||
|
||||
const certIds = [];
|
||||
for (const item of list) {
|
||||
this.logger.info(`监听器${listener}绑定的证书${item.CertificateId},status:${item.Status},IsDefault:${item.IsDefault}`);
|
||||
if (item.Status !== "Associated") {
|
||||
continue;
|
||||
}
|
||||
@@ -240,10 +246,12 @@ export class AliyunDeployCertToNLB extends AbstractTaskPlugin {
|
||||
}
|
||||
certIds.push( parseInt(item.CertificateId));
|
||||
}
|
||||
this.logger.info(`监听器${listener}绑定的证书${certIds}`);
|
||||
//检查是否过期,过期则删除
|
||||
const invalidCertIds = [];
|
||||
for (const certId of certIds) {
|
||||
const res = await sslClient.getCertInfo(certId);
|
||||
this.logger.info(`证书${certId}过期时间:${res.notAfter}`);
|
||||
if (res.notAfter < new Date().getTime()) {
|
||||
invalidCertIds.push(certId);
|
||||
}
|
||||
@@ -252,7 +260,7 @@ export class AliyunDeployCertToNLB extends AbstractTaskPlugin {
|
||||
this.logger.info(`监听器${listener}没有过期的证书`);
|
||||
return
|
||||
}
|
||||
this.logger.info(`开始解绑过期的证书:${invalidCertIds}`);
|
||||
this.logger.info(`开始解绑过期的证书:${invalidCertIds},listener:${listener}`);
|
||||
|
||||
const ids:any = {}
|
||||
let i = 0
|
||||
|
||||
Reference in New Issue
Block a user