config/forms: allow blacklisting email servers by IP (#518)

Adds a new config entry (EMAIL_SERVER_BLACKLIST, tuple of IPv4 addresses
as strings) and an email validator for registering, which will query all
the MX records for the domain and reject the registration if any of the
A records for any of the MX records are found in the blacklist.
If the query fails, the blacklist is ignored; the email is accepted.
This commit is contained in:
Anna-Maria Meriniemi
2018-08-20 21:29:30 +03:00
committed by Arylide
parent 86b7eb7ccd
commit 8c892f09cc
3 changed files with 49 additions and 3 deletions

View File

@@ -59,6 +59,11 @@ EMAIL_BLACKLIST = (
re.compile(r'(?i)@(msn\.com|passport\.(com|net))'),
# '@dodgydomain.tk'
)
EMAIL_SERVER_BLACKLIST = (
# Bad mailserver IPs here (MX server.com -> A mail.server.com > 11.22.33.44)
# '1.2.3.4', '11.22.33.44'
)
# Recaptcha keys (https://www.google.com/recaptcha)