예제 #1
0
파일: lib.py 프로젝트: brucewu16899/modoboa
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
예제 #2
0
파일: lib.py 프로젝트: the-cc-dev/modoboa
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
예제 #3
0
파일: lib.py 프로젝트: brucewu16899/modoboa
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
예제 #4
0
파일: lib.py 프로젝트: brucewu16899/modoboa
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
예제 #5
0
파일: lib.py 프로젝트: the-cc-dev/modoboa
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
예제 #6
0
파일: lib.py 프로젝트: the-cc-dev/modoboa
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
예제 #7
0
파일: lib.py 프로젝트: brucewu16899/modoboa
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
예제 #8
0
파일: lib.py 프로젝트: the-cc-dev/modoboa
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
예제 #9
0
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')
예제 #10
0
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')
예제 #11
0
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')