Underscores should not be in hostnames (#728)

This commit is contained in:
kevgliss 2017-03-15 08:41:06 -07:00 committed by GitHub
parent d9f2faa462
commit b0ea027769
1 changed files with 37 additions and 31 deletions

View File

@ -12,6 +12,8 @@ from flask import current_app
from cryptography import x509 from cryptography import x509
from cryptography.hazmat.primitives.asymmetric import rsa from cryptography.hazmat.primitives.asymmetric import rsa
from idna.core import InvalidCodepoint
from sqlalchemy.orm import relationship from sqlalchemy.orm import relationship
from sqlalchemy.sql.expression import case from sqlalchemy.sql.expression import case
from sqlalchemy.ext.hybrid import hybrid_property from sqlalchemy.ext.hybrid import hybrid_property
@ -244,6 +246,8 @@ class Certificate(db.Model):
return_extensions = { return_extensions = {
'sub_alt_names': {'names': []} 'sub_alt_names': {'names': []}
} }
try:
cert = lemur.common.utils.parse_certificate(self.body) cert = lemur.common.utils.parse_certificate(self.body)
for extension in cert.extensions: for extension in cert.extensions:
value = extension.value value = extension.value
@ -286,6 +290,8 @@ class Certificate(db.Model):
# TODO: Not supporting custom OIDs yet. https://github.com/Netflix/lemur/issues/665 # TODO: Not supporting custom OIDs yet. https://github.com/Netflix/lemur/issues/665
else: else:
current_app.logger.warning('Custom OIDs not yet supported for clone operation.') current_app.logger.warning('Custom OIDs not yet supported for clone operation.')
except InvalidCodepoint as e:
current_app.logger.warning('Unable to parse extensions due to underscore in dns name')
return return_extensions return return_extensions