BFD (Brute Force Detection) is a tool that all VPS/Dedicated admins should use in their servers. Installation instructions are included in the Securing and Optimizing your server thread. Unfortunately the default rules are outdated, wrong and just not right for Jag's VPS/Dedicated servers.
I'm attaching a set of completely rewritten rules which are specific to Jag servers. First delete ALL the default rules (under /usr/local/bfd/rules by default) and unzip the attached archive in there.
apache-exploits - protects against apache and script exploits, scans and others.
apache - reads the correct log file and checks for login failures, works for all domains on the system
exim - checks for email rejections, too many from the same IP means its a spammer
imapd - checks for failed login attempts
pop3d - checks for failed login attempts
pure-ftpd - checks for failed login attempts
sshd - checks for various attacks, failed logins and broken requests
All these rules are fully tested, very efficient and independent from virtual domains. If there is a service you'd like to see included, please let me know. Its also possible to add more detections for the same service.
Comments/suggestions are welcome.
STEP 1 - Installation
Just download the attached file and unzip it inside your "rules" directory (/usr/local/bfd/rules/ by default). Overwrite all files. You may also delete all the files under your BFD tmp directory (/usr/local/bfd/tmp/ by default) so all counters are reset and your log files are re-read from the start.
STEP 2 - BFD configuration modification
The default configuration of BFD is also lacking support for Jag's servers. To be specific, it can't block IP addresses via iptables. The following is a simple change in the configuration (conf.bfd) that should make things work:
Search for:
BCMD="/etc/apf/apf -d $ATT_HOST {bfd.$MOD}"
Change to:
BCMD="/sbin/iptables -I INPUT -s $ATT_HOST -j DROP"
and...
Search for:
BCMD_FILE="/etc/apf/deny_hosts.rules"
Change to:
BCMD_FILE="$INSPATH/deny_hosts.rules"
STEP 3 - BFD exclude files
BFD uses a list of files which contain "safe" or "known" IP addresses. Any address listed in those files will not be blocked if its detected as an attacker. Unfortunately the default list is not good enough for Jag's servers.
Edit the file "exclude.files" (under /usr/local/bfd by default) and replace its contents with the following lines:
/etc/ipaddrpool
/etc/domainips
/etc/hosts.allow
/etc/hosts.deny
/usr/local/bfd/ignore.hosts
Change Log
5.0 - New "cpanel" module for cpanel logs, several new exploits
4.0 - Loads of new exploits, directadmin support for exim, Geoffrey's cyrus code, exim updates
3.0 - More 'apache-exploits', sshd fixes, lots of minor improvements
2.0 - Added 'apache-exploits', TMP path detection, more efficient scans.
1.0 - Initial release.


LinkBack URL
About LinkBacks



Reply With Quote



Bookmarks