<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: FAQ</title>
	<atom:link href="http://danger.rulez.sk/index.php/bruteforceblocker/faq/feed/" rel="self" type="application/rss+xml" />
	<link>http://danger.rulez.sk</link>
	<description>Yet another FreeBSD committer's homepage</description>
	<lastBuildDate>Thu, 04 Mar 2010 06:41:34 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: danger</title>
		<link>http://danger.rulez.sk/index.php/bruteforceblocker/faq/comment-page-1/#comment-758</link>
		<dc:creator>danger</dc:creator>
		<pubDate>Tue, 17 Nov 2009 20:02:23 +0000</pubDate>
		<guid isPermaLink="false">http://danger.rulez.sk/?page_id=6#comment-758</guid>
		<description>People are used to just send me an email and I will handle it manually.
Please do so as well, stating which IP you would like to have to be removed.</description>
		<content:encoded><![CDATA[<p>People are used to just send me an email and I will handle it manually.<br />
Please do so as well, stating which IP you would like to have to be removed.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Macio</title>
		<link>http://danger.rulez.sk/index.php/bruteforceblocker/faq/comment-page-1/#comment-757</link>
		<dc:creator>Macio</dc:creator>
		<pubDate>Tue, 17 Nov 2009 14:31:04 +0000</pubDate>
		<guid isPermaLink="false">http://danger.rulez.sk/?page_id=6#comment-757</guid>
		<description>Hi

I was wondering is there was any way to be deleted from this Blist.
Or is there some timeout after your IP is deleted if you dont have a compromised computer anymore.</description>
		<content:encoded><![CDATA[<p>Hi</p>
<p>I was wondering is there was any way to be deleted from this Blist.<br />
Or is there some timeout after your IP is deleted if you dont have a compromised computer anymore.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: danger</title>
		<link>http://danger.rulez.sk/index.php/bruteforceblocker/faq/comment-page-1/#comment-751</link>
		<dc:creator>danger</dc:creator>
		<pubDate>Tue, 29 Sep 2009 08:24:51 +0000</pubDate>
		<guid isPermaLink="false">http://danger.rulez.sk/?page_id=6#comment-751</guid>
		<description>I believe you have already resolved it after our talk on IRC... ;)</description>
		<content:encoded><![CDATA[<p>I believe you have already resolved it after our talk on IRC&#8230; <img src='http://danger.rulez.sk/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andre</title>
		<link>http://danger.rulez.sk/index.php/bruteforceblocker/faq/comment-page-1/#comment-749</link>
		<dc:creator>Andre</dc:creator>
		<pubDate>Thu, 17 Sep 2009 00:57:50 +0000</pubDate>
		<guid isPermaLink="false">http://danger.rulez.sk/?page_id=6#comment-749</guid>
		<description>I recently installed this script and it works great but I came across a problem that I haven&#039;t been able to resolve.The IPs that are blocked aren’t removed in the time specified in the timeout variable. How often does the script check when a blocked IP has expired? I looked at the code it seems that it only gets checked if there is an attack in the process but if there isn’t an attack for a long time, the IP will remain blocked. Anyone have ideas on this?</description>
		<content:encoded><![CDATA[<p>I recently installed this script and it works great but I came across a problem that I haven&#8217;t been able to resolve.The IPs that are blocked aren’t removed in the time specified in the timeout variable. How often does the script check when a blocked IP has expired? I looked at the code it seems that it only gets checked if there is an attack in the process but if there isn’t an attack for a long time, the IP will remain blocked. Anyone have ideas on this?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cassidy</title>
		<link>http://danger.rulez.sk/index.php/bruteforceblocker/faq/comment-page-1/#comment-724</link>
		<dc:creator>Cassidy</dc:creator>
		<pubDate>Tue, 07 Apr 2009 05:23:55 +0000</pubDate>
		<guid isPermaLink="false">http://danger.rulez.sk/?page_id=6#comment-724</guid>
		<description>I went ahead and crafted a simple hack for CIDR based whitelist networks.

You need the following from CPAN:
Net::IP::Match::XS

Change lines from:
if (!grep { /$IP/ } @{$cfg-&gt;{whitelist}}) {

TO:
if (!match_ip( $IP, @{$cfg-&gt;{whitelist}})) {

It works well for me so far.

Thanks for a great solution!</description>
		<content:encoded><![CDATA[<p>I went ahead and crafted a simple hack for CIDR based whitelist networks.</p>
<p>You need the following from CPAN:<br />
Net::IP::Match::XS</p>
<p>Change lines from:<br />
if (!grep { /$IP/ } @{$cfg-&gt;{whitelist}}) {</p>
<p>TO:<br />
if (!match_ip( $IP, @{$cfg-&gt;{whitelist}})) {</p>
<p>It works well for me so far.</p>
<p>Thanks for a great solution!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Norbert</title>
		<link>http://danger.rulez.sk/index.php/bruteforceblocker/faq/comment-page-1/#comment-723</link>
		<dc:creator>Norbert</dc:creator>
		<pubDate>Thu, 26 Feb 2009 02:48:40 +0000</pubDate>
		<guid isPermaLink="false">http://danger.rulez.sk/?page_id=6#comment-723</guid>
		<description>Dear danger,
After long time I just entered your site again and I can see your reply - thanks ;-)

BTW, I successfully (8 months) use your script after I succeed adapting it to my needs. You are probably right with suggestion of blocking attackers like in the example above, but I don&#039;t have too much experience with PF and simply afraid some experiments on heavily loaded production server.

What I implemented is 100% transparent and is doing its task well.
Now I can notice only a few BAD attempts daily which is acceptable.

Below I&#039;d like to present my scripts, one might find them useful:

# cat /etc/periodic/hourly/bruteforce_blocker
#!/usr/local/bin/bash
echo&gt;/var/db/www-bruteforce
/etc/rc.d/pf reload
/etc/rc.d/syslogd reload


# cat /usr/local/sbin/apache_syslog
#!/usr/local/bin/perl
# script: apache-access-logger

use Sys::Syslog;
$SERVER_NAME = shift &#124;&#124; &#039;www&#039;;

$PRIORITY = &#039;info&#039;;
$FACILITY = &#039;local1&#039;;

Sys::Syslog::setlogsock(&#039;unix&#039;);
openlog ($SERVER_NAME,&#039;ndelay&#039;, $FACILITY);
while () {
    chomp;
    syslog($PRIORITY,$_);
}
closelog;


# cat /etc/syslog.conf &#124; grep local1
local1.*                                        /var/log/apache_syslog.log
local1.*                                        &#124;/usr/local/sbin/bruteforceblocker


in apache virtual host
In my apache virtual host conf I have:

SetEnvIf Request_URI “/scripts/scripts” brute_force
CustomLog “&#124;/usr/local/sbin/apache_syslog” combined env=brute_force
CustomLog “/var/log/domain/domain-bruteforce_log” combined env=brute_force

SetEnvIf Request_URI “/includes/includes” brute_force
CustomLog “&#124;/usr/local/sbin/apache_syslog” combined env=brute_force
CustomLog “/var/log/domain/domain-bruteforce_log” combined env=brute_force


my custom bruteforceblocker rules look like this:
        /.*www: ($work-&gt;{ipv4}&#124;$work-&gt;{ipv6}&#124;$work-&gt;{fqdn}).*/i &#124;&#124;
        /.*ftpd:.*@($work-&gt;{ipv4}).*uthentication fail.*/i

the second rule is for pureftpd

Best regards
Norbert</description>
		<content:encoded><![CDATA[<p>Dear danger,<br />
After long time I just entered your site again and I can see your reply &#8211; thanks <img src='http://danger.rulez.sk/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>BTW, I successfully (8 months) use your script after I succeed adapting it to my needs. You are probably right with suggestion of blocking attackers like in the example above, but I don&#8217;t have too much experience with PF and simply afraid some experiments on heavily loaded production server.</p>
<p>What I implemented is 100% transparent and is doing its task well.<br />
Now I can notice only a few BAD attempts daily which is acceptable.</p>
<p>Below I&#8217;d like to present my scripts, one might find them useful:</p>
<p># cat /etc/periodic/hourly/bruteforce_blocker<br />
#!/usr/local/bin/bash<br />
echo&gt;/var/db/www-bruteforce<br />
/etc/rc.d/pf reload<br />
/etc/rc.d/syslogd reload</p>
<p># cat /usr/local/sbin/apache_syslog<br />
#!/usr/local/bin/perl<br />
# script: apache-access-logger</p>
<p>use Sys::Syslog;<br />
$SERVER_NAME = shift || &#8216;www&#8217;;</p>
<p>$PRIORITY = &#8216;info&#8217;;<br />
$FACILITY = &#8216;local1&#8242;;</p>
<p>Sys::Syslog::setlogsock(&#8216;unix&#8217;);<br />
openlog ($SERVER_NAME,&#8217;ndelay&#8217;, $FACILITY);<br />
while () {<br />
    chomp;<br />
    syslog($PRIORITY,$_);<br />
}<br />
closelog;</p>
<p># cat /etc/syslog.conf | grep local1<br />
local1.*                                        /var/log/apache_syslog.log<br />
local1.*                                        |/usr/local/sbin/bruteforceblocker</p>
<p>in apache virtual host<br />
In my apache virtual host conf I have:</p>
<p>SetEnvIf Request_URI “/scripts/scripts” brute_force<br />
CustomLog “|/usr/local/sbin/apache_syslog” combined env=brute_force<br />
CustomLog “/var/log/domain/domain-bruteforce_log” combined env=brute_force</p>
<p>SetEnvIf Request_URI “/includes/includes” brute_force<br />
CustomLog “|/usr/local/sbin/apache_syslog” combined env=brute_force<br />
CustomLog “/var/log/domain/domain-bruteforce_log” combined env=brute_force</p>
<p>my custom bruteforceblocker rules look like this:<br />
        /.*www: ($work-&gt;{ipv4}|$work-&gt;{ipv6}|$work-&gt;{fqdn}).*/i ||<br />
        /.*ftpd:.*@($work-&gt;{ipv4}).*uthentication fail.*/i</p>
<p>the second rule is for pureftpd</p>
<p>Best regards<br />
Norbert</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: danger</title>
		<link>http://danger.rulez.sk/index.php/bruteforceblocker/faq/comment-page-1/#comment-694</link>
		<dc:creator>danger</dc:creator>
		<pubDate>Thu, 19 Jun 2008 05:55:51 +0000</pubDate>
		<guid isPermaLink="false">http://danger.rulez.sk/?page_id=6#comment-694</guid>
		<description>Dear Norbert,

thank you for using my script; however I don&#039;t think it&#039;s a wise idea to use my script for the task you are trying to accomplish. Much more convenient ways would be something like this:

table &lt;httpsuckers&gt; persist
block quick from &lt;httpsuckers&gt;

pass inet proto tcp from any to $localnet port {http, https} \
        flags S/SA keep state \
	(max-src-conn 100, max-src-conn-rate 15/5, \
         overload &lt;httpsuckers&gt; flush global)

together with security/expiretable port to remove old IPs from the table. I hope this helps to you.</description>
		<content:encoded><![CDATA[<p>Dear Norbert,</p>
<p>thank you for using my script; however I don&#8217;t think it&#8217;s a wise idea to use my script for the task you are trying to accomplish. Much more convenient ways would be something like this:</p>
<p>table <httpsuckers> persist<br />
block quick from </httpsuckers><httpsuckers></p>
<p>pass inet proto tcp from any to $localnet port {http, https} \<br />
        flags S/SA keep state \<br />
	(max-src-conn 100, max-src-conn-rate 15/5, \<br />
         overload </httpsuckers><httpsuckers> flush global)</p>
<p>together with security/expiretable port to remove old IPs from the table. I hope this helps to you.</httpsuckers></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Norbert</title>
		<link>http://danger.rulez.sk/index.php/bruteforceblocker/faq/comment-page-1/#comment-693</link>
		<dc:creator>Norbert</dc:creator>
		<pubDate>Thu, 19 Jun 2008 00:30:31 +0000</pubDate>
		<guid isPermaLink="false">http://danger.rulez.sk/?page_id=6#comment-693</guid>
		<description>Thank you for your great script !!!
I have adapted it to block some http requests. I was qurious why my server is so havily loaded and then I realized that I have a lot of requests similar to http://domain.name.com/index.php/includes/includes/scripts/scripts.

I decided to use your scripts to disconnect &quot;crackers&quot; from my server. Although disconnecting is working fine, the time limit doesn&#039;t work and I don;t know why.

Will you find some time helping me.
Below you can find my files, I am running FreeBSD 6.2

In my apache virtual host I have:

SetEnvIf Request_URI &quot;/scripts/scripts&quot; brute_force
CustomLog &quot;&#124;/usr/local/sbin/apache_syslog&quot; combined env=brute_force
CustomLog &quot;/var/log/domain/domain-bruteforce_log&quot; combined env=brute_force

SetEnvIf Request_URI &quot;/includes/includes&quot; brute_force
CustomLog &quot;&#124;/usr/local/sbin/apache_syslog&quot; combined env=brute_force
CustomLog &quot;/var/log/domain/domain-bruteforce_log&quot; combined env=brute_force


in syslog.conf

local1.*                                        &#124;/usr/local/sbin/bruteforceblock
er
local1.*                                        /var/log/apache_syslog.log


in apache_syslog:
#!/usr/local/bin/perl
# script: apache-access-logger

use Sys::Syslog;
$SERVER_NAME = shift &#124;&#124; &#039;www&#039;;

$PRIORITY = &#039;info&#039;;
$FACILITY = &#039;local1&#039;;

Sys::Syslog::setlogsock(&#039;unix&#039;);
openlog ($SERVER_NAME,&#039;ndelay&#039;, $FACILITY);
while () {
    chomp;
    syslog($PRIORITY,$_);
}
closelog;


and extra rule in your script
# the core process

while () {
    if (/.*Failed password.*from ($work-&gt;{ipv4}&#124;$work-&gt;{ipv6}&#124;$work-&gt;{fqdn}) por
t.*/i &#124;&#124;
        /.*Invalid user.*from ($work-&gt;{ipv4}&#124;$work-&gt;{ipv6}&#124;$work-&gt;{fqdn})$/i &#124;&#124;
        /.*Did not receive identification string from ($work-&gt;{ipv4}&#124;$work-&gt;{ipv
6}&#124;$work-&gt;{fqdn})$/i &#124;&#124;
        /.*Bad protocol version identification .* from ($work-&gt;{ipv4}&#124;$work-&gt;{ip
v6}&#124;$work-&gt;{fqdn})$/i &#124;&#124;
        /.*User.*from ($work-&gt;{ipv4}&#124;$work-&gt;{ipv6}&#124;$work-&gt;{fqdn}) not allowed be
cause.*/i &#124;&#124;
        /.*www: ($work-&gt;{ipv4}&#124;$work-&gt;{ipv6}&#124;$work-&gt;{fqdn}).*/i ) {</description>
		<content:encoded><![CDATA[<p>Thank you for your great script !!!<br />
I have adapted it to block some http requests. I was qurious why my server is so havily loaded and then I realized that I have a lot of requests similar to <a href="http://domain.name.com/index.php/includes/includes/scripts/scripts" rel="nofollow">http://domain.name.com/index.php/includes/includes/scripts/scripts</a>.</p>
<p>I decided to use your scripts to disconnect &#8220;crackers&#8221; from my server. Although disconnecting is working fine, the time limit doesn&#8217;t work and I don;t know why.</p>
<p>Will you find some time helping me.<br />
Below you can find my files, I am running FreeBSD 6.2</p>
<p>In my apache virtual host I have:</p>
<p>SetEnvIf Request_URI &#8220;/scripts/scripts&#8221; brute_force<br />
CustomLog &#8220;|/usr/local/sbin/apache_syslog&#8221; combined env=brute_force<br />
CustomLog &#8220;/var/log/domain/domain-bruteforce_log&#8221; combined env=brute_force</p>
<p>SetEnvIf Request_URI &#8220;/includes/includes&#8221; brute_force<br />
CustomLog &#8220;|/usr/local/sbin/apache_syslog&#8221; combined env=brute_force<br />
CustomLog &#8220;/var/log/domain/domain-bruteforce_log&#8221; combined env=brute_force</p>
<p>in syslog.conf</p>
<p>local1.*                                        |/usr/local/sbin/bruteforceblock<br />
er<br />
local1.*                                        /var/log/apache_syslog.log</p>
<p>in apache_syslog:<br />
#!/usr/local/bin/perl<br />
# script: apache-access-logger</p>
<p>use Sys::Syslog;<br />
$SERVER_NAME = shift || &#8216;www&#8217;;</p>
<p>$PRIORITY = &#8216;info&#8217;;<br />
$FACILITY = &#8216;local1&#8242;;</p>
<p>Sys::Syslog::setlogsock(&#8216;unix&#8217;);<br />
openlog ($SERVER_NAME,&#8217;ndelay&#8217;, $FACILITY);<br />
while () {<br />
    chomp;<br />
    syslog($PRIORITY,$_);<br />
}<br />
closelog;</p>
<p>and extra rule in your script<br />
# the core process</p>
<p>while () {<br />
    if (/.*Failed password.*from ($work-&gt;{ipv4}|$work-&gt;{ipv6}|$work-&gt;{fqdn}) por<br />
t.*/i ||<br />
        /.*Invalid user.*from ($work-&gt;{ipv4}|$work-&gt;{ipv6}|$work-&gt;{fqdn})$/i ||<br />
        /.*Did not receive identification string from ($work-&gt;{ipv4}|$work-&gt;{ipv<br />
6}|$work-&gt;{fqdn})$/i ||<br />
        /.*Bad protocol version identification .* from ($work-&gt;{ipv4}|$work-&gt;{ip<br />
v6}|$work-&gt;{fqdn})$/i ||<br />
        /.*User.*from ($work-&gt;{ipv4}|$work-&gt;{ipv6}|$work-&gt;{fqdn}) not allowed be<br />
cause.*/i ||<br />
        /.*www: ($work-&gt;{ipv4}|$work-&gt;{ipv6}|$work-&gt;{fqdn}).*/i ) {</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: danger</title>
		<link>http://danger.rulez.sk/index.php/bruteforceblocker/faq/comment-page-1/#comment-691</link>
		<dc:creator>danger</dc:creator>
		<pubDate>Thu, 17 Apr 2008 00:26:35 +0000</pubDate>
		<guid isPermaLink="false">http://danger.rulez.sk/?page_id=6#comment-691</guid>
		<description>Sorry, this is not yet possible (patches welcome :-)), however I suppose you can work this around by simple &quot;quick&quot; rule in pf.conf before bruteforceblocker&#039;s rule, i.e.:

&lt;blockquote&gt;table &lt;bruteforce&gt; persist file &quot;/var/db/ssh-bruteforce&quot;

pass in log quick proto tcp from 192.60.128.0/22 to any port ssh
block in log quick proto tcp from &lt;bruteforce&gt; to any port ssh&lt;/blockquote&gt;

Pretty straightforward. If you want to whitelist more CIDRs, you can also use another table for whitelist. I hope it helps you.
I think I can add this to my TODO list, but I am nowadays a bit too much busy so it might take some time to implement by me. By the way, I suppose the implementation shouldn&#039;t be hard using e.g. Net::CIDR perl extension....</description>
		<content:encoded><![CDATA[<p>Sorry, this is not yet possible (patches welcome <img src='http://danger.rulez.sk/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> ), however I suppose you can work this around by simple &#8220;quick&#8221; rule in pf.conf before bruteforceblocker&#8217;s rule, i.e.:</p>
<blockquote><p>table <bruteforce> persist file &#8220;/var/db/ssh-bruteforce&#8221;</p>
<p>pass in log quick proto tcp from 192.60.128.0/22 to any port ssh<br />
block in log quick proto tcp from </bruteforce><bruteforce> to any port ssh</bruteforce></p></blockquote>
<p>Pretty straightforward. If you want to whitelist more CIDRs, you can also use another table for whitelist. I hope it helps you.<br />
I think I can add this to my TODO list, but I am nowadays a bit too much busy so it might take some time to implement by me. By the way, I suppose the implementation shouldn&#8217;t be hard using e.g. Net::CIDR perl extension&#8230;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Pearl</title>
		<link>http://danger.rulez.sk/index.php/bruteforceblocker/faq/comment-page-1/#comment-690</link>
		<dc:creator>Michael Pearl</dc:creator>
		<pubDate>Wed, 16 Apr 2008 20:07:25 +0000</pubDate>
		<guid isPermaLink="false">http://danger.rulez.sk/?page_id=6#comment-690</guid>
		<description>Does the &#039;whitelist&#039; in the bruteforceblocker.conf support CIDR or possibly wildcards? I&#039;d like to whitelist an entire /22.</description>
		<content:encoded><![CDATA[<p>Does the &#8216;whitelist&#8217; in the bruteforceblocker.conf support CIDR or possibly wildcards? I&#8217;d like to whitelist an entire /22.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
