@Ovi,
In response to your post and your statement
Do you still think its a good idea to move these 2 conf files in /etc/nginx/conf.d ?
I can suggest that you
1 - add a file in /etc/nginx with the name of (for example) bbb.conf,
2 - edit the contents of bbb.conf to contain
include /etc/nginx/bots.d/blockbots.conf
include /etc/nginx/bots.d/ddos.conf
and save the file,
3 - do a
nginx -t command, followd by a Nginx stop/start sequence.
Now, with respect to your other question
And if you don't mind me asking, how do you load malware blocklists in your nginx?
I must emphasize that we run a (huge) number of solutions in production environments to block bad traffic.
Nginx is just a simple part of that set of solutions, with Nginx being used to gather information and to block traffic at the proxy level.
To be honest, one of the most
simple,
efficient and
cost-effective solutions for a server is : Nginx +
custom Fail2Ban actions (+ 1 cronjob to reload Nginx config).
In essence, this (combined) solution uses (custom) Fail2Ban actions to :
- identify
offenders and block them for a short period of time via Nginx
deny directives,
- identify
repeat offenders and block them for a period of one year via Nginx
deny directives,
- identify
notorious offenders - read: bad IPs that return even after a ban period of one year - via
firewall rulesets,
and note that "identification" is simply based on log entries in various relevant log files.
The main advantages of this approach are that
- script based bypassing of Fail2Ban is less likely,
- false positives are not penalized to a too high degree,
- offenders are penalized according to the degree and/or persistence of offending traffic,
- offenders are permanently blocked via the firewall, only if there is a reason to do so :
the firewall is kept relatively clean
- attacks based on firewall overloads are less effective,
-
Nginx blocklists are both
dynamic and relatively
clean,
- Nginx can do what it can do best : handle a lot of request per second, including rejection of bad requests,
- Fail2Ban becomes less intrusive to server performance if the Nginx blocklists are getting bigger,
- Apache is not involved - with the exception of ModSecurity on the Apache level (as reliable input to identify offenders)
and there is two associated advantages that can be mentioned : (on the one hand) the entire setup is simple and can be easily copied across systems and (on the other hand) it seems to be the case that Nginx blocklists decrease in terms of numbers of offending IPs over time, which is a rather unexpected result.
Please note that there is a
close balance to be found between the various tools to use when trying to block bad traffic.
For instance, ModSecurity is not very reliable when used at the Nginx level (which also requires a custom Nginx binary or a commercial Nginx Plus license) and/or firewalls can become very big (and as such, firewalls ironically become part of the attack surface - firewall overloading is one way to hack a system) and/or Fail2Ban is not always very efficient (and it also using iptables/the firewall by default) and/or Nginx will start slowly in the case that a lot of config has to be loaded........ a complex interaction!
Simply stated, any overkill in the usage of one of the "tools" to fight bad traffic can make the entire system a bit more vulnerable.
To be honest, this is also the reason why I do not use the "Krogza" solution - it is
Krogzilla for any system : it is just including a whole lot of solutions to problems that often will not even occur on a Plesk system, hence making Nginx less effective than it could be - and that is not a good starting point.
Anyway, you can always send me a private message on this forum, if you want to continue this conversation - I suggest that you do so and that we keep this post "resolved".
Regards........