Пример #1
0
    def validate_cname_record_value(self, default_record=False):
        value = str(self.values.get("value"))
        if default_record:
            test_value = value.replace("DOMAIN", "example.com")
        else:
            test_value = value

        if not ValidateDNS.record_hostname(test_value):
            raise RecordValueException("Invalid cname value: " + value)
Пример #2
0
    def validate_record_hostname(self, default_record=False):
        name = str(self.values.get("name"))
        if default_record:
            test_name = name.replace("DOMAIN", "example.com")
        else:
            test_name = name

        if not ValidateDNS.record_hostname(test_name):
            raise RecordValueException("Invalid name: " + name)
Пример #3
0
    def validate_cname_record_value(self, default_record=False):
        value = str(self.values.get("value"))
        if default_record:
            test_value = value.replace("DOMAIN", "example.com")
        else:
            test_value = value

        if not ValidateDNS.record_hostname(test_value):
            raise RecordValueException("Invalid cname value: " + value)
Пример #4
0
    def validate_record_hostname(self, default_record=False):
        name = str(self.values.get("name"))
        if default_record:
            test_name = name.replace("DOMAIN", "example.com")
        else:
            test_name = name

        if not ValidateDNS.record_hostname(test_name):
            raise RecordValueException("Invalid name: " + name)
Пример #5
0
    def validate(self, default_record=False):
        if not default_record:
            self.validate_domain_id()
        self.validate_record_hostname(default_record)

        value = str(self.values.get("value"))
        if ValidateIPAddress.ipv4(value):
            raise RecordValueException(
                "NS record names cannot be an IP address")

        if not ValidateDNS.record_hostname(value):
            raise RecordValueException("Invalid value for NS record: " + value)
Пример #6
0
    def validate(self, default_record=False):
        if not default_record:
            self.validate_domain_id()
        self.validate_record_hostname(default_record)

        value = str(self.values.get("value"))
        if ValidateIPAddress.ipv4(value):
            raise RecordValueException(
                "NS record names cannot be an IP address"
            )

        if not ValidateDNS.record_hostname(value):
            raise RecordValueException(
                "Invalid value for NS record: " + value
            )
Пример #7
0
    def validate(self, default_record=False):
        if not default_record:
            self.validate_domain_id()
        self.validate_record_hostname(default_record)
        flag = str(self.values.get("flag"))
        if not flag.isdigit():
            raise RecordValueException("Invalid CAA flag: " + flag)

        tag = str(self.values.get("tag"))
        tagval = str(self.values.get("tagval"))
        if tag == "issue" or tag == "issuewild":
            # verify either a domain or semi-colon
            if tagval == ';':
                pass
            elif not ValidateDNS.record_hostname(tagval):
                raise RecordValueException("Invalid CAA tag value for %s: %s" %
                                           (tag, tagval))
        elif tag == 'iodef':
            p = re.compile('^(https?|mailto):', re.IGNORECASE)
            if not p.match(tagval):
                raise RecordValueException("Invalid CAA tag value for %s: %s" %
                                           (tag, tagval))
        else:
            raise RecordValueException("Invalid CAA tag: " + tag)
Пример #8
0
    def validate(self):
        if self.status not in ["active", "inactive"]:
            raise ValueError("status must be either 'active' or 'inactive'")

        if not ValidateDNS.record_hostname(self.domain):
            raise ValueError("domain is invalid: " + self.domain)
Пример #9
0
    def validate(self):
        if self.status not in ["active", "inactive"]:
            raise ValueError("status must be either 'active' or 'inactive'")

        if not ValidateDNS.record_hostname(self.domain):
            raise ValueError("domain is invalid: " + self.domain)
Пример #10
0
 def record_hostname(self, name):
     return ValidateDNS.record_hostname(name)
Пример #11
0
 def record_hostname(self, name):
     return ValidateDNS.record_hostname(name)