def create_certificate(self, csr, issuer_options): # body, chain, external_id parsed_csr = parse_csr(csr) try: san = parsed_csr.extensions.get_extension_for_oid( ExtensionOID.SUBJECT_ALTERNATIVE_NAME) if san and san.value.get_values_for_type(x509.IPAddress): return IP_SAN_NO_CN_CERT_STR, INTERMEDIATE_CERT_STR, None except x509.ExtensionNotFound: pass return SAN_CERT_STR, INTERMEDIATE_CERT_STR, None
def __init__(self, **kwargs): self.csr = kwargs.get("csr") self.private_key = kwargs.get("private_key", "") if self.private_key: # If the request does not send private key, the key exists but the value is None self.private_key = self.private_key.strip() self.external_id = kwargs.get("external_id") # when destinations are appended they require a valid name. if kwargs.get("name"): self.name = get_or_increase_name(defaults.text_to_slug(kwargs["name"]), 0) self.rename = False else: # TODO: Fix auto-generated name, it should be renamed on creation self.name = get_or_increase_name( defaults.certificate_name( kwargs["common_name"], kwargs["authority"].name, dt.now(), dt.now(), False, ), self.external_id, ) self.rename = True self.cn = defaults.common_name(utils.parse_csr(self.csr)) self.owner = kwargs["owner"] self.number_attempts = 0 if kwargs.get("chain"): self.chain = kwargs["chain"].strip() self.notify = kwargs.get("notify", True) self.destinations = kwargs.get("destinations", []) self.notifications = kwargs.get("notifications", []) self.description = kwargs.get("description") self.roles = list(set(kwargs.get("roles", []))) self.replaces = kwargs.get("replaces", []) self.rotation = kwargs.get("rotation") self.rotation_policy = kwargs.get("rotation_policy") try: self.dns_provider_id = kwargs.get("dns_provider").id except (AttributeError, KeyError, TypeError, Exception): pass
def __init__(self, **kwargs): self.csr = kwargs.get('csr') self.private_key = kwargs.get('private_key', "") if self.private_key: # If the request does not send private key, the key exists but the value is None self.private_key = self.private_key.strip() self.external_id = kwargs.get('external_id') # when destinations are appended they require a valid name. if kwargs.get('name'): self.name = get_or_increase_name( defaults.text_to_slug(kwargs['name']), 0) self.rename = False else: # TODO: Fix auto-generated name, it should be renamed on creation self.name = get_or_increase_name( defaults.certificate_name(kwargs['common_name'], kwargs['authority'].name, dt.now(), dt.now(), False), self.external_id) self.rename = True self.cn = defaults.common_name(utils.parse_csr(self.csr)) self.owner = kwargs['owner'] self.number_attempts = 0 if kwargs.get('chain'): self.chain = kwargs['chain'].strip() self.notify = kwargs.get('notify', True) self.destinations = kwargs.get('destinations', []) self.notifications = kwargs.get('notifications', []) self.description = kwargs.get('description') self.roles = list(set(kwargs.get('roles', []))) self.replaces = kwargs.get('replaces', []) self.rotation = kwargs.get('rotation') self.rotation_policy = kwargs.get('rotation_policy') try: self.dns_provider_id = kwargs.get('dns_provider').id except (AttributeError, KeyError, TypeError, Exception): pass
def __init__(self, **kwargs): self.csr = kwargs.get('csr') self.private_key = kwargs.get('private_key', "") if self.private_key: # If the request does not send private key, the key exists but the value is None self.private_key = self.private_key.strip() self.external_id = kwargs.get('external_id') # when destinations are appended they require a valid name. if kwargs.get('name'): self.name = get_or_increase_name(defaults.text_to_slug(kwargs['name']), 0) self.rename = False else: # TODO: Fix auto-generated name, it should be renamed on creation self.name = get_or_increase_name( defaults.certificate_name(kwargs['common_name'], kwargs['authority'].name, dt.now(), dt.now(), False), self.external_id) self.rename = True self.cn = defaults.common_name(utils.parse_csr(self.csr)) self.owner = kwargs['owner'] self.number_attempts = 0 if kwargs.get('chain'): self.chain = kwargs['chain'].strip() self.notify = kwargs.get('notify', True) self.destinations = kwargs.get('destinations', []) self.notifications = kwargs.get('notifications', []) self.description = kwargs.get('description') self.roles = list(set(kwargs.get('roles', []))) self.replaces = kwargs.get('replaces', []) self.rotation = kwargs.get('rotation') self.rotation_policy = kwargs.get('rotation_policy') try: self.dns_provider_id = kwargs.get('dns_provider').id except (AttributeError, KeyError, TypeError, Exception): pass