aboutsummaryrefslogtreecommitdiffstats
path: root/templates/ingress/nginx_snippet_ban.inc
diff options
context:
space:
mode:
authorJan Tuomi <jan@jantuomi.fi>2025-12-29 23:16:22 +0200
committerJan Tuomi <jan@jantuomi.fi>2025-12-29 23:16:22 +0200
commit533bc95c751337d5f2952252b0378848cf078357 (patch)
tree2bf4ccadc31baf02d2a586fe7357af99787265dc /templates/ingress/nginx_snippet_ban.inc
parent39feba1c79c1a0c2743932af35e157ba29d089d1 (diff)
Add crawler tarpit
Diffstat (limited to 'templates/ingress/nginx_snippet_ban.inc')
-rw-r--r--templates/ingress/nginx_snippet_ban.inc17
1 files changed, 17 insertions, 0 deletions
diff --git a/templates/ingress/nginx_snippet_ban.inc b/templates/ingress/nginx_snippet_ban.inc
new file mode 100644
index 0000000..029b965
--- /dev/null
+++ b/templates/ingress/nginx_snippet_ban.inc
@@ -0,0 +1,17 @@
+# Trap route
+location ^~ /wp-admin/ {
+ proxy_set_header X-IP $remote_addr;
+ proxy_method POST;
+ proxy_pass http://unix:/var/run/pfban/ban.sock:/ban;
+
+ proxy_connect_timeout 50ms;
+ proxy_send_timeout 50ms;
+ proxy_read_timeout 50ms;
+
+ # If the socket isn't up yet, still return something
+ error_page 500 502 503 504 = @ban_fallback;
+}
+
+location @ban_fallback {
+ return 204;
+}