Ejemplo n.º 1
0
def run(db, reporter):
    """
    Check that all A-records have a corresponding PTR record.

    Decide which domains to check depending on available SOA records.
    """

    checked_zones = set(generate_soa_domains(db))

    all_ok = True

    for rr in generate_records(db, 'SRV'):
        if not domain_in(rr.resolved_label, checked_zones):
            continue

        lookup = rr.resolved_target

        if not domain_in(lookup, checked_zones):
            continue

        if db.query(lookup, record=['A', 'NS', 'CNAME']):
            continue

        all_ok = False

        reporter.error(
            "Missing target [A, NS, CNAME]: {0}: ({1})".format(
                lookup, repr(rr)))

    return all_ok
Ejemplo n.º 2
0
def run(db, reporter):
    """
    Check all CNAMEs within the database that they actually point to something.

    Decide which domains to check depending on available SOA records.
    """

    all_ok = True

    checked_zones = set(generate_soa_domains(db))

    for rr in generate_records(db, 'CNAME'):
        if not domain_in(rr.resolved_target, checked_zones):
            continue

        lookup = rr.resolved_target

        if db.query(lookup, record=['A', 'NS', 'CNAME', 'PTR']):
            continue

        all_ok = False
        reporter.error(
            "Missing target [A, NS, CNAME, PTR]: {0} ({1})".format(
                lookup, repr(rr)))

    return all_ok