summary refs log tree commit diff
path: root/synapse/config/repository.py
diff options
context:
space:
mode:
authorMatthew Hodgson <matthew@arasphere.net>2016-05-16 13:13:26 +0100
committerMatthew Hodgson <matthew@arasphere.net>2016-05-16 13:13:26 +0100
commit2d98c960ecfe50faae2eaedff45eebe8ba54cf6e (patch)
tree7f7cff56157068180daef95e1994af8d22f107d7 /synapse/config/repository.py
parentfix logo (diff)
parentClean up the blacklist/whitelist handling. (diff)
downloadsynapse-2d98c960ecfe50faae2eaedff45eebe8ba54cf6e.tar.xz
Merge pull request #760 from matrix-org/matthew/preview_url_ip_whitelist
add a url_preview_ip_range_whitelist config param
Diffstat (limited to 'synapse/config/repository.py')
-rw-r--r--synapse/config/repository.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/synapse/config/repository.py b/synapse/config/repository.py
index d61e525e62..8810079848 100644
--- a/synapse/config/repository.py
+++ b/synapse/config/repository.py
@@ -100,8 +100,13 @@ class ContentRepositoryConfig(Config):
                     "to work"
                 )
 
-            if "url_preview_url_blacklist" in config:
-                self.url_preview_url_blacklist = config["url_preview_url_blacklist"]
+            self.url_preview_ip_range_whitelist = IPSet(
+                config.get("url_preview_ip_range_whitelist", ())
+            )
+
+            self.url_preview_url_blacklist = config.get(
+                "url_preview_url_blacklist", ()
+            )
 
     def default_config(self, **kwargs):
         media_store = self.default_path("media_store")
@@ -162,6 +167,15 @@ class ContentRepositoryConfig(Config):
         # - '10.0.0.0/8'
         # - '172.16.0.0/12'
         # - '192.168.0.0/16'
+        #
+        # List of IP address CIDR ranges that the URL preview spider is allowed
+        # to access even if they are specified in url_preview_ip_range_blacklist.
+        # This is useful for specifying exceptions to wide-ranging blacklisted
+        # target IP ranges - e.g. for enabling URL previews for a specific private
+        # website only visible in your network.
+        #
+        # url_preview_ip_range_whitelist:
+        # - '192.168.1.1'
 
         # Optional list of URL matches that the URL preview spider is
         # denied from accessing.  You should use url_preview_ip_range_blacklist