def get_dns_challenges()

in lemur/plugins/lemur_acme/acme_handlers.py [0:0]


    def get_dns_challenges(self, host, authorizations):
        """Get dns challenges for provided domain
            Also indicate if the hostname is already validated
        """

        domain_to_validate, is_wildcard = self.strip_wildcard(host)
        dns_challenges = []
        for authz in authorizations:
            if not authz.body.identifier.value.lower() == domain_to_validate.lower():
                continue
            if is_wildcard and not authz.body.wildcard:
                continue
            if not is_wildcard and authz.body.wildcard:
                continue
            # skip valid challenge, as long as this challenge is for the domain_to_validate
            if authz.body.status == STATUS_VALID:
                metrics.send("get_acme_challenges_already_valid", "counter", 1)
                log_data = {"message": "already validated, skipping", "hostname": authz.body.identifier.value}
                current_app.logger.info(log_data)
                return [], True

            for combo in authz.body.challenges:
                if isinstance(combo.chall, challenges.DNS01):
                    dns_challenges.append(combo)

        return dns_challenges, False