<?xml version="1.0" encoding="UTF-8"?>
<trick>
  <category-id type="integer">1</category-id>
  <comments type="integer"></comments>
  <content>&lt;h2&gt;Installation and setup&lt;/h2&gt;


	&lt;p&gt;All you need to run sshguard is some sort of system logger (in this example, we&amp;#8217;re using syslog-ng), iptables and of course a running ssh daemon. Visit the &lt;a href=&quot;http://sshguard.sourceforge.net/&quot;&gt;sshguard website&lt;/a&gt; for more information on how to use it with a different logger. Every major distribution should have sshguard in its package management system. I&amp;#8217;m on Gentoo, so I just had to enter &lt;em&gt;emerge sshguard&lt;/em&gt;.&lt;/p&gt;


	&lt;p&gt;Next, we have to tell the system logger (syslog-ng) to pass the logs to sshguard. This is done in the &lt;strong&gt;syslog-ng.conf&lt;/strong&gt;:&lt;/p&gt;


&lt;pre&gt;
&lt;code&gt;
filter sshlogs { facility(auth, authpriv) and match(&quot;sshd&quot;); };
destination sshguardproc {
        program(&quot;/usr/sbin/sshguard&quot; 
        template(&quot;$DATE $FULLHOST $MESSAGE\n&quot;));
};
log { source(src); filter(sshlogs); destination(sshguardproc); };
&lt;/code&gt;
&lt;/pre&gt;

	&lt;p&gt;Tell syslog-ng to re-read it&amp;#8217;s configuration:&lt;/p&gt;


&lt;pre&gt;
&lt;code&gt;
killall -HUP syslog-ng
&lt;/code&gt;
&lt;/pre&gt;

	&lt;p&gt;Set up your Netfilter (iptables rules) as usual. You&amp;#8217;ll find plenty of example on the interwebs, but you can also leave it pretty much empty. Just make sure to have the following:&lt;/p&gt;


&lt;pre&gt;
&lt;code&gt;
iptables -N sshguard
iptables -A INPUT -p tcp --dport 22 -j sshguard
&lt;/code&gt;
&lt;/pre&gt;

	&lt;p&gt;This sets up a new sshguard chain and passes the ssh traffic to it. sshguard takes care of the rest &amp;#8211; that&amp;#8217;s basically it!&lt;/p&gt;</content>
  <content-bbcode nil="true"></content-bbcode>
  <content-format>Textile</content-format>
  <content-html nil="true"></content-html>
  <content-textile>h2. Installation and setup

p. All you need to run sshguard is some sort of system logger (in this example, we're using syslog-ng), iptables and of course a running ssh daemon. Visit the &quot;sshguard website&quot;:http://sshguard.sourceforge.net/ for more information on how to use it with a different logger. Every major distribution should have sshguard in its package management system. I'm on Gentoo, so I just had to enter _emerge sshguard_.


p. Next, we have to tell the system logger (syslog-ng) to pass the logs to sshguard. This is done in the *syslog-ng.conf*:


&lt;pre&gt;
&lt;code&gt;
filter sshlogs { facility(auth, authpriv) and match(&quot;sshd&quot;); };
destination sshguardproc {
        program(&quot;/usr/sbin/sshguard&quot;
        template(&quot;$DATE $FULLHOST $MESSAGE\n&quot;));
};
log { source(src); filter(sshlogs); destination(sshguardproc); };
&lt;/code&gt;
&lt;/pre&gt;


p. Tell syslog-ng to re-read it's configuration:


&lt;pre&gt;
&lt;code&gt;
killall -HUP syslog-ng
&lt;/code&gt;
&lt;/pre&gt;


p. Set up your Netfilter (iptables rules) as usual. You'll find plenty of example on the interwebs, but you can also leave it pretty much empty. Just make sure to have the following:


&lt;pre&gt;
&lt;code&gt;
iptables -N sshguard
iptables -A INPUT -p tcp --dport 22 -j sshguard
&lt;/code&gt;
&lt;/pre&gt;


p. This sets up a new sshguard chain and passes the ssh traffic to it. sshguard takes care of the rest - that's basically it!</content-textile>
  <created-at type="datetime">2008-06-16T03:12:48+02:00</created-at>
  <creator-id type="integer">1</creator-id>
  <deleted-at type="datetime" nil="true"></deleted-at>
  <file nil="true"></file>
  <id type="integer">262</id>
  <lang-id type="integer" nil="true"></lang-id>
  <locale>en</locale>
  <nreports type="integer">0</nreports>
  <nvotes type="integer">3</nvotes>
  <permalink>block_ssh_brute_force_attacks_with_sshguard</permalink>
  <published-at type="datetime">2008-06-16T13:12:33+02:00</published-at>
  <state>published</state>
  <summary>sshguard was born for protecting SSH servers from the today's widespread brute force attacks, and evolved to an extensible log supervisor for blocking attacks to applications in real-time. It monitors logging activity and reacts to attacks by blocking their source addresses.</summary>
  <title>Block SSH Brute Force Attacks with sshguard</title>
  <updated-at type="datetime">2008-06-16T15:12:33+02:00</updated-at>
  <updater-id type="integer">37</updater-id>
  <url nil="true"></url>
  <url-code nil="true"></url-code>
</trick>
