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, 'A'):
        if not domain_in(rr.resolved_label, checked_zones):
            continue

        lookup = reversed_address(rr.address)

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

        all_ok = False

        reporter.error(
            "Missing reverse [PTR, 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