|Specify path to config file|
bruteblock is a daemon, which checks ipfw2 table periodically and removes expired entries.
The following command line options are available for bruteblockd:
-t table Specify numer of ipfw2 table -s sleep Specify table check interval -p pidfile Specify location of the pid file -f Run the daemon in the foreground (do not daemonize) -h Display help
Such design allows to avoid any IPC use and to store entries for different services in one table. Also makes it is easy for the administrator to get list of currently blocked addresses and edit the list if needed so.
Configuration file for bruteblock utility allows you to set following values:
regexp regular expression in perl-compatible format that is used to extract failed password attempts from log files. max_count, within_time defines time interval and maximum number of failed password attempts during that interval. If the number is exceeded by specific IP, that IP is blocked. reset_ip time-to-live of table entry. When it expires, address is removed from the table, thus being unblocked. ipfw2_table_no number of ipfw2 table to add bad IPs to. Must match -t parameter of bruteblockd.
First, you need to establish log processing to determine attackers IPs and add them to ipfw2 table. Edit /etc/syslog.conf and add the following entry:auth.info;authpriv.info | exec /usr/local/sbin/bruteblock -f /usr/local/etc/bruteblock/ssh.conf
then restart syslogd.
Next, youll want to setup periodical cleanup of ipfw2 table. Add following lines to /etc/rc.conf:bruteblockd_enable="YES" bruteblockd_table="1" bruteblockd_flags="-s 5"
dont forget to change table number and sleep interval to match your needs.
Now launch bruteblockd: /usr/local/etc/rc.d/bruteblockd.sh start
Finally, setup your ipfw to block addresses contained in the table:ipfw add 100 deny ip from me to table\(1\) ipfw add 100 deny ip from table\(1\) to me
you may want to add these lines to you /etc/rc.firewall.
Bruteblock requires FreeBSD 5.3 and above (tested on FreeBSD 5.3, 5.4, 6.1) with ipfw2 firewall.
ipfw(8), rc.conf(5), syslog.conf(5)
.An Alex Samorukov Aq firstname.lastname@example.org , http://samm.kiev.ua/bruteblock/