def get_spf_record(domain): """Return SPF record for domain (if any).""" records = admin_lib.get_dns_records(domain, "TXT") if records is None: return None for record in records: value = str(record).strip('"') if value.startswith("v=spf1"): return value return None
def get_dmarc_record(domain): """Return DMARC record for domain (if any).""" name = "_dmarc.{}".format(domain) records = admin_lib.get_dns_records(name, "TXT") if records is None: return None for record in records: value = str(record).strip('"') if value.startswith("v=DMARC1"): return value return None
def get_dkim_record(domain, selector): """Return DKIM records form domain (if any).""" name = "{}._domainkey.{}".format(selector, domain) records = admin_lib.get_dns_records(name, "TXT") if records is None: return None for record in records: value = str(record).strip('"') if value.startswith("v=DKIM1"): return value return None
def _get_simple_record(name): """We just want to know if name is declared.""" for rdtype in ["A", "CNAME", "AAAA"]: records = admin_lib.get_dns_records(name, rdtype) if records is not None: break else: return None for record in records: value = str(record).strip('"') break return value
def get_dmarc_record(domain): """Return DMARC record for domain (if any).""" name = "_dmarc.{}".format(domain) records = admin_lib.get_dns_records(name, "TXT") return _get_record_type_value(records, 'DMARC1')
def get_dkim_record(domain, selector): """Return DKIM records form domain (if any).""" name = "{}._domainkey.{}".format(selector, domain) records = admin_lib.get_dns_records(name, "TXT") return _get_record_type_value(records, 'DKIM1')
def get_spf_record(domain): """Return SPF record for domain (if any).""" records = admin_lib.get_dns_records(domain, "TXT") return _get_record_type_value(records, 'spf1')