Skip to content

Instantly share code, notes, and snippets.

@kanibaspinar
Created June 13, 2016 09:20
Show Gist options
  • Save kanibaspinar/090a63674929dcea8c88787b19693c17 to your computer and use it in GitHub Desktop.
Save kanibaspinar/090a63674929dcea8c88787b19693c17 to your computer and use it in GitHub Desktop.
Prevention of new types of attacks at Layer 7 with nginx
# Back up the old files before editing #
if ($http_user_agent ~* (Trident*) ) {
return 444;
}
if ($http_user_agent ~* (-) ) {
return 444;
}
if ($http_user_agent ~* (Java) ) {
return 444;
}
if ($request_method !~ ^(GET|HEAD|POST)$ ) {
return 444;
}
if ($http_user_agent ~* (python-requests/2.9.1) ) {
return 444;
}
if ($http_user_agent ~* (Python-urllib/2.6) ) {
return 444;
}
# Comment the following 2 lines to make the Apache status page public
if ($http_user_agent ~* (WordPress*) ) {
return 444;
}
if ($http_user_agent ~* (-) ) {
return 444;
}
#Have A Nice Days , $Kbsp#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment