installing the digicert CIS plugin (#537)

This commit is contained in:
kevgliss 2016-11-29 10:02:40 -08:00 committed by GitHub
parent bfc80f982c
commit 3db3214cbe
4 changed files with 13 additions and 49 deletions

View File

@ -8,6 +8,8 @@
"""
from flask import current_app
from lemur.exceptions import InvalidConfiguration
# inspired by https://github.com/getsentry/sentry
class InstanceManager(object):
@ -58,8 +60,10 @@ class InstanceManager(object):
results.append(cls())
else:
results.append(cls)
except InvalidConfiguration as e:
current_app.logger.warning("Plugin '{0}' may not work correctly. {1}".format(class_name, e))
except Exception as e:
current_app.logger.exception('Unable to import %s. Reason: %s', cls_path, e)
current_app.logger.exception("Unable to import {0}. Reason: {1}".format(cls_path, e))
continue
self.cache = results

View File

@ -14,6 +14,8 @@ from cryptography.hazmat.backends import default_backend
from flask_restful.reqparse import RequestParser
from lemur.exceptions import InvalidConfiguration
paginated_parser = RequestParser()
paginated_parser.add_argument('count', type=int, default=10, location='args')
@ -61,6 +63,4 @@ def validate_conf(app, required_vars):
"""
for var in required_vars:
if not app.config.get(var):
raise Exception("Required variable {var} is not set, ensure that it is set in Lemur's configuration file".format(
var=var
))
raise InvalidConfiguration("Required variable '{var}' is not set in Lemur's conf.".format(var=var))

View File

@ -7,8 +7,8 @@ from flask import current_app
class LemurException(Exception):
def __init__(self):
current_app.logger.error(self)
def __init__(self, *args, **kwargs):
current_app.logger.exception(self)
class DuplicateError(LemurException):
@ -19,41 +19,11 @@ class DuplicateError(LemurException):
return repr("Duplicate found! Could not create: {0}".format(self.key))
class AuthenticationFailedException(LemurException):
def __init__(self, remote_ip, user_agent):
self.remote_ip = remote_ip
self.user_agent = user_agent
def __str__(self):
return repr("Failed login from: {} {}".format(self.remote_ip, self.user_agent))
class IntegrityError(LemurException):
def __init__(self, message):
self.message = message
def __str__(self):
return repr(self.message)
class AssociatedObjectNotFound(LemurException):
def __init__(self, message):
self.message = message
def __str__(self):
return repr(self.message)
class InvalidListener(LemurException):
def __str__(self):
return repr("Invalid listener, ensure you select a certificate if you are using a secure protocol")
class CertificateUnavailable(LemurException):
def __str__(self):
return repr("The certificate requested is not available")
class AttrNotFound(LemurException):
def __init__(self, field):
self.field = field
@ -62,16 +32,5 @@ class AttrNotFound(LemurException):
return repr("The field '{0}' is not sortable".format(self.field))
class NoPersistanceFound(Exception):
def __str__(self):
return repr("No peristence method found, Lemur cannot persist sensitive information")
class NoEncryptionKeyFound(Exception):
def __str__(self):
return repr("Aborting... Lemur cannot locate db encryption key, is ENCRYPTION_KEY set?")
class InvalidToken(Exception):
def __str__(self):
return repr("Invalid token")
class InvalidConfiguration(Exception):
pass

View File

@ -187,6 +187,7 @@ setup(
'cryptography_issuer = lemur.plugins.lemur_cryptography.plugin:CryptographyIssuerPlugin',
'cfssl_issuer = lemur.plugins.lemur_cfssl.plugin:CfsslIssuerPlugin',
'digicert_issuer = lemur.plugins.lemur_digicert.plugin:DigiCertIssuerPlugin',
'digicert_cis_issuer = lemur.plugins.lemur_digicert.plugin:DigiCertCISIssuerPlugin',
],
},
classifiers=[