def __init__(self, *args, **kwargs): """Initialize source with appropriate details.""" required_vars = [ 'DIGICERT_CIS_API_KEY', 'DIGICERT_CIS_URL', 'DIGICERT_CIS_ROOT', 'DIGICERT_CIS_INTERMEDIATE', 'DIGICERT_CIS_PROFILE_NAME' ] validate_conf(current_app, required_vars) self.session = requests.Session() self.session.headers.update( { 'X-DC-DEVKEY': current_app.config['DIGICERT_CIS_API_KEY'], 'Content-Type': 'application/json' } ) self.session.hooks = dict(response=log_status_code) a = requests.adapters.HTTPAdapter(max_retries=3) self.session.mount('https://', a) super(DigiCertCISSourcePlugin, self).__init__(*args, **kwargs)
def __init__(self, *args, **kwargs): """Initialize the issuer with the appropriate details.""" required_vars = [ "ENTRUST_API_CERT", "ENTRUST_API_KEY", "ENTRUST_API_USER", "ENTRUST_API_PASS", "ENTRUST_URL", "ENTRUST_ROOT", "ENTRUST_NAME", "ENTRUST_EMAIL", "ENTRUST_PHONE", ] validate_conf(current_app, required_vars) self.session = requests.Session() cert_file = current_app.config.get("ENTRUST_API_CERT") key_file = current_app.config.get("ENTRUST_API_KEY") user = current_app.config.get("ENTRUST_API_USER") password = current_app.config.get("ENTRUST_API_PASS") self.session.cert = (cert_file, key_file) self.session.auth = (user, password) self.session.hooks = dict(response=log_status_code) # max_retries applies only to failed DNS lookups, socket connections and connection timeouts, # never to requests where data has made it to the server. # we Retry we also covers HTTP status code 500, 502, 503, 504 retry_strategy = Retry(total=3, backoff_factor=0.1, status_forcelist=[500, 502, 503, 504]) adapter = requests.adapters.HTTPAdapter(max_retries=retry_strategy) self.session.mount("https://", adapter) super(EntrustSourcePlugin, self).__init__(*args, **kwargs)
def __init__(self, *args, **kwargs): """Initialize source with appropriate details.""" required_vars = [ 'DIGICERT_CIS_API_KEY', 'DIGICERT_CIS_URL', 'DIGICERT_CIS_ROOT', 'DIGICERT_CIS_INTERMEDIATE', 'DIGICERT_CIS_PROFILE_NAME' ] validate_conf(current_app, required_vars) self.session = requests.Session() self.session.headers.update( { 'X-DC-DEVKEY': current_app.config['DIGICERT_CIS_API_KEY'], 'Content-Type': 'application/json' } ) self.session.hooks = dict(response=log_status_code) a = requests.adapters.HTTPAdapter(max_retries=3) self.session.mount('https://', a) super(DigiCertCISSourcePlugin, self).__init__(*args, **kwargs)
def __init__(self, *args, **kwargs): """Initialize the issuer with the appropriate details.""" required_vars = [ "ENTRUST_API_CERT", "ENTRUST_API_KEY", "ENTRUST_API_USER", "ENTRUST_API_PASS", "ENTRUST_URL", "ENTRUST_ROOT", "ENTRUST_NAME", "ENTRUST_EMAIL", "ENTRUST_PHONE", ] validate_conf(current_app, required_vars) self.session = requests.Session() cert_file = current_app.config.get("ENTRUST_API_CERT") key_file = current_app.config.get("ENTRUST_API_KEY") user = current_app.config.get("ENTRUST_API_USER") password = current_app.config.get("ENTRUST_API_PASS") self.session.cert = (cert_file, key_file) self.session.auth = (user, password) self.session.hooks = dict(response=log_status_code) # self.session.config['keep_alive'] = False super(EntrustIssuerPlugin, self).__init__(*args, **kwargs)
def configure_app(app, config=None): """ Different ways of configuration :param app: :param config: :return: """ # respect the config first if config and config != 'None': app.config.from_object(from_file(config)) else: try: app.config.from_envvar("LEMUR_CONF") except RuntimeError: # look in default paths if os.path.isfile(os.path.expanduser("~/.lemur/lemur.conf.py")): app.config.from_object( from_file(os.path.expanduser("~/.lemur/lemur.conf.py"))) else: app.config.from_object( from_file( os.path.join( os.path.dirname(os.path.realpath(__file__)), 'default.conf.py'))) validate_conf(app, REQUIRED_VARIABLES)
def __init__(self, *args, **kwargs): """Initialize the issuer with the appropriate details.""" required_vars = [ "DIGICERT_CIS_API_KEY", "DIGICERT_CIS_URL", "DIGICERT_CIS_ROOTS", "DIGICERT_CIS_PROFILE_NAMES", ] validate_conf(current_app, required_vars) self.session = requests.Session() self.session.headers.update({ "X-DC-DEVKEY": current_app.config["DIGICERT_CIS_API_KEY"], "Content-Type": "application/json", }) self.session.hooks = dict(response=log_status_code) # max_retries applies only to failed DNS lookups, socket connections and connection timeouts, # never to requests where data has made it to the server. # we Retry we also covers HTTP status code 406, 500, 502, 503, 504 retry_strategy = Retry(total=3, backoff_factor=0.1, status_forcelist=[406, 500, 502, 503, 504]) adapter = requests.adapters.HTTPAdapter(max_retries=retry_strategy) self.session.mount("https://", adapter) super(DigiCertCISIssuerPlugin, self).__init__(*args, **kwargs)
def _check_conf(): """ Verifies required configuration variables are set :return: """ utils.validate_conf(current_app, REQUIRED_VARIABLES)
def __init__(self, *args, **kwargs): required_vars = [ 'ACME_DIRECTORY_URL', 'ACME_TEL', 'ACME_EMAIL', 'ACME_AWS_ACCOUNT_NUMBER', 'ACME_ROOT' ] validate_conf(current_app, required_vars) super(ACMEIssuerPlugin, self).__init__(*args, **kwargs)
def _ldap_validate_conf(self): """ Confirms required ldap config settings exist. """ required_vars = [ 'LDAP_BIND_URI', 'LDAP_BASE_DN', 'LDAP_EMAIL_DOMAIN', ] validate_conf(current_app, required_vars)
def _ldap_validate_conf(self): """ Confirms required ldap config settings exist. """ required_vars = [ 'LDAP_BIND_URI', 'LDAP_BASE_DN', 'LDAP_EMAIL_DOMAIN', ] validate_conf(current_app, required_vars)
def __init__(self, *args, **kwargs): required_vars = [ 'ACME_DIRECTORY_URL', 'ACME_TEL', 'ACME_EMAIL', 'ACME_AWS_ACCOUNT_NUMBER', 'ACME_ROOT' ] validate_conf(current_app, required_vars) super(ACMEIssuerPlugin, self).__init__(*args, **kwargs)
def run(self, *args, **kwargs): from gunicorn.app.wsgiapp import WSGIApplication app = WSGIApplication() # run startup tasks on an app like object validate_conf(current_app, REQUIRED_VARIABLES) app.app_uri = 'lemur:create_app(config="{0}")'.format(current_app.config.get('CONFIG_PATH')) return app.run()
def run(self, *args, **kwargs): from gunicorn.app.wsgiapp import WSGIApplication app = WSGIApplication() # run startup tasks on an app like object validate_conf(current_app, REQUIRED_VARIABLES) app.app_uri = 'lemur:create_app(config="{0}")'.format(current_app.config.get('CONFIG_PATH')) return app.run()
def run(self, *args, **kwargs): from gunicorn.app.wsgiapp import WSGIApplication app = WSGIApplication() # run startup tasks on a app like object pre_app = create_app(kwargs.get('config')) validate_conf(pre_app, REQUIRED_VARIABLES) app.app_uri = 'lemur:create_app(config="{0}")'.format( kwargs.get('config')) return app.run()
def __init__(self, *args, **kwargs): required_vars = [ 'ACME_DIRECTORY_URL', 'ACME_TEL', 'ACME_EMAIL', 'ACME_AWS_ACCOUNT_NUMBER', 'ACME_ROOT' ] validate_conf(current_app, required_vars) self.dns_provider_name = current_app.config.get( 'ACME_DNS_PROVIDER', 'route53') current_app.logger.debug("Using DNS provider: {0}".format( self.dns_provider_name)) self.dns_provider = __import__(self.dns_provider_name, globals(), locals(), [], 1) super(ACMEIssuerPlugin, self).__init__(*args, **kwargs)
def run(self, *args, **kwargs): from gunicorn.app.wsgiapp import WSGIApplication app = WSGIApplication() # run startup tasks on an app like object validate_conf(current_app, REQUIRED_VARIABLES) app.app_uri = 'lemur:create_app(config_path="{0}")'.format( current_app.config.get("CONFIG_PATH")) log_config_dict = current_app.config.get("LOG_CONFIG_DICT") if log_config_dict: app.cfg.set("logconfig_dict", log_config_dict) return app.run()
def __init__(self, *args, **kwargs): """Initialize source with appropriate details.""" required_vars = [ 'DIGICERT_API_KEY', 'DIGICERT_URL', 'DIGICERT_ORG_ID', 'DIGICERT_ROOT', 'DIGICERT_INTERMEDIATE' ] validate_conf(current_app, required_vars) self.session = requests.Session() self.session.headers.update({ 'X-DC-DEVKEY': current_app.config['DIGICERT_API_KEY'], 'Content-Type': 'application/json' }) self.session.hooks = dict(response=log_status_code) super(DigiCertSourcePlugin, self).__init__(*args, **kwargs)
def __init__(self, *args, **kwargs): """Initialize source with appropriate details.""" required_vars = [ 'DIGICERT_API_KEY', 'DIGICERT_URL', 'DIGICERT_ORG_ID', 'DIGICERT_ROOT', ] validate_conf(current_app, required_vars) self.session = requests.Session() self.session.headers.update( { 'X-DC-DEVKEY': current_app.config['DIGICERT_API_KEY'], 'Content-Type': 'application/json' } ) self.session.hooks = dict(response=log_status_code) super(DigiCertSourcePlugin, self).__init__(*args, **kwargs)
def __init__(self, *args, **kwargs): """Initialize source with appropriate details.""" required_vars = [ "DIGICERT_API_KEY", "DIGICERT_URL", "DIGICERT_ORG_ID", "DIGICERT_ROOT", ] validate_conf(current_app, required_vars) self.session = requests.Session() self.session.headers.update({ "X-DC-DEVKEY": current_app.config["DIGICERT_API_KEY"], "Content-Type": "application/json", }) self.session.hooks = dict(response=log_status_code) super(DigiCertSourcePlugin, self).__init__(*args, **kwargs)
def __init__(self, *args, **kwargs): """Initialize the issuer with the appropriate details.""" required_vars = [ "DIGICERT_CIS_API_KEY", "DIGICERT_CIS_URL", "DIGICERT_CIS_ROOTS", "DIGICERT_CIS_PROFILE_NAMES", ] validate_conf(current_app, required_vars) self.session = requests.Session() self.session.headers.update({ "X-DC-DEVKEY": current_app.config["DIGICERT_CIS_API_KEY"], "Content-Type": "application/json", }) self.session.hooks = dict(response=log_status_code) super(DigiCertCISIssuerPlugin, self).__init__(*args, **kwargs)
def __init__(self, *args, **kwargs): """Initialize the issuer with the appropriate details.""" required_vars = [ 'DIGICERT_CIS_API_KEY', 'DIGICERT_CIS_URL', 'DIGICERT_CIS_ROOT', 'DIGICERT_CIS_INTERMEDIATE', 'DIGICERT_CIS_PROFILE_NAME' ] validate_conf(current_app, required_vars) self.session = requests.Session() self.session.headers.update( { 'X-DC-DEVKEY': current_app.config['DIGICERT_CIS_API_KEY'], 'Content-Type': 'application/json' } ) self.session.hooks = dict(response=log_status_code) super(DigiCertCISIssuerPlugin, self).__init__(*args, **kwargs)
def __init__(self, *args, **kwargs): """Initialize source with appropriate details.""" required_vars = [ "DIGICERT_CIS_API_KEY", "DIGICERT_CIS_URL", "DIGICERT_CIS_ROOTS", "DIGICERT_CIS_PROFILE_NAMES", ] validate_conf(current_app, required_vars) self.session = requests.Session() self.session.headers.update({ "X-DC-DEVKEY": current_app.config["DIGICERT_CIS_API_KEY"], "Content-Type": "application/json", }) self.session.hooks = dict(response=log_status_code) a = requests.adapters.HTTPAdapter(max_retries=3) self.session.mount("https://", a) super(DigiCertCISSourcePlugin, self).__init__(*args, **kwargs)
def _check_conf(): utils.validate_conf(current_app, REQUIRED_VARIABLES)