coren has submitted this change and it was merged.

Change subject: dynamicproxy: Make blocked user agents configurable
......................................................................


dynamicproxy: Make blocked user agents configurable

Untested

Bug: T90844
Change-Id: Ia739e81e25873095f47751a57fb7abfd889b5f89
---
M modules/dynamicproxy/manifests/init.pp
M modules/dynamicproxy/templates/urlproxy.conf
2 files changed, 3 insertions(+), 3 deletions(-)

Approvals:
  coren: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/dynamicproxy/manifests/init.pp 
b/modules/dynamicproxy/manifests/init.pp
index 527f69d..9bbb30c 100644
--- a/modules/dynamicproxy/manifests/init.pp
+++ b/modules/dynamicproxy/manifests/init.pp
@@ -31,6 +31,7 @@
     $error_description    = "Our servers are currently experiencing a 
technical problem. This is probably temporary and should be fixed soon. Please 
try again later.",
     $error_details        = undef,
     $web_domain           = undef,
+    $blocked_user_agent_regex = "TweetmemeBot", # T73120 - misbehaving crawler
 ) {
     if $ssl_certificate_name != false and $ssl_settings == undef {
         fail('ssl_certificate_nme set but ssl_settings not set')
diff --git a/modules/dynamicproxy/templates/urlproxy.conf 
b/modules/dynamicproxy/templates/urlproxy.conf
index 7f99639..de69767 100644
--- a/modules/dynamicproxy/templates/urlproxy.conf
+++ b/modules/dynamicproxy/templates/urlproxy.conf
@@ -72,9 +72,8 @@
         return 403 "Requests must have a user agent";
     }
 
-    # Block crawlers that do not behave well
-    if ($http_user_agent ~* "TweetmemeBot") { # T73120
-        return 403;
+    if ($http_user_agent ~* "<% @blocked_user_agent_regex -%>") {
+        return 403 "Blocked user agent";
     }
 
     include uwsgi_params;

-- 
To view, visit https://gerrit.wikimedia.org/r/246125
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia739e81e25873095f47751a57fb7abfd889b5f89
Gerrit-PatchSet: 4
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Alex Monk <kren...@gmail.com>
Gerrit-Reviewer: Tim Landscheidt <t...@tim-landscheidt.de>
Gerrit-Reviewer: Yuvipanda <yuvipa...@wikimedia.org>
Gerrit-Reviewer: coren <mpellet...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to