adding rate limit for Enturst
This commit is contained in:
parent
88e587af11
commit
f5cd7ecbd5
|
@ -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, start=1):
|
||||||
|
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:
|
||||||
|
|
Loading…
Reference in New Issue