Example #1
0
 def __init__(self):
     self.dns_providers_for_domain = {}
     try:
         self.all_dns_providers = dns_provider_service.get_all_dns_providers()
     except Exception as e:
         current_app.logger.error("Unable to fetch DNS Providers: {}".format(e))
         self.all_dns_providers = []
Example #2
0
def get_all_zones():
    """
    Retrieves all DNS providers from the database. Refreshes the zones associated with each DNS provider
    """
    print("[+] Starting dns provider zone lookup and configuration.")
    dns_providers = get_all_dns_providers()
    acme_dns_handler = AcmeDnsHandler()

    function = f"{__name__}.{sys._getframe().f_code.co_name}"
    log_data = {
        "function": function,
        "message": "",
    }

    for dns_provider in dns_providers:
        try:
            zones = acme_dns_handler.get_all_zones(dns_provider)
            set_domains(dns_provider, zones)
        except Exception as e:
            print("[+] Error with DNS Provider {}: {}".format(
                dns_provider.name, e))
            log_data[
                "message"] = f"get all zones failed for {dns_provider} {e}."
            capture_exception(extra=log_data)

    status = SUCCESS_METRIC_STATUS

    metrics.send("get_all_zones", "counter", 1, metric_tags={"status": status})
    print("[+] Done with dns provider zone lookup and configuration.")
Example #3
0
 def __init__(self):
     self.dns_providers_for_domain = {}
     try:
         self.all_dns_providers = dns_provider_service.get_all_dns_providers()
     except Exception as e:
         metrics.send("AcmeHandler_init_error", "counter", 1)
         sentry.captureException()
         current_app.logger.error(f"Unable to fetch DNS Providers: {e}")
         self.all_dns_providers = []
Example #4
0
 def __init__(self):
     self.dns_providers_for_domain = {}
     try:
         self.all_dns_providers = dns_provider_service.get_all_dns_providers(
         )
     except Exception as e:
         current_app.logger.error(
             "Unable to fetch DNS Providers: {}".format(e))
         self.all_dns_providers = []
Example #5
0
File: cli.py Project: Netflix/lemur
def get_all_zones():
    """
    Retrieves all DNS providers from the database. Refreshes the zones associated with each DNS provider
    """
    print("[+] Starting dns provider zone lookup and configuration.")
    dns_providers = get_all_dns_providers()
    acme_plugin = plugins.get("acme-issuer")

    for dns_provider in dns_providers:
        try:
            zones = acme_plugin.get_all_zones(dns_provider)
            set_domains(dns_provider, zones)
        except Exception as e:
            print("[+] Error with DNS Provider {}: {}".format(dns_provider.name, e))
            set_domains(dns_provider, [])

    status = SUCCESS_METRIC_STATUS

    metrics.send('get_all_zones', 'counter', 1, metric_tags={'status': status})
    print("[+] Done with dns provider zone lookup and configuration.")
Example #6
0
def get_all_zones():
    """
    Retrieves all DNS providers from the database. Refreshes the zones associated with each DNS provider
    """
    print("[+] Starting dns provider zone lookup and configuration.")
    dns_providers = get_all_dns_providers()
    acme_plugin = plugins.get("acme-issuer")

    for dns_provider in dns_providers:
        try:
            zones = acme_plugin.get_all_zones(dns_provider)
            set_domains(dns_provider, zones)
        except Exception as e:
            print("[+] Error with DNS Provider {}: {}".format(dns_provider.name, e))
            set_domains(dns_provider, [])

    status = SUCCESS_METRIC_STATUS

    metrics.send("get_all_zones", "counter", 1, metric_tags={"status": status})
    print("[+] Done with dns provider zone lookup and configuration.")
Example #7
0
 def __init__(self):
     self.dns_providers_for_domain = {}
     self.all_dns_providers = dns_provider_service.get_all_dns_providers()