Blocking malicious User-agents using nginx:
- With the increase in users on Internet malicious activities are also increasing day by day.
- It's getting difficult to check each & every malicious activity everyday to secure our servers & data.
- One day I was checking
nginx access logs of & suddenly a user agent called “Jorgee ” startedhiting random APIs onnginx server.
After investigating about
I searched about more malicious user agents online & made a list so that I can block them in
Below is the sample configuration I have set in nginx.conf in server{} block:-
## Block common/malicious user agents ##
if ($http_user_agent ~* LWP::Simple|BBBike|wget|jorgee) {
return 403;
}
- Here ~* I have used for making list case insensitive.
These are the user agents I have blocked:
Whenever these user agents will try to hit
Testing:
curl -A jorgee 127.0.0.1
Hope this would help you in securing your servers.
More From Oodles
Ready to innovate? Let's get in touch
Cookies are important to the proper functioning of a site. To improve your experience, we use cookies to remember log-in details and provide secure log-in, collect statistics to optimize site functionality, and deliver content tailored to your interests. Click Agree and Proceed to accept cookies and go directly to the site or click on View Cookie Settings to see detailed descriptions of the types of cookies and choose whether to accept certain cookies while on the site.
About Author
Ankit Arora
Ankit is a Redhat Certified Engineer and Cloud Engineer.