Merge branch 'master' into check-revoke-revised
This commit is contained in:
commit
5215a71a6d
|
@ -31,11 +31,11 @@ class DNSResolveError(DNSError):
|
||||||
|
|
||||||
def is_valid_domain(domain):
|
def is_valid_domain(domain):
|
||||||
"""Checks if a domain is syntactically valid and returns a bool"""
|
"""Checks if a domain is syntactically valid and returns a bool"""
|
||||||
if len(domain) > 253:
|
|
||||||
return False
|
|
||||||
if domain[-1] == ".":
|
if domain[-1] == ".":
|
||||||
domain = domain[:-1]
|
domain = domain[:-1]
|
||||||
fqdn_re = re.compile("(?=^.{1,254}$)(^(?:(?!\d+\.|-)[a-zA-Z0-9_\-]{1,63}(?<!-)\.?)+(?:[a-zA-Z]{2,})$)", re.IGNORECASE)
|
if len(domain) > 253:
|
||||||
|
return False
|
||||||
|
fqdn_re = re.compile("(?=^.{1,63}$)(^(?:[a-z0-9_](?:-*[a-z0-9_])+)$|^[a-z0-9]$)", re.IGNORECASE)
|
||||||
return all(fqdn_re.match(d) for d in domain.split("."))
|
return all(fqdn_re.match(d) for d in domain.split("."))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,9 +4,20 @@ from lemur.dns_providers import util as dnsutil
|
||||||
|
|
||||||
class TestDNSProvider(unittest.TestCase):
|
class TestDNSProvider(unittest.TestCase):
|
||||||
def test_is_valid_domain(self):
|
def test_is_valid_domain(self):
|
||||||
self.assertTrue(dnsutil.is_valid_domain("example.com"))
|
self.assertTrue(dnsutil.is_valid_domain('example.com'))
|
||||||
self.assertTrue(dnsutil.is_valid_domain("foo.bar.org"))
|
self.assertTrue(dnsutil.is_valid_domain('foo.bar.org'))
|
||||||
self.assertTrue(dnsutil.is_valid_domain("_acme-chall.example.com"))
|
self.assertTrue(dnsutil.is_valid_domain('exam--ple.io'))
|
||||||
self.assertFalse(dnsutil.is_valid_domain("e/xample.com"))
|
self.assertTrue(dnsutil.is_valid_domain('a.example.com'))
|
||||||
self.assertFalse(dnsutil.is_valid_domain("exam\ple.com"))
|
self.assertTrue(dnsutil.is_valid_domain('example.io'))
|
||||||
self.assertFalse(dnsutil.is_valid_domain("*.example.com"))
|
self.assertTrue(dnsutil.is_valid_domain('example-of-under-63-character-domain-label-length-limit-1234567.com'))
|
||||||
|
self.assertFalse(dnsutil.is_valid_domain('example-of-over-63-character-domain-label-length-limit-123456789.com'))
|
||||||
|
self.assertTrue(dnsutil.is_valid_domain('_acme-chall.example.com'))
|
||||||
|
self.assertFalse(dnsutil.is_valid_domain('e/xample.com'))
|
||||||
|
self.assertFalse(dnsutil.is_valid_domain('exam\ple.com'))
|
||||||
|
self.assertFalse(dnsutil.is_valid_domain('<example.com'))
|
||||||
|
self.assertFalse(dnsutil.is_valid_domain('*.example.com'))
|
||||||
|
self.assertFalse(dnsutil.is_valid_domain('-example.io'))
|
||||||
|
self.assertFalse(dnsutil.is_valid_domain('example-.io'))
|
||||||
|
self.assertFalse(dnsutil.is_valid_domain('example..io'))
|
||||||
|
self.assertFalse(dnsutil.is_valid_domain('exa mple.io'))
|
||||||
|
self.assertFalse(dnsutil.is_valid_domain('-'))
|
||||||
|
|
|
@ -16,8 +16,8 @@ babel==2.8.0 # via sphinx
|
||||||
bcrypt==3.1.7 # via -r requirements.txt, flask-bcrypt, paramiko
|
bcrypt==3.1.7 # via -r requirements.txt, flask-bcrypt, paramiko
|
||||||
billiard==3.6.3.0 # via -r requirements.txt, celery
|
billiard==3.6.3.0 # via -r requirements.txt, celery
|
||||||
blinker==1.4 # via -r requirements.txt, flask-mail, flask-principal, raven
|
blinker==1.4 # via -r requirements.txt, flask-mail, flask-principal, raven
|
||||||
boto3==1.13.18 # via -r requirements.txt
|
boto3==1.13.19 # via -r requirements.txt
|
||||||
botocore==1.16.18 # via -r requirements.txt, boto3, s3transfer
|
botocore==1.16.19 # via -r requirements.txt, boto3, s3transfer
|
||||||
celery[redis]==4.4.2 # via -r requirements.txt
|
celery[redis]==4.4.2 # via -r requirements.txt
|
||||||
certifi==2020.4.5.1 # via -r requirements.txt, requests
|
certifi==2020.4.5.1 # via -r requirements.txt, requests
|
||||||
certsrv==2.1.1 # via -r requirements.txt
|
certsrv==2.1.1 # via -r requirements.txt
|
||||||
|
@ -38,7 +38,7 @@ flask-principal==0.4.0 # via -r requirements.txt
|
||||||
flask-replicated==1.3 # via -r requirements.txt
|
flask-replicated==1.3 # via -r requirements.txt
|
||||||
flask-restful==0.3.8 # via -r requirements.txt
|
flask-restful==0.3.8 # via -r requirements.txt
|
||||||
flask-script==2.0.6 # via -r requirements.txt
|
flask-script==2.0.6 # via -r requirements.txt
|
||||||
flask-sqlalchemy==2.4.1 # via -r requirements.txt, flask-migrate
|
flask-sqlalchemy==2.4.3 # via -r requirements.txt, flask-migrate
|
||||||
flask==1.1.2 # via -r requirements.txt, flask-bcrypt, flask-cors, flask-mail, flask-migrate, flask-principal, flask-restful, flask-script, flask-sqlalchemy, raven
|
flask==1.1.2 # via -r requirements.txt, flask-bcrypt, flask-cors, flask-mail, flask-migrate, flask-principal, flask-restful, flask-script, flask-sqlalchemy, raven
|
||||||
future==0.18.2 # via -r requirements.txt, cloudflare
|
future==0.18.2 # via -r requirements.txt, cloudflare
|
||||||
gunicorn==20.0.4 # via -r requirements.txt
|
gunicorn==20.0.4 # via -r requirements.txt
|
||||||
|
@ -57,7 +57,7 @@ lockfile==0.12.2 # via -r requirements.txt
|
||||||
logmatic-python==0.1.7 # via -r requirements.txt
|
logmatic-python==0.1.7 # via -r requirements.txt
|
||||||
mako==1.1.2 # via -r requirements.txt, alembic
|
mako==1.1.2 # via -r requirements.txt, alembic
|
||||||
markupsafe==1.1.1 # via -r requirements.txt, jinja2, mako
|
markupsafe==1.1.1 # via -r requirements.txt, jinja2, mako
|
||||||
marshmallow-sqlalchemy==0.23.0 # via -r requirements.txt
|
marshmallow-sqlalchemy==0.23.1 # via -r requirements.txt
|
||||||
marshmallow==2.20.4 # via -r requirements.txt, marshmallow-sqlalchemy
|
marshmallow==2.20.4 # via -r requirements.txt, marshmallow-sqlalchemy
|
||||||
ndg-httpsclient==0.5.1 # via -r requirements.txt
|
ndg-httpsclient==0.5.1 # via -r requirements.txt
|
||||||
packaging==20.3 # via sphinx
|
packaging==20.3 # via sphinx
|
||||||
|
@ -90,7 +90,7 @@ s3transfer==0.3.3 # via -r requirements.txt, boto3
|
||||||
six==1.15.0 # via -r requirements.txt, acme, bcrypt, cryptography, flask-cors, flask-restful, hvac, josepy, jsonlines, packaging, pynacl, pyopenssl, python-dateutil, retrying, sphinxcontrib-httpdomain, sqlalchemy-utils
|
six==1.15.0 # via -r requirements.txt, acme, bcrypt, cryptography, flask-cors, flask-restful, hvac, josepy, jsonlines, packaging, pynacl, pyopenssl, python-dateutil, retrying, sphinxcontrib-httpdomain, sqlalchemy-utils
|
||||||
snowballstemmer==2.0.0 # via sphinx
|
snowballstemmer==2.0.0 # via sphinx
|
||||||
sphinx-rtd-theme==0.4.3 # via -r requirements-docs.in
|
sphinx-rtd-theme==0.4.3 # via -r requirements-docs.in
|
||||||
sphinx==3.0.3 # via -r requirements-docs.in, sphinx-rtd-theme, sphinxcontrib-httpdomain
|
sphinx==3.0.4 # via -r requirements-docs.in, sphinx-rtd-theme, sphinxcontrib-httpdomain
|
||||||
sphinxcontrib-applehelp==1.0.2 # via sphinx
|
sphinxcontrib-applehelp==1.0.2 # via sphinx
|
||||||
sphinxcontrib-devhelp==1.0.2 # via sphinx
|
sphinxcontrib-devhelp==1.0.2 # via sphinx
|
||||||
sphinxcontrib-htmlhelp==1.0.3 # via sphinx
|
sphinxcontrib-htmlhelp==1.0.3 # via sphinx
|
||||||
|
|
|
@ -10,9 +10,9 @@ aws-sam-translator==1.22.0 # via cfn-lint
|
||||||
aws-xray-sdk==2.5.0 # via moto
|
aws-xray-sdk==2.5.0 # via moto
|
||||||
bandit==1.6.2 # via -r requirements-tests.in
|
bandit==1.6.2 # via -r requirements-tests.in
|
||||||
black==19.10b0 # via -r requirements-tests.in
|
black==19.10b0 # via -r requirements-tests.in
|
||||||
boto3==1.13.18 # via aws-sam-translator, moto
|
boto3==1.13.19 # via aws-sam-translator, moto
|
||||||
boto==2.49.0 # via moto
|
boto==2.49.0 # via moto
|
||||||
botocore==1.16.18 # via aws-xray-sdk, boto3, moto, s3transfer
|
botocore==1.16.19 # via aws-xray-sdk, boto3, moto, s3transfer
|
||||||
certifi==2020.4.5.1 # via requests
|
certifi==2020.4.5.1 # via requests
|
||||||
cffi==1.14.0 # via cryptography
|
cffi==1.14.0 # via cryptography
|
||||||
cfn-lint==0.29.5 # via moto
|
cfn-lint==0.29.5 # via moto
|
||||||
|
|
|
@ -14,8 +14,8 @@ asyncpool==1.0 # via -r requirements.in
|
||||||
bcrypt==3.1.7 # via flask-bcrypt, paramiko
|
bcrypt==3.1.7 # via flask-bcrypt, paramiko
|
||||||
billiard==3.6.3.0 # via celery
|
billiard==3.6.3.0 # via celery
|
||||||
blinker==1.4 # via flask-mail, flask-principal, raven
|
blinker==1.4 # via flask-mail, flask-principal, raven
|
||||||
boto3==1.13.18 # via -r requirements.in
|
boto3==1.13.19 # via -r requirements.in
|
||||||
botocore==1.16.18 # via -r requirements.in, boto3, s3transfer
|
botocore==1.16.19 # via -r requirements.in, boto3, s3transfer
|
||||||
celery[redis]==4.4.2 # via -r requirements.in
|
celery[redis]==4.4.2 # via -r requirements.in
|
||||||
certifi==2020.4.5.1 # via -r requirements.in, requests
|
certifi==2020.4.5.1 # via -r requirements.in, requests
|
||||||
certsrv==2.1.1 # via -r requirements.in
|
certsrv==2.1.1 # via -r requirements.in
|
||||||
|
@ -36,7 +36,7 @@ flask-principal==0.4.0 # via -r requirements.in
|
||||||
flask-replicated==1.3 # via -r requirements.in
|
flask-replicated==1.3 # via -r requirements.in
|
||||||
flask-restful==0.3.8 # via -r requirements.in
|
flask-restful==0.3.8 # via -r requirements.in
|
||||||
flask-script==2.0.6 # via -r requirements.in
|
flask-script==2.0.6 # via -r requirements.in
|
||||||
flask-sqlalchemy==2.4.1 # via -r requirements.in, flask-migrate
|
flask-sqlalchemy==2.4.3 # via -r requirements.in, flask-migrate
|
||||||
flask==1.1.2 # via -r requirements.in, flask-bcrypt, flask-cors, flask-mail, flask-migrate, flask-principal, flask-restful, flask-script, flask-sqlalchemy, raven
|
flask==1.1.2 # via -r requirements.in, flask-bcrypt, flask-cors, flask-mail, flask-migrate, flask-principal, flask-restful, flask-script, flask-sqlalchemy, raven
|
||||||
future==0.18.2 # via -r requirements.in, cloudflare
|
future==0.18.2 # via -r requirements.in, cloudflare
|
||||||
gunicorn==20.0.4 # via -r requirements.in
|
gunicorn==20.0.4 # via -r requirements.in
|
||||||
|
@ -54,7 +54,7 @@ lockfile==0.12.2 # via -r requirements.in
|
||||||
logmatic-python==0.1.7 # via -r requirements.in
|
logmatic-python==0.1.7 # via -r requirements.in
|
||||||
mako==1.1.2 # via alembic
|
mako==1.1.2 # via alembic
|
||||||
markupsafe==1.1.1 # via jinja2, mako
|
markupsafe==1.1.1 # via jinja2, mako
|
||||||
marshmallow-sqlalchemy==0.23.0 # via -r requirements.in
|
marshmallow-sqlalchemy==0.23.1 # via -r requirements.in
|
||||||
marshmallow==2.20.4 # via -r requirements.in, marshmallow-sqlalchemy
|
marshmallow==2.20.4 # via -r requirements.in, marshmallow-sqlalchemy
|
||||||
ndg-httpsclient==0.5.1 # via -r requirements.in
|
ndg-httpsclient==0.5.1 # via -r requirements.in
|
||||||
paramiko==2.7.1 # via -r requirements.in
|
paramiko==2.7.1 # via -r requirements.in
|
||||||
|
|
Loading…
Reference in New Issue