Odoo Community vs Enterprise: Which Version Is Better for Your Business?
Compare the differences between Odoo Community and Enterprise versions. Check out our detailed guide to determine the best ERP solution for your business.
Blog
Knowledge
Systems running on Odoo infrastructure can sometimes face performance issues due to unauthorized scans and malicious bot activities. Particularly, inappropriate HTTPS requests directed to the HTTP port can cause errors in werkzeug logs on servers, leading to system slowdowns and restarts.
In this article, we share step by step a Fail2Ban configuration developed to automatically block unwanted requests on Odoo servers. With this lightweight, software-based, and effective method, system performance is improved while ensuring that log files remain more meaningful.
Fail2Ban detects erroneous attempts that match specific patterns by analyzing server logs and automatically blocks these IP addresses. Through this approach, the Odoo server gains proactive protection against the following threats:
As the first step, we need to install fail2ban to our system.
sudo apt update
sudo apt install fail2ban
The custom filter below detects common URL patterns targeted by bots:
sudo nano /etc/fail2ban/filter.d/nginx-odoo.conf
Content:
[Definition]
failregex = ^<HOST> -.*"(GET|POST).*(/login|/cgi-bin|/web/database/selector|/manage/account|/+CSCOE+|/doc/index.html|/robots.txt).*" (404|400|403)
ignoreregex =
For Fail2Ban to work according to this filter, the following structure is added to the jail.local file:
sudo nano /etc/fail2ban/jail.local
[nginx-odoo]
enabled = true
port = http,https
filter = nginx-odoo
logpath = /var/log/nginx/access.log
maxretry = 5
findtime = 600
bantime = 3600
By this config, IP is banned for 5 hours if 5 unsuccessful requests are present in the last 10 minutes.
sudo systemctl restart fail2ban
sudo fail2ban-client status nginx-odoo
The status of the config can be checked by the following Curl commands.
curl -k https://[domain]/cgi-bin/test
curl -k https://[domain]/+CSCOE+/logon.html
After a while from these requests, you can see that your IP address has been blocked and access has been cut off.
Thanks to the Fail2Ban configuration:
Morever, manual override to unban an IP address, the following command can be used:
sudo fail2ban-client unban <ip>
This configuration provided with Fail2Ban is one of the simplest yet most effective methods that can be applied to increase security and stability on Odoo servers. Especially in production environments, this measure is of critical importance to prevent unnecessary interventions and maintain log quality.
It should not be forgotten that this structure is not "set and forget"; it is a security layer that should be continuously active on every enterprise server.
Author
Volkan Akkurt
Odoo Expert
Yazar
Blog
Knowledge Base