]> git.ipfire.org Git - ipfire.org.git/commitdiff
Remove unused blacklist feature
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 8 Jun 2020 15:01:55 +0000 (15:01 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 8 Jun 2020 15:02:47 +0000 (15:02 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Makefile.am
src/backend/util.py
src/templates/static/blocked.html [deleted file]
src/web/__init__.py
src/web/base.py

index 63c51e1f6690560237a64a7e547b35a180913983..983bec65c083af21d171b97f77d5256f005fa6b6 100644 (file)
@@ -305,7 +305,6 @@ templates_people_modules_DATA = \
 templates_people_modulesdir = $(templates_peopledir)/modules
 
 templates_static_DATA = \
-       src/templates/static/blocked.html \
        src/templates/static/features.html \
        src/templates/static/legal.html \
        src/templates/static/support.html
index 99a9868a9fe1de8d09ca5253ba0ae29f9f4837f3..18bcbe3d9240a9463badfeace991c31d752692bd 100644 (file)
@@ -139,25 +139,6 @@ class Address(Object):
 
                return blacklists
 
-       async def is_blacklisted(self):
-               logging.debug("Checking if %s is blacklisted..." % self)
-
-               # Perform checks
-               blacklists = { bl : self._resolve_blacklist(bl) for bl in BLOCKLISTS }
-
-               # If we are blacklisted on one list, this one is screwed
-               for bl in blacklists:
-                       code, message = await blacklists[bl]
-
-                       logging.debug("Response from %s is: %s (%s)" % (bl, code, message))
-
-                       # Exclude matches on SBLCSS
-                       if bl == "sbl.spamhaus.org" and code == "127.0.0.3":
-                               continue
-
-                       # Consider the host blocked for any non-zero return code
-                       if code:
-                               return True
 
 def format_asn(asn):
        network = db.get_as(asn)
diff --git a/src/templates/static/blocked.html b/src/templates/static/blocked.html
deleted file mode 100644 (file)
index 22fcb5a..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-{% extends "../base.html" %}
-
-{% block title %}{{ _("You have been blocked") }}{% end block %}
-
-{% block container %}
-       <div class="container">
-               <div class="row justify-content-center mt-5">
-                       <div class="col-12 col-md-3 text-center">
-                               <span class="fas fa-shield-alt fa-10x p-5"></span>
-                       </div>
-
-                       <div class="col-12 col-md-5">
-                               <h5 class="mb-0">{{ _("Oops") }}</h5>
-                               <h1>{{ _("You have been blocked") }}</h1>
-
-                               <p>
-                                       {{ _("Your request has been blocked because your IP address is suspected to spread spam.") }}
-                               </p>
-
-                               <p>
-                                       <a href="https://location.ipfire.org/lookup/{{ address }}">
-                                               {{ _("Click here to find out more about the status of your IP address") }}
-                                       </a>
-                               </p>
-                       </div>
-               </div>
-       </div>
-{% end %}
-
-{% block footer %}{% end block %}
index f94d06cdd63709e83cf3aa37b5183d519512a8c0..53cb41c1e7be57941eecafdb99493558d208b494 100644 (file)
@@ -148,9 +148,6 @@ class Application(tornado.web.Application):
 
                        # Export arbitrary error pages
                        (r"/error/([45][0-9]{2})", base.ErrorHandler),
-
-                       # Block page
-                       (r"/blocked", base.BlockedHandler),
                ])
 
                # blog.ipfire.org
index 6b25ded18d99a417ed5a77623523ab6ad1e4d5ba..6c5031d80cf021c7b935ca4fd24ff88b22667584 100644 (file)
@@ -13,22 +13,6 @@ import tornado.web
 from ..decorators import *
 from .. import util
 
-def blacklisted(method):
-       @functools.wraps(method)
-       async def wrapper(self, *args, **kwargs):
-               # Check if remote is blacklisted
-               is_blacklisted = await self.remote.is_blacklisted()
-
-               # If so, redirect to the blocked page
-               if is_blacklisted:
-                       logging.warning("%s is blacklisted" % self.remote)
-
-                       return self.redirect("https://www.ipfire.org/blocked")
-
-               return method(self, *args, **kwargs)
-
-       return wrapper
-
 class ratelimit(object):
        def __init__(self, minutes=15, requests=180):
                self.minutes = minutes
@@ -257,11 +241,3 @@ class ErrorHandler(BaseHandler):
                        raise tornado.web.HTTPError(400)
 
                raise tornado.web.HTTPError(code)
-
-
-class BlockedHandler(BaseHandler):
-       def get(self):
-               # 403 - Forbidden
-               self.set_status(403)
-
-               self.render("static/blocked.html", address=self.get_remote_ip())