Fixes an issue where the issuer has special chars in the name. AWS dislikes special chars in certificate names so we strip them out here. In general we want to have the name tracked by Lemur be the same as what is uploaded to various destinations.

This commit is contained in:
Kevin Glisson 2015-06-24 16:51:44 -07:00 committed by kevgliss
parent 39ad270dad
commit 37669b906c
1 changed files with 3 additions and 1 deletions

View File

@ -116,8 +116,10 @@ def cert_get_issuer(cert):
:param cert:
:return: Issuer
"""
delchars = ''.join(c for c in map(chr, range(256)) if not c.isalnum())
try:
return cert.subject.get_attributes_for_oid(x509.OID_ORGANIZATION_NAME)[0].value
issuer = str(cert.subject.get_attributes_for_oid(x509.OID_ORGANIZATION_NAME)[0].value)
return issuer.translate(None, delchars)
except Exception as e:
current_app.logger.error("Unable to get issuer! {0}".format(e))