Skip to content

Commit

Permalink
registration email validation: make hardcoded stuff configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasWaldmann committed Oct 14, 2018
1 parent a248b93 commit e3acaa4
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 26 deletions.
29 changes: 3 additions & 26 deletions nsupdate/accounts/registration_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
logger = logging.getLogger(__name__)

from django import forms
from django.conf import settings
from django.utils.translation import ugettext_lazy as _

from registration.forms import RegistrationForm
Expand All @@ -18,34 +19,10 @@
resolver = dns.resolver.Resolver()
resolver.search = [dns.name.root, ]
resolver.lifetime = 5.0
resolver.nameservers = settings.NAMESERVERS

# TODO: this is nsupdate.info site specific:
# - we only have ipv6 (thus transform the v4 addrs to v6)
# - dnspython stumbles over our own scoped ipv6 nameserver ip (fe80::1%eth0,
# see https://github.com/rthalley/dnspython/issues/283 ), so we use google / cloudflare :-|
resolver.nameservers = ['64:ff9b::8.8.8.8', '64:ff9b::1.1.1.1', ]


# TODO: move to a file
# domains that have a non-working mx / that are frequently abused:
maildomain_blacklist = """
babau\.ga$
bezeqint\.net$
everytg\.ml$
flu\.cc$
goerieblog\.com$
igg\.biz$
lady-and-lunch\.xyz$
mailcatch\.com$
mailspam\.xyz$
napalm51\.gq$
nut\.cc$
pine-and-onyx\.xyz$
stars-and-glory\.top$
usa\.cc$
xoxy\.net$
"""
maildomain_blacklist = maildomain_blacklist.strip().splitlines()
maildomain_blacklist = settings.MAILDOMAIN_BLACKLIST.strip().splitlines()


def check_mx(domain):
Expand Down
26 changes: 26 additions & 0 deletions nsupdate/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,32 @@
from netaddr import IPSet, IPAddress, IPNetwork
BAD_IPS_HOST = IPSet([]) # inner list can have IPAddress and IPNetwork elements

# nameservers used e.g. for MX lookups in the registration email validation
# TODO: this is nsupdate.info site specific:
# - we only have ipv6 (thus transform the v4 addrs to v6)
# - dnspython stumbles over our own scoped ipv6 nameserver ip (fe80::1%eth0,
# see https://github.com/rthalley/dnspython/issues/283 ), so we use google / cloudflare :-|
NAMESERVERS = ['64:ff9b::8.8.8.8', '64:ff9b::1.1.1.1', ]

# domains that have a non-working mx / that are frequently abused:
MAILDOMAIN_BLACKLIST = """
babau\.ga$
bezeqint\.net$
everytg\.ml$
flu\.cc$
goerieblog\.com$
igg\.biz$
lady-and-lunch\.xyz$
mailcatch\.com$
mailspam\.xyz$
napalm51\.gq$
nut\.cc$
pine-and-onyx\.xyz$
stars-and-glory\.top$
usa\.cc$
xoxy\.net$
"""

# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
Expand Down

0 comments on commit e3acaa4

Please sign in to comment.