Merge pull request #3363 from hosseinsh/entrust-ratelimit-deactive

Entrust: respecting Entrust's rate limit
This commit is contained in:
Hossein Shafagh 2021-01-19 16:42:56 -08:00 committed by GitHub
commit 556e9fa70a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -11,6 +11,7 @@ from flask_principal import Identity, identity_changed
from flask_script import Manager from flask_script import Manager
from sqlalchemy import or_ from sqlalchemy import or_
from tabulate import tabulate from tabulate import tabulate
from time import sleep
from lemur import database from lemur import database
from lemur.authorities.models import Authority from lemur.authorities.models import Authority
@ -761,7 +762,10 @@ def deactivate_entrust_certificates():
certificates = get_all_valid_certs(['entrust-issuer']) certificates = get_all_valid_certs(['entrust-issuer'])
entrust_plugin = plugins.get('entrust-issuer') entrust_plugin = plugins.get('entrust-issuer')
for cert in certificates: for index, cert in enumerate(certificates):
if (index % 10) == 0:
# Entrust enforces a 10 request per 30s rate limit
sleep(30)
try: try:
response = entrust_plugin.deactivate_certificate(cert) response = entrust_plugin.deactivate_certificate(cert)
if response == 200: if response == 200: