Created
March 20, 2023 07:44
-
-
Save laztname/5cfa8e5a7072b9a3cf80282909a95bd9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
## Block user agents | |
set $block_user_agents 0; | |
# Common bandwidth hoggers and hacking tools. | |
if ($http_user_agent ~ "libwww-perl") { | |
set $block_user_agents 1; | |
} | |
if ($http_user_agent ~ "Go-http-client") { | |
set $block_user_agents 1; | |
} | |
if ($http_user_agent ~ "python-requests") { | |
set $block_user_agents 1; | |
} | |
if ($http_user_agent ~ "masscan") { | |
set $block_user_agents 1; | |
} | |
if ($http_user_agent ~ "masscan") { | |
set $block_user_agents 1; | |
} | |
if ($block_user_agents = 1) { | |
return 403; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment