From 37669b906cc25b2ed6b72ba0f1d7b409e5dde0a3 Mon Sep 17 00:00:00 2001 From: Kevin Glisson Date: Wed, 24 Jun 2015 16:51:44 -0700 Subject: [PATCH] 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. --- lemur/certificates/models.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lemur/certificates/models.py b/lemur/certificates/models.py index 81947bfc..1f7ffc0c 100644 --- a/lemur/certificates/models.py +++ b/lemur/certificates/models.py @@ -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))