<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://wiki.linuxmce.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Pw44</id>
	<title>LinuxMCE - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.linuxmce.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Pw44"/>
	<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php/Special:Contributions/Pw44"/>
	<updated>2026-07-21T20:35:46Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.44.0</generator>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=Fail2ban_-_A_tool_against_brute_force&amp;diff=33891</id>
		<title>Fail2ban - A tool against brute force</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=Fail2ban_-_A_tool_against_brute_force&amp;diff=33891"/>
		<updated>2013-02-23T05:58:56Z</updated>

		<summary type="html">&lt;p&gt;Pw44: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: Networking|Firewall, fail2ban]]&lt;br /&gt;
{{versioninfo|810Status=Works|810UpdatedDate=5 October 2010|810UpdatedBy=pw44|1004Status=Works|1004UpdatedDate=23 January 2013|1004UpdatedBy=pw44}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Having asterik installed is almost an invitation for others wishing to place calls at your expense.&lt;br /&gt;
&lt;br /&gt;
After configuring my sip trunk, it did not take 2 days and some &amp;quot;smart guy&amp;quot;  was trying to register to take advantage of it, and causing me losses.&lt;br /&gt;
&lt;br /&gt;
Fail2ban prevented it, blocking the attacker with iptables rules.&lt;br /&gt;
&lt;br /&gt;
Installing fail2ban is not complicated and i will describe the steps to have it properly installed and configured, so you can protect your asterisk and other services from brute force attack.&lt;br /&gt;
&lt;br /&gt;
Files under /etc/asterisk/ are owned by the asterisk user, so preceed any edit commands with&lt;br /&gt;
 sudo -u asterisk &amp;lt;command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
on Linuxmce 1004 no need to edit sip.conf  this is implemented on asterisk realtime database.&lt;br /&gt;
&lt;br /&gt;
The first thing to do is edit /etc/asterisk/sip.conf and add the following line:&lt;br /&gt;
 alwaysauthreject=yes                                                 &lt;br /&gt;
My sip.conf file looks like:&lt;br /&gt;
 ............&lt;br /&gt;
 [general]&lt;br /&gt;
 #include sip_general_additional.conf&lt;br /&gt;
 &lt;br /&gt;
 bindport = 5060       ; Port to bind to (SIP is 5060)&lt;br /&gt;
 bindaddr = 0.0.0.0    ; Address to bind to (all addresses on machine)&lt;br /&gt;
 &#039;&#039;&#039;alwaysauthreject=yes&#039;&#039;&#039;                                                 &lt;br /&gt;
 disallow=all                                                         &lt;br /&gt;
 allow=ulaw                                                           &lt;br /&gt;
 allow=alaw  &lt;br /&gt;
 .............                    &lt;br /&gt;
Install fail2ban with: &lt;br /&gt;
 sudo apt-get install fail2ban&lt;br /&gt;
&lt;br /&gt;
After is installed, you need to change /etc/asterisk/logger.conf and add the following line under [general] section (You may have to create this before the [logfiles] section). &lt;br /&gt;
&lt;br /&gt;
 [general]&lt;br /&gt;
 dateformat=%F %T&lt;br /&gt;
&lt;br /&gt;
In /etc/asterisk/logger.conf add the following line under the [logfiles] section for asterisk to log NOTICE level events to the syslog (/var/log/messages) as well as its normal log file. These entries in syslog will have a Date/Time stamp that is usable by fail2ban.&lt;br /&gt;
&lt;br /&gt;
 syslog.local0 =&amp;gt; notice &lt;br /&gt;
&lt;br /&gt;
Reload asterisk, as root, with:&lt;br /&gt;
&lt;br /&gt;
 sudo asterisk -rx &amp;quot;logger reload&amp;quot; &lt;br /&gt;
&lt;br /&gt;
Configuring fail2ban:&lt;br /&gt;
&lt;br /&gt;
 cd /etc/fail2ban/filter.d&lt;br /&gt;
&lt;br /&gt;
 touch asterisk.conf &lt;br /&gt;
&lt;br /&gt;
 vi asterisk.conf&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR ASTERISK 1.&#039;&#039;&#039;4, insert the following (copy &amp;amp; paste)&lt;br /&gt;
&lt;br /&gt;
 # Fail2Ban configuration file (for asterisk 1.4)&lt;br /&gt;
 #&lt;br /&gt;
 #&lt;br /&gt;
 # $Revision: 250 $&lt;br /&gt;
 #&lt;br /&gt;
 [INCLUDES]&lt;br /&gt;
 # Read common prefixes. If any customizations available -- read them from&lt;br /&gt;
 # common.local&lt;br /&gt;
 #before = common.conf&lt;br /&gt;
 [Definition]&lt;br /&gt;
 #_daemon = asterisk&lt;br /&gt;
 # Option:  failregex&lt;br /&gt;
 # Notes.:  regex to match the password failures messages in the logfile. The&lt;br /&gt;
 #          host must be matched by a group named &amp;quot;host&amp;quot;. The tag &amp;quot;&amp;lt;HOST&amp;gt;&amp;quot; can&lt;br /&gt;
 #          be used for standard IP/hostname matching and is only an alias for&lt;br /&gt;
 #          (?:::f{4,6}:)?(?P&amp;lt;host&amp;gt;\S+)&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 failregex = NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Wrong password&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - No matching peer found&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Username/auth name mismatch&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Device does not match ACL&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&amp;quot; .* failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Peer is not supposed to register&lt;br /&gt;
             NOTICE.* &amp;lt;HOST&amp;gt; failed to authenticate as &#039;.*&#039;$&lt;br /&gt;
             NOTICE.* .*: No registration for peer &#039;.*&#039; \(from &amp;lt;HOST&amp;gt;\)&lt;br /&gt;
             NOTICE.* .*: Host &amp;lt;HOST&amp;gt; failed MD5 authentication for &#039;.*&#039; (.*)&lt;br /&gt;
             NOTICE.* .*: Failed to authenticate user .*@&amp;lt;HOST&amp;gt;.*&lt;br /&gt;
 # Option:  ignoreregex&lt;br /&gt;
 # Notes.:  regex to ignore. If this regex matches, the line is ignored.&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 ignoreregex =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR ASTERISK 1.8&#039;&#039;&#039;, insert the following (copy &amp;amp; paste)&lt;br /&gt;
&lt;br /&gt;
 # Fail2Ban configuration file&lt;br /&gt;
 #&lt;br /&gt;
 #&lt;br /&gt;
 # $Revision: 250 $&lt;br /&gt;
 #&lt;br /&gt;
 [INCLUDES]&lt;br /&gt;
 # Read common prefixes. If any customizations available -- read them from&lt;br /&gt;
 # common.local&lt;br /&gt;
 #before = common.conf&lt;br /&gt;
 [Definition]&lt;br /&gt;
 #_daemon = asterisk&lt;br /&gt;
 # Option:  failregex&lt;br /&gt;
 # Notes.:  regex to match the password failures messages in the logfile. The&lt;br /&gt;
 #          host must be matched by a group named &amp;quot;host&amp;quot;. The tag &amp;quot;&amp;lt;HOST&amp;gt;&amp;quot; can&lt;br /&gt;
 #          be used for standard IP/hostname matching and is only an alias for&lt;br /&gt;
 #          (?:::f{4,6}:)?(?P&amp;lt;host&amp;gt;\S+)&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 failregex = NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;:.*&#039; - Wrong password&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;:.*&#039; - No matching peer found&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;:.*&#039; - No matching peer found&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;:.*&#039; - Username/auth name mismatch&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;:.*&#039; - Device does not match ACL&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;:.*&#039; - Peer is not supposed to register&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;:.*&#039; - ACL error (permit/deny)&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;:.*&#039; - Device does not match ACL&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;\&amp;quot;.*\&amp;quot;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;:.*&#039; - No matching peer found&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;\&amp;quot;.*\&amp;quot;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;:.*&#039; - Wrong password&lt;br /&gt;
             NOTICE.* &amp;lt;HOST&amp;gt; failed to authenticate as &#039;.*&#039;$&lt;br /&gt;
             NOTICE.* .*: No registration for peer &#039;.*&#039; \(from &amp;lt;HOST&amp;gt;\)&lt;br /&gt;
             NOTICE.* .*: Host &amp;lt;HOST&amp;gt; failed MD5 authentication for &#039;.*&#039; (.*)&lt;br /&gt;
             NOTICE.* .*: Failed to authenticate user .*@&amp;lt;HOST&amp;gt;.*&lt;br /&gt;
             NOTICE.* .*: &amp;lt;HOST&amp;gt; failed to authenticate as &#039;.*&#039;&lt;br /&gt;
             NOTICE.* .*: &amp;lt;HOST&amp;gt; tried  to authenticate with nonexistent user &#039;.*&#039;&lt;br /&gt;
             VERBOSE.*SIP/&amp;lt;HOST&amp;gt;-.*Received incoming SIP connection from unknown peer&lt;br /&gt;
    &lt;br /&gt;
 # Option:  ignoreregex&lt;br /&gt;
 # Notes.:  regex to ignore. If this regex matches, the line is ignored.&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 ignoreregex =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next edit /etc/fail2ban/jail.conf to include the following section so that it uses the new filter. &lt;br /&gt;
&lt;br /&gt;
 [asterisk-iptables]&lt;br /&gt;
 enabled  = true&lt;br /&gt;
 filter   = asterisk&lt;br /&gt;
 action   = iptables-allports[name=ASTERISK, protocol=all]&lt;br /&gt;
            sendmail-whois[name=ASTERISK, dest=root, sender=fail2ban@example.org]&lt;br /&gt;
 logpath  = /var/log/asterisk/full&lt;br /&gt;
 maxretry = 2&lt;br /&gt;
 bantime = 259200&lt;br /&gt;
&lt;br /&gt;
Locate the line ignoreip in /etc/fail2ban/jail.conf (beginning of the file) and insert the ip&#039;s and / or blocks you want fail2ban to ignore, so you don&#039;t risk banning yourserf or any host in your network.&lt;br /&gt;
&lt;br /&gt;
Mine is defined as follows:&lt;br /&gt;
&lt;br /&gt;
 [DEFAULT]&lt;br /&gt;
 # &amp;quot;ignoreip&amp;quot; can be an IP address, a CIDR mask or a DNS host. Fail2ban will not&lt;br /&gt;
 # ban a host which matches an address in this list. Several addresses can be   &lt;br /&gt;
 # defined using space separator.                                               &lt;br /&gt;
 ignoreip = 127.0.0.1 192.168.80.1 192.168.80.0/24 &lt;br /&gt;
&lt;br /&gt;
To start fail2ban type the following as root:&lt;br /&gt;
&lt;br /&gt;
 /etc/init.d/fail2ban start&lt;br /&gt;
&lt;br /&gt;
Check It&lt;br /&gt;
&lt;br /&gt;
For LinuxMCE, there is needed &amp;quot;patch&amp;quot;, while fail2ban is not part of the distribution.&lt;br /&gt;
&lt;br /&gt;
When LinuxMCE starts, it runs /usr/pluto/bin/Network_Firewall.sh, and this is done AFTER /etc/init.d/fail2ban is started.&lt;br /&gt;
&lt;br /&gt;
So, edit /usr/pluto/bin/Network_Firewall.sh and add the following at the END of this file:&lt;br /&gt;
 &lt;br /&gt;
 /etc/init.d/fail2ban restart&lt;br /&gt;
&lt;br /&gt;
This will make sure that fail2bain is started AFTER the iptables rules from LinuxMCE.&lt;br /&gt;
&lt;br /&gt;
If started properly issue the following command to view your iptables rules:&lt;br /&gt;
&lt;br /&gt;
 iptables -L -v&lt;br /&gt;
&lt;br /&gt;
You should see something like the following for the INPUT chain (this is the ouput of mine)&lt;br /&gt;
&lt;br /&gt;
 Chain INPUT (policy DROP 2241 packets, 160K bytes)              &lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination         &lt;br /&gt;
   372 27264 &#039;&#039;&#039;fail2ban-SSH&#039;&#039;&#039;  tcp  --  any    any     anywhere             anywhere            tcp dpt:ssh                                                                                          &lt;br /&gt;
 1312K  991M &#039;&#039;&#039;fail2ban-ASTERISK&#039;&#039;&#039;  all  --  any    any     anywhere             anywhere            &lt;br /&gt;
  553K   81M ACCEPT     all  --  lo     any     anywhere             anywhere                    &lt;br /&gt;
 1288K 1162M ACCEPT     all  --  any    any     anywhere             anywhere            state RELATED,ESTABLISHED                                                                               &lt;br /&gt;
     9   540 ACCEPT     all  --  any    any     anywhere             anywhere            MARK match 0x1                                                                                          &lt;br /&gt;
     2  1152 ACCEPT     udp  --  any    any     anywhere             anywhere            udp   dpt:bootps                                                                                          &lt;br /&gt;
 19276 5790K ACCEPT     all  --  any    any     192.168.80.0/24      anywhere                    &lt;br /&gt;
     0     0 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:iax                                                                                             &lt;br /&gt;
     4  1795 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:sip                                                                                             &lt;br /&gt;
     0     0 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:2000                                                                                            &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:sieve                                                                                           &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:1723                                                                                            &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:www                                                                                             &lt;br /&gt;
     1    60 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:ssh                                                                                             &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:https                                                                                           &lt;br /&gt;
     1    50 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpts:10001:20000&lt;br /&gt;
     0     0 ACCEPT     gre  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain FORWARD (policy ACCEPT 719K packets, 245M bytes)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
     0     0 TCPMSS     tcp  --  any    ppp+    anywhere             anywhere            tcp flags:SYN,RST/SYN TCPMSS clamp to PMTU&lt;br /&gt;
 Chain OUTPUT (policy ACCEPT 2099K packets, 590M bytes)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
     0     0 ACCEPT     gre  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain &#039;&#039;&#039;fail2ban-ASTERISK&#039;&#039;&#039; (1 references)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
  5091 2125K DROP       all  --  any    any     173.193.194.106-static.reverse.softlayer.com  anywhere&lt;br /&gt;
 1307K  989M RETURN     all  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain &#039;&#039;&#039;fail2ban-SSH&#039;&#039;&#039; (1 references)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
&lt;br /&gt;
If you do not see something similar to that then you have some troubleshooting to, check out /var/log/fail2ban.log.&lt;br /&gt;
&lt;br /&gt;
Example of my /var/log/fai2ban.log (173.193.194.106 is the real address from the attacker fail2ban banned):&lt;br /&gt;
&lt;br /&gt;
 ....&lt;br /&gt;
 2010-09-19 11:12:56,131 fail2ban.filter : INFO   Set maxRetry = 6&lt;br /&gt;
 2010-09-19 11:12:56,133 fail2ban.filter : INFO   Set findtime = 600&lt;br /&gt;
 2010-09-19 11:12:56,133 fail2ban.actions: INFO   Set banTime = 600&lt;br /&gt;
 2010-09-19 11:12:56,138 fail2ban.jail   : INFO   Jail &#039;ssh-iptables&#039; started&lt;br /&gt;
 2010-09-19 11:12:56,139 fail2ban.jail   : INFO   Jail &#039;asterisk-iptables&#039; started&lt;br /&gt;
 2010-09-19 11:12:56,141 fail2ban.jail   : INFO   Jail &#039;apache-tcpwrapper&#039; started&lt;br /&gt;
 2010-09-19 15:33:50,392 fail2ban.actions: WARNING [asterisk-iptables] Ban 173.193.194.106&lt;br /&gt;
 2010-09-19 15:34:50,982 fail2ban.actions: WARNING [asterisk-iptables] 173.193.194.106 already banned&lt;br /&gt;
&lt;br /&gt;
And this is the log (/var/log/asterisk/messages) showing the attack:&lt;br /&gt;
&lt;br /&gt;
 [2010-09-19 15:33:48] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;3235410554&amp;quot;&amp;lt;sip:3235410554@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                           &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;thomas&amp;quot;&amp;lt;sip:thomas@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;arsenal&amp;quot;&amp;lt;sip:arsenal@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;letmein&amp;quot;&amp;lt;sip:letmein@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;liverpool&amp;quot;&amp;lt;sip:liverpool@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;nevermind&amp;quot;&amp;lt;sip:nevermind@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;getmein&amp;quot;&amp;lt;sip:getmein@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;echo&amp;quot;&amp;lt;sip:echo@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;bmw325&amp;quot;&amp;lt;sip:bmw325@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;bmw335&amp;quot;&amp;lt;sip:bmw335@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w3e&amp;quot;&amp;lt;sip:1q2w3e@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w3e4r5t6y&amp;quot;&amp;lt;sip:1q2w3e4r5t6y@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q1q2w2w&amp;quot;&amp;lt;sip:1q1q2w2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w1q2w&amp;quot;&amp;lt;sip:1q2w1q2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w&amp;quot;&amp;lt;sip:1q2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;11q22w&amp;quot;&amp;lt;sip:11q22w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;q1w2&amp;quot;&amp;lt;sip:q1w2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;q1w2e3&amp;quot;&amp;lt;sip:q1w2e3@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;tvv03tvv03&amp;quot;&amp;lt;sip:tvv03tvv03@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                           &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd1&amp;quot;&amp;lt;sip:abcd1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd12&amp;quot;&amp;lt;sip:abcd12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd123&amp;quot;&amp;lt;sip:abcd123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;qq11ww22ee33rr44&amp;quot;&amp;lt;sip:qq11ww22ee33rr44@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1&amp;quot;&amp;lt;sip:sip1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip2&amp;quot;&amp;lt;sip:sip2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip12&amp;quot;&amp;lt;sip:sip12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip123&amp;quot;&amp;lt;sip:sip123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1234&amp;quot;&amp;lt;sip:sip1234@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip12345&amp;quot;&amp;lt;sip:sip12345@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1111&amp;quot;&amp;lt;sip:sip1111@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip222&amp;quot;&amp;lt;sip:sip222@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1qa2ws3ed&amp;quot;&amp;lt;sip:1qa2ws3ed@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1234asdf&amp;quot;&amp;lt;sip:1234asdf@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1a2s3d&amp;quot;&amp;lt;sip:1a2s3d@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1a2s3d4f&amp;quot;&amp;lt;sip:1a2s3d4f@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;asdzxc&amp;quot;&amp;lt;sip:asdzxc@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;123zxc&amp;quot;&amp;lt;sip:123zxc@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1234zxcv&amp;quot;&amp;lt;sip:1234zxcv@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;aazzssxx&amp;quot;&amp;lt;sip:aazzssxx@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;p@ssword&amp;quot;&amp;lt;sip:p@ssword@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;p@ssw0rd&amp;quot;&amp;lt;sip:p@ssw0rd@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;pass1&amp;quot;&amp;lt;sip:pass1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;password3&amp;quot;&amp;lt;sip:password3@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;pass12&amp;quot;&amp;lt;sip:pass12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account&amp;quot;&amp;lt;sip:account@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;passlogin&amp;quot;&amp;lt;sip:passlogin@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account1&amp;quot;&amp;lt;sip:account1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account5&amp;quot;&amp;lt;sip:account5@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account6&amp;quot;&amp;lt;sip:account6@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account123&amp;quot;&amp;lt;sip:account123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account12&amp;quot;&amp;lt;sip:account12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc1&amp;quot;&amp;lt;sip:acc1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc2&amp;quot;&amp;lt;sip:acc2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc12&amp;quot;&amp;lt;sip:acc12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
&lt;br /&gt;
One last tip: you need a MTA, like sendmail or postfix, in order to receive the notifications from fail2ban.&lt;br /&gt;
&lt;br /&gt;
If you have a MTA installed and properly configured, nothing else is needed, but if not, install sendmail&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install sendmail&lt;br /&gt;
&lt;br /&gt;
Then edit the /etc/hosts file and change the line &#039;&#039;&#039;192.168.80.1 dcerouter&#039;&#039;&#039; to read &#039;&#039;&#039;192.168.80.1 dcerouter.localdomain dcerouter&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Doing it, sendmail will start as expected (fast) and mail will properly delivered. If this change is not done, sendmail will take a long time to start, because it does not find the qualified host name, as the log shows:&lt;br /&gt;
&lt;br /&gt;
 Sep 27 13:12:11 dcerouter sendmail[10585]: My unqualified host name (dcerouter) unknown; sleeping for retry&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I hope this wiki helps.&lt;br /&gt;
&lt;br /&gt;
source: &lt;br /&gt;
 http://www.fail2ban.org&lt;br /&gt;
 http://www.voip-info.org/wiki/view/Fail2Ban+(with+iptables)+And+Asterisk&lt;br /&gt;
 http://www.fail2ban.org/wiki/index.php/Asterisk&lt;br /&gt;
&lt;br /&gt;
More protection with iptables:&lt;br /&gt;
 http://sysadminman.net/blog/2010/limiting-sipiax-connections-to-asterisk-with-iptables-1082&lt;/div&gt;</summary>
		<author><name>Pw44</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=Fail2ban_-_A_tool_against_brute_force&amp;diff=33890</id>
		<title>Fail2ban - A tool against brute force</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=Fail2ban_-_A_tool_against_brute_force&amp;diff=33890"/>
		<updated>2013-02-23T05:57:41Z</updated>

		<summary type="html">&lt;p&gt;Pw44: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: Networking|Firewall, fail2ban]]&lt;br /&gt;
{{versioninfo|810Status=Works|810UpdatedDate=5 October 2010|810UpdatedBy=pw44}}&lt;br /&gt;
{{versioninfo|1004Status=Works|1004UpdatedDate=23 January 2013|1004UpdatedBy=pw44}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Having asterik installed is almost an invitation for others wishing to place calls at your expense.&lt;br /&gt;
&lt;br /&gt;
After configuring my sip trunk, it did not take 2 days and some &amp;quot;smart guy&amp;quot;  was trying to register to take advantage of it, and causing me losses.&lt;br /&gt;
&lt;br /&gt;
Fail2ban prevented it, blocking the attacker with iptables rules.&lt;br /&gt;
&lt;br /&gt;
Installing fail2ban is not complicated and i will describe the steps to have it properly installed and configured, so you can protect your asterisk and other services from brute force attack.&lt;br /&gt;
&lt;br /&gt;
Files under /etc/asterisk/ are owned by the asterisk user, so preceed any edit commands with&lt;br /&gt;
 sudo -u asterisk &amp;lt;command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
on Linuxmce 1004 no need to edit sip.conf  this is implemented on asterisk realtime database.&lt;br /&gt;
&lt;br /&gt;
The first thing to do is edit /etc/asterisk/sip.conf and add the following line:&lt;br /&gt;
 alwaysauthreject=yes                                                 &lt;br /&gt;
My sip.conf file looks like:&lt;br /&gt;
 ............&lt;br /&gt;
 [general]&lt;br /&gt;
 #include sip_general_additional.conf&lt;br /&gt;
 &lt;br /&gt;
 bindport = 5060       ; Port to bind to (SIP is 5060)&lt;br /&gt;
 bindaddr = 0.0.0.0    ; Address to bind to (all addresses on machine)&lt;br /&gt;
 &#039;&#039;&#039;alwaysauthreject=yes&#039;&#039;&#039;                                                 &lt;br /&gt;
 disallow=all                                                         &lt;br /&gt;
 allow=ulaw                                                           &lt;br /&gt;
 allow=alaw  &lt;br /&gt;
 .............                    &lt;br /&gt;
Install fail2ban with: &lt;br /&gt;
 sudo apt-get install fail2ban&lt;br /&gt;
&lt;br /&gt;
After is installed, you need to change /etc/asterisk/logger.conf and add the following line under [general] section (You may have to create this before the [logfiles] section). &lt;br /&gt;
&lt;br /&gt;
 [general]&lt;br /&gt;
 dateformat=%F %T&lt;br /&gt;
&lt;br /&gt;
In /etc/asterisk/logger.conf add the following line under the [logfiles] section for asterisk to log NOTICE level events to the syslog (/var/log/messages) as well as its normal log file. These entries in syslog will have a Date/Time stamp that is usable by fail2ban.&lt;br /&gt;
&lt;br /&gt;
 syslog.local0 =&amp;gt; notice &lt;br /&gt;
&lt;br /&gt;
Reload asterisk, as root, with:&lt;br /&gt;
&lt;br /&gt;
 sudo asterisk -rx &amp;quot;logger reload&amp;quot; &lt;br /&gt;
&lt;br /&gt;
Configuring fail2ban:&lt;br /&gt;
&lt;br /&gt;
 cd /etc/fail2ban/filter.d&lt;br /&gt;
&lt;br /&gt;
 touch asterisk.conf &lt;br /&gt;
&lt;br /&gt;
 vi asterisk.conf&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR ASTERISK 1.&#039;&#039;&#039;4, insert the following (copy &amp;amp; paste)&lt;br /&gt;
&lt;br /&gt;
 # Fail2Ban configuration file (for asterisk 1.4)&lt;br /&gt;
 #&lt;br /&gt;
 #&lt;br /&gt;
 # $Revision: 250 $&lt;br /&gt;
 #&lt;br /&gt;
 [INCLUDES]&lt;br /&gt;
 # Read common prefixes. If any customizations available -- read them from&lt;br /&gt;
 # common.local&lt;br /&gt;
 #before = common.conf&lt;br /&gt;
 [Definition]&lt;br /&gt;
 #_daemon = asterisk&lt;br /&gt;
 # Option:  failregex&lt;br /&gt;
 # Notes.:  regex to match the password failures messages in the logfile. The&lt;br /&gt;
 #          host must be matched by a group named &amp;quot;host&amp;quot;. The tag &amp;quot;&amp;lt;HOST&amp;gt;&amp;quot; can&lt;br /&gt;
 #          be used for standard IP/hostname matching and is only an alias for&lt;br /&gt;
 #          (?:::f{4,6}:)?(?P&amp;lt;host&amp;gt;\S+)&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 failregex = NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Wrong password&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - No matching peer found&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Username/auth name mismatch&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Device does not match ACL&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&amp;quot; .* failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Peer is not supposed to register&lt;br /&gt;
             NOTICE.* &amp;lt;HOST&amp;gt; failed to authenticate as &#039;.*&#039;$&lt;br /&gt;
             NOTICE.* .*: No registration for peer &#039;.*&#039; \(from &amp;lt;HOST&amp;gt;\)&lt;br /&gt;
             NOTICE.* .*: Host &amp;lt;HOST&amp;gt; failed MD5 authentication for &#039;.*&#039; (.*)&lt;br /&gt;
             NOTICE.* .*: Failed to authenticate user .*@&amp;lt;HOST&amp;gt;.*&lt;br /&gt;
 # Option:  ignoreregex&lt;br /&gt;
 # Notes.:  regex to ignore. If this regex matches, the line is ignored.&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 ignoreregex =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR ASTERISK 1.8&#039;&#039;&#039;, insert the following (copy &amp;amp; paste)&lt;br /&gt;
&lt;br /&gt;
 # Fail2Ban configuration file&lt;br /&gt;
 #&lt;br /&gt;
 #&lt;br /&gt;
 # $Revision: 250 $&lt;br /&gt;
 #&lt;br /&gt;
 [INCLUDES]&lt;br /&gt;
 # Read common prefixes. If any customizations available -- read them from&lt;br /&gt;
 # common.local&lt;br /&gt;
 #before = common.conf&lt;br /&gt;
 [Definition]&lt;br /&gt;
 #_daemon = asterisk&lt;br /&gt;
 # Option:  failregex&lt;br /&gt;
 # Notes.:  regex to match the password failures messages in the logfile. The&lt;br /&gt;
 #          host must be matched by a group named &amp;quot;host&amp;quot;. The tag &amp;quot;&amp;lt;HOST&amp;gt;&amp;quot; can&lt;br /&gt;
 #          be used for standard IP/hostname matching and is only an alias for&lt;br /&gt;
 #          (?:::f{4,6}:)?(?P&amp;lt;host&amp;gt;\S+)&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 failregex = NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;:.*&#039; - Wrong password&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;:.*&#039; - No matching peer found&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;:.*&#039; - No matching peer found&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;:.*&#039; - Username/auth name mismatch&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;:.*&#039; - Device does not match ACL&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;:.*&#039; - Peer is not supposed to register&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;:.*&#039; - ACL error (permit/deny)&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;:.*&#039; - Device does not match ACL&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;\&amp;quot;.*\&amp;quot;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;:.*&#039; - No matching peer found&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;\&amp;quot;.*\&amp;quot;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;:.*&#039; - Wrong password&lt;br /&gt;
             NOTICE.* &amp;lt;HOST&amp;gt; failed to authenticate as &#039;.*&#039;$&lt;br /&gt;
             NOTICE.* .*: No registration for peer &#039;.*&#039; \(from &amp;lt;HOST&amp;gt;\)&lt;br /&gt;
             NOTICE.* .*: Host &amp;lt;HOST&amp;gt; failed MD5 authentication for &#039;.*&#039; (.*)&lt;br /&gt;
             NOTICE.* .*: Failed to authenticate user .*@&amp;lt;HOST&amp;gt;.*&lt;br /&gt;
             NOTICE.* .*: &amp;lt;HOST&amp;gt; failed to authenticate as &#039;.*&#039;&lt;br /&gt;
             NOTICE.* .*: &amp;lt;HOST&amp;gt; tried  to authenticate with nonexistent user &#039;.*&#039;&lt;br /&gt;
             VERBOSE.*SIP/&amp;lt;HOST&amp;gt;-.*Received incoming SIP connection from unknown peer&lt;br /&gt;
    &lt;br /&gt;
 # Option:  ignoreregex&lt;br /&gt;
 # Notes.:  regex to ignore. If this regex matches, the line is ignored.&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 ignoreregex =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next edit /etc/fail2ban/jail.conf to include the following section so that it uses the new filter. &lt;br /&gt;
&lt;br /&gt;
 [asterisk-iptables]&lt;br /&gt;
 enabled  = true&lt;br /&gt;
 filter   = asterisk&lt;br /&gt;
 action   = iptables-allports[name=ASTERISK, protocol=all]&lt;br /&gt;
            sendmail-whois[name=ASTERISK, dest=root, sender=fail2ban@example.org]&lt;br /&gt;
 logpath  = /var/log/asterisk/full&lt;br /&gt;
 maxretry = 2&lt;br /&gt;
 bantime = 259200&lt;br /&gt;
&lt;br /&gt;
Locate the line ignoreip in /etc/fail2ban/jail.conf (beginning of the file) and insert the ip&#039;s and / or blocks you want fail2ban to ignore, so you don&#039;t risk banning yourserf or any host in your network.&lt;br /&gt;
&lt;br /&gt;
Mine is defined as follows:&lt;br /&gt;
&lt;br /&gt;
 [DEFAULT]&lt;br /&gt;
 # &amp;quot;ignoreip&amp;quot; can be an IP address, a CIDR mask or a DNS host. Fail2ban will not&lt;br /&gt;
 # ban a host which matches an address in this list. Several addresses can be   &lt;br /&gt;
 # defined using space separator.                                               &lt;br /&gt;
 ignoreip = 127.0.0.1 192.168.80.1 192.168.80.0/24 &lt;br /&gt;
&lt;br /&gt;
To start fail2ban type the following as root:&lt;br /&gt;
&lt;br /&gt;
 /etc/init.d/fail2ban start&lt;br /&gt;
&lt;br /&gt;
Check It&lt;br /&gt;
&lt;br /&gt;
For LinuxMCE, there is needed &amp;quot;patch&amp;quot;, while fail2ban is not part of the distribution.&lt;br /&gt;
&lt;br /&gt;
When LinuxMCE starts, it runs /usr/pluto/bin/Network_Firewall.sh, and this is done AFTER /etc/init.d/fail2ban is started.&lt;br /&gt;
&lt;br /&gt;
So, edit /usr/pluto/bin/Network_Firewall.sh and add the following at the END of this file:&lt;br /&gt;
 &lt;br /&gt;
 /etc/init.d/fail2ban restart&lt;br /&gt;
&lt;br /&gt;
This will make sure that fail2bain is started AFTER the iptables rules from LinuxMCE.&lt;br /&gt;
&lt;br /&gt;
If started properly issue the following command to view your iptables rules:&lt;br /&gt;
&lt;br /&gt;
 iptables -L -v&lt;br /&gt;
&lt;br /&gt;
You should see something like the following for the INPUT chain (this is the ouput of mine)&lt;br /&gt;
&lt;br /&gt;
 Chain INPUT (policy DROP 2241 packets, 160K bytes)              &lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination         &lt;br /&gt;
   372 27264 &#039;&#039;&#039;fail2ban-SSH&#039;&#039;&#039;  tcp  --  any    any     anywhere             anywhere            tcp dpt:ssh                                                                                          &lt;br /&gt;
 1312K  991M &#039;&#039;&#039;fail2ban-ASTERISK&#039;&#039;&#039;  all  --  any    any     anywhere             anywhere            &lt;br /&gt;
  553K   81M ACCEPT     all  --  lo     any     anywhere             anywhere                    &lt;br /&gt;
 1288K 1162M ACCEPT     all  --  any    any     anywhere             anywhere            state RELATED,ESTABLISHED                                                                               &lt;br /&gt;
     9   540 ACCEPT     all  --  any    any     anywhere             anywhere            MARK match 0x1                                                                                          &lt;br /&gt;
     2  1152 ACCEPT     udp  --  any    any     anywhere             anywhere            udp   dpt:bootps                                                                                          &lt;br /&gt;
 19276 5790K ACCEPT     all  --  any    any     192.168.80.0/24      anywhere                    &lt;br /&gt;
     0     0 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:iax                                                                                             &lt;br /&gt;
     4  1795 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:sip                                                                                             &lt;br /&gt;
     0     0 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:2000                                                                                            &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:sieve                                                                                           &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:1723                                                                                            &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:www                                                                                             &lt;br /&gt;
     1    60 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:ssh                                                                                             &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:https                                                                                           &lt;br /&gt;
     1    50 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpts:10001:20000&lt;br /&gt;
     0     0 ACCEPT     gre  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain FORWARD (policy ACCEPT 719K packets, 245M bytes)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
     0     0 TCPMSS     tcp  --  any    ppp+    anywhere             anywhere            tcp flags:SYN,RST/SYN TCPMSS clamp to PMTU&lt;br /&gt;
 Chain OUTPUT (policy ACCEPT 2099K packets, 590M bytes)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
     0     0 ACCEPT     gre  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain &#039;&#039;&#039;fail2ban-ASTERISK&#039;&#039;&#039; (1 references)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
  5091 2125K DROP       all  --  any    any     173.193.194.106-static.reverse.softlayer.com  anywhere&lt;br /&gt;
 1307K  989M RETURN     all  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain &#039;&#039;&#039;fail2ban-SSH&#039;&#039;&#039; (1 references)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
&lt;br /&gt;
If you do not see something similar to that then you have some troubleshooting to, check out /var/log/fail2ban.log.&lt;br /&gt;
&lt;br /&gt;
Example of my /var/log/fai2ban.log (173.193.194.106 is the real address from the attacker fail2ban banned):&lt;br /&gt;
&lt;br /&gt;
 ....&lt;br /&gt;
 2010-09-19 11:12:56,131 fail2ban.filter : INFO   Set maxRetry = 6&lt;br /&gt;
 2010-09-19 11:12:56,133 fail2ban.filter : INFO   Set findtime = 600&lt;br /&gt;
 2010-09-19 11:12:56,133 fail2ban.actions: INFO   Set banTime = 600&lt;br /&gt;
 2010-09-19 11:12:56,138 fail2ban.jail   : INFO   Jail &#039;ssh-iptables&#039; started&lt;br /&gt;
 2010-09-19 11:12:56,139 fail2ban.jail   : INFO   Jail &#039;asterisk-iptables&#039; started&lt;br /&gt;
 2010-09-19 11:12:56,141 fail2ban.jail   : INFO   Jail &#039;apache-tcpwrapper&#039; started&lt;br /&gt;
 2010-09-19 15:33:50,392 fail2ban.actions: WARNING [asterisk-iptables] Ban 173.193.194.106&lt;br /&gt;
 2010-09-19 15:34:50,982 fail2ban.actions: WARNING [asterisk-iptables] 173.193.194.106 already banned&lt;br /&gt;
&lt;br /&gt;
And this is the log (/var/log/asterisk/messages) showing the attack:&lt;br /&gt;
&lt;br /&gt;
 [2010-09-19 15:33:48] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;3235410554&amp;quot;&amp;lt;sip:3235410554@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                           &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;thomas&amp;quot;&amp;lt;sip:thomas@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;arsenal&amp;quot;&amp;lt;sip:arsenal@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;letmein&amp;quot;&amp;lt;sip:letmein@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;liverpool&amp;quot;&amp;lt;sip:liverpool@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;nevermind&amp;quot;&amp;lt;sip:nevermind@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;getmein&amp;quot;&amp;lt;sip:getmein@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;echo&amp;quot;&amp;lt;sip:echo@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;bmw325&amp;quot;&amp;lt;sip:bmw325@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;bmw335&amp;quot;&amp;lt;sip:bmw335@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w3e&amp;quot;&amp;lt;sip:1q2w3e@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w3e4r5t6y&amp;quot;&amp;lt;sip:1q2w3e4r5t6y@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q1q2w2w&amp;quot;&amp;lt;sip:1q1q2w2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w1q2w&amp;quot;&amp;lt;sip:1q2w1q2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w&amp;quot;&amp;lt;sip:1q2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;11q22w&amp;quot;&amp;lt;sip:11q22w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;q1w2&amp;quot;&amp;lt;sip:q1w2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;q1w2e3&amp;quot;&amp;lt;sip:q1w2e3@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;tvv03tvv03&amp;quot;&amp;lt;sip:tvv03tvv03@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                           &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd1&amp;quot;&amp;lt;sip:abcd1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd12&amp;quot;&amp;lt;sip:abcd12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd123&amp;quot;&amp;lt;sip:abcd123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;qq11ww22ee33rr44&amp;quot;&amp;lt;sip:qq11ww22ee33rr44@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1&amp;quot;&amp;lt;sip:sip1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip2&amp;quot;&amp;lt;sip:sip2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip12&amp;quot;&amp;lt;sip:sip12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip123&amp;quot;&amp;lt;sip:sip123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1234&amp;quot;&amp;lt;sip:sip1234@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip12345&amp;quot;&amp;lt;sip:sip12345@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1111&amp;quot;&amp;lt;sip:sip1111@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip222&amp;quot;&amp;lt;sip:sip222@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1qa2ws3ed&amp;quot;&amp;lt;sip:1qa2ws3ed@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1234asdf&amp;quot;&amp;lt;sip:1234asdf@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1a2s3d&amp;quot;&amp;lt;sip:1a2s3d@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1a2s3d4f&amp;quot;&amp;lt;sip:1a2s3d4f@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;asdzxc&amp;quot;&amp;lt;sip:asdzxc@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;123zxc&amp;quot;&amp;lt;sip:123zxc@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1234zxcv&amp;quot;&amp;lt;sip:1234zxcv@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;aazzssxx&amp;quot;&amp;lt;sip:aazzssxx@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;p@ssword&amp;quot;&amp;lt;sip:p@ssword@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;p@ssw0rd&amp;quot;&amp;lt;sip:p@ssw0rd@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;pass1&amp;quot;&amp;lt;sip:pass1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;password3&amp;quot;&amp;lt;sip:password3@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;pass12&amp;quot;&amp;lt;sip:pass12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account&amp;quot;&amp;lt;sip:account@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;passlogin&amp;quot;&amp;lt;sip:passlogin@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account1&amp;quot;&amp;lt;sip:account1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account5&amp;quot;&amp;lt;sip:account5@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account6&amp;quot;&amp;lt;sip:account6@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account123&amp;quot;&amp;lt;sip:account123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account12&amp;quot;&amp;lt;sip:account12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc1&amp;quot;&amp;lt;sip:acc1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc2&amp;quot;&amp;lt;sip:acc2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc12&amp;quot;&amp;lt;sip:acc12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
&lt;br /&gt;
One last tip: you need a MTA, like sendmail or postfix, in order to receive the notifications from fail2ban.&lt;br /&gt;
&lt;br /&gt;
If you have a MTA installed and properly configured, nothing else is needed, but if not, install sendmail&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install sendmail&lt;br /&gt;
&lt;br /&gt;
Then edit the /etc/hosts file and change the line &#039;&#039;&#039;192.168.80.1 dcerouter&#039;&#039;&#039; to read &#039;&#039;&#039;192.168.80.1 dcerouter.localdomain dcerouter&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Doing it, sendmail will start as expected (fast) and mail will properly delivered. If this change is not done, sendmail will take a long time to start, because it does not find the qualified host name, as the log shows:&lt;br /&gt;
&lt;br /&gt;
 Sep 27 13:12:11 dcerouter sendmail[10585]: My unqualified host name (dcerouter) unknown; sleeping for retry&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I hope this wiki helps.&lt;br /&gt;
&lt;br /&gt;
source: &lt;br /&gt;
 http://www.fail2ban.org&lt;br /&gt;
 http://www.voip-info.org/wiki/view/Fail2Ban+(with+iptables)+And+Asterisk&lt;br /&gt;
 http://www.fail2ban.org/wiki/index.php/Asterisk&lt;br /&gt;
&lt;br /&gt;
More protection with iptables:&lt;br /&gt;
 http://sysadminman.net/blog/2010/limiting-sipiax-connections-to-asterisk-with-iptables-1082&lt;/div&gt;</summary>
		<author><name>Pw44</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=Fail2ban_-_A_tool_against_brute_force&amp;diff=33889</id>
		<title>Fail2ban - A tool against brute force</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=Fail2ban_-_A_tool_against_brute_force&amp;diff=33889"/>
		<updated>2013-02-23T05:54:35Z</updated>

		<summary type="html">&lt;p&gt;Pw44: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: Networking|Firewall, fail2ban]]&lt;br /&gt;
{{versioninfo|810Status=Works|810UpdatedDate=5 October 2010|810UpdatedBy=pw44}}&lt;br /&gt;
&lt;br /&gt;
Having asterik installed is almost an invitation for others wishing to place calls at your expense.&lt;br /&gt;
&lt;br /&gt;
After configuring my sip trunk, it did not take 2 days and some &amp;quot;smart guy&amp;quot;  was trying to register to take advantage of it, and causing me losses.&lt;br /&gt;
&lt;br /&gt;
Fail2ban prevented it, blocking the attacker with iptables rules.&lt;br /&gt;
&lt;br /&gt;
Installing fail2ban is not complicated and i will describe the steps to have it properly installed and configured, so you can protect your asterisk and other services from brute force attack.&lt;br /&gt;
&lt;br /&gt;
Files under /etc/asterisk/ are owned by the asterisk user, so preceed any edit commands with&lt;br /&gt;
 sudo -u asterisk &amp;lt;command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
on Linuxmce 1004 no need to edit sip.conf  this is implemented on asterisk realtime database.&lt;br /&gt;
&lt;br /&gt;
The first thing to do is edit /etc/asterisk/sip.conf and add the following line:&lt;br /&gt;
 alwaysauthreject=yes                                                 &lt;br /&gt;
My sip.conf file looks like:&lt;br /&gt;
 ............&lt;br /&gt;
 [general]&lt;br /&gt;
 #include sip_general_additional.conf&lt;br /&gt;
 &lt;br /&gt;
 bindport = 5060       ; Port to bind to (SIP is 5060)&lt;br /&gt;
 bindaddr = 0.0.0.0    ; Address to bind to (all addresses on machine)&lt;br /&gt;
 &#039;&#039;&#039;alwaysauthreject=yes&#039;&#039;&#039;                                                 &lt;br /&gt;
 disallow=all                                                         &lt;br /&gt;
 allow=ulaw                                                           &lt;br /&gt;
 allow=alaw  &lt;br /&gt;
 .............                    &lt;br /&gt;
Install fail2ban with: &lt;br /&gt;
 sudo apt-get install fail2ban&lt;br /&gt;
&lt;br /&gt;
After is installed, you need to change /etc/asterisk/logger.conf and add the following line under [general] section (You may have to create this before the [logfiles] section). &lt;br /&gt;
&lt;br /&gt;
 [general]&lt;br /&gt;
 dateformat=%F %T&lt;br /&gt;
&lt;br /&gt;
In /etc/asterisk/logger.conf add the following line under the [logfiles] section for asterisk to log NOTICE level events to the syslog (/var/log/messages) as well as its normal log file. These entries in syslog will have a Date/Time stamp that is usable by fail2ban.&lt;br /&gt;
&lt;br /&gt;
 syslog.local0 =&amp;gt; notice &lt;br /&gt;
&lt;br /&gt;
Reload asterisk, as root, with:&lt;br /&gt;
&lt;br /&gt;
 sudo asterisk -rx &amp;quot;logger reload&amp;quot; &lt;br /&gt;
&lt;br /&gt;
Configuring fail2ban:&lt;br /&gt;
&lt;br /&gt;
 cd /etc/fail2ban/filter.d&lt;br /&gt;
&lt;br /&gt;
 touch asterisk.conf &lt;br /&gt;
&lt;br /&gt;
 vi asterisk.conf&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR ASTERISK 1.&#039;&#039;&#039;4, insert the following (copy &amp;amp; paste)&lt;br /&gt;
&lt;br /&gt;
 # Fail2Ban configuration file (for asterisk 1.4)&lt;br /&gt;
 #&lt;br /&gt;
 #&lt;br /&gt;
 # $Revision: 250 $&lt;br /&gt;
 #&lt;br /&gt;
 [INCLUDES]&lt;br /&gt;
 # Read common prefixes. If any customizations available -- read them from&lt;br /&gt;
 # common.local&lt;br /&gt;
 #before = common.conf&lt;br /&gt;
 [Definition]&lt;br /&gt;
 #_daemon = asterisk&lt;br /&gt;
 # Option:  failregex&lt;br /&gt;
 # Notes.:  regex to match the password failures messages in the logfile. The&lt;br /&gt;
 #          host must be matched by a group named &amp;quot;host&amp;quot;. The tag &amp;quot;&amp;lt;HOST&amp;gt;&amp;quot; can&lt;br /&gt;
 #          be used for standard IP/hostname matching and is only an alias for&lt;br /&gt;
 #          (?:::f{4,6}:)?(?P&amp;lt;host&amp;gt;\S+)&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 failregex = NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Wrong password&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - No matching peer found&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Username/auth name mismatch&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Device does not match ACL&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&amp;quot; .* failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Peer is not supposed to register&lt;br /&gt;
             NOTICE.* &amp;lt;HOST&amp;gt; failed to authenticate as &#039;.*&#039;$&lt;br /&gt;
             NOTICE.* .*: No registration for peer &#039;.*&#039; \(from &amp;lt;HOST&amp;gt;\)&lt;br /&gt;
             NOTICE.* .*: Host &amp;lt;HOST&amp;gt; failed MD5 authentication for &#039;.*&#039; (.*)&lt;br /&gt;
             NOTICE.* .*: Failed to authenticate user .*@&amp;lt;HOST&amp;gt;.*&lt;br /&gt;
 # Option:  ignoreregex&lt;br /&gt;
 # Notes.:  regex to ignore. If this regex matches, the line is ignored.&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 ignoreregex =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR ASTERISK 1.8&#039;&#039;&#039;, insert the following (copy &amp;amp; paste)&lt;br /&gt;
&lt;br /&gt;
 # Fail2Ban configuration file&lt;br /&gt;
 #&lt;br /&gt;
 #&lt;br /&gt;
 # $Revision: 250 $&lt;br /&gt;
 #&lt;br /&gt;
 [INCLUDES]&lt;br /&gt;
 # Read common prefixes. If any customizations available -- read them from&lt;br /&gt;
 # common.local&lt;br /&gt;
 #before = common.conf&lt;br /&gt;
 [Definition]&lt;br /&gt;
 #_daemon = asterisk&lt;br /&gt;
 # Option:  failregex&lt;br /&gt;
 # Notes.:  regex to match the password failures messages in the logfile. The&lt;br /&gt;
 #          host must be matched by a group named &amp;quot;host&amp;quot;. The tag &amp;quot;&amp;lt;HOST&amp;gt;&amp;quot; can&lt;br /&gt;
 #          be used for standard IP/hostname matching and is only an alias for&lt;br /&gt;
 #          (?:::f{4,6}:)?(?P&amp;lt;host&amp;gt;\S+)&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 failregex = NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;:.*&#039; - Wrong password&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;:.*&#039; - No matching peer found&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;:.*&#039; - No matching peer found&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;:.*&#039; - Username/auth name mismatch&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;:.*&#039; - Device does not match ACL&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;:.*&#039; - Peer is not supposed to register&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;:.*&#039; - ACL error (permit/deny)&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;:.*&#039; - Device does not match ACL&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;\&amp;quot;.*\&amp;quot;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;:.*&#039; - No matching peer found&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;\&amp;quot;.*\&amp;quot;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;:.*&#039; - Wrong password&lt;br /&gt;
             NOTICE.* &amp;lt;HOST&amp;gt; failed to authenticate as &#039;.*&#039;$&lt;br /&gt;
             NOTICE.* .*: No registration for peer &#039;.*&#039; \(from &amp;lt;HOST&amp;gt;\)&lt;br /&gt;
             NOTICE.* .*: Host &amp;lt;HOST&amp;gt; failed MD5 authentication for &#039;.*&#039; (.*)&lt;br /&gt;
             NOTICE.* .*: Failed to authenticate user .*@&amp;lt;HOST&amp;gt;.*&lt;br /&gt;
             NOTICE.* .*: &amp;lt;HOST&amp;gt; failed to authenticate as &#039;.*&#039;&lt;br /&gt;
             NOTICE.* .*: &amp;lt;HOST&amp;gt; tried  to authenticate with nonexistent user &#039;.*&#039;&lt;br /&gt;
             VERBOSE.*SIP/&amp;lt;HOST&amp;gt;-.*Received incoming SIP connection from unknown peer&lt;br /&gt;
    &lt;br /&gt;
 # Option:  ignoreregex&lt;br /&gt;
 # Notes.:  regex to ignore. If this regex matches, the line is ignored.&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 ignoreregex =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next edit /etc/fail2ban/jail.conf to include the following section so that it uses the new filter. &lt;br /&gt;
&lt;br /&gt;
 [asterisk-iptables]&lt;br /&gt;
 enabled  = true&lt;br /&gt;
 filter   = asterisk&lt;br /&gt;
 action   = iptables-allports[name=ASTERISK, protocol=all]&lt;br /&gt;
            sendmail-whois[name=ASTERISK, dest=root, sender=fail2ban@example.org]&lt;br /&gt;
 logpath  = /var/log/asterisk/full&lt;br /&gt;
 maxretry = 2&lt;br /&gt;
 bantime = 259200&lt;br /&gt;
&lt;br /&gt;
Locate the line ignoreip in /etc/fail2ban/jail.conf (beginning of the file) and insert the ip&#039;s and / or blocks you want fail2ban to ignore, so you don&#039;t risk banning yourserf or any host in your network.&lt;br /&gt;
&lt;br /&gt;
Mine is defined as follows:&lt;br /&gt;
&lt;br /&gt;
 [DEFAULT]&lt;br /&gt;
 # &amp;quot;ignoreip&amp;quot; can be an IP address, a CIDR mask or a DNS host. Fail2ban will not&lt;br /&gt;
 # ban a host which matches an address in this list. Several addresses can be   &lt;br /&gt;
 # defined using space separator.                                               &lt;br /&gt;
 ignoreip = 127.0.0.1 192.168.80.1 192.168.80.0/24 &lt;br /&gt;
&lt;br /&gt;
To start fail2ban type the following as root:&lt;br /&gt;
&lt;br /&gt;
 /etc/init.d/fail2ban start&lt;br /&gt;
&lt;br /&gt;
Check It&lt;br /&gt;
&lt;br /&gt;
For LinuxMCE, there is needed &amp;quot;patch&amp;quot;, while fail2ban is not part of the distribution.&lt;br /&gt;
&lt;br /&gt;
When LinuxMCE starts, it runs /usr/pluto/bin/Network_Firewall.sh, and this is done AFTER /etc/init.d/fail2ban is started.&lt;br /&gt;
&lt;br /&gt;
So, edit /usr/pluto/bin/Network_Firewall.sh and add the following at the END of this file:&lt;br /&gt;
 &lt;br /&gt;
 /etc/init.d/fail2ban restart&lt;br /&gt;
&lt;br /&gt;
This will make sure that fail2bain is started AFTER the iptables rules from LinuxMCE.&lt;br /&gt;
&lt;br /&gt;
If started properly issue the following command to view your iptables rules:&lt;br /&gt;
&lt;br /&gt;
 iptables -L -v&lt;br /&gt;
&lt;br /&gt;
You should see something like the following for the INPUT chain (this is the ouput of mine)&lt;br /&gt;
&lt;br /&gt;
 Chain INPUT (policy DROP 2241 packets, 160K bytes)              &lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination         &lt;br /&gt;
   372 27264 &#039;&#039;&#039;fail2ban-SSH&#039;&#039;&#039;  tcp  --  any    any     anywhere             anywhere            tcp dpt:ssh                                                                                          &lt;br /&gt;
 1312K  991M &#039;&#039;&#039;fail2ban-ASTERISK&#039;&#039;&#039;  all  --  any    any     anywhere             anywhere            &lt;br /&gt;
  553K   81M ACCEPT     all  --  lo     any     anywhere             anywhere                    &lt;br /&gt;
 1288K 1162M ACCEPT     all  --  any    any     anywhere             anywhere            state RELATED,ESTABLISHED                                                                               &lt;br /&gt;
     9   540 ACCEPT     all  --  any    any     anywhere             anywhere            MARK match 0x1                                                                                          &lt;br /&gt;
     2  1152 ACCEPT     udp  --  any    any     anywhere             anywhere            udp   dpt:bootps                                                                                          &lt;br /&gt;
 19276 5790K ACCEPT     all  --  any    any     192.168.80.0/24      anywhere                    &lt;br /&gt;
     0     0 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:iax                                                                                             &lt;br /&gt;
     4  1795 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:sip                                                                                             &lt;br /&gt;
     0     0 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:2000                                                                                            &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:sieve                                                                                           &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:1723                                                                                            &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:www                                                                                             &lt;br /&gt;
     1    60 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:ssh                                                                                             &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:https                                                                                           &lt;br /&gt;
     1    50 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpts:10001:20000&lt;br /&gt;
     0     0 ACCEPT     gre  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain FORWARD (policy ACCEPT 719K packets, 245M bytes)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
     0     0 TCPMSS     tcp  --  any    ppp+    anywhere             anywhere            tcp flags:SYN,RST/SYN TCPMSS clamp to PMTU&lt;br /&gt;
 Chain OUTPUT (policy ACCEPT 2099K packets, 590M bytes)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
     0     0 ACCEPT     gre  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain &#039;&#039;&#039;fail2ban-ASTERISK&#039;&#039;&#039; (1 references)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
  5091 2125K DROP       all  --  any    any     173.193.194.106-static.reverse.softlayer.com  anywhere&lt;br /&gt;
 1307K  989M RETURN     all  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain &#039;&#039;&#039;fail2ban-SSH&#039;&#039;&#039; (1 references)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
&lt;br /&gt;
If you do not see something similar to that then you have some troubleshooting to, check out /var/log/fail2ban.log.&lt;br /&gt;
&lt;br /&gt;
Example of my /var/log/fai2ban.log (173.193.194.106 is the real address from the attacker fail2ban banned):&lt;br /&gt;
&lt;br /&gt;
 ....&lt;br /&gt;
 2010-09-19 11:12:56,131 fail2ban.filter : INFO   Set maxRetry = 6&lt;br /&gt;
 2010-09-19 11:12:56,133 fail2ban.filter : INFO   Set findtime = 600&lt;br /&gt;
 2010-09-19 11:12:56,133 fail2ban.actions: INFO   Set banTime = 600&lt;br /&gt;
 2010-09-19 11:12:56,138 fail2ban.jail   : INFO   Jail &#039;ssh-iptables&#039; started&lt;br /&gt;
 2010-09-19 11:12:56,139 fail2ban.jail   : INFO   Jail &#039;asterisk-iptables&#039; started&lt;br /&gt;
 2010-09-19 11:12:56,141 fail2ban.jail   : INFO   Jail &#039;apache-tcpwrapper&#039; started&lt;br /&gt;
 2010-09-19 15:33:50,392 fail2ban.actions: WARNING [asterisk-iptables] Ban 173.193.194.106&lt;br /&gt;
 2010-09-19 15:34:50,982 fail2ban.actions: WARNING [asterisk-iptables] 173.193.194.106 already banned&lt;br /&gt;
&lt;br /&gt;
And this is the log (/var/log/asterisk/messages) showing the attack:&lt;br /&gt;
&lt;br /&gt;
 [2010-09-19 15:33:48] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;3235410554&amp;quot;&amp;lt;sip:3235410554@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                           &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;thomas&amp;quot;&amp;lt;sip:thomas@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;arsenal&amp;quot;&amp;lt;sip:arsenal@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;letmein&amp;quot;&amp;lt;sip:letmein@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;liverpool&amp;quot;&amp;lt;sip:liverpool@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;nevermind&amp;quot;&amp;lt;sip:nevermind@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;getmein&amp;quot;&amp;lt;sip:getmein@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;echo&amp;quot;&amp;lt;sip:echo@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;bmw325&amp;quot;&amp;lt;sip:bmw325@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;bmw335&amp;quot;&amp;lt;sip:bmw335@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w3e&amp;quot;&amp;lt;sip:1q2w3e@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w3e4r5t6y&amp;quot;&amp;lt;sip:1q2w3e4r5t6y@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q1q2w2w&amp;quot;&amp;lt;sip:1q1q2w2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w1q2w&amp;quot;&amp;lt;sip:1q2w1q2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w&amp;quot;&amp;lt;sip:1q2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;11q22w&amp;quot;&amp;lt;sip:11q22w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;q1w2&amp;quot;&amp;lt;sip:q1w2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;q1w2e3&amp;quot;&amp;lt;sip:q1w2e3@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;tvv03tvv03&amp;quot;&amp;lt;sip:tvv03tvv03@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                           &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd1&amp;quot;&amp;lt;sip:abcd1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd12&amp;quot;&amp;lt;sip:abcd12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd123&amp;quot;&amp;lt;sip:abcd123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;qq11ww22ee33rr44&amp;quot;&amp;lt;sip:qq11ww22ee33rr44@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1&amp;quot;&amp;lt;sip:sip1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip2&amp;quot;&amp;lt;sip:sip2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip12&amp;quot;&amp;lt;sip:sip12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip123&amp;quot;&amp;lt;sip:sip123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1234&amp;quot;&amp;lt;sip:sip1234@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip12345&amp;quot;&amp;lt;sip:sip12345@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1111&amp;quot;&amp;lt;sip:sip1111@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip222&amp;quot;&amp;lt;sip:sip222@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1qa2ws3ed&amp;quot;&amp;lt;sip:1qa2ws3ed@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1234asdf&amp;quot;&amp;lt;sip:1234asdf@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1a2s3d&amp;quot;&amp;lt;sip:1a2s3d@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1a2s3d4f&amp;quot;&amp;lt;sip:1a2s3d4f@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;asdzxc&amp;quot;&amp;lt;sip:asdzxc@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;123zxc&amp;quot;&amp;lt;sip:123zxc@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1234zxcv&amp;quot;&amp;lt;sip:1234zxcv@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;aazzssxx&amp;quot;&amp;lt;sip:aazzssxx@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;p@ssword&amp;quot;&amp;lt;sip:p@ssword@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;p@ssw0rd&amp;quot;&amp;lt;sip:p@ssw0rd@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;pass1&amp;quot;&amp;lt;sip:pass1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;password3&amp;quot;&amp;lt;sip:password3@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;pass12&amp;quot;&amp;lt;sip:pass12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account&amp;quot;&amp;lt;sip:account@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;passlogin&amp;quot;&amp;lt;sip:passlogin@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account1&amp;quot;&amp;lt;sip:account1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account5&amp;quot;&amp;lt;sip:account5@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account6&amp;quot;&amp;lt;sip:account6@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account123&amp;quot;&amp;lt;sip:account123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account12&amp;quot;&amp;lt;sip:account12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc1&amp;quot;&amp;lt;sip:acc1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc2&amp;quot;&amp;lt;sip:acc2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc12&amp;quot;&amp;lt;sip:acc12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
&lt;br /&gt;
One last tip: you need a MTA, like sendmail or postfix, in order to receive the notifications from fail2ban.&lt;br /&gt;
&lt;br /&gt;
If you have a MTA installed and properly configured, nothing else is needed, but if not, install sendmail&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install sendmail&lt;br /&gt;
&lt;br /&gt;
Then edit the /etc/hosts file and change the line &#039;&#039;&#039;192.168.80.1 dcerouter&#039;&#039;&#039; to read &#039;&#039;&#039;192.168.80.1 dcerouter.localdomain dcerouter&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Doing it, sendmail will start as expected (fast) and mail will properly delivered. If this change is not done, sendmail will take a long time to start, because it does not find the qualified host name, as the log shows:&lt;br /&gt;
&lt;br /&gt;
 Sep 27 13:12:11 dcerouter sendmail[10585]: My unqualified host name (dcerouter) unknown; sleeping for retry&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I hope this wiki helps.&lt;br /&gt;
&lt;br /&gt;
source: &lt;br /&gt;
 http://www.fail2ban.org&lt;br /&gt;
 http://www.voip-info.org/wiki/view/Fail2Ban+(with+iptables)+And+Asterisk&lt;br /&gt;
 http://www.fail2ban.org/wiki/index.php/Asterisk&lt;br /&gt;
&lt;br /&gt;
More protection with iptables:&lt;br /&gt;
 http://sysadminman.net/blog/2010/limiting-sipiax-connections-to-asterisk-with-iptables-1082&lt;/div&gt;</summary>
		<author><name>Pw44</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=Fail2ban_-_A_tool_against_brute_force&amp;diff=33888</id>
		<title>Fail2ban - A tool against brute force</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=Fail2ban_-_A_tool_against_brute_force&amp;diff=33888"/>
		<updated>2013-02-23T05:51:58Z</updated>

		<summary type="html">&lt;p&gt;Pw44: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: Networking|Firewall, fail2ban]]&lt;br /&gt;
{{versioninfo|810Status=Works|810UpdatedDate=5 October 2010|810UpdatedBy=pw44}}&lt;br /&gt;
&lt;br /&gt;
Having asterik installed is almost an invitation for others wishing to place calls at your expense.&lt;br /&gt;
&lt;br /&gt;
After configuring my sip trunk, it did not take 2 days and some &amp;quot;smart guy&amp;quot;  was trying to register to take advantage of it, and causing me losses.&lt;br /&gt;
&lt;br /&gt;
Fail2ban prevented it, blocking the attacker with iptables rules.&lt;br /&gt;
&lt;br /&gt;
Installing fail2ban is not complicated and i will describe the steps to have it properly installed and configured, so you can protect your asterisk and other services from brute force attack.&lt;br /&gt;
&lt;br /&gt;
Files under /etc/asterisk/ are owned by the asterisk user, so preceed any edit commands with&lt;br /&gt;
 sudo -u asterisk &amp;lt;command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
on Linuxmce 1004 no need to edit sip.conf  this is implemented on asterisk realtime database.&lt;br /&gt;
&lt;br /&gt;
The first thing to do is edit /etc/asterisk/sip.conf and add the following line:&lt;br /&gt;
 alwaysauthreject=yes                                                 &lt;br /&gt;
My sip.conf file looks like:&lt;br /&gt;
 ............&lt;br /&gt;
 [general]&lt;br /&gt;
 #include sip_general_additional.conf&lt;br /&gt;
 &lt;br /&gt;
 bindport = 5060       ; Port to bind to (SIP is 5060)&lt;br /&gt;
 bindaddr = 0.0.0.0    ; Address to bind to (all addresses on machine)&lt;br /&gt;
 &#039;&#039;&#039;alwaysauthreject=yes&#039;&#039;&#039;                                                 &lt;br /&gt;
 disallow=all                                                         &lt;br /&gt;
 allow=ulaw                                                           &lt;br /&gt;
 allow=alaw  &lt;br /&gt;
 .............                    &lt;br /&gt;
Install fail2ban with: &lt;br /&gt;
 sudo apt-get install fail2ban&lt;br /&gt;
&lt;br /&gt;
After is installed, you need to change /etc/asterisk/logger.conf and add the following line under [general] section (You may have to create this before the [logfiles] section). &lt;br /&gt;
&lt;br /&gt;
 [general]&lt;br /&gt;
 dateformat=%F %T&lt;br /&gt;
&lt;br /&gt;
In /etc/asterisk/logger.conf add the following line under the [logfiles] section for asterisk to log NOTICE level events to the syslog (/var/log/messages) as well as its normal log file. These entries in syslog will have a Date/Time stamp that is usable by fail2ban.&lt;br /&gt;
&lt;br /&gt;
 syslog.local0 =&amp;gt; notice &lt;br /&gt;
&lt;br /&gt;
Reload asterisk, as root, with:&lt;br /&gt;
&lt;br /&gt;
 sudo asterisk -rx &amp;quot;logger reload&amp;quot; &lt;br /&gt;
&lt;br /&gt;
Configuring fail2ban:&lt;br /&gt;
&lt;br /&gt;
 cd /etc/fail2ban/filter.d&lt;br /&gt;
&lt;br /&gt;
 touch asterisk.conf &lt;br /&gt;
&lt;br /&gt;
 vi asterisk.conf&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR ASTERISK 1.&#039;&#039;&#039;4, insert the following (copy &amp;amp; paste)&lt;br /&gt;
&lt;br /&gt;
 # Fail2Ban configuration file (for asterisk 1.4)&lt;br /&gt;
 #&lt;br /&gt;
 #&lt;br /&gt;
 # $Revision: 250 $&lt;br /&gt;
 #&lt;br /&gt;
 [INCLUDES]&lt;br /&gt;
 # Read common prefixes. If any customizations available -- read them from&lt;br /&gt;
 # common.local&lt;br /&gt;
 #before = common.conf&lt;br /&gt;
 [Definition]&lt;br /&gt;
 #_daemon = asterisk&lt;br /&gt;
 # Option:  failregex&lt;br /&gt;
 # Notes.:  regex to match the password failures messages in the logfile. The&lt;br /&gt;
 #          host must be matched by a group named &amp;quot;host&amp;quot;. The tag &amp;quot;&amp;lt;HOST&amp;gt;&amp;quot; can&lt;br /&gt;
 #          be used for standard IP/hostname matching and is only an alias for&lt;br /&gt;
 #          (?:::f{4,6}:)?(?P&amp;lt;host&amp;gt;\S+)&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 failregex = NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Wrong password&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - No matching peer found&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Username/auth name mismatch&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Device does not match ACL&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&amp;quot; .* failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Peer is not supposed to register&lt;br /&gt;
             NOTICE.* &amp;lt;HOST&amp;gt; failed to authenticate as &#039;.*&#039;$&lt;br /&gt;
             NOTICE.* .*: No registration for peer &#039;.*&#039; \(from &amp;lt;HOST&amp;gt;\)&lt;br /&gt;
             NOTICE.* .*: Host &amp;lt;HOST&amp;gt; failed MD5 authentication for &#039;.*&#039; (.*)&lt;br /&gt;
             NOTICE.* .*: Failed to authenticate user .*@&amp;lt;HOST&amp;gt;.*&lt;br /&gt;
 # Option:  ignoreregex&lt;br /&gt;
 # Notes.:  regex to ignore. If this regex matches, the line is ignored.&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 ignoreregex =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOR ASTERISK 1.8&#039;&#039;&#039;, insert the following (copy &amp;amp; paste)&lt;br /&gt;
&lt;br /&gt;
# Fail2Ban configuration file&lt;br /&gt;
#&lt;br /&gt;
#&lt;br /&gt;
# $Revision: 250 $&lt;br /&gt;
#&lt;br /&gt;
[INCLUDES]&lt;br /&gt;
# Read common prefixes. If any customizations available -- read them from&lt;br /&gt;
# common.local&lt;br /&gt;
#before = common.conf&lt;br /&gt;
[Definition]&lt;br /&gt;
#_daemon = asterisk&lt;br /&gt;
# Option:  failregex&lt;br /&gt;
# Notes.:  regex to match the password failures messages in the logfile. The&lt;br /&gt;
#          host must be matched by a group named &amp;quot;host&amp;quot;. The tag &amp;quot;&amp;lt;HOST&amp;gt;&amp;quot; can&lt;br /&gt;
#          be used for standard IP/hostname matching and is only an alias for&lt;br /&gt;
#          (?:::f{4,6}:)?(?P&amp;lt;host&amp;gt;\S+)&lt;br /&gt;
# Values:  TEXT&lt;br /&gt;
#&lt;br /&gt;
failregex = NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;:.*&#039; - Wrong password&lt;br /&gt;
            NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;:.*&#039; - No matching peer found&lt;br /&gt;
            NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;:.*&#039; - No matching peer found&lt;br /&gt;
            NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;:.*&#039; - Username/auth name mismatch&lt;br /&gt;
            NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;:.*&#039; - Device does not match ACL&lt;br /&gt;
            NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;:.*&#039; - Peer is not supposed to register&lt;br /&gt;
            NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;:.*&#039; - ACL error (permit/deny)&lt;br /&gt;
            NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;:.*&#039; - Device does not match ACL&lt;br /&gt;
            NOTICE.* .*: Registration from &#039;\&amp;quot;.*\&amp;quot;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;:.*&#039; - No matching peer found&lt;br /&gt;
            NOTICE.* .*: Registration from &#039;\&amp;quot;.*\&amp;quot;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;:.*&#039; - Wrong password&lt;br /&gt;
            NOTICE.* &amp;lt;HOST&amp;gt; failed to authenticate as &#039;.*&#039;$&lt;br /&gt;
            NOTICE.* .*: No registration for peer &#039;.*&#039; \(from &amp;lt;HOST&amp;gt;\)&lt;br /&gt;
            NOTICE.* .*: Host &amp;lt;HOST&amp;gt; failed MD5 authentication for &#039;.*&#039; (.*)&lt;br /&gt;
            NOTICE.* .*: Failed to authenticate user .*@&amp;lt;HOST&amp;gt;.*&lt;br /&gt;
            NOTICE.* .*: &amp;lt;HOST&amp;gt; failed to authenticate as &#039;.*&#039;&lt;br /&gt;
            NOTICE.* .*: &amp;lt;HOST&amp;gt; tried  to authenticate with nonexistent user &#039;.*&#039;&lt;br /&gt;
            VERBOSE.*SIP/&amp;lt;HOST&amp;gt;-.*Received incoming SIP connection from unknown peer&lt;br /&gt;
   &lt;br /&gt;
# Option:  ignoreregex&lt;br /&gt;
# Notes.:  regex to ignore. If this regex matches, the line is ignored.&lt;br /&gt;
# Values:  TEXT&lt;br /&gt;
#&lt;br /&gt;
ignoreregex =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next edit /etc/fail2ban/jail.conf to include the following section so that it uses the new filter. &lt;br /&gt;
&lt;br /&gt;
 [asterisk-iptables]&lt;br /&gt;
 enabled  = true&lt;br /&gt;
 filter   = asterisk&lt;br /&gt;
 action   = iptables-allports[name=ASTERISK, protocol=all]&lt;br /&gt;
            sendmail-whois[name=ASTERISK, dest=root, sender=fail2ban@example.org]&lt;br /&gt;
 logpath  = /var/log/asterisk/full&lt;br /&gt;
 maxretry = 2&lt;br /&gt;
 bantime = 259200&lt;br /&gt;
&lt;br /&gt;
Locate the line ignoreip in /etc/fail2ban/jail.conf (beginning of the file) and insert the ip&#039;s and / or blocks you want fail2ban to ignore, so you don&#039;t risk banning yourserf or any host in your network.&lt;br /&gt;
&lt;br /&gt;
Mine is defined as follows:&lt;br /&gt;
&lt;br /&gt;
 [DEFAULT]&lt;br /&gt;
 # &amp;quot;ignoreip&amp;quot; can be an IP address, a CIDR mask or a DNS host. Fail2ban will not&lt;br /&gt;
 # ban a host which matches an address in this list. Several addresses can be   &lt;br /&gt;
 # defined using space separator.                                               &lt;br /&gt;
 ignoreip = 127.0.0.1 192.168.80.1 192.168.80.0/24 &lt;br /&gt;
&lt;br /&gt;
To start fail2ban type the following as root:&lt;br /&gt;
&lt;br /&gt;
 /etc/init.d/fail2ban start&lt;br /&gt;
&lt;br /&gt;
Check It&lt;br /&gt;
&lt;br /&gt;
For LinuxMCE, there is needed &amp;quot;patch&amp;quot;, while fail2ban is not part of the distribution.&lt;br /&gt;
&lt;br /&gt;
When LinuxMCE starts, it runs /usr/pluto/bin/Network_Firewall.sh, and this is done AFTER /etc/init.d/fail2ban is started.&lt;br /&gt;
&lt;br /&gt;
So, edit /usr/pluto/bin/Network_Firewall.sh and add the following at the END of this file:&lt;br /&gt;
 &lt;br /&gt;
 /etc/init.d/fail2ban restart&lt;br /&gt;
&lt;br /&gt;
This will make sure that fail2bain is started AFTER the iptables rules from LinuxMCE.&lt;br /&gt;
&lt;br /&gt;
If started properly issue the following command to view your iptables rules:&lt;br /&gt;
&lt;br /&gt;
 iptables -L -v&lt;br /&gt;
&lt;br /&gt;
You should see something like the following for the INPUT chain (this is the ouput of mine)&lt;br /&gt;
&lt;br /&gt;
 Chain INPUT (policy DROP 2241 packets, 160K bytes)              &lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination         &lt;br /&gt;
   372 27264 &#039;&#039;&#039;fail2ban-SSH&#039;&#039;&#039;  tcp  --  any    any     anywhere             anywhere            tcp dpt:ssh                                                                                          &lt;br /&gt;
 1312K  991M &#039;&#039;&#039;fail2ban-ASTERISK&#039;&#039;&#039;  all  --  any    any     anywhere             anywhere            &lt;br /&gt;
  553K   81M ACCEPT     all  --  lo     any     anywhere             anywhere                    &lt;br /&gt;
 1288K 1162M ACCEPT     all  --  any    any     anywhere             anywhere            state RELATED,ESTABLISHED                                                                               &lt;br /&gt;
     9   540 ACCEPT     all  --  any    any     anywhere             anywhere            MARK match 0x1                                                                                          &lt;br /&gt;
     2  1152 ACCEPT     udp  --  any    any     anywhere             anywhere            udp   dpt:bootps                                                                                          &lt;br /&gt;
 19276 5790K ACCEPT     all  --  any    any     192.168.80.0/24      anywhere                    &lt;br /&gt;
     0     0 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:iax                                                                                             &lt;br /&gt;
     4  1795 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:sip                                                                                             &lt;br /&gt;
     0     0 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:2000                                                                                            &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:sieve                                                                                           &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:1723                                                                                            &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:www                                                                                             &lt;br /&gt;
     1    60 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:ssh                                                                                             &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:https                                                                                           &lt;br /&gt;
     1    50 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpts:10001:20000&lt;br /&gt;
     0     0 ACCEPT     gre  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain FORWARD (policy ACCEPT 719K packets, 245M bytes)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
     0     0 TCPMSS     tcp  --  any    ppp+    anywhere             anywhere            tcp flags:SYN,RST/SYN TCPMSS clamp to PMTU&lt;br /&gt;
 Chain OUTPUT (policy ACCEPT 2099K packets, 590M bytes)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
     0     0 ACCEPT     gre  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain &#039;&#039;&#039;fail2ban-ASTERISK&#039;&#039;&#039; (1 references)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
  5091 2125K DROP       all  --  any    any     173.193.194.106-static.reverse.softlayer.com  anywhere&lt;br /&gt;
 1307K  989M RETURN     all  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain &#039;&#039;&#039;fail2ban-SSH&#039;&#039;&#039; (1 references)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
&lt;br /&gt;
If you do not see something similar to that then you have some troubleshooting to, check out /var/log/fail2ban.log.&lt;br /&gt;
&lt;br /&gt;
Example of my /var/log/fai2ban.log (173.193.194.106 is the real address from the attacker fail2ban banned):&lt;br /&gt;
&lt;br /&gt;
 ....&lt;br /&gt;
 2010-09-19 11:12:56,131 fail2ban.filter : INFO   Set maxRetry = 6&lt;br /&gt;
 2010-09-19 11:12:56,133 fail2ban.filter : INFO   Set findtime = 600&lt;br /&gt;
 2010-09-19 11:12:56,133 fail2ban.actions: INFO   Set banTime = 600&lt;br /&gt;
 2010-09-19 11:12:56,138 fail2ban.jail   : INFO   Jail &#039;ssh-iptables&#039; started&lt;br /&gt;
 2010-09-19 11:12:56,139 fail2ban.jail   : INFO   Jail &#039;asterisk-iptables&#039; started&lt;br /&gt;
 2010-09-19 11:12:56,141 fail2ban.jail   : INFO   Jail &#039;apache-tcpwrapper&#039; started&lt;br /&gt;
 2010-09-19 15:33:50,392 fail2ban.actions: WARNING [asterisk-iptables] Ban 173.193.194.106&lt;br /&gt;
 2010-09-19 15:34:50,982 fail2ban.actions: WARNING [asterisk-iptables] 173.193.194.106 already banned&lt;br /&gt;
&lt;br /&gt;
And this is the log (/var/log/asterisk/messages) showing the attack:&lt;br /&gt;
&lt;br /&gt;
 [2010-09-19 15:33:48] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;3235410554&amp;quot;&amp;lt;sip:3235410554@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                           &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;thomas&amp;quot;&amp;lt;sip:thomas@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;arsenal&amp;quot;&amp;lt;sip:arsenal@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;letmein&amp;quot;&amp;lt;sip:letmein@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;liverpool&amp;quot;&amp;lt;sip:liverpool@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;nevermind&amp;quot;&amp;lt;sip:nevermind@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;getmein&amp;quot;&amp;lt;sip:getmein@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;echo&amp;quot;&amp;lt;sip:echo@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;bmw325&amp;quot;&amp;lt;sip:bmw325@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;bmw335&amp;quot;&amp;lt;sip:bmw335@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w3e&amp;quot;&amp;lt;sip:1q2w3e@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w3e4r5t6y&amp;quot;&amp;lt;sip:1q2w3e4r5t6y@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q1q2w2w&amp;quot;&amp;lt;sip:1q1q2w2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w1q2w&amp;quot;&amp;lt;sip:1q2w1q2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w&amp;quot;&amp;lt;sip:1q2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;11q22w&amp;quot;&amp;lt;sip:11q22w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;q1w2&amp;quot;&amp;lt;sip:q1w2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;q1w2e3&amp;quot;&amp;lt;sip:q1w2e3@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;tvv03tvv03&amp;quot;&amp;lt;sip:tvv03tvv03@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                           &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd1&amp;quot;&amp;lt;sip:abcd1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd12&amp;quot;&amp;lt;sip:abcd12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd123&amp;quot;&amp;lt;sip:abcd123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;qq11ww22ee33rr44&amp;quot;&amp;lt;sip:qq11ww22ee33rr44@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1&amp;quot;&amp;lt;sip:sip1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip2&amp;quot;&amp;lt;sip:sip2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip12&amp;quot;&amp;lt;sip:sip12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip123&amp;quot;&amp;lt;sip:sip123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1234&amp;quot;&amp;lt;sip:sip1234@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip12345&amp;quot;&amp;lt;sip:sip12345@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1111&amp;quot;&amp;lt;sip:sip1111@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip222&amp;quot;&amp;lt;sip:sip222@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1qa2ws3ed&amp;quot;&amp;lt;sip:1qa2ws3ed@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1234asdf&amp;quot;&amp;lt;sip:1234asdf@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1a2s3d&amp;quot;&amp;lt;sip:1a2s3d@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1a2s3d4f&amp;quot;&amp;lt;sip:1a2s3d4f@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;asdzxc&amp;quot;&amp;lt;sip:asdzxc@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;123zxc&amp;quot;&amp;lt;sip:123zxc@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1234zxcv&amp;quot;&amp;lt;sip:1234zxcv@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;aazzssxx&amp;quot;&amp;lt;sip:aazzssxx@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;p@ssword&amp;quot;&amp;lt;sip:p@ssword@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;p@ssw0rd&amp;quot;&amp;lt;sip:p@ssw0rd@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;pass1&amp;quot;&amp;lt;sip:pass1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;password3&amp;quot;&amp;lt;sip:password3@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;pass12&amp;quot;&amp;lt;sip:pass12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account&amp;quot;&amp;lt;sip:account@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;passlogin&amp;quot;&amp;lt;sip:passlogin@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account1&amp;quot;&amp;lt;sip:account1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account5&amp;quot;&amp;lt;sip:account5@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account6&amp;quot;&amp;lt;sip:account6@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account123&amp;quot;&amp;lt;sip:account123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account12&amp;quot;&amp;lt;sip:account12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc1&amp;quot;&amp;lt;sip:acc1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc2&amp;quot;&amp;lt;sip:acc2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc12&amp;quot;&amp;lt;sip:acc12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
&lt;br /&gt;
One last tip: you need a MTA, like sendmail or postfix, in order to receive the notifications from fail2ban.&lt;br /&gt;
&lt;br /&gt;
If you have a MTA installed and properly configured, nothing else is needed, but if not, install sendmail&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install sendmail&lt;br /&gt;
&lt;br /&gt;
Then edit the /etc/hosts file and change the line &#039;&#039;&#039;192.168.80.1 dcerouter&#039;&#039;&#039; to read &#039;&#039;&#039;192.168.80.1 dcerouter.localdomain dcerouter&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Doing it, sendmail will start as expected (fast) and mail will properly delivered. If this change is not done, sendmail will take a long time to start, because it does not find the qualified host name, as the log shows:&lt;br /&gt;
&lt;br /&gt;
 Sep 27 13:12:11 dcerouter sendmail[10585]: My unqualified host name (dcerouter) unknown; sleeping for retry&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I hope this wiki helps.&lt;br /&gt;
&lt;br /&gt;
source: &lt;br /&gt;
 http://www.fail2ban.org&lt;br /&gt;
 http://www.voip-info.org/wiki/view/Fail2Ban+(with+iptables)+And+Asterisk&lt;br /&gt;
 http://www.fail2ban.org/wiki/index.php/Asterisk&lt;br /&gt;
&lt;br /&gt;
More protection with iptables:&lt;br /&gt;
 http://sysadminman.net/blog/2010/limiting-sipiax-connections-to-asterisk-with-iptables-1082&lt;/div&gt;</summary>
		<author><name>Pw44</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=Linksys_SPA3102&amp;diff=33295</id>
		<title>Linksys SPA3102</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=Linksys_SPA3102&amp;diff=33295"/>
		<updated>2012-10-25T18:57:13Z</updated>

		<summary type="html">&lt;p&gt;Pw44: /* PSTN Tab */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: Hardware]]&lt;br /&gt;
[[Category:Telecom]]&lt;br /&gt;
[[Category:VoIP]]&lt;br /&gt;
[[Category:ATA]]&lt;br /&gt;
{| align=&amp;quot;right&amp;quot;&lt;br /&gt;
  | __TOC__&lt;br /&gt;
  |}&lt;br /&gt;
&lt;br /&gt;
====Background====&lt;br /&gt;
The Linksys SPA3102/Sipura 3000 PSTN Gateways feature the ability to connect a standard telephone landline to IP-based data networks and can be configured as a SIP trunk for use with your LinuxMCE built-in telephony system. &lt;br /&gt;
&lt;br /&gt;
Due to the area in which I live, there are no viable High Speed DSL/CABLE or other types of internet. I only have access to Satellite Internet, which due to the nature of the beast, has a very high latency (900 - 1400ms average) and I can not use a traditional VOIP provider like Broadvoice, Vonage, or the like. However as the telephony feature of LinuxMCE is a very cool perk to this system, I figured I would have a go at integrating my analog Verizon landline into the system. To create this SIP/Bridge I chose the Linksys SPA3102, however after scanning the FreePBX forums, I can assume they will work well with the Sipura 3000 as well. After many hours of breaking, and then fixing my phone setup, I have a working viable solution, and these steps will detail how to set up this product for use with LinuxMCE. Some of these settings are borrowed from the existing wiki&#039;s here on these products, but after using them and failing, I had a go on my own. as always if there is a better more efficient way to accomplish this, please EDIT this wiki. I am by no means an expert. :)&lt;br /&gt;
&lt;br /&gt;
{{p}}&lt;br /&gt;
&lt;br /&gt;
=Required items to complete this process.=&lt;br /&gt;
&lt;br /&gt;
*Linksys SPA3102 or Sipura SPA3000 - Average price between $40 and $80, depending on your source. I used Newegg, because &amp;quot;Once you&#039;ve NewEgged....&amp;quot;&lt;br /&gt;
** [http://www.newegg.com/Product/Product.aspx?Item=N82E16833124239&amp;amp;Tpk=spa3102 Linksys SPA3102]&lt;br /&gt;
* A laptop, netboox, or PC you can temporarily connect a network cable to the LAN port on the device&lt;br /&gt;
* A web browser for configuring the SPA and the Phone Lines in LinuxMCE webmin.&lt;br /&gt;
* The following file: [http://dataless.jeromenet.org/filespace/spa3102.tar.gz spa3102.tar.gz]&lt;br /&gt;
* Any hardwired old school phone, with touchtone.&lt;br /&gt;
&lt;br /&gt;
{{p}}&lt;br /&gt;
&lt;br /&gt;
=Setting up with LinuxMCE=&lt;br /&gt;
&lt;br /&gt;
====Adding the new config files to your core.====&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;No longer needed, config files added to LinuxMCE 810.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Download the above file to a location of your choice&lt;br /&gt;
** wget http://dataless.jeromenet.org/filespace/spa3102.tar.gz&lt;br /&gt;
* Extract/Copy/Modify the files&lt;br /&gt;
** tar zxvf spa3102.tar.gz&lt;br /&gt;
** chmod a+x create_amp_spa3102.pl&lt;br /&gt;
** sudo cp create_amp_spa3102.pl /usr/pluto/bin&lt;br /&gt;
** sudo cp provider_list.txt /etc/asterisk&lt;br /&gt;
*** This file is default plus my addition, if you have already modified your /etc/asterisk/provider_list.txt, you can also simply add the line:&lt;br /&gt;
*** Linksys SPA3102/SPA3000         http://www.cisco.com/en/US/products/ps10027     spa3102 SIP  (tab seperated)&lt;br /&gt;
First steps completed.&lt;br /&gt;
&lt;br /&gt;
{{p}}&lt;br /&gt;
&lt;br /&gt;
====Adding your new Phone Line====&lt;br /&gt;
* Log into the webadmin of your core&lt;br /&gt;
* From the left hand panel, choose &amp;quot;Phone Lines&amp;quot;&lt;br /&gt;
* In the right panel, using the drop downs, select the new &amp;quot;Linksys SPA3102/SPA300&amp;quot; option.&lt;br /&gt;
* You will now be presented with 4 boxes to enter data. use the settings I have below here. (They are not UberSecure, and you can change them to what you like, just remember the username and password for later, when we configure the SPA itself)&lt;br /&gt;
** Username: spa3102&lt;br /&gt;
** Password: lmce&lt;br /&gt;
** Phone Number: &amp;lt;insert your 10 digit phone number, including your area code, like 5553221234&amp;gt; Very important, sets up routing, caller ID, etc.&lt;br /&gt;
** Host: dynamic &amp;lt;later in this wiki, when setting up the SPA, we will be setting a manual IP address, but this dynamic setting now, works some magic, lets leave it that way.&amp;gt;&lt;br /&gt;
** Save the file&lt;br /&gt;
Second steps completed. Congratulations, you just set up your FreePBX trunk!! Beer.&lt;br /&gt;
&lt;br /&gt;
{{p}}&lt;br /&gt;
&lt;br /&gt;
=Setting up the SPA3102/SPA3000=&lt;br /&gt;
&lt;br /&gt;
====Factory reset your device (just to be on the same page.)====&lt;br /&gt;
* Plug your hardwire phone into the &amp;quot;Phone&amp;quot; jack on the SPA.&lt;br /&gt;
* Pick up the receiver on your hardwired phone&lt;br /&gt;
** Dial ****&lt;br /&gt;
** When the voice comes on dial 7 3 7 3 8#&lt;br /&gt;
** When prompted to confirm, press 1&lt;br /&gt;
Factory reset complete!&lt;br /&gt;
&lt;br /&gt;
* Plug a network cable from the &amp;quot;WAN&amp;quot; port on the SPA to the internal network on your core.&lt;br /&gt;
* Plug a phone cable into the &amp;quot;Line&amp;quot; jack on the SPA to your wall jack.&lt;br /&gt;
* Plug a network cable into the &amp;quot;LAN&amp;quot; port on the SPA into your laptop, netbook, or PC.&lt;br /&gt;
** Once your device gets an IP address from the SPA, point your browser to http://192.168.0.1&lt;br /&gt;
*** By default the SPA has no passwords set for User, or Admin.&lt;br /&gt;
{{p}}&lt;br /&gt;
&lt;br /&gt;
====WAN Setup====&lt;br /&gt;
&lt;br /&gt;
* Using the image below, set up all the areas in yellow - Summary:&lt;br /&gt;
** Static IP&lt;br /&gt;
** IP - 192.168.80.200&lt;br /&gt;
** Netmask - 255.255.255.0&lt;br /&gt;
** Gateway - 192.168.80.1&lt;br /&gt;
** Hostname - SPA3102&lt;br /&gt;
** Primary DNS - 192.168.80.1&lt;br /&gt;
** Primary NTP - 192.168.80.1&lt;br /&gt;
** Set WAN server to &amp;quot;Yes&amp;quot;&lt;br /&gt;
You can now, and always remember to, click &amp;quot;Apply All Changes&amp;quot; at the bottom, and if you like, disconnect your device from the LAN port, and re-connect to it from your MD or regular PC.&lt;br /&gt;
&lt;br /&gt;
[[Image:Spa3102-wan-setup.png]]&lt;br /&gt;
{{p}}&lt;br /&gt;
&lt;br /&gt;
====SIP Setup====&lt;br /&gt;
&lt;br /&gt;
* The only thing we need to change here is the RTP packet size&lt;br /&gt;
** RTP Parameters&lt;br /&gt;
*** RTP Packet Size - 0.020  - !!! Very important to do this !!!&lt;br /&gt;
&lt;br /&gt;
[[Image:Spa3102-sip-status.png]]&lt;br /&gt;
{{p}}&lt;br /&gt;
&lt;br /&gt;
====Regional Set Up====&lt;br /&gt;
&lt;br /&gt;
* Clear out all Vertical Service Activation Codes - We want FreePBX/LMCE to control these.&lt;br /&gt;
** Vertical Service Activation Codes&lt;br /&gt;
*** Clear out all codes like shown below.&lt;br /&gt;
&lt;br /&gt;
[[Image:Spa3102-regional-status.png]]&lt;br /&gt;
{{p}}&lt;br /&gt;
&lt;br /&gt;
====PSTN Tab====&lt;br /&gt;
&lt;br /&gt;
* Using the image below, set up all the areas in yellow - Summary:&lt;br /&gt;
** Line Enable - Yes&lt;br /&gt;
** SIP Settings&lt;br /&gt;
*** SIP port - 5061&lt;br /&gt;
** Proxy Settings&lt;br /&gt;
*** Proxy - 192.168.80.1&lt;br /&gt;
*** Register Expires - 300&lt;br /&gt;
*** Make Call Without Reg - Yes&lt;br /&gt;
*** Ans Call Without Reg - Yes&lt;br /&gt;
** Subscriber Settings&lt;br /&gt;
*** Display Name - Unknown Caller (this is what is displayed when a call comes in without caller ID info)&lt;br /&gt;
*** UserID - spa3102 (this is what you set when creating the Phone Line in the LinuxMCE webmin)&lt;br /&gt;
*** Password - lmce (this is what you set when creating the Phone Line in the LinuxMCE webmin)&lt;br /&gt;
** Dial Plans&lt;br /&gt;
*** A note here, do not change any of the default (xx.) settings other than Dial Plan 2 !!&lt;br /&gt;
**** Dial Plan 2 - (S0&amp;lt;:XXXXXXXXXX&amp;gt;) - where the X&#039;s are your 10 digit phone number including area code. - note to, that is a zero beside the S&lt;br /&gt;
** VoIP-To-PSTN Gateway Setup&lt;br /&gt;
*** VoIP-To-PSTN Gateway Enable - Yes&lt;br /&gt;
*** VoIP Caller Auth Method - None&lt;br /&gt;
*** VoIP PIN Max Retry - 3&lt;br /&gt;
*** One Stage Dialing - Yes  - Extremely inportant setting !!!&lt;br /&gt;
*** Line 1 VoIP Caller DP - none&lt;br /&gt;
*** VoIP Caller Default DP - none&lt;br /&gt;
*** Line 1 Fallback DP - none&lt;br /&gt;
** PSTN-To-VoIP Gateway Setup&lt;br /&gt;
*** PSTN-To-VoIP Gateway Enable - Yes&lt;br /&gt;
*** PSTN Caller Auth Method - none&lt;br /&gt;
*** PSTN Ring Thru Line 1 - No&lt;br /&gt;
*** PSTN PIN Max Retry - 3&lt;br /&gt;
*** PSTN CID For VoIP CID - Yes&lt;br /&gt;
*** PSTN Caller Default DP - 2&lt;br /&gt;
*** Off Hook While Calling VoIP - No&lt;br /&gt;
*** Line 1 Signal Hook Flash To PSTN - Disabled&lt;br /&gt;
** FXO Timer Values (sec)&lt;br /&gt;
*** VoIP Answer Delay - 0 (zero)&lt;br /&gt;
*** PSTN Answer Delay - 3&lt;br /&gt;
*** Detect CPC - No&lt;br /&gt;
** Don&#039;t forget to &amp;quot;Submit All Changes&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;For LinuxMCE 10.04 ------- CHANGE THE FOLLOWING:&#039;&#039;&#039; Thx to gbutters&lt;br /&gt;
 &lt;br /&gt;
*** Subscriber Information&lt;br /&gt;
*** &#039;&#039;&#039;User ID: XXXXXXXXXX &amp;lt;- your phone number including area code&#039;&#039;&#039; &lt;br /&gt;
*** &#039;&#039;&#039;Use Auth ID:   yes&#039;&#039;&#039;&lt;br /&gt;
*** &#039;&#039;&#039;Auth ID:   XXXXXXXXXX &amp;lt;- your phone number including area code&#039;&#039;&#039;  &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
PSTN Tab setup complete!!! Congratualtions!! Beer!&lt;br /&gt;
&lt;br /&gt;
[[Image:Spa3102-pstn-1.png]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Spa3102-pstn-2.png]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Spa3102-pstn-3.png]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Spa3102-pstn-4.png]]&lt;br /&gt;
&lt;br /&gt;
{{p}}&lt;br /&gt;
&lt;br /&gt;
=Troubleshooting=&lt;br /&gt;
&lt;br /&gt;
====Dial Rules vs Dial Patterns====&lt;br /&gt;
&lt;br /&gt;
One of the first issues I came across, was getting the &amp;quot;Your call can not be completed as dialed&amp;quot;, and the &amp;quot;All circuits are busy now&amp;quot; Messages.&lt;br /&gt;
Here is what I did to overcome them.&lt;br /&gt;
&lt;br /&gt;
* Dial Rules&lt;br /&gt;
** Log into the LinuxMCE webmin&lt;br /&gt;
*** From the top click Advanced &amp;gt; Configuration &amp;gt; Phones setup to get to the FreePBX admin screen.&lt;br /&gt;
*** In the left click on trunks&lt;br /&gt;
**** In the right click on the trunk you created for the spa3102&lt;br /&gt;
**** Look for Dial Rules:&lt;br /&gt;
**** Clear everything that is in it&lt;br /&gt;
**** Scroll to bottom, click &amp;quot;Submit Changes&amp;quot;&lt;br /&gt;
**** At the top of the FreePBX screen click &amp;quot;Apply Configuration Changes&amp;quot;&lt;br /&gt;
This does several things, including eliminating your significant other saying &amp;quot;Why do I have to Dial a 9 and a 1 to call next door&amp;quot; :)&lt;br /&gt;
&lt;br /&gt;
* Dial Patterns&lt;br /&gt;
** In the left click &amp;quot;Outbound Routes&amp;quot;&lt;br /&gt;
** In the right, click the button for your spa3102 outbound routes&lt;br /&gt;
An explanation here as to the difference between Dial Patterns, and Dial Rules.&lt;br /&gt;
&lt;br /&gt;
Dial Rules are used to add a number/character to, or strip a number/character away from anything dialed on any extension in your home. I did not need anything like this as to dial long distance, I only need enter the area code and the number, no 1 and certainly no 9.&lt;br /&gt;
Dial patterns are how FreePBX knows how to send a particular call to a route. You may have a route just for local long distance, and you may have a route for international calls, and then another for local calls.&lt;br /&gt;
In my cituation, I only need 911, local 7 digit numbers, and long distance 10 digit numbers, so here is what is in my outbound route Dial Pattern:&lt;br /&gt;
** N11  - For 911&lt;br /&gt;
** NXXNXXXXXX - For 10 digit long distance&lt;br /&gt;
** NXXXXXX - for regular old 7 digit local calls&lt;br /&gt;
&lt;br /&gt;
That is it. I only have one trunk, and I only need it to do those 3 types of calls, so why complicate it right?&lt;br /&gt;
There is way more information available at:&lt;br /&gt;
&lt;br /&gt;
[http://support.freepbx.org FreePBX support/Wiki/Forums].&lt;br /&gt;
&lt;br /&gt;
{{p}}&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
You should now see something like this when looking at the &amp;quot;Info&amp;quot; tab:&lt;br /&gt;
&lt;br /&gt;
[[Image:Spa3102-pstn-status.png]]&lt;br /&gt;
&lt;br /&gt;
You will notice here that I did not have my phone line plugged in at the time, LMCE was answering calls, and I had not had the routuing set up the way I want.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
All required settings should now be applied. Try to make a test call. If your MD&#039;s are not set up for making some calls, try an IP phone if you have one, or a SIP device, like an Ekiga softphone [[Ekiga]]&lt;br /&gt;
&lt;br /&gt;
In addition to the PSTN setup, I will also do a wiki on configuring the &amp;quot;Phone&amp;quot; jack coming out of the SPA as an extension in LinuxMCE phones set up.&lt;br /&gt;
Located here: [[Linksys_SPA3102_Line_1_Extension_Set_Up]]&lt;br /&gt;
{{p}}&lt;br /&gt;
&lt;br /&gt;
====Useful Link Goodness:====&lt;br /&gt;
&lt;br /&gt;
[[Ekiga]] - Excellent write up on getting a softphone setup on your favorite Non-LinuxMCE linux box.&lt;br /&gt;
&lt;br /&gt;
[[Linksys_spa-3102]] - Original SPA3102 page.&lt;br /&gt;
&lt;br /&gt;
[[Linksys_spa3000_pstn_interface]] - Another home-grown wiki on the device&lt;br /&gt;
&lt;br /&gt;
[http://www.freepbx.org/support/documentation/howtos/howto-linksys-spa-3102-sipura-spa-3000-freepbx The FreePBX HowTo that saved what is left of my hair]&lt;br /&gt;
&lt;br /&gt;
Best Regards, &lt;br /&gt;
&lt;br /&gt;
--[[User:Sethj|Sethj]] 21:13, 11 October 2010 (CEST)&lt;/div&gt;</summary>
		<author><name>Pw44</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=Linksys_SPA3102&amp;diff=33294</id>
		<title>Linksys SPA3102</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=Linksys_SPA3102&amp;diff=33294"/>
		<updated>2012-10-25T18:55:57Z</updated>

		<summary type="html">&lt;p&gt;Pw44: /* PSTN Tab */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: Hardware]]&lt;br /&gt;
[[Category:Telecom]]&lt;br /&gt;
[[Category:VoIP]]&lt;br /&gt;
[[Category:ATA]]&lt;br /&gt;
{| align=&amp;quot;right&amp;quot;&lt;br /&gt;
  | __TOC__&lt;br /&gt;
  |}&lt;br /&gt;
&lt;br /&gt;
====Background====&lt;br /&gt;
The Linksys SPA3102/Sipura 3000 PSTN Gateways feature the ability to connect a standard telephone landline to IP-based data networks and can be configured as a SIP trunk for use with your LinuxMCE built-in telephony system. &lt;br /&gt;
&lt;br /&gt;
Due to the area in which I live, there are no viable High Speed DSL/CABLE or other types of internet. I only have access to Satellite Internet, which due to the nature of the beast, has a very high latency (900 - 1400ms average) and I can not use a traditional VOIP provider like Broadvoice, Vonage, or the like. However as the telephony feature of LinuxMCE is a very cool perk to this system, I figured I would have a go at integrating my analog Verizon landline into the system. To create this SIP/Bridge I chose the Linksys SPA3102, however after scanning the FreePBX forums, I can assume they will work well with the Sipura 3000 as well. After many hours of breaking, and then fixing my phone setup, I have a working viable solution, and these steps will detail how to set up this product for use with LinuxMCE. Some of these settings are borrowed from the existing wiki&#039;s here on these products, but after using them and failing, I had a go on my own. as always if there is a better more efficient way to accomplish this, please EDIT this wiki. I am by no means an expert. :)&lt;br /&gt;
&lt;br /&gt;
{{p}}&lt;br /&gt;
&lt;br /&gt;
=Required items to complete this process.=&lt;br /&gt;
&lt;br /&gt;
*Linksys SPA3102 or Sipura SPA3000 - Average price between $40 and $80, depending on your source. I used Newegg, because &amp;quot;Once you&#039;ve NewEgged....&amp;quot;&lt;br /&gt;
** [http://www.newegg.com/Product/Product.aspx?Item=N82E16833124239&amp;amp;Tpk=spa3102 Linksys SPA3102]&lt;br /&gt;
* A laptop, netboox, or PC you can temporarily connect a network cable to the LAN port on the device&lt;br /&gt;
* A web browser for configuring the SPA and the Phone Lines in LinuxMCE webmin.&lt;br /&gt;
* The following file: [http://dataless.jeromenet.org/filespace/spa3102.tar.gz spa3102.tar.gz]&lt;br /&gt;
* Any hardwired old school phone, with touchtone.&lt;br /&gt;
&lt;br /&gt;
{{p}}&lt;br /&gt;
&lt;br /&gt;
=Setting up with LinuxMCE=&lt;br /&gt;
&lt;br /&gt;
====Adding the new config files to your core.====&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;No longer needed, config files added to LinuxMCE 810.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Download the above file to a location of your choice&lt;br /&gt;
** wget http://dataless.jeromenet.org/filespace/spa3102.tar.gz&lt;br /&gt;
* Extract/Copy/Modify the files&lt;br /&gt;
** tar zxvf spa3102.tar.gz&lt;br /&gt;
** chmod a+x create_amp_spa3102.pl&lt;br /&gt;
** sudo cp create_amp_spa3102.pl /usr/pluto/bin&lt;br /&gt;
** sudo cp provider_list.txt /etc/asterisk&lt;br /&gt;
*** This file is default plus my addition, if you have already modified your /etc/asterisk/provider_list.txt, you can also simply add the line:&lt;br /&gt;
*** Linksys SPA3102/SPA3000         http://www.cisco.com/en/US/products/ps10027     spa3102 SIP  (tab seperated)&lt;br /&gt;
First steps completed.&lt;br /&gt;
&lt;br /&gt;
{{p}}&lt;br /&gt;
&lt;br /&gt;
====Adding your new Phone Line====&lt;br /&gt;
* Log into the webadmin of your core&lt;br /&gt;
* From the left hand panel, choose &amp;quot;Phone Lines&amp;quot;&lt;br /&gt;
* In the right panel, using the drop downs, select the new &amp;quot;Linksys SPA3102/SPA300&amp;quot; option.&lt;br /&gt;
* You will now be presented with 4 boxes to enter data. use the settings I have below here. (They are not UberSecure, and you can change them to what you like, just remember the username and password for later, when we configure the SPA itself)&lt;br /&gt;
** Username: spa3102&lt;br /&gt;
** Password: lmce&lt;br /&gt;
** Phone Number: &amp;lt;insert your 10 digit phone number, including your area code, like 5553221234&amp;gt; Very important, sets up routing, caller ID, etc.&lt;br /&gt;
** Host: dynamic &amp;lt;later in this wiki, when setting up the SPA, we will be setting a manual IP address, but this dynamic setting now, works some magic, lets leave it that way.&amp;gt;&lt;br /&gt;
** Save the file&lt;br /&gt;
Second steps completed. Congratulations, you just set up your FreePBX trunk!! Beer.&lt;br /&gt;
&lt;br /&gt;
{{p}}&lt;br /&gt;
&lt;br /&gt;
=Setting up the SPA3102/SPA3000=&lt;br /&gt;
&lt;br /&gt;
====Factory reset your device (just to be on the same page.)====&lt;br /&gt;
* Plug your hardwire phone into the &amp;quot;Phone&amp;quot; jack on the SPA.&lt;br /&gt;
* Pick up the receiver on your hardwired phone&lt;br /&gt;
** Dial ****&lt;br /&gt;
** When the voice comes on dial 7 3 7 3 8#&lt;br /&gt;
** When prompted to confirm, press 1&lt;br /&gt;
Factory reset complete!&lt;br /&gt;
&lt;br /&gt;
* Plug a network cable from the &amp;quot;WAN&amp;quot; port on the SPA to the internal network on your core.&lt;br /&gt;
* Plug a phone cable into the &amp;quot;Line&amp;quot; jack on the SPA to your wall jack.&lt;br /&gt;
* Plug a network cable into the &amp;quot;LAN&amp;quot; port on the SPA into your laptop, netbook, or PC.&lt;br /&gt;
** Once your device gets an IP address from the SPA, point your browser to http://192.168.0.1&lt;br /&gt;
*** By default the SPA has no passwords set for User, or Admin.&lt;br /&gt;
{{p}}&lt;br /&gt;
&lt;br /&gt;
====WAN Setup====&lt;br /&gt;
&lt;br /&gt;
* Using the image below, set up all the areas in yellow - Summary:&lt;br /&gt;
** Static IP&lt;br /&gt;
** IP - 192.168.80.200&lt;br /&gt;
** Netmask - 255.255.255.0&lt;br /&gt;
** Gateway - 192.168.80.1&lt;br /&gt;
** Hostname - SPA3102&lt;br /&gt;
** Primary DNS - 192.168.80.1&lt;br /&gt;
** Primary NTP - 192.168.80.1&lt;br /&gt;
** Set WAN server to &amp;quot;Yes&amp;quot;&lt;br /&gt;
You can now, and always remember to, click &amp;quot;Apply All Changes&amp;quot; at the bottom, and if you like, disconnect your device from the LAN port, and re-connect to it from your MD or regular PC.&lt;br /&gt;
&lt;br /&gt;
[[Image:Spa3102-wan-setup.png]]&lt;br /&gt;
{{p}}&lt;br /&gt;
&lt;br /&gt;
====SIP Setup====&lt;br /&gt;
&lt;br /&gt;
* The only thing we need to change here is the RTP packet size&lt;br /&gt;
** RTP Parameters&lt;br /&gt;
*** RTP Packet Size - 0.020  - !!! Very important to do this !!!&lt;br /&gt;
&lt;br /&gt;
[[Image:Spa3102-sip-status.png]]&lt;br /&gt;
{{p}}&lt;br /&gt;
&lt;br /&gt;
====Regional Set Up====&lt;br /&gt;
&lt;br /&gt;
* Clear out all Vertical Service Activation Codes - We want FreePBX/LMCE to control these.&lt;br /&gt;
** Vertical Service Activation Codes&lt;br /&gt;
*** Clear out all codes like shown below.&lt;br /&gt;
&lt;br /&gt;
[[Image:Spa3102-regional-status.png]]&lt;br /&gt;
{{p}}&lt;br /&gt;
&lt;br /&gt;
====PSTN Tab====&lt;br /&gt;
&lt;br /&gt;
* Using the image below, set up all the areas in yellow - Summary:&lt;br /&gt;
** Line Enable - Yes&lt;br /&gt;
** SIP Settings&lt;br /&gt;
*** SIP port - 5061&lt;br /&gt;
** Proxy Settings&lt;br /&gt;
*** Proxy - 192.168.80.1&lt;br /&gt;
*** Register Expires - 300&lt;br /&gt;
*** Make Call Without Reg - Yes&lt;br /&gt;
*** Ans Call Without Reg - Yes&lt;br /&gt;
** Subscriber Settings&lt;br /&gt;
*** Display Name - Unknown Caller (this is what is displayed when a call comes in without caller ID info)&lt;br /&gt;
*** UserID - spa3102 (this is what you set when creating the Phone Line in the LinuxMCE webmin)&lt;br /&gt;
*** Password - lmce (this is what you set when creating the Phone Line in the LinuxMCE webmin)&lt;br /&gt;
** Dial Plans&lt;br /&gt;
*** A note here, do not change any of the default (xx.) settings other than Dial Plan 2 !!&lt;br /&gt;
**** Dial Plan 2 - (S0&amp;lt;:XXXXXXXXXX&amp;gt;) - where the X&#039;s are your 10 digit phone number including area code. - note to, that is a zero beside the S&lt;br /&gt;
** VoIP-To-PSTN Gateway Setup&lt;br /&gt;
*** VoIP-To-PSTN Gateway Enable - Yes&lt;br /&gt;
*** VoIP Caller Auth Method - None&lt;br /&gt;
*** VoIP PIN Max Retry - 3&lt;br /&gt;
*** One Stage Dialing - Yes  - Extremely inportant setting !!!&lt;br /&gt;
*** Line 1 VoIP Caller DP - none&lt;br /&gt;
*** VoIP Caller Default DP - none&lt;br /&gt;
*** Line 1 Fallback DP - none&lt;br /&gt;
** PSTN-To-VoIP Gateway Setup&lt;br /&gt;
*** PSTN-To-VoIP Gateway Enable - Yes&lt;br /&gt;
*** PSTN Caller Auth Method - none&lt;br /&gt;
*** PSTN Ring Thru Line 1 - No&lt;br /&gt;
*** PSTN PIN Max Retry - 3&lt;br /&gt;
*** PSTN CID For VoIP CID - Yes&lt;br /&gt;
*** PSTN Caller Default DP - 2&lt;br /&gt;
*** Off Hook While Calling VoIP - No&lt;br /&gt;
*** Line 1 Signal Hook Flash To PSTN - Disabled&lt;br /&gt;
** FXO Timer Values (sec)&lt;br /&gt;
*** VoIP Answer Delay - 0 (zero)&lt;br /&gt;
*** PSTN Answer Delay - 3&lt;br /&gt;
*** Detect CPC - No&lt;br /&gt;
** Don&#039;t forget to &amp;quot;Submit All Changes&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;For LinuxMCE 10.04 ------- CHANGE THE FOLLOWING:&#039;&#039;&#039; Thx to gbutters&lt;br /&gt;
 &lt;br /&gt;
Subscriber Information&lt;br /&gt;
Display Name:   Unknown  Caller   &lt;br /&gt;
&#039;&#039;&#039;User ID: XXXXXXXXXX &amp;lt;- your phone number including area code&#039;&#039;&#039; &lt;br /&gt;
Password:   lmce   &lt;br /&gt;
&#039;&#039;&#039;Use Auth ID:   yes&#039;&#039;&#039;&lt;br /&gt;
&#039;&#039;&#039;Auth ID:   XXXXXXXXXX &amp;lt;- your phone number including area code&#039;&#039;&#039;  &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
PSTN Tab setup complete!!! Congratualtions!! Beer!&lt;br /&gt;
&lt;br /&gt;
[[Image:Spa3102-pstn-1.png]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Spa3102-pstn-2.png]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Spa3102-pstn-3.png]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Spa3102-pstn-4.png]]&lt;br /&gt;
&lt;br /&gt;
{{p}}&lt;br /&gt;
&lt;br /&gt;
=Troubleshooting=&lt;br /&gt;
&lt;br /&gt;
====Dial Rules vs Dial Patterns====&lt;br /&gt;
&lt;br /&gt;
One of the first issues I came across, was getting the &amp;quot;Your call can not be completed as dialed&amp;quot;, and the &amp;quot;All circuits are busy now&amp;quot; Messages.&lt;br /&gt;
Here is what I did to overcome them.&lt;br /&gt;
&lt;br /&gt;
* Dial Rules&lt;br /&gt;
** Log into the LinuxMCE webmin&lt;br /&gt;
*** From the top click Advanced &amp;gt; Configuration &amp;gt; Phones setup to get to the FreePBX admin screen.&lt;br /&gt;
*** In the left click on trunks&lt;br /&gt;
**** In the right click on the trunk you created for the spa3102&lt;br /&gt;
**** Look for Dial Rules:&lt;br /&gt;
**** Clear everything that is in it&lt;br /&gt;
**** Scroll to bottom, click &amp;quot;Submit Changes&amp;quot;&lt;br /&gt;
**** At the top of the FreePBX screen click &amp;quot;Apply Configuration Changes&amp;quot;&lt;br /&gt;
This does several things, including eliminating your significant other saying &amp;quot;Why do I have to Dial a 9 and a 1 to call next door&amp;quot; :)&lt;br /&gt;
&lt;br /&gt;
* Dial Patterns&lt;br /&gt;
** In the left click &amp;quot;Outbound Routes&amp;quot;&lt;br /&gt;
** In the right, click the button for your spa3102 outbound routes&lt;br /&gt;
An explanation here as to the difference between Dial Patterns, and Dial Rules.&lt;br /&gt;
&lt;br /&gt;
Dial Rules are used to add a number/character to, or strip a number/character away from anything dialed on any extension in your home. I did not need anything like this as to dial long distance, I only need enter the area code and the number, no 1 and certainly no 9.&lt;br /&gt;
Dial patterns are how FreePBX knows how to send a particular call to a route. You may have a route just for local long distance, and you may have a route for international calls, and then another for local calls.&lt;br /&gt;
In my cituation, I only need 911, local 7 digit numbers, and long distance 10 digit numbers, so here is what is in my outbound route Dial Pattern:&lt;br /&gt;
** N11  - For 911&lt;br /&gt;
** NXXNXXXXXX - For 10 digit long distance&lt;br /&gt;
** NXXXXXX - for regular old 7 digit local calls&lt;br /&gt;
&lt;br /&gt;
That is it. I only have one trunk, and I only need it to do those 3 types of calls, so why complicate it right?&lt;br /&gt;
There is way more information available at:&lt;br /&gt;
&lt;br /&gt;
[http://support.freepbx.org FreePBX support/Wiki/Forums].&lt;br /&gt;
&lt;br /&gt;
{{p}}&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
You should now see something like this when looking at the &amp;quot;Info&amp;quot; tab:&lt;br /&gt;
&lt;br /&gt;
[[Image:Spa3102-pstn-status.png]]&lt;br /&gt;
&lt;br /&gt;
You will notice here that I did not have my phone line plugged in at the time, LMCE was answering calls, and I had not had the routuing set up the way I want.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
All required settings should now be applied. Try to make a test call. If your MD&#039;s are not set up for making some calls, try an IP phone if you have one, or a SIP device, like an Ekiga softphone [[Ekiga]]&lt;br /&gt;
&lt;br /&gt;
In addition to the PSTN setup, I will also do a wiki on configuring the &amp;quot;Phone&amp;quot; jack coming out of the SPA as an extension in LinuxMCE phones set up.&lt;br /&gt;
Located here: [[Linksys_SPA3102_Line_1_Extension_Set_Up]]&lt;br /&gt;
{{p}}&lt;br /&gt;
&lt;br /&gt;
====Useful Link Goodness:====&lt;br /&gt;
&lt;br /&gt;
[[Ekiga]] - Excellent write up on getting a softphone setup on your favorite Non-LinuxMCE linux box.&lt;br /&gt;
&lt;br /&gt;
[[Linksys_spa-3102]] - Original SPA3102 page.&lt;br /&gt;
&lt;br /&gt;
[[Linksys_spa3000_pstn_interface]] - Another home-grown wiki on the device&lt;br /&gt;
&lt;br /&gt;
[http://www.freepbx.org/support/documentation/howtos/howto-linksys-spa-3102-sipura-spa-3000-freepbx The FreePBX HowTo that saved what is left of my hair]&lt;br /&gt;
&lt;br /&gt;
Best Regards, &lt;br /&gt;
&lt;br /&gt;
--[[User:Sethj|Sethj]] 21:13, 11 October 2010 (CEST)&lt;/div&gt;</summary>
		<author><name>Pw44</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=Linksys_SPA3102&amp;diff=33293</id>
		<title>Linksys SPA3102</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=Linksys_SPA3102&amp;diff=33293"/>
		<updated>2012-10-25T18:55:08Z</updated>

		<summary type="html">&lt;p&gt;Pw44: /* PSTN Tab */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: Hardware]]&lt;br /&gt;
[[Category:Telecom]]&lt;br /&gt;
[[Category:VoIP]]&lt;br /&gt;
[[Category:ATA]]&lt;br /&gt;
{| align=&amp;quot;right&amp;quot;&lt;br /&gt;
  | __TOC__&lt;br /&gt;
  |}&lt;br /&gt;
&lt;br /&gt;
====Background====&lt;br /&gt;
The Linksys SPA3102/Sipura 3000 PSTN Gateways feature the ability to connect a standard telephone landline to IP-based data networks and can be configured as a SIP trunk for use with your LinuxMCE built-in telephony system. &lt;br /&gt;
&lt;br /&gt;
Due to the area in which I live, there are no viable High Speed DSL/CABLE or other types of internet. I only have access to Satellite Internet, which due to the nature of the beast, has a very high latency (900 - 1400ms average) and I can not use a traditional VOIP provider like Broadvoice, Vonage, or the like. However as the telephony feature of LinuxMCE is a very cool perk to this system, I figured I would have a go at integrating my analog Verizon landline into the system. To create this SIP/Bridge I chose the Linksys SPA3102, however after scanning the FreePBX forums, I can assume they will work well with the Sipura 3000 as well. After many hours of breaking, and then fixing my phone setup, I have a working viable solution, and these steps will detail how to set up this product for use with LinuxMCE. Some of these settings are borrowed from the existing wiki&#039;s here on these products, but after using them and failing, I had a go on my own. as always if there is a better more efficient way to accomplish this, please EDIT this wiki. I am by no means an expert. :)&lt;br /&gt;
&lt;br /&gt;
{{p}}&lt;br /&gt;
&lt;br /&gt;
=Required items to complete this process.=&lt;br /&gt;
&lt;br /&gt;
*Linksys SPA3102 or Sipura SPA3000 - Average price between $40 and $80, depending on your source. I used Newegg, because &amp;quot;Once you&#039;ve NewEgged....&amp;quot;&lt;br /&gt;
** [http://www.newegg.com/Product/Product.aspx?Item=N82E16833124239&amp;amp;Tpk=spa3102 Linksys SPA3102]&lt;br /&gt;
* A laptop, netboox, or PC you can temporarily connect a network cable to the LAN port on the device&lt;br /&gt;
* A web browser for configuring the SPA and the Phone Lines in LinuxMCE webmin.&lt;br /&gt;
* The following file: [http://dataless.jeromenet.org/filespace/spa3102.tar.gz spa3102.tar.gz]&lt;br /&gt;
* Any hardwired old school phone, with touchtone.&lt;br /&gt;
&lt;br /&gt;
{{p}}&lt;br /&gt;
&lt;br /&gt;
=Setting up with LinuxMCE=&lt;br /&gt;
&lt;br /&gt;
====Adding the new config files to your core.====&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;No longer needed, config files added to LinuxMCE 810.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Download the above file to a location of your choice&lt;br /&gt;
** wget http://dataless.jeromenet.org/filespace/spa3102.tar.gz&lt;br /&gt;
* Extract/Copy/Modify the files&lt;br /&gt;
** tar zxvf spa3102.tar.gz&lt;br /&gt;
** chmod a+x create_amp_spa3102.pl&lt;br /&gt;
** sudo cp create_amp_spa3102.pl /usr/pluto/bin&lt;br /&gt;
** sudo cp provider_list.txt /etc/asterisk&lt;br /&gt;
*** This file is default plus my addition, if you have already modified your /etc/asterisk/provider_list.txt, you can also simply add the line:&lt;br /&gt;
*** Linksys SPA3102/SPA3000         http://www.cisco.com/en/US/products/ps10027     spa3102 SIP  (tab seperated)&lt;br /&gt;
First steps completed.&lt;br /&gt;
&lt;br /&gt;
{{p}}&lt;br /&gt;
&lt;br /&gt;
====Adding your new Phone Line====&lt;br /&gt;
* Log into the webadmin of your core&lt;br /&gt;
* From the left hand panel, choose &amp;quot;Phone Lines&amp;quot;&lt;br /&gt;
* In the right panel, using the drop downs, select the new &amp;quot;Linksys SPA3102/SPA300&amp;quot; option.&lt;br /&gt;
* You will now be presented with 4 boxes to enter data. use the settings I have below here. (They are not UberSecure, and you can change them to what you like, just remember the username and password for later, when we configure the SPA itself)&lt;br /&gt;
** Username: spa3102&lt;br /&gt;
** Password: lmce&lt;br /&gt;
** Phone Number: &amp;lt;insert your 10 digit phone number, including your area code, like 5553221234&amp;gt; Very important, sets up routing, caller ID, etc.&lt;br /&gt;
** Host: dynamic &amp;lt;later in this wiki, when setting up the SPA, we will be setting a manual IP address, but this dynamic setting now, works some magic, lets leave it that way.&amp;gt;&lt;br /&gt;
** Save the file&lt;br /&gt;
Second steps completed. Congratulations, you just set up your FreePBX trunk!! Beer.&lt;br /&gt;
&lt;br /&gt;
{{p}}&lt;br /&gt;
&lt;br /&gt;
=Setting up the SPA3102/SPA3000=&lt;br /&gt;
&lt;br /&gt;
====Factory reset your device (just to be on the same page.)====&lt;br /&gt;
* Plug your hardwire phone into the &amp;quot;Phone&amp;quot; jack on the SPA.&lt;br /&gt;
* Pick up the receiver on your hardwired phone&lt;br /&gt;
** Dial ****&lt;br /&gt;
** When the voice comes on dial 7 3 7 3 8#&lt;br /&gt;
** When prompted to confirm, press 1&lt;br /&gt;
Factory reset complete!&lt;br /&gt;
&lt;br /&gt;
* Plug a network cable from the &amp;quot;WAN&amp;quot; port on the SPA to the internal network on your core.&lt;br /&gt;
* Plug a phone cable into the &amp;quot;Line&amp;quot; jack on the SPA to your wall jack.&lt;br /&gt;
* Plug a network cable into the &amp;quot;LAN&amp;quot; port on the SPA into your laptop, netbook, or PC.&lt;br /&gt;
** Once your device gets an IP address from the SPA, point your browser to http://192.168.0.1&lt;br /&gt;
*** By default the SPA has no passwords set for User, or Admin.&lt;br /&gt;
{{p}}&lt;br /&gt;
&lt;br /&gt;
====WAN Setup====&lt;br /&gt;
&lt;br /&gt;
* Using the image below, set up all the areas in yellow - Summary:&lt;br /&gt;
** Static IP&lt;br /&gt;
** IP - 192.168.80.200&lt;br /&gt;
** Netmask - 255.255.255.0&lt;br /&gt;
** Gateway - 192.168.80.1&lt;br /&gt;
** Hostname - SPA3102&lt;br /&gt;
** Primary DNS - 192.168.80.1&lt;br /&gt;
** Primary NTP - 192.168.80.1&lt;br /&gt;
** Set WAN server to &amp;quot;Yes&amp;quot;&lt;br /&gt;
You can now, and always remember to, click &amp;quot;Apply All Changes&amp;quot; at the bottom, and if you like, disconnect your device from the LAN port, and re-connect to it from your MD or regular PC.&lt;br /&gt;
&lt;br /&gt;
[[Image:Spa3102-wan-setup.png]]&lt;br /&gt;
{{p}}&lt;br /&gt;
&lt;br /&gt;
====SIP Setup====&lt;br /&gt;
&lt;br /&gt;
* The only thing we need to change here is the RTP packet size&lt;br /&gt;
** RTP Parameters&lt;br /&gt;
*** RTP Packet Size - 0.020  - !!! Very important to do this !!!&lt;br /&gt;
&lt;br /&gt;
[[Image:Spa3102-sip-status.png]]&lt;br /&gt;
{{p}}&lt;br /&gt;
&lt;br /&gt;
====Regional Set Up====&lt;br /&gt;
&lt;br /&gt;
* Clear out all Vertical Service Activation Codes - We want FreePBX/LMCE to control these.&lt;br /&gt;
** Vertical Service Activation Codes&lt;br /&gt;
*** Clear out all codes like shown below.&lt;br /&gt;
&lt;br /&gt;
[[Image:Spa3102-regional-status.png]]&lt;br /&gt;
{{p}}&lt;br /&gt;
&lt;br /&gt;
====PSTN Tab====&lt;br /&gt;
&lt;br /&gt;
* Using the image below, set up all the areas in yellow - Summary:&lt;br /&gt;
** Line Enable - Yes&lt;br /&gt;
** SIP Settings&lt;br /&gt;
*** SIP port - 5061&lt;br /&gt;
** Proxy Settings&lt;br /&gt;
*** Proxy - 192.168.80.1&lt;br /&gt;
*** Register Expires - 300&lt;br /&gt;
*** Make Call Without Reg - Yes&lt;br /&gt;
*** Ans Call Without Reg - Yes&lt;br /&gt;
** Subscriber Settings&lt;br /&gt;
*** Display Name - Unknown Caller (this is what is displayed when a call comes in without caller ID info)&lt;br /&gt;
*** UserID - spa3102 (this is what you set when creating the Phone Line in the LinuxMCE webmin)&lt;br /&gt;
*** Password - lmce (this is what you set when creating the Phone Line in the LinuxMCE webmin)&lt;br /&gt;
** Dial Plans&lt;br /&gt;
*** A note here, do not change any of the default (xx.) settings other than Dial Plan 2 !!&lt;br /&gt;
**** Dial Plan 2 - (S0&amp;lt;:XXXXXXXXXX&amp;gt;) - where the X&#039;s are your 10 digit phone number including area code. - note to, that is a zero beside the S&lt;br /&gt;
** VoIP-To-PSTN Gateway Setup&lt;br /&gt;
*** VoIP-To-PSTN Gateway Enable - Yes&lt;br /&gt;
*** VoIP Caller Auth Method - None&lt;br /&gt;
*** VoIP PIN Max Retry - 3&lt;br /&gt;
*** One Stage Dialing - Yes  - Extremely inportant setting !!!&lt;br /&gt;
*** Line 1 VoIP Caller DP - none&lt;br /&gt;
*** VoIP Caller Default DP - none&lt;br /&gt;
*** Line 1 Fallback DP - none&lt;br /&gt;
** PSTN-To-VoIP Gateway Setup&lt;br /&gt;
*** PSTN-To-VoIP Gateway Enable - Yes&lt;br /&gt;
*** PSTN Caller Auth Method - none&lt;br /&gt;
*** PSTN Ring Thru Line 1 - No&lt;br /&gt;
*** PSTN PIN Max Retry - 3&lt;br /&gt;
*** PSTN CID For VoIP CID - Yes&lt;br /&gt;
*** PSTN Caller Default DP - 2&lt;br /&gt;
*** Off Hook While Calling VoIP - No&lt;br /&gt;
*** Line 1 Signal Hook Flash To PSTN - Disabled&lt;br /&gt;
** FXO Timer Values (sec)&lt;br /&gt;
*** VoIP Answer Delay - 0 (zero)&lt;br /&gt;
*** PSTN Answer Delay - 3&lt;br /&gt;
*** Detect CPC - No&lt;br /&gt;
** Don&#039;t forget to &amp;quot;Submit All Changes&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;For LinuxMCE 10.04 ------- CHANGE THE FOLLOWING:&#039;&#039;&#039; Thx to gbutters&lt;br /&gt;
 &lt;br /&gt;
Subscriber Information&lt;br /&gt;
Display Name:   Unknown  Caller   &#039;&#039;&#039;User ID: XXXXXXXXXX &amp;lt;- your phone number including area code&#039;&#039;&#039; &lt;br /&gt;
Password:   lmce   &#039;&#039;&#039;Use Auth ID:   yes&#039;&#039;&#039;&lt;br /&gt;
&#039;&#039;&#039;Auth ID:   XXXXXXXXXX &amp;lt;- your phone number including area code&#039;&#039;&#039;  &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
PSTN Tab setup complete!!! Congratualtions!! Beer!&lt;br /&gt;
&lt;br /&gt;
[[Image:Spa3102-pstn-1.png]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Spa3102-pstn-2.png]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Spa3102-pstn-3.png]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Spa3102-pstn-4.png]]&lt;br /&gt;
&lt;br /&gt;
{{p}}&lt;br /&gt;
&lt;br /&gt;
=Troubleshooting=&lt;br /&gt;
&lt;br /&gt;
====Dial Rules vs Dial Patterns====&lt;br /&gt;
&lt;br /&gt;
One of the first issues I came across, was getting the &amp;quot;Your call can not be completed as dialed&amp;quot;, and the &amp;quot;All circuits are busy now&amp;quot; Messages.&lt;br /&gt;
Here is what I did to overcome them.&lt;br /&gt;
&lt;br /&gt;
* Dial Rules&lt;br /&gt;
** Log into the LinuxMCE webmin&lt;br /&gt;
*** From the top click Advanced &amp;gt; Configuration &amp;gt; Phones setup to get to the FreePBX admin screen.&lt;br /&gt;
*** In the left click on trunks&lt;br /&gt;
**** In the right click on the trunk you created for the spa3102&lt;br /&gt;
**** Look for Dial Rules:&lt;br /&gt;
**** Clear everything that is in it&lt;br /&gt;
**** Scroll to bottom, click &amp;quot;Submit Changes&amp;quot;&lt;br /&gt;
**** At the top of the FreePBX screen click &amp;quot;Apply Configuration Changes&amp;quot;&lt;br /&gt;
This does several things, including eliminating your significant other saying &amp;quot;Why do I have to Dial a 9 and a 1 to call next door&amp;quot; :)&lt;br /&gt;
&lt;br /&gt;
* Dial Patterns&lt;br /&gt;
** In the left click &amp;quot;Outbound Routes&amp;quot;&lt;br /&gt;
** In the right, click the button for your spa3102 outbound routes&lt;br /&gt;
An explanation here as to the difference between Dial Patterns, and Dial Rules.&lt;br /&gt;
&lt;br /&gt;
Dial Rules are used to add a number/character to, or strip a number/character away from anything dialed on any extension in your home. I did not need anything like this as to dial long distance, I only need enter the area code and the number, no 1 and certainly no 9.&lt;br /&gt;
Dial patterns are how FreePBX knows how to send a particular call to a route. You may have a route just for local long distance, and you may have a route for international calls, and then another for local calls.&lt;br /&gt;
In my cituation, I only need 911, local 7 digit numbers, and long distance 10 digit numbers, so here is what is in my outbound route Dial Pattern:&lt;br /&gt;
** N11  - For 911&lt;br /&gt;
** NXXNXXXXXX - For 10 digit long distance&lt;br /&gt;
** NXXXXXX - for regular old 7 digit local calls&lt;br /&gt;
&lt;br /&gt;
That is it. I only have one trunk, and I only need it to do those 3 types of calls, so why complicate it right?&lt;br /&gt;
There is way more information available at:&lt;br /&gt;
&lt;br /&gt;
[http://support.freepbx.org FreePBX support/Wiki/Forums].&lt;br /&gt;
&lt;br /&gt;
{{p}}&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
You should now see something like this when looking at the &amp;quot;Info&amp;quot; tab:&lt;br /&gt;
&lt;br /&gt;
[[Image:Spa3102-pstn-status.png]]&lt;br /&gt;
&lt;br /&gt;
You will notice here that I did not have my phone line plugged in at the time, LMCE was answering calls, and I had not had the routuing set up the way I want.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
All required settings should now be applied. Try to make a test call. If your MD&#039;s are not set up for making some calls, try an IP phone if you have one, or a SIP device, like an Ekiga softphone [[Ekiga]]&lt;br /&gt;
&lt;br /&gt;
In addition to the PSTN setup, I will also do a wiki on configuring the &amp;quot;Phone&amp;quot; jack coming out of the SPA as an extension in LinuxMCE phones set up.&lt;br /&gt;
Located here: [[Linksys_SPA3102_Line_1_Extension_Set_Up]]&lt;br /&gt;
{{p}}&lt;br /&gt;
&lt;br /&gt;
====Useful Link Goodness:====&lt;br /&gt;
&lt;br /&gt;
[[Ekiga]] - Excellent write up on getting a softphone setup on your favorite Non-LinuxMCE linux box.&lt;br /&gt;
&lt;br /&gt;
[[Linksys_spa-3102]] - Original SPA3102 page.&lt;br /&gt;
&lt;br /&gt;
[[Linksys_spa3000_pstn_interface]] - Another home-grown wiki on the device&lt;br /&gt;
&lt;br /&gt;
[http://www.freepbx.org/support/documentation/howtos/howto-linksys-spa-3102-sipura-spa-3000-freepbx The FreePBX HowTo that saved what is left of my hair]&lt;br /&gt;
&lt;br /&gt;
Best Regards, &lt;br /&gt;
&lt;br /&gt;
--[[User:Sethj|Sethj]] 21:13, 11 October 2010 (CEST)&lt;/div&gt;</summary>
		<author><name>Pw44</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=Linksys_SPA3102&amp;diff=33292</id>
		<title>Linksys SPA3102</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=Linksys_SPA3102&amp;diff=33292"/>
		<updated>2012-10-25T18:52:34Z</updated>

		<summary type="html">&lt;p&gt;Pw44: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: Hardware]]&lt;br /&gt;
[[Category:Telecom]]&lt;br /&gt;
[[Category:VoIP]]&lt;br /&gt;
[[Category:ATA]]&lt;br /&gt;
{| align=&amp;quot;right&amp;quot;&lt;br /&gt;
  | __TOC__&lt;br /&gt;
  |}&lt;br /&gt;
&lt;br /&gt;
====Background====&lt;br /&gt;
The Linksys SPA3102/Sipura 3000 PSTN Gateways feature the ability to connect a standard telephone landline to IP-based data networks and can be configured as a SIP trunk for use with your LinuxMCE built-in telephony system. &lt;br /&gt;
&lt;br /&gt;
Due to the area in which I live, there are no viable High Speed DSL/CABLE or other types of internet. I only have access to Satellite Internet, which due to the nature of the beast, has a very high latency (900 - 1400ms average) and I can not use a traditional VOIP provider like Broadvoice, Vonage, or the like. However as the telephony feature of LinuxMCE is a very cool perk to this system, I figured I would have a go at integrating my analog Verizon landline into the system. To create this SIP/Bridge I chose the Linksys SPA3102, however after scanning the FreePBX forums, I can assume they will work well with the Sipura 3000 as well. After many hours of breaking, and then fixing my phone setup, I have a working viable solution, and these steps will detail how to set up this product for use with LinuxMCE. Some of these settings are borrowed from the existing wiki&#039;s here on these products, but after using them and failing, I had a go on my own. as always if there is a better more efficient way to accomplish this, please EDIT this wiki. I am by no means an expert. :)&lt;br /&gt;
&lt;br /&gt;
{{p}}&lt;br /&gt;
&lt;br /&gt;
=Required items to complete this process.=&lt;br /&gt;
&lt;br /&gt;
*Linksys SPA3102 or Sipura SPA3000 - Average price between $40 and $80, depending on your source. I used Newegg, because &amp;quot;Once you&#039;ve NewEgged....&amp;quot;&lt;br /&gt;
** [http://www.newegg.com/Product/Product.aspx?Item=N82E16833124239&amp;amp;Tpk=spa3102 Linksys SPA3102]&lt;br /&gt;
* A laptop, netboox, or PC you can temporarily connect a network cable to the LAN port on the device&lt;br /&gt;
* A web browser for configuring the SPA and the Phone Lines in LinuxMCE webmin.&lt;br /&gt;
* The following file: [http://dataless.jeromenet.org/filespace/spa3102.tar.gz spa3102.tar.gz]&lt;br /&gt;
* Any hardwired old school phone, with touchtone.&lt;br /&gt;
&lt;br /&gt;
{{p}}&lt;br /&gt;
&lt;br /&gt;
=Setting up with LinuxMCE=&lt;br /&gt;
&lt;br /&gt;
====Adding the new config files to your core.====&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;No longer needed, config files added to LinuxMCE 810.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Download the above file to a location of your choice&lt;br /&gt;
** wget http://dataless.jeromenet.org/filespace/spa3102.tar.gz&lt;br /&gt;
* Extract/Copy/Modify the files&lt;br /&gt;
** tar zxvf spa3102.tar.gz&lt;br /&gt;
** chmod a+x create_amp_spa3102.pl&lt;br /&gt;
** sudo cp create_amp_spa3102.pl /usr/pluto/bin&lt;br /&gt;
** sudo cp provider_list.txt /etc/asterisk&lt;br /&gt;
*** This file is default plus my addition, if you have already modified your /etc/asterisk/provider_list.txt, you can also simply add the line:&lt;br /&gt;
*** Linksys SPA3102/SPA3000         http://www.cisco.com/en/US/products/ps10027     spa3102 SIP  (tab seperated)&lt;br /&gt;
First steps completed.&lt;br /&gt;
&lt;br /&gt;
{{p}}&lt;br /&gt;
&lt;br /&gt;
====Adding your new Phone Line====&lt;br /&gt;
* Log into the webadmin of your core&lt;br /&gt;
* From the left hand panel, choose &amp;quot;Phone Lines&amp;quot;&lt;br /&gt;
* In the right panel, using the drop downs, select the new &amp;quot;Linksys SPA3102/SPA300&amp;quot; option.&lt;br /&gt;
* You will now be presented with 4 boxes to enter data. use the settings I have below here. (They are not UberSecure, and you can change them to what you like, just remember the username and password for later, when we configure the SPA itself)&lt;br /&gt;
** Username: spa3102&lt;br /&gt;
** Password: lmce&lt;br /&gt;
** Phone Number: &amp;lt;insert your 10 digit phone number, including your area code, like 5553221234&amp;gt; Very important, sets up routing, caller ID, etc.&lt;br /&gt;
** Host: dynamic &amp;lt;later in this wiki, when setting up the SPA, we will be setting a manual IP address, but this dynamic setting now, works some magic, lets leave it that way.&amp;gt;&lt;br /&gt;
** Save the file&lt;br /&gt;
Second steps completed. Congratulations, you just set up your FreePBX trunk!! Beer.&lt;br /&gt;
&lt;br /&gt;
{{p}}&lt;br /&gt;
&lt;br /&gt;
=Setting up the SPA3102/SPA3000=&lt;br /&gt;
&lt;br /&gt;
====Factory reset your device (just to be on the same page.)====&lt;br /&gt;
* Plug your hardwire phone into the &amp;quot;Phone&amp;quot; jack on the SPA.&lt;br /&gt;
* Pick up the receiver on your hardwired phone&lt;br /&gt;
** Dial ****&lt;br /&gt;
** When the voice comes on dial 7 3 7 3 8#&lt;br /&gt;
** When prompted to confirm, press 1&lt;br /&gt;
Factory reset complete!&lt;br /&gt;
&lt;br /&gt;
* Plug a network cable from the &amp;quot;WAN&amp;quot; port on the SPA to the internal network on your core.&lt;br /&gt;
* Plug a phone cable into the &amp;quot;Line&amp;quot; jack on the SPA to your wall jack.&lt;br /&gt;
* Plug a network cable into the &amp;quot;LAN&amp;quot; port on the SPA into your laptop, netbook, or PC.&lt;br /&gt;
** Once your device gets an IP address from the SPA, point your browser to http://192.168.0.1&lt;br /&gt;
*** By default the SPA has no passwords set for User, or Admin.&lt;br /&gt;
{{p}}&lt;br /&gt;
&lt;br /&gt;
====WAN Setup====&lt;br /&gt;
&lt;br /&gt;
* Using the image below, set up all the areas in yellow - Summary:&lt;br /&gt;
** Static IP&lt;br /&gt;
** IP - 192.168.80.200&lt;br /&gt;
** Netmask - 255.255.255.0&lt;br /&gt;
** Gateway - 192.168.80.1&lt;br /&gt;
** Hostname - SPA3102&lt;br /&gt;
** Primary DNS - 192.168.80.1&lt;br /&gt;
** Primary NTP - 192.168.80.1&lt;br /&gt;
** Set WAN server to &amp;quot;Yes&amp;quot;&lt;br /&gt;
You can now, and always remember to, click &amp;quot;Apply All Changes&amp;quot; at the bottom, and if you like, disconnect your device from the LAN port, and re-connect to it from your MD or regular PC.&lt;br /&gt;
&lt;br /&gt;
[[Image:Spa3102-wan-setup.png]]&lt;br /&gt;
{{p}}&lt;br /&gt;
&lt;br /&gt;
====SIP Setup====&lt;br /&gt;
&lt;br /&gt;
* The only thing we need to change here is the RTP packet size&lt;br /&gt;
** RTP Parameters&lt;br /&gt;
*** RTP Packet Size - 0.020  - !!! Very important to do this !!!&lt;br /&gt;
&lt;br /&gt;
[[Image:Spa3102-sip-status.png]]&lt;br /&gt;
{{p}}&lt;br /&gt;
&lt;br /&gt;
====Regional Set Up====&lt;br /&gt;
&lt;br /&gt;
* Clear out all Vertical Service Activation Codes - We want FreePBX/LMCE to control these.&lt;br /&gt;
** Vertical Service Activation Codes&lt;br /&gt;
*** Clear out all codes like shown below.&lt;br /&gt;
&lt;br /&gt;
[[Image:Spa3102-regional-status.png]]&lt;br /&gt;
{{p}}&lt;br /&gt;
&lt;br /&gt;
====PSTN Tab====&lt;br /&gt;
&lt;br /&gt;
* Using the image below, set up all the areas in yellow - Summary:&lt;br /&gt;
** Line Enable - Yes&lt;br /&gt;
** SIP Settings&lt;br /&gt;
*** SIP port - 5061&lt;br /&gt;
** Proxy Settings&lt;br /&gt;
*** Proxy - 192.168.80.1&lt;br /&gt;
*** Register Expires - 300&lt;br /&gt;
*** Make Call Without Reg - Yes&lt;br /&gt;
*** Ans Call Without Reg - Yes&lt;br /&gt;
** Subscriber Settings&lt;br /&gt;
*** Display Name - Unknown Caller (this is what is displayed when a call comes in without caller ID info)&lt;br /&gt;
*** UserID - spa3102 (this is what you set when creating the Phone Line in the LinuxMCE webmin)&lt;br /&gt;
*** Password - lmce (this is what you set when creating the Phone Line in the LinuxMCE webmin)&lt;br /&gt;
** Dial Plans&lt;br /&gt;
*** A note here, do not change any of the default (xx.) settings other than Dial Plan 2 !!&lt;br /&gt;
**** Dial Plan 2 - (S0&amp;lt;:XXXXXXXXXX&amp;gt;) - where the X&#039;s are your 10 digit phone number including area code. - note to, that is a zero beside the S&lt;br /&gt;
** VoIP-To-PSTN Gateway Setup&lt;br /&gt;
*** VoIP-To-PSTN Gateway Enable - Yes&lt;br /&gt;
*** VoIP Caller Auth Method - None&lt;br /&gt;
*** VoIP PIN Max Retry - 3&lt;br /&gt;
*** One Stage Dialing - Yes  - Extremely inportant setting !!!&lt;br /&gt;
*** Line 1 VoIP Caller DP - none&lt;br /&gt;
*** VoIP Caller Default DP - none&lt;br /&gt;
*** Line 1 Fallback DP - none&lt;br /&gt;
** PSTN-To-VoIP Gateway Setup&lt;br /&gt;
*** PSTN-To-VoIP Gateway Enable - Yes&lt;br /&gt;
*** PSTN Caller Auth Method - none&lt;br /&gt;
*** PSTN Ring Thru Line 1 - No&lt;br /&gt;
*** PSTN PIN Max Retry - 3&lt;br /&gt;
*** PSTN CID For VoIP CID - Yes&lt;br /&gt;
*** PSTN Caller Default DP - 2&lt;br /&gt;
*** Off Hook While Calling VoIP - No&lt;br /&gt;
*** Line 1 Signal Hook Flash To PSTN - Disabled&lt;br /&gt;
** FXO Timer Values (sec)&lt;br /&gt;
*** VoIP Answer Delay - 0 (zero)&lt;br /&gt;
*** PSTN Answer Delay - 3&lt;br /&gt;
*** Detect CPC - No&lt;br /&gt;
** Don&#039;t forget to &amp;quot;Submit All Changes&amp;quot;&lt;br /&gt;
&lt;br /&gt;
FOR LinuxMCE 10.04 ------- CHANGE THE FOLLOWING:&lt;br /&gt;
 &lt;br /&gt;
Subscriber Information&lt;br /&gt;
Display Name:   Unknown  Caller   User ID: XXXXXXXXXX &amp;lt;- your phone number including area code &lt;br /&gt;
Password:   lmce   Use Auth ID:   yes&lt;br /&gt;
Auth ID:   XXXXXXXXXX &amp;lt;- your phone number including area code  &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
PSTN Tab setup complete!!! Congratualtions!! Beer!&lt;br /&gt;
&lt;br /&gt;
[[Image:Spa3102-pstn-1.png]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Spa3102-pstn-2.png]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Spa3102-pstn-3.png]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Spa3102-pstn-4.png]]&lt;br /&gt;
&lt;br /&gt;
{{p}}&lt;br /&gt;
&lt;br /&gt;
=Troubleshooting=&lt;br /&gt;
&lt;br /&gt;
====Dial Rules vs Dial Patterns====&lt;br /&gt;
&lt;br /&gt;
One of the first issues I came across, was getting the &amp;quot;Your call can not be completed as dialed&amp;quot;, and the &amp;quot;All circuits are busy now&amp;quot; Messages.&lt;br /&gt;
Here is what I did to overcome them.&lt;br /&gt;
&lt;br /&gt;
* Dial Rules&lt;br /&gt;
** Log into the LinuxMCE webmin&lt;br /&gt;
*** From the top click Advanced &amp;gt; Configuration &amp;gt; Phones setup to get to the FreePBX admin screen.&lt;br /&gt;
*** In the left click on trunks&lt;br /&gt;
**** In the right click on the trunk you created for the spa3102&lt;br /&gt;
**** Look for Dial Rules:&lt;br /&gt;
**** Clear everything that is in it&lt;br /&gt;
**** Scroll to bottom, click &amp;quot;Submit Changes&amp;quot;&lt;br /&gt;
**** At the top of the FreePBX screen click &amp;quot;Apply Configuration Changes&amp;quot;&lt;br /&gt;
This does several things, including eliminating your significant other saying &amp;quot;Why do I have to Dial a 9 and a 1 to call next door&amp;quot; :)&lt;br /&gt;
&lt;br /&gt;
* Dial Patterns&lt;br /&gt;
** In the left click &amp;quot;Outbound Routes&amp;quot;&lt;br /&gt;
** In the right, click the button for your spa3102 outbound routes&lt;br /&gt;
An explanation here as to the difference between Dial Patterns, and Dial Rules.&lt;br /&gt;
&lt;br /&gt;
Dial Rules are used to add a number/character to, or strip a number/character away from anything dialed on any extension in your home. I did not need anything like this as to dial long distance, I only need enter the area code and the number, no 1 and certainly no 9.&lt;br /&gt;
Dial patterns are how FreePBX knows how to send a particular call to a route. You may have a route just for local long distance, and you may have a route for international calls, and then another for local calls.&lt;br /&gt;
In my cituation, I only need 911, local 7 digit numbers, and long distance 10 digit numbers, so here is what is in my outbound route Dial Pattern:&lt;br /&gt;
** N11  - For 911&lt;br /&gt;
** NXXNXXXXXX - For 10 digit long distance&lt;br /&gt;
** NXXXXXX - for regular old 7 digit local calls&lt;br /&gt;
&lt;br /&gt;
That is it. I only have one trunk, and I only need it to do those 3 types of calls, so why complicate it right?&lt;br /&gt;
There is way more information available at:&lt;br /&gt;
&lt;br /&gt;
[http://support.freepbx.org FreePBX support/Wiki/Forums].&lt;br /&gt;
&lt;br /&gt;
{{p}}&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
You should now see something like this when looking at the &amp;quot;Info&amp;quot; tab:&lt;br /&gt;
&lt;br /&gt;
[[Image:Spa3102-pstn-status.png]]&lt;br /&gt;
&lt;br /&gt;
You will notice here that I did not have my phone line plugged in at the time, LMCE was answering calls, and I had not had the routuing set up the way I want.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
All required settings should now be applied. Try to make a test call. If your MD&#039;s are not set up for making some calls, try an IP phone if you have one, or a SIP device, like an Ekiga softphone [[Ekiga]]&lt;br /&gt;
&lt;br /&gt;
In addition to the PSTN setup, I will also do a wiki on configuring the &amp;quot;Phone&amp;quot; jack coming out of the SPA as an extension in LinuxMCE phones set up.&lt;br /&gt;
Located here: [[Linksys_SPA3102_Line_1_Extension_Set_Up]]&lt;br /&gt;
{{p}}&lt;br /&gt;
&lt;br /&gt;
====Useful Link Goodness:====&lt;br /&gt;
&lt;br /&gt;
[[Ekiga]] - Excellent write up on getting a softphone setup on your favorite Non-LinuxMCE linux box.&lt;br /&gt;
&lt;br /&gt;
[[Linksys_spa-3102]] - Original SPA3102 page.&lt;br /&gt;
&lt;br /&gt;
[[Linksys_spa3000_pstn_interface]] - Another home-grown wiki on the device&lt;br /&gt;
&lt;br /&gt;
[http://www.freepbx.org/support/documentation/howtos/howto-linksys-spa-3102-sipura-spa-3000-freepbx The FreePBX HowTo that saved what is left of my hair]&lt;br /&gt;
&lt;br /&gt;
Best Regards, &lt;br /&gt;
&lt;br /&gt;
--[[User:Sethj|Sethj]] 21:13, 11 October 2010 (CEST)&lt;/div&gt;</summary>
		<author><name>Pw44</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=Asterisk_Extension_with_Nokia_Phone&amp;diff=25992</id>
		<title>Asterisk Extension with Nokia Phone</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=Asterisk_Extension_with_Nokia_Phone&amp;diff=25992"/>
		<updated>2010-10-23T13:06:06Z</updated>

		<summary type="html">&lt;p&gt;Pw44: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Telecom]]&lt;br /&gt;
[[Category:Phone Lines]]&lt;br /&gt;
[[Category:VoIP]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
{{versioninfo|810Status=Works|810UpdatedDate=13 October 2010|810UpdatedBy=PW44}}&lt;br /&gt;
&lt;br /&gt;
Imagine being on vacations and someone calls your home phone number and your mobile rings. &lt;br /&gt;
&lt;br /&gt;
With phones having SIP clients, it&#039;s possible to have an extension of your home system.&lt;br /&gt;
&lt;br /&gt;
My Nokia N95 became an extension of my home system, and i will describe how.&lt;br /&gt;
&lt;br /&gt;
Webadmin -&amp;gt; Wizard -&amp;gt; Phones -&amp;gt; Add Device. &lt;br /&gt;
&lt;br /&gt;
Select Generic Sip Phone (device template #1734)-&amp;gt; Pick device. &lt;br /&gt;
&lt;br /&gt;
Take note of the extension number and extension number password. You will need to inform it in the Nokia configuration below.&lt;br /&gt;
&lt;br /&gt;
After done, configure you Nokia like:&lt;br /&gt;
 &lt;br /&gt;
# configure your phone with your home wireless access point and make sure that phone can navigate. By default it will ask for a DHCP leased IP, so it will be hooked to the 192.168.80.* subnet&lt;br /&gt;
# go to Menu -&amp;gt; Tools -&amp;gt; Settings -&amp;gt; Connections -&amp;gt; SIP settings and create e new profile with the following config:&lt;br /&gt;
# Profile Name : name of your choice&lt;br /&gt;
# Service profile : IETF&lt;br /&gt;
# Default access point : your access point&lt;br /&gt;
# Public user name : sip:userid@192.168.80.1 (where userid should be the extension number created in webadmin)&lt;br /&gt;
# Use compression : no&lt;br /&gt;
# Registration : always on&lt;br /&gt;
# Use security : no&lt;br /&gt;
# Proxy Server&lt;br /&gt;
# Proxy server address : sip:192.168.80.1&lt;br /&gt;
# Realm : asterisk (it is asterisk by default, unless it is differently set in /etc/asterisk/sip.conf)&lt;br /&gt;
# User name : extension number &lt;br /&gt;
# Password :  extension number password&lt;br /&gt;
# Allow loose routing : yes&lt;br /&gt;
# Transport type : UDP&lt;br /&gt;
# Port : 5060 &lt;br /&gt;
# Registrar server&lt;br /&gt;
# Registrar serv. addr. : sip:192.168.80.1&lt;br /&gt;
# Realm : none&lt;br /&gt;
# User name : extension number&lt;br /&gt;
# Password : none&lt;br /&gt;
# Transport type : UDP&lt;br /&gt;
# Port : 5060&lt;br /&gt;
# Save all&lt;br /&gt;
# Go to Menu -&amp;gt; Tools -&amp;gt; Settings -&amp;gt; Connections -&amp;gt; Internet Tel and create a new Internet Tel profile, chossing the SIP profile you created before.&lt;br /&gt;
&lt;br /&gt;
If everything is right, you will be able to place &amp;quot;internet calls&amp;quot; from the Nokia Phone, which acts as a telefone device of your system.&lt;br /&gt;
&lt;br /&gt;
If you plan to have it also working from outside your home, i suggest you enable a PPTP server and get SymVPN, a PPTP client for Symbian.&lt;br /&gt;
&lt;br /&gt;
Have this configured, i do have two sip profiles, one for inside the house and other for outside, enbling me to have an extension of my telecom system from any wifi spot, public or not, even at my work.&lt;/div&gt;</summary>
		<author><name>Pw44</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=Fail2ban_-_A_tool_against_brute_force&amp;diff=25905</id>
		<title>Fail2ban - A tool against brute force</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=Fail2ban_-_A_tool_against_brute_force&amp;diff=25905"/>
		<updated>2010-10-15T21:04:03Z</updated>

		<summary type="html">&lt;p&gt;Pw44: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: Tutorials]]&lt;br /&gt;
[[Category: Networking]]&lt;br /&gt;
{{versioninfo|810Status=Works|810UpdatedDate=5 October 2010|810UpdatedBy=pw44}}&lt;br /&gt;
&lt;br /&gt;
Having asterik installed is almost an invitation for others wishing to place calls at your expense.&lt;br /&gt;
&lt;br /&gt;
After configuring my sip trunk, it did not take 2 days and some &amp;quot;smart guy&amp;quot;  was trying to register to take advantage of it, and causing me losses.&lt;br /&gt;
&lt;br /&gt;
Fail2ban prevented it, blocking the attacker with iptables rules.&lt;br /&gt;
&lt;br /&gt;
Installing fail2ban is not complicated and i will describe the steps to have it properly installed and configured, so you can protect your asterisk and other services from brute force attack.&lt;br /&gt;
&lt;br /&gt;
Files under /etc/asterisk/ are owned by the asterisk user, so preceed any edit commands with&lt;br /&gt;
 sudo -u asterisk &amp;lt;command&amp;gt;&lt;br /&gt;
The first thing to do is edit /etc/asterisk/sip.conf and add the following line:&lt;br /&gt;
 alwaysauthreject=yes                                                 &lt;br /&gt;
My sip.conf file looks like:&lt;br /&gt;
 ............&lt;br /&gt;
 [general]&lt;br /&gt;
 #include sip_general_additional.conf&lt;br /&gt;
 &lt;br /&gt;
 bindport = 5060       ; Port to bind to (SIP is 5060)&lt;br /&gt;
 bindaddr = 0.0.0.0    ; Address to bind to (all addresses on machine)&lt;br /&gt;
 &#039;&#039;&#039;alwaysauthreject=yes&#039;&#039;&#039;                                                 &lt;br /&gt;
 disallow=all                                                         &lt;br /&gt;
 allow=ulaw                                                           &lt;br /&gt;
 allow=alaw  &lt;br /&gt;
 .............                    &lt;br /&gt;
Install fail2ban with: &lt;br /&gt;
 sudo apt-get install fail2ban&lt;br /&gt;
&lt;br /&gt;
After is installed, you need to change /etc/asterisk/logger.conf and add the following line under [general] section (You may have to create this before the [logfiles] section). &lt;br /&gt;
&lt;br /&gt;
 [general]&lt;br /&gt;
 dateformat=%F %T&lt;br /&gt;
&lt;br /&gt;
In /etc/asterisk/logger.conf add the following line under the [logfiles] section for asterisk to log NOTICE level events to the syslog (/var/log/messages) as well as its normal log file. These entries in syslog will have a Date/Time stamp that is usable by fail2ban.&lt;br /&gt;
&lt;br /&gt;
 syslog.local0 =&amp;gt; notice &lt;br /&gt;
&lt;br /&gt;
Reload asterisk, as root, with:&lt;br /&gt;
&lt;br /&gt;
 sudo asterisk -rx &amp;quot;logger reload&amp;quot; &lt;br /&gt;
&lt;br /&gt;
Configuring fail2ban:&lt;br /&gt;
&lt;br /&gt;
 cd /etc/fail2ban/filter.d&lt;br /&gt;
&lt;br /&gt;
 touch asterisk.conf &lt;br /&gt;
&lt;br /&gt;
 vi asterisk.conf&lt;br /&gt;
&lt;br /&gt;
insert the following (copy &amp;amp; paste)&lt;br /&gt;
&lt;br /&gt;
 # Fail2Ban configuration file&lt;br /&gt;
 #&lt;br /&gt;
 #&lt;br /&gt;
 # $Revision: 250 $&lt;br /&gt;
 #&lt;br /&gt;
 [INCLUDES]&lt;br /&gt;
 # Read common prefixes. If any customizations available -- read them from&lt;br /&gt;
 # common.local&lt;br /&gt;
 #before = common.conf&lt;br /&gt;
 [Definition]&lt;br /&gt;
 #_daemon = asterisk&lt;br /&gt;
 # Option:  failregex&lt;br /&gt;
 # Notes.:  regex to match the password failures messages in the logfile. The&lt;br /&gt;
 #          host must be matched by a group named &amp;quot;host&amp;quot;. The tag &amp;quot;&amp;lt;HOST&amp;gt;&amp;quot; can&lt;br /&gt;
 #          be used for standard IP/hostname matching and is only an alias for&lt;br /&gt;
 #          (?:::f{4,6}:)?(?P&amp;lt;host&amp;gt;\S+)&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 failregex = NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Wrong password&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - No matching peer found&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Username/auth name mismatch&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Device does not match ACL&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&amp;quot; .* failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Peer is not supposed to register&lt;br /&gt;
             NOTICE.* &amp;lt;HOST&amp;gt; failed to authenticate as &#039;.*&#039;$&lt;br /&gt;
             NOTICE.* .*: No registration for peer &#039;.*&#039; \(from &amp;lt;HOST&amp;gt;\)&lt;br /&gt;
             NOTICE.* .*: Host &amp;lt;HOST&amp;gt; failed MD5 authentication for &#039;.*&#039; (.*)&lt;br /&gt;
             NOTICE.* .*: Failed to authenticate user .*@&amp;lt;HOST&amp;gt;.*&lt;br /&gt;
 # Option:  ignoreregex&lt;br /&gt;
 # Notes.:  regex to ignore. If this regex matches, the line is ignored.&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 ignoreregex =&lt;br /&gt;
&lt;br /&gt;
Next edit /etc/fail2ban/jail.conf to include the following section so that it uses the new filter. &lt;br /&gt;
&lt;br /&gt;
 [asterisk-iptables]&lt;br /&gt;
 enabled  = true&lt;br /&gt;
 filter   = asterisk&lt;br /&gt;
 action   = iptables-allports[name=ASTERISK, protocol=all]&lt;br /&gt;
            sendmail-whois[name=ASTERISK, dest=root, sender=fail2ban@example.org]&lt;br /&gt;
 logpath  = /var/log/asterisk/full&lt;br /&gt;
 maxretry = 2&lt;br /&gt;
 bantime = 259200&lt;br /&gt;
&lt;br /&gt;
Locate the line ignoreip in /etc/fail2ban/jail.conf (beginning of the file) and insert the ip&#039;s and / or blocks you want fail2ban to ignore, so you don&#039;t risk banning yourserf or any host in your network.&lt;br /&gt;
&lt;br /&gt;
Mine is defined as follows:&lt;br /&gt;
&lt;br /&gt;
 [DEFAULT]&lt;br /&gt;
 # &amp;quot;ignoreip&amp;quot; can be an IP address, a CIDR mask or a DNS host. Fail2ban will not&lt;br /&gt;
 # ban a host which matches an address in this list. Several addresses can be   &lt;br /&gt;
 # defined using space separator.                                               &lt;br /&gt;
 ignoreip = 127.0.0.1 192.168.80.1 192.168.80.0/24 &lt;br /&gt;
&lt;br /&gt;
To start fail2ban type the following as root:&lt;br /&gt;
&lt;br /&gt;
 /etc/init.d/fail2ban start&lt;br /&gt;
&lt;br /&gt;
Check It&lt;br /&gt;
&lt;br /&gt;
For LinuxMCE, there is needed &amp;quot;patch&amp;quot;, while fail2ban is not part of the distribution.&lt;br /&gt;
&lt;br /&gt;
When LinuxMCE starts, it runs /usr/pluto/bin/Network_Firewall.sh, and this is done AFTER /etc/init.d/fail2ban is started.&lt;br /&gt;
&lt;br /&gt;
So, edit /usr/pluto/bin/Network_Firewall.sh and add the following at the END of this file:&lt;br /&gt;
 &lt;br /&gt;
 /etc/init.d/fail2ban restart&lt;br /&gt;
&lt;br /&gt;
This will make sure that fail2bain is started AFTER the iptables rules from LinuxMCE.&lt;br /&gt;
&lt;br /&gt;
If started properly issue the following command to view your iptables rules:&lt;br /&gt;
&lt;br /&gt;
 iptables -L -v&lt;br /&gt;
&lt;br /&gt;
You should see something like the following for the INPUT chain (this is the ouput of mine)&lt;br /&gt;
&lt;br /&gt;
 Chain INPUT (policy DROP 2241 packets, 160K bytes)              &lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination         &lt;br /&gt;
   372 27264 &#039;&#039;&#039;fail2ban-SSH&#039;&#039;&#039;  tcp  --  any    any     anywhere             anywhere            tcp dpt:ssh                                                                                          &lt;br /&gt;
 1312K  991M &#039;&#039;&#039;fail2ban-ASTERISK&#039;&#039;&#039;  all  --  any    any     anywhere             anywhere            &lt;br /&gt;
  553K   81M ACCEPT     all  --  lo     any     anywhere             anywhere                    &lt;br /&gt;
 1288K 1162M ACCEPT     all  --  any    any     anywhere             anywhere            state RELATED,ESTABLISHED                                                                               &lt;br /&gt;
     9   540 ACCEPT     all  --  any    any     anywhere             anywhere            MARK match 0x1                                                                                          &lt;br /&gt;
     2  1152 ACCEPT     udp  --  any    any     anywhere             anywhere            udp   dpt:bootps                                                                                          &lt;br /&gt;
 19276 5790K ACCEPT     all  --  any    any     192.168.80.0/24      anywhere                    &lt;br /&gt;
     0     0 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:iax                                                                                             &lt;br /&gt;
     4  1795 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:sip                                                                                             &lt;br /&gt;
     0     0 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:2000                                                                                            &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:sieve                                                                                           &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:1723                                                                                            &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:www                                                                                             &lt;br /&gt;
     1    60 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:ssh                                                                                             &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:https                                                                                           &lt;br /&gt;
     1    50 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpts:10001:20000&lt;br /&gt;
     0     0 ACCEPT     gre  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain FORWARD (policy ACCEPT 719K packets, 245M bytes)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
     0     0 TCPMSS     tcp  --  any    ppp+    anywhere             anywhere            tcp flags:SYN,RST/SYN TCPMSS clamp to PMTU&lt;br /&gt;
 Chain OUTPUT (policy ACCEPT 2099K packets, 590M bytes)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
     0     0 ACCEPT     gre  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain &#039;&#039;&#039;fail2ban-ASTERISK&#039;&#039;&#039; (1 references)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
  5091 2125K DROP       all  --  any    any     173.193.194.106-static.reverse.softlayer.com  anywhere&lt;br /&gt;
 1307K  989M RETURN     all  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain &#039;&#039;&#039;fail2ban-SSH&#039;&#039;&#039; (1 references)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
&lt;br /&gt;
If you do not see something similar to that then you have some troubleshooting to, check out /var/log/fail2ban.log.&lt;br /&gt;
&lt;br /&gt;
Example of my /var/log/fai2ban.log (173.193.194.106 is the real address from the attacker fail2ban banned):&lt;br /&gt;
&lt;br /&gt;
 ....&lt;br /&gt;
 2010-09-19 11:12:56,131 fail2ban.filter : INFO   Set maxRetry = 6&lt;br /&gt;
 2010-09-19 11:12:56,133 fail2ban.filter : INFO   Set findtime = 600&lt;br /&gt;
 2010-09-19 11:12:56,133 fail2ban.actions: INFO   Set banTime = 600&lt;br /&gt;
 2010-09-19 11:12:56,138 fail2ban.jail   : INFO   Jail &#039;ssh-iptables&#039; started&lt;br /&gt;
 2010-09-19 11:12:56,139 fail2ban.jail   : INFO   Jail &#039;asterisk-iptables&#039; started&lt;br /&gt;
 2010-09-19 11:12:56,141 fail2ban.jail   : INFO   Jail &#039;apache-tcpwrapper&#039; started&lt;br /&gt;
 2010-09-19 15:33:50,392 fail2ban.actions: WARNING [asterisk-iptables] Ban 173.193.194.106&lt;br /&gt;
 2010-09-19 15:34:50,982 fail2ban.actions: WARNING [asterisk-iptables] 173.193.194.106 already banned&lt;br /&gt;
&lt;br /&gt;
And this is the log (/var/log/asterisk/messages) showing the attack:&lt;br /&gt;
&lt;br /&gt;
 [2010-09-19 15:33:48] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;3235410554&amp;quot;&amp;lt;sip:3235410554@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                           &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;thomas&amp;quot;&amp;lt;sip:thomas@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;arsenal&amp;quot;&amp;lt;sip:arsenal@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;letmein&amp;quot;&amp;lt;sip:letmein@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;liverpool&amp;quot;&amp;lt;sip:liverpool@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;nevermind&amp;quot;&amp;lt;sip:nevermind@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;getmein&amp;quot;&amp;lt;sip:getmein@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;echo&amp;quot;&amp;lt;sip:echo@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;bmw325&amp;quot;&amp;lt;sip:bmw325@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;bmw335&amp;quot;&amp;lt;sip:bmw335@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w3e&amp;quot;&amp;lt;sip:1q2w3e@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w3e4r5t6y&amp;quot;&amp;lt;sip:1q2w3e4r5t6y@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q1q2w2w&amp;quot;&amp;lt;sip:1q1q2w2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w1q2w&amp;quot;&amp;lt;sip:1q2w1q2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w&amp;quot;&amp;lt;sip:1q2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;11q22w&amp;quot;&amp;lt;sip:11q22w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;q1w2&amp;quot;&amp;lt;sip:q1w2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;q1w2e3&amp;quot;&amp;lt;sip:q1w2e3@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;tvv03tvv03&amp;quot;&amp;lt;sip:tvv03tvv03@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                           &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd1&amp;quot;&amp;lt;sip:abcd1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd12&amp;quot;&amp;lt;sip:abcd12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd123&amp;quot;&amp;lt;sip:abcd123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;qq11ww22ee33rr44&amp;quot;&amp;lt;sip:qq11ww22ee33rr44@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1&amp;quot;&amp;lt;sip:sip1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip2&amp;quot;&amp;lt;sip:sip2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip12&amp;quot;&amp;lt;sip:sip12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip123&amp;quot;&amp;lt;sip:sip123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1234&amp;quot;&amp;lt;sip:sip1234@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip12345&amp;quot;&amp;lt;sip:sip12345@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1111&amp;quot;&amp;lt;sip:sip1111@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip222&amp;quot;&amp;lt;sip:sip222@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1qa2ws3ed&amp;quot;&amp;lt;sip:1qa2ws3ed@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1234asdf&amp;quot;&amp;lt;sip:1234asdf@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1a2s3d&amp;quot;&amp;lt;sip:1a2s3d@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1a2s3d4f&amp;quot;&amp;lt;sip:1a2s3d4f@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;asdzxc&amp;quot;&amp;lt;sip:asdzxc@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;123zxc&amp;quot;&amp;lt;sip:123zxc@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1234zxcv&amp;quot;&amp;lt;sip:1234zxcv@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;aazzssxx&amp;quot;&amp;lt;sip:aazzssxx@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;p@ssword&amp;quot;&amp;lt;sip:p@ssword@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;p@ssw0rd&amp;quot;&amp;lt;sip:p@ssw0rd@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;pass1&amp;quot;&amp;lt;sip:pass1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;password3&amp;quot;&amp;lt;sip:password3@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;pass12&amp;quot;&amp;lt;sip:pass12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account&amp;quot;&amp;lt;sip:account@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;passlogin&amp;quot;&amp;lt;sip:passlogin@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account1&amp;quot;&amp;lt;sip:account1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account5&amp;quot;&amp;lt;sip:account5@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account6&amp;quot;&amp;lt;sip:account6@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account123&amp;quot;&amp;lt;sip:account123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account12&amp;quot;&amp;lt;sip:account12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc1&amp;quot;&amp;lt;sip:acc1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc2&amp;quot;&amp;lt;sip:acc2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc12&amp;quot;&amp;lt;sip:acc12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
&lt;br /&gt;
One last tip: you need a MTA, like sendmail or postfix, in order to receive the notifications from fail2ban.&lt;br /&gt;
&lt;br /&gt;
If you have a MTA installed and properly configured, nothing else is needed, but if not, install sendmail&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install sendmail&lt;br /&gt;
&lt;br /&gt;
Then edit the /etc/hosts file and change the line &#039;&#039;&#039;192.168.80.1 dcerouter&#039;&#039;&#039; to read &#039;&#039;&#039;192.168.80.1 dcerouter.localdomain dcerouter&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Doing it, sendmail will start as expected (fast) and mail will properly delivered. If this change is not done, sendmail will take a long time to start, because it does not find the qualified host name, as the log shows:&lt;br /&gt;
&lt;br /&gt;
 Sep 27 13:12:11 dcerouter sendmail[10585]: My unqualified host name (dcerouter) unknown; sleeping for retry&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I hope this wiki helps.&lt;br /&gt;
&lt;br /&gt;
source: &lt;br /&gt;
 http://www.fail2ban.org&lt;br /&gt;
 http://www.voip-info.org/wiki/view/Fail2Ban+(with+iptables)+And+Asterisk&lt;br /&gt;
 http://www.fail2ban.org/wiki/index.php/Asterisk&lt;br /&gt;
&lt;br /&gt;
More protection with iptables:&lt;br /&gt;
 http://sysadminman.net/blog/2010/limiting-sipiax-connections-to-asterisk-with-iptables-1082&lt;/div&gt;</summary>
		<author><name>Pw44</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=Asterisk_Extension_with_Nokia_Phone&amp;diff=25895</id>
		<title>Asterisk Extension with Nokia Phone</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=Asterisk_Extension_with_Nokia_Phone&amp;diff=25895"/>
		<updated>2010-10-13T22:34:58Z</updated>

		<summary type="html">&lt;p&gt;Pw44: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:VOIP Setups]]&lt;br /&gt;
[[Category:Telecom]]&lt;br /&gt;
[[Category:Phone Lines]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
{{versioninfo|810Status=Works|810UpdatedDate=13 October 2010|810UpdatedBy=PW44}}&lt;br /&gt;
&lt;br /&gt;
Imagine being on vacations and someone calls your home phone number and your mobile rings. &lt;br /&gt;
&lt;br /&gt;
With phones having SIP clients, it&#039;s possible to have an extension of your home system.&lt;br /&gt;
&lt;br /&gt;
My Nokia N95 became an extension of my home system, and i will describe how.&lt;br /&gt;
&lt;br /&gt;
Webadmin -&amp;gt; Wizard -&amp;gt; Phones -&amp;gt; Add Device. &lt;br /&gt;
&lt;br /&gt;
Select Generic Sip Phone (device template #1734)-&amp;gt; Pick device. &lt;br /&gt;
&lt;br /&gt;
Take note of the extension number and extension number password. You will need to inform it in the Nokia configuration below.&lt;br /&gt;
&lt;br /&gt;
After done, configure you Nokia like:&lt;br /&gt;
 &lt;br /&gt;
# configure your phone with your home wireless access point and make sure that phone can navigate. By default it will ask for a DHCP leased IP, so it will be hooked to the 192.168.80.* subnet&lt;br /&gt;
# go to Menu -&amp;gt; Tools -&amp;gt; Settings -&amp;gt; Connections -&amp;gt; SIP settings and create e new profile with the following config:&lt;br /&gt;
# Profile Name : name of your choice&lt;br /&gt;
# Service profile : IETF&lt;br /&gt;
# Default access point : your access point&lt;br /&gt;
# Public user name : sip:userid@192.168.80.1 (where userid should be the ext number you defined earlier in AMP)&lt;br /&gt;
# Use compression : no&lt;br /&gt;
# Registration : always on&lt;br /&gt;
# Use security : no&lt;br /&gt;
# Proxy Server&lt;br /&gt;
# Proxy server address : sip:192.168.80.1&lt;br /&gt;
# Realm : asterisk (it is asterisk by default, unless it is differently set in /etc/asterisk/sip.conf)&lt;br /&gt;
# User name : extension number &lt;br /&gt;
# Password :  extension number password&lt;br /&gt;
# Allow loose routing : yes&lt;br /&gt;
# Transport type : UDP&lt;br /&gt;
# Port : 5060 &lt;br /&gt;
# Registrar server&lt;br /&gt;
# Registrar serv. addr. : sip:192.168.80.1&lt;br /&gt;
# Realm : none&lt;br /&gt;
# User name : extension number&lt;br /&gt;
# Password : none&lt;br /&gt;
# Transport type : UDP&lt;br /&gt;
# Port : 5060&lt;br /&gt;
# Save all&lt;br /&gt;
# Go to Menu -&amp;gt; Tools -&amp;gt; Settings -&amp;gt; Connections -&amp;gt; Internet Tel and create a new Internet Tel profile, chossing the SIP profile you created before.&lt;br /&gt;
&lt;br /&gt;
If everything is right, you will be able to place &amp;quot;internet calls&amp;quot; from the Nokia Phone, which acts as a telefone device of your system.&lt;br /&gt;
&lt;br /&gt;
If you plan to have it also working from outside your home, i suggest you enable a PPTP server and get SymVPN, a PPTP client for Symbian.&lt;br /&gt;
&lt;br /&gt;
Have this configured, i do have two sip profiles, one for inside the house and other for outside, enbling me to have an extension of my telecom system from any wifi spot, public or not, even at my work.&lt;/div&gt;</summary>
		<author><name>Pw44</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=Asterisk_Extension_with_Nokia_Phone&amp;diff=25894</id>
		<title>Asterisk Extension with Nokia Phone</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=Asterisk_Extension_with_Nokia_Phone&amp;diff=25894"/>
		<updated>2010-10-13T22:34:29Z</updated>

		<summary type="html">&lt;p&gt;Pw44: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:VOIP Setups]]&lt;br /&gt;
[[Category:Telecom]]&lt;br /&gt;
[[Category:Phone Lines]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
{{versioninfo|810Status=Works|810UpdatedDate=13 October 2010|810UpdatedBy=PW44}}&lt;br /&gt;
&lt;br /&gt;
Imagine being on vacations and someone calls your home phone number and your mobile rings. &lt;br /&gt;
&lt;br /&gt;
With phones having SIP clients, it&#039;s possible to have an extension of your home system.&lt;br /&gt;
&lt;br /&gt;
My Nokia N95 became an extension of my home system, and i will describe how.&lt;br /&gt;
&lt;br /&gt;
Webadmin -&amp;gt; Wizard -&amp;gt; Phones -&amp;gt; Add Device. &lt;br /&gt;
&lt;br /&gt;
Select Generic Sip Phone (device template #1734)-&amp;gt; Pick device. &lt;br /&gt;
&lt;br /&gt;
Take note of the extension number and extension number password. You will need to inform it in the Nokia configuration below.&lt;br /&gt;
&lt;br /&gt;
After done, configure you Nokia like:&lt;br /&gt;
 &lt;br /&gt;
# configure your phone with your home wireless access point and make sure that phone can navigate. By default it will ask for a DHCP leased IP, so it will be hooked to the 192.168.80.* subnet&lt;br /&gt;
# go to Menu -&amp;gt; Tools -&amp;gt; Settings -&amp;gt; Connections -&amp;gt; SIP settings and create e new profile with the following config:&lt;br /&gt;
# Profile Name : name of your choice&lt;br /&gt;
# Service profile : IETF&lt;br /&gt;
# Default access point : your access point&lt;br /&gt;
# Public user name : sip:userid@192.168.80.1 (where userid should be the ext number you defined earlier in AMP)&lt;br /&gt;
# Use compression : no&lt;br /&gt;
# Registration : always on&lt;br /&gt;
# Use security : no&lt;br /&gt;
# Proxy Server&lt;br /&gt;
# Proxy server address : sip:192.168.80.1&lt;br /&gt;
# Realm : asterisk (it is asterisk by default, unless it is differently set in /etc/asterisk/sip.conf)&lt;br /&gt;
# User name : extension number &lt;br /&gt;
# Password :  extension number password&lt;br /&gt;
# Allow loose routing : yes&lt;br /&gt;
# Transport type : UDP&lt;br /&gt;
# Port : 5060 &lt;br /&gt;
# Registrar server&lt;br /&gt;
# Registrar serv. addr. : sip:192.168.80.1&lt;br /&gt;
# Realm : none&lt;br /&gt;
# User name : extension number&lt;br /&gt;
# Password : none&lt;br /&gt;
# Transport type : UDP&lt;br /&gt;
# Port : 5060&lt;br /&gt;
# Save all&lt;br /&gt;
# Go to Menu -&amp;gt; Tools -&amp;gt; Settings -&amp;gt; Connections -&amp;gt; Internet Tel and create a new Internet Tel profile, chossing the SIP profile you created before.&lt;br /&gt;
&lt;br /&gt;
If everything is right, you will be able to place &amp;quot;internet calls&amp;quot;from the Nokia Phone, which acts as a telefone device of your system.&lt;br /&gt;
&lt;br /&gt;
If you plan to have it also working from outside your home, i suggest you enable a PPTP server and get SymVPN, a PPTP client for Symbian.&lt;br /&gt;
&lt;br /&gt;
Have this configured, i do have two sip profiles, one for inside the house and other for outside, enbling me to have an extension of my telecom system from any wifi spot, public or not, even at my work.&lt;/div&gt;</summary>
		<author><name>Pw44</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=Asterisk_Extension_with_Nokia_Phone&amp;diff=25893</id>
		<title>Asterisk Extension with Nokia Phone</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=Asterisk_Extension_with_Nokia_Phone&amp;diff=25893"/>
		<updated>2010-10-13T22:33:55Z</updated>

		<summary type="html">&lt;p&gt;Pw44: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:VOIP Setups]]&lt;br /&gt;
[[Category:Telecom]]&lt;br /&gt;
[[Category:Phone Lines]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
{{versioninfo|810Status=Works|810UpdatedDate=5 October 2010|810UpdatedBy=PW44}}&lt;br /&gt;
&lt;br /&gt;
Imagine being on vacations and someone calls your home phone number and your mobile rings. &lt;br /&gt;
&lt;br /&gt;
With phones having SIP clients, it&#039;s possible to have an extension of your home system.&lt;br /&gt;
&lt;br /&gt;
My Nokia N95 became an extension of my home system, and i will describe how.&lt;br /&gt;
&lt;br /&gt;
Webadmin -&amp;gt; Wizard -&amp;gt; Phones -&amp;gt; Add Device. &lt;br /&gt;
&lt;br /&gt;
Select Generic Sip Phone (device template #1734)-&amp;gt; Pick device. &lt;br /&gt;
&lt;br /&gt;
Take note of the extension number and extension number password. You will need to inform it in the Nokia configuration below.&lt;br /&gt;
&lt;br /&gt;
After done, configure you Nokia like:&lt;br /&gt;
 &lt;br /&gt;
# configure your phone with your home wireless access point and make sure that phone can navigate. By default it will ask for a DHCP leased IP, so it will be hooked to the 192.168.80.* subnet&lt;br /&gt;
# go to Menu -&amp;gt; Tools -&amp;gt; Settings -&amp;gt; Connections -&amp;gt; SIP settings and create e new profile with the following config:&lt;br /&gt;
# Profile Name : name of your choice&lt;br /&gt;
# Service profile : IETF&lt;br /&gt;
# Default access point : your access point&lt;br /&gt;
# Public user name : sip:userid@192.168.80.1 (where userid should be the ext number you defined earlier in AMP)&lt;br /&gt;
# Use compression : no&lt;br /&gt;
# Registration : always on&lt;br /&gt;
# Use security : no&lt;br /&gt;
# Proxy Server&lt;br /&gt;
# Proxy server address : sip:192.168.80.1&lt;br /&gt;
# Realm : asterisk (it is asterisk by default, unless it is differently set in /etc/asterisk/sip.conf)&lt;br /&gt;
# User name : extension number &lt;br /&gt;
# Password :  extension number password&lt;br /&gt;
# Allow loose routing : yes&lt;br /&gt;
# Transport type : UDP&lt;br /&gt;
# Port : 5060 &lt;br /&gt;
# Registrar server&lt;br /&gt;
# Registrar serv. addr. : sip:192.168.80.1&lt;br /&gt;
# Realm : none&lt;br /&gt;
# User name : extension number&lt;br /&gt;
# Password : none&lt;br /&gt;
# Transport type : UDP&lt;br /&gt;
# Port : 5060&lt;br /&gt;
# Save all&lt;br /&gt;
# Go to Menu -&amp;gt; Tools -&amp;gt; Settings -&amp;gt; Connections -&amp;gt; Internet Tel and create a new Internet Tel profile, chossing the SIP profile you created before.&lt;br /&gt;
&lt;br /&gt;
If everything is right, you will be able to place &amp;quot;internet calls&amp;quot;from the Nokia Phone, which acts as a telefone device of your system.&lt;br /&gt;
&lt;br /&gt;
If you plan to have it also working from outside your home, i suggest you enable a PPTP server and get SymVPN, a PPTP client for Symbian.&lt;br /&gt;
&lt;br /&gt;
Have this configured, i do have two sip profiles, one for inside the house and other for outside, enbling me to have an extension of my telecom system from any wifi spot, public or not, even at my work.&lt;/div&gt;</summary>
		<author><name>Pw44</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=Asterisk_Extension_with_Nokia_Phone&amp;diff=25892</id>
		<title>Asterisk Extension with Nokia Phone</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=Asterisk_Extension_with_Nokia_Phone&amp;diff=25892"/>
		<updated>2010-10-13T22:32:17Z</updated>

		<summary type="html">&lt;p&gt;Pw44: New page: Category:VOIP Setups Category:Telecom Category:Phone Lines Category:Tutorials {{versioninfo|810Status=Works|810UpdatedDate=5 October 2010|810UpdatedBy=PW44}}  Imagine being...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:VOIP Setups]]&lt;br /&gt;
[[Category:Telecom]]&lt;br /&gt;
[[Category:Phone Lines]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
{{versioninfo|810Status=Works|810UpdatedDate=5 October 2010|810UpdatedBy=PW44}}&lt;br /&gt;
&lt;br /&gt;
Imagine being on vacations and someone calls your home phone number and your mobile rings. &lt;br /&gt;
&lt;br /&gt;
With phones having SIP clients, it&#039;s possible to have an extension of your home system.&lt;br /&gt;
&lt;br /&gt;
My Nokia N95 became an extension of my home system, and i will describe how.&lt;br /&gt;
&lt;br /&gt;
Webadmin -&amp;gt; Wizard -&amp;gt; Phones -&amp;gt; Add Device. &lt;br /&gt;
&lt;br /&gt;
Select Generic Sip Phone (device template #1734)-&amp;gt; Pick device.&lt;br /&gt;
&lt;br /&gt;
As you would do with any generic SIP phone. Take note of the extension number and extension number password. You will need to inform it in the Nokia configuration below.&lt;br /&gt;
&lt;br /&gt;
After done, configure you Nokia like:&lt;br /&gt;
 &lt;br /&gt;
# configure your phone with your home wireless access point and make sure that phone can navigate. By default it will ask for a DHCP leased IP, so it will be hooked to the 192.168.80.* subnet&lt;br /&gt;
# go to Menu -&amp;gt; Tools -&amp;gt; Settings -&amp;gt; Connections -&amp;gt; SIP settings and create e new profile with the following config:&lt;br /&gt;
# Profile Name : name of your choice&lt;br /&gt;
# Service profile : IETF&lt;br /&gt;
# Default access point : your access point&lt;br /&gt;
# Public user name : sip:userid@192.168.80.1 (where userid should be the ext number you defined earlier in AMP)&lt;br /&gt;
# Use compression : no&lt;br /&gt;
# Registration : always on&lt;br /&gt;
# Use security : no&lt;br /&gt;
# Proxy Server&lt;br /&gt;
# Proxy server address : sip:192.168.80.1&lt;br /&gt;
# Realm : asterisk (it is asterisk by default, unless it is differently set in /etc/asterisk/sip.conf)&lt;br /&gt;
# User name : extension number &lt;br /&gt;
# Password :  extension number password&lt;br /&gt;
# Allow loose routing : yes&lt;br /&gt;
# Transport type : UDP&lt;br /&gt;
# Port : 5060 &lt;br /&gt;
# Registrar server&lt;br /&gt;
# Registrar serv. addr. : sip:192.168.80.1&lt;br /&gt;
# Realm : none&lt;br /&gt;
# User name : extension number&lt;br /&gt;
# Password : none&lt;br /&gt;
# Transport type : UDP&lt;br /&gt;
# Port : 5060&lt;br /&gt;
# Save all&lt;br /&gt;
# Go to Menu -&amp;gt; Tools -&amp;gt; Settings -&amp;gt; Connections -&amp;gt; Internet Tel and create a new Internet Tel profile, chossing the SIP profile you created before.&lt;br /&gt;
&lt;br /&gt;
If everything is right, you will be able to place &amp;quot;internet calls&amp;quot;from the Nokia Phone, which acts as a telefone device of your system.&lt;br /&gt;
&lt;br /&gt;
If you plan to have it also working from outside your home, i suggest you enable a PPTP server and get SymVPN, a PPTP client for Symbian.&lt;br /&gt;
&lt;br /&gt;
Have this configured, i do have two sip profiles, one for inside the house and other for outside, enbling me to have an extension of my telecom system from any wifi spot, public or not, even at my work.&lt;/div&gt;</summary>
		<author><name>Pw44</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=Linksys_SPA3102&amp;diff=25878</id>
		<title>Linksys SPA3102</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=Linksys_SPA3102&amp;diff=25878"/>
		<updated>2010-10-11T21:18:01Z</updated>

		<summary type="html">&lt;p&gt;Pw44: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: Hardware]]&lt;br /&gt;
{| align=&amp;quot;right&amp;quot;&lt;br /&gt;
  | __TOC__&lt;br /&gt;
  |}&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Telecom]]&lt;br /&gt;
[[Category:Voip]]&lt;br /&gt;
====Background====&lt;br /&gt;
The Linksys SPA3102/Sipura 3000 PSTN Gateways feature the ability to connect a standard telephone landline to IP-based data networks and can be configured as a SIP trunk for use with your LinuxMCE built-in telephony system. &lt;br /&gt;
&lt;br /&gt;
Due to the area in which I live, there are no viable High Speed DSL/CABLE or other types of internet. I only have access to Satellite Internet, which due to the nature of the beast, has a very high latency (900 - 1400ms average) and I can not use a traditional VOIP provider like Broadvoice, Vonage, or the like. However as the telephony feature of LinuxMCE is a very cool perk to this system, I figured I would have a go at integrating my analog Verizon landline into the system. To create this SIP/Bridge I chose the Linksys SPA3102, however after scanning the FreePBX forums, I can assume they will work well with the Sipura 3000 as well. After many hours of breaking, and then fixing my phone setup, I have a working viable solution, and these steps will detail how to set up this product for use with LinuxMCE. Some of these settings are borrowed from the existing wiki&#039;s here on these products, but after using them and failing, I had a go on my own. as always if there is a better more efficient way to accomplish this, please EDIT this wiki. I am by no means an expert. :)&lt;br /&gt;
&lt;br /&gt;
=Required items to complete this process.=&lt;br /&gt;
&lt;br /&gt;
*Linksys SPA3102 or Sipura SPA3000 - Average price between $40 and $80, depending on your source. I used Newegg, because &amp;quot;Once you&#039;ve NewEgged....&amp;quot;&lt;br /&gt;
** [http://www.newegg.com/Product/Product.aspx?Item=N82E16833124239&amp;amp;Tpk=spa3102 Linksys SPA3102]&lt;br /&gt;
* A laptop, netboox, or PC you can temporarily connect a network cable to the LAN port on the device&lt;br /&gt;
* A web browser for configuring the SPA and the Phone Lines in LinuxMCE webmin.&lt;br /&gt;
* The following file: [http://dataless.jeromenet.org/filespace/spa3102.tar.gz spa3102.tar.gz]&lt;br /&gt;
* Any hardwired old school phone, with touchtone.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Setting up with LinuxMCE=&lt;br /&gt;
&lt;br /&gt;
====Adding the new config files to your core.====&lt;br /&gt;
* Download the above file to a location of your choice&lt;br /&gt;
** wget http://dataless.jeromenet.org/filespace/spa3102.tar.gz&lt;br /&gt;
* Extract/Copy/Modify the files&lt;br /&gt;
** tar zxvf spa3102.tar.gz&lt;br /&gt;
** chmod a+x create_amp_spa3102.pl&lt;br /&gt;
** sudo cp create_amp_spa3102.pl /usr/pluto/bin&lt;br /&gt;
** sudo cp provider_list.txt /etc/asterisk&lt;br /&gt;
*** This file is default plus my addition, if you have already modified your /etc/asterisk/provider_list.txt, you can also simply add the line:&lt;br /&gt;
*** Linksys SPA3102/SPA3000         http://www.cisco.com/en/US/products/ps10027     spa3102 SIP  (tab seperated)&lt;br /&gt;
First steps completed.&lt;br /&gt;
&lt;br /&gt;
====Adding your new Phone Line====&lt;br /&gt;
* Log into the webadmin of your core&lt;br /&gt;
* From the left hand panel, choose &amp;quot;Phone Lines&amp;quot;&lt;br /&gt;
* In the right panel, using the drop downs, select the new &amp;quot;Linksys SPA3102/SPA300&amp;quot; option.&lt;br /&gt;
* You will now be presented with 4 boxes to enter data. use the settings I have below here. (They are not UberSecure, and you can change them to what you like, just remember the username and password for later, when we configure the SPA itself)&lt;br /&gt;
** Username: spa3102&lt;br /&gt;
** Password: lmce&lt;br /&gt;
** Phone Number: &amp;lt;insert your 10 digit phone number, including your area code, like 5553221234&amp;gt; Very important, sets up routing, caller ID, etc.&lt;br /&gt;
** Host: dynamic &amp;lt;later in this wiki, when setting up the SPA, we will be setting a manual IP address, but this dynamic setting now, works some magic, lets leave it that way.&amp;gt;&lt;br /&gt;
** Save the file&lt;br /&gt;
Second steps completed. Congratulations, you just set up your FreePBX trunk!! Beer.&lt;br /&gt;
&lt;br /&gt;
=Setting up the SPA3102/SPA3000=&lt;br /&gt;
&lt;br /&gt;
====Factory reset your device (just to be on the same page.)====&lt;br /&gt;
* Plug your hardwire phone into the &amp;quot;Phone&amp;quot; jack on the SPA.&lt;br /&gt;
* Pick up the receiver on your hardwired phone&lt;br /&gt;
** Dial ****&lt;br /&gt;
** When the voice comes on dial 7 3 7 3 8#&lt;br /&gt;
** When prompted to confirm, press 1&lt;br /&gt;
Factory reset complete!&lt;br /&gt;
&lt;br /&gt;
* Plug a network cable from the &amp;quot;WAN&amp;quot; port on the SPA to the internal network on your core.&lt;br /&gt;
* Plug a phone cable into the &amp;quot;Line&amp;quot; jack on the SPA to your wall jack.&lt;br /&gt;
* Plug a network cable into the &amp;quot;LAN&amp;quot; port on the SPA into your laptop, netbook, or PC.&lt;br /&gt;
** Once your device gets an IP address from the SPA, point your browser to http://192.168.0.1&lt;br /&gt;
*** By default the SPA has no passwords set for User, or Admin.&lt;br /&gt;
&lt;br /&gt;
====WAN Setup====&lt;br /&gt;
&lt;br /&gt;
* Using the image below, set up all the areas in yellow - Summary:&lt;br /&gt;
** Static IP&lt;br /&gt;
** IP - 192.168.80.200&lt;br /&gt;
** Netmask - 255.255.255.0&lt;br /&gt;
** Gateway - 192.168.80.1&lt;br /&gt;
** Hostname - SPA3102&lt;br /&gt;
** Primary DNS - 192.168.80.1&lt;br /&gt;
** Primary NTP - 192.168.80.1&lt;br /&gt;
** Set WAN server to &amp;quot;Yes&amp;quot;&lt;br /&gt;
You can now, and always remember to, click &amp;quot;Apply All Changes&amp;quot; at the bottom, and if you like, disconnect your device from the LAN port, and re-connect to it from your MD or regular PC.&lt;br /&gt;
&lt;br /&gt;
[[Image:Spa3102-wan-setup.png]]&lt;br /&gt;
&lt;br /&gt;
====SIP Setup====&lt;br /&gt;
&lt;br /&gt;
* The only thing we need to change here is the RTP packet size&lt;br /&gt;
** RTP Parameters&lt;br /&gt;
*** RTP Packet Size - 0.020  - !!! Very important to do this !!!&lt;br /&gt;
&lt;br /&gt;
[[Image:Spa3102-sip-status.png]]&lt;br /&gt;
&lt;br /&gt;
====Regional Set Up====&lt;br /&gt;
&lt;br /&gt;
* Clear out all Vertical Service Activation Codes - We want FreePBX/LMCE to control these.&lt;br /&gt;
** Vertical Service Activation Codes&lt;br /&gt;
*** Clear out all codes like shown below.&lt;br /&gt;
&lt;br /&gt;
[[Image:Spa3102-regional-status.png]]&lt;br /&gt;
&lt;br /&gt;
====PSTN Tab====&lt;br /&gt;
&lt;br /&gt;
* Using the image below, set up all the areas in yellow - Summary:&lt;br /&gt;
** Line Enable - Yes&lt;br /&gt;
** SIP Settings&lt;br /&gt;
*** SIP port - 5061&lt;br /&gt;
** Proxy Settings&lt;br /&gt;
*** Proxy - 192.168.80.1&lt;br /&gt;
*** Register Expires - 300&lt;br /&gt;
*** Make Call Without Reg - Yes&lt;br /&gt;
*** Ans Call Without Reg - Yes&lt;br /&gt;
** Subscriber Settings&lt;br /&gt;
*** Display Name - Unknown Caller (this is what is displayed when a call comes in without caller ID info)&lt;br /&gt;
*** UserID - spa3102 (this is what you set when creating the Phone Line in the LinuxMCE webmin)&lt;br /&gt;
*** Password - lmce (this is what you set when creating the Phone Line in the LinuxMCE webmin)&lt;br /&gt;
** Dial Plans&lt;br /&gt;
*** A note here, do not change any of the default (xx.) settings other than Dial Plan 2 !!&lt;br /&gt;
**** Dial Plan 2 - (S0&amp;lt;:XXXXXXXXXX&amp;gt;) - where the X&#039;s are your 10 digit phone number including area code. - note to, that is a zero beside the S&lt;br /&gt;
** VoIP-To-PSTN Gateway Setup&lt;br /&gt;
*** VoIP-To-PSTN Gateway Enable - Yes&lt;br /&gt;
*** VoIP Caller Auth Method - None&lt;br /&gt;
*** VoIP PIN Max Retry - 3&lt;br /&gt;
*** One Stage Dialing - Yes  - Extremely inportant setting !!!&lt;br /&gt;
*** Line 1 VoIP Caller DP - none&lt;br /&gt;
*** VoIP Caller Default DP - none&lt;br /&gt;
*** Line 1 Fallback DP - none&lt;br /&gt;
** PSTN-To-VoIP Gateway Setup&lt;br /&gt;
*** PSTN-To-VoIP Gateway Enable - Yes&lt;br /&gt;
*** PSTN Caller Auth Method - none&lt;br /&gt;
*** PSTN Ring Thru Line 1 - No&lt;br /&gt;
*** PSTN PIN Max Retry - 3&lt;br /&gt;
*** PSTN CID For VoIP CID - Yes&lt;br /&gt;
*** PSTN Caller Default DP - 2&lt;br /&gt;
*** Off Hook While Calling VoIP - No&lt;br /&gt;
*** Line 1 Signal Hook Flash To PSTN - Disabled&lt;br /&gt;
** FXO Timer Values (sec)&lt;br /&gt;
*** VoIP Answer Delay - 0 (zero)&lt;br /&gt;
*** PSTN Answer Delay - 3&lt;br /&gt;
*** Detect CPC - No&lt;br /&gt;
** Don&#039;t forget to &amp;quot;Submit All Changes&amp;quot;&lt;br /&gt;
&lt;br /&gt;
PSTN Tab setup complete!!! Congratualtions!! Beer!&lt;br /&gt;
&lt;br /&gt;
[[Image:Spa3102-pstn-1.png]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Spa3102-pstn-2.png]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Spa3102-pstn-3.png]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Spa3102-pstn-4.png]]&lt;br /&gt;
&lt;br /&gt;
=Troubleshooting=&lt;br /&gt;
&lt;br /&gt;
====Dial Rules vs Dial Patterns====&lt;br /&gt;
&lt;br /&gt;
One of the first issues I came across, was getting the &amp;quot;Your call can not be completed as dialed&amp;quot;, and the &amp;quot;All circuits are busy now&amp;quot; Messages.&lt;br /&gt;
Here is what I did to overcome them.&lt;br /&gt;
&lt;br /&gt;
* Dial Rules&lt;br /&gt;
** Log into the LinuxMCE webmin&lt;br /&gt;
*** From the top click Advanced &amp;gt; Configuration &amp;gt; Phones setup to get to the FreePBX admin screen.&lt;br /&gt;
*** In the left click on trunks&lt;br /&gt;
**** In the right click on the trunk you created for the spa3102&lt;br /&gt;
**** Look for Dial Rules:&lt;br /&gt;
**** Clear everything that is in it&lt;br /&gt;
**** Scroll to bottom, click &amp;quot;Submit Changes&amp;quot;&lt;br /&gt;
**** At the top of the FreePBX screen click &amp;quot;Apply Configuration Changes&amp;quot;&lt;br /&gt;
This does several things, including eliminating your significant other saying &amp;quot;Why do I have to Dial a 9 and a 1 to call next door&amp;quot; :)&lt;br /&gt;
&lt;br /&gt;
* Dial Patterns&lt;br /&gt;
** In the left click &amp;quot;Outbound Routes&amp;quot;&lt;br /&gt;
** In the right, click the button for your spa3102 outbound routes&lt;br /&gt;
An explanation here as to the difference between Dial Patterns, and Dial Rules.&lt;br /&gt;
&lt;br /&gt;
Dial Rules are used to add a number/character to, or strip a number/character away from anything dialed on any extension in your home. I did not need anything like this as to dial long distance, I only need enter the area code and the number, no 1 and certainly no 9.&lt;br /&gt;
Dial patterns are how FreePBX knows how to send a particular call to a route. You may have a route just for local long distance, and you may have a route for international calls, and then another for local calls.&lt;br /&gt;
In my cituation, I only need 911, local 7 digit numbers, and long distance 10 digit numbers, so here is what is in my outbound route Dial Pattern:&lt;br /&gt;
** N11  - For 911&lt;br /&gt;
** NXXNXXXXXX - For 10 digit long distance&lt;br /&gt;
** NXXXXXX - for regular old 7 digit local calls&lt;br /&gt;
&lt;br /&gt;
That is it. I only have one trunk, and I only need it to do those 3 types of calls, so why complicate it right?&lt;br /&gt;
There is way more information available at:&lt;br /&gt;
&lt;br /&gt;
[http://support.freepbx.org FreePBX support/Wiki/Forums].&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
You should now see something like this when looking at the &amp;quot;Info&amp;quot; tab:&lt;br /&gt;
&lt;br /&gt;
[[Image:Spa3102-pstn-status.png]]&lt;br /&gt;
&lt;br /&gt;
You will notice here that I did not have my phone line plugged in at the time, LMCE was answering calls, and I had not had the routuing set up the way I want.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
All required settings should now be applied. Try to make a test call. If your MD&#039;s are not set up for making some calls, try an IP phone if you have one, or a SIP device, like an Ekiga softphone [[Ekiga]]&lt;br /&gt;
&lt;br /&gt;
In addition to the PSTN setup, I will also do a wiki on configuring the &amp;quot;Phone&amp;quot; jack coming out of the SPA as an extension in LinuxMCE phones set up.&lt;br /&gt;
Located here: [[Linksys_SPA3102_Line_1_Extension_Set_Up#Configure_the_Line_1_Tab]]&lt;br /&gt;
&lt;br /&gt;
====Useful Link Goodness:====&lt;br /&gt;
&lt;br /&gt;
[[Ekiga]] - Excellent write up on getting a softphone setup on your favorite Non-LinuxMCE linux box.&lt;br /&gt;
&lt;br /&gt;
[[Linksys_spa-3102]] - Original SPA3102 page.&lt;br /&gt;
&lt;br /&gt;
[[Linksys_spa3000_pstn_interface]] - Another home-grown wiki on the device&lt;br /&gt;
&lt;br /&gt;
[http://www.freepbx.org/support/documentation/howtos/howto-linksys-spa-3102-sipura-spa-3000-freepbx The FreePBX HowTo that saved what is left of my hair]&lt;br /&gt;
&lt;br /&gt;
Best Regards, &lt;br /&gt;
&lt;br /&gt;
--[[User:Sethj|Sethj]] 21:13, 11 October 2010 (CEST)&lt;/div&gt;</summary>
		<author><name>Pw44</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=Linksys_SPA3102&amp;diff=25877</id>
		<title>Linksys SPA3102</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=Linksys_SPA3102&amp;diff=25877"/>
		<updated>2010-10-11T20:23:38Z</updated>

		<summary type="html">&lt;p&gt;Pw44: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: Hardware]]&lt;br /&gt;
{| align=&amp;quot;right&amp;quot;&lt;br /&gt;
  | __TOC__&lt;br /&gt;
  |}&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Telecom]]&lt;br /&gt;
[[Category:Voip]]&lt;br /&gt;
====Background====&lt;br /&gt;
The Linksys SPA3102/Sipura 3000 PSTN Gateways feature the ability to connect a standard telephone landline to IP-based data networks and can be configured as a SIP trunk for use with your LinuxMCE built-in telephony system. &lt;br /&gt;
&lt;br /&gt;
Due to the area in which I live, there are no viable High Speed DSL/CABLE or other types of internet. I only have access to Satellite Internet, which due to the nature of the beast, has a very high latency (900 - 1400ms average) and I can not use a traditional VOIP provider like Broadvoice, Vonage, or the like. However as the telephony feature of LinuxMCE is a very cool perk to this system, I figured I would have a go at integrating my analog Verizon landline into the system. To create this SIP/Bridge I chose the Linksys SPA3102, however after scanning the FreePBX forums, I can assume they will work well with the Sipura 3000 as well. After many hours of breaking, and then fixing my phone setup, I have a working viable solution, and these steps will detail how to set up this product for use with LinuxMCE. Some of these settings are borrowed from the existing wiki&#039;s here on these products, but after using them and failing, I had a go on my own. as always if there is a better more efficient way to accomplish this, please EDIT this wiki. I am by no means an expert. :)&lt;br /&gt;
&lt;br /&gt;
=Required items to complete this process.=&lt;br /&gt;
&lt;br /&gt;
*Linksys SPA3102 or Sipura SPA3000 - Average price between $40 and $80, depending on your source. I used Newegg, because &amp;quot;Once you&#039;ve NewEgged....&amp;quot;&lt;br /&gt;
** [http://www.newegg.com/Product/Product.aspx?Item=N82E16833124239&amp;amp;Tpk=spa3102 Linksys SPA3102]&lt;br /&gt;
* A laptop, netboox, or PC you can temporarily connect a network cable to the LAN port on the device&lt;br /&gt;
* A web browser for configuring the SPA and the Phone Lines in LinuxMCE webmin.&lt;br /&gt;
* The following file: [http://dataless.jeromenet.org/filespace/spa3102.tar.gz spa3102.tar.gz]&lt;br /&gt;
* Any hardwired old school phone, with touchtone.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Setting up with LinuxMCE=&lt;br /&gt;
&lt;br /&gt;
====Adding the new config files to your core.====&lt;br /&gt;
* Download the above file to a location of your choice&lt;br /&gt;
** wget http://dataless.jeromenet.org/filespace/spa3102.tar.gz&lt;br /&gt;
* Extract/Copy/Modify the files&lt;br /&gt;
** tar zxvf spa3102.tar.gz&lt;br /&gt;
** chmod a+x create_amp_spa3102.pl&lt;br /&gt;
** sudo cp create_amp_spa3102.pl /usr/pluto/bin&lt;br /&gt;
** sudo cp provider_list.txt /etc/asterisk&lt;br /&gt;
*** This file is default plus my addition, if you have already modified your /etc/asterisk/provider_list.txt, you can also simply add the line:&lt;br /&gt;
*** Linksys SPA3102/SPA3000         http://www.cisco.com/en/US/products/ps10027     spa3102 SIP  (tab seperated)&lt;br /&gt;
First steps completed.&lt;br /&gt;
&lt;br /&gt;
====Adding your new Phone Line====&lt;br /&gt;
* Log into the webadmin of your core&lt;br /&gt;
* From the left hand panel, choose &amp;quot;Phone Lines&amp;quot;&lt;br /&gt;
* In the right panel, using the drop downs, select the new &amp;quot;Linksys SPA3102/SPA300&amp;quot; option.&lt;br /&gt;
* You will now be presented with 4 boxes to enter data. use the settings I have below here. (They are not UberSecure, and you can change them to what you like, just remember the username and password for later, when we configure the SPA itself)&lt;br /&gt;
** Username: spa3102&lt;br /&gt;
** Password: lmce&lt;br /&gt;
** Phone Number: &amp;lt;insert your 10 digit phone number, including your area code, like 5553221234&amp;gt; Very important, sets up routing, caller ID, etc.&lt;br /&gt;
** Host: dynamic &amp;lt;later in this wiki, when setting up the SPA, we will be setting a manual IP address, but this dynamic setting now, works some magic, lets leave it that way.&amp;gt;&lt;br /&gt;
** Save the file&lt;br /&gt;
Second steps completed. Congratulations, you just set up your FreePBX trunk!! Beer.&lt;br /&gt;
&lt;br /&gt;
=Setting up the SPA3102/SPA3000=&lt;br /&gt;
&lt;br /&gt;
====Factory reset your device (just to be on the same page.)====&lt;br /&gt;
* Plug your hardwire phone into the &amp;quot;Phone&amp;quot; jack on the SPA.&lt;br /&gt;
* Pick up the receiver on your hardwired phone&lt;br /&gt;
** Dial ****&lt;br /&gt;
** When the voice comes on dial 7 3 7 3 8#&lt;br /&gt;
** When prompted to confirm, press 1&lt;br /&gt;
Factory reset complete!&lt;br /&gt;
&lt;br /&gt;
* Plug a network cable from the &amp;quot;WAN&amp;quot; port on the SPA to the internal network on your core.&lt;br /&gt;
* Plug a phone cable into the &amp;quot;Line&amp;quot; jack on the SPA to your wall jack.&lt;br /&gt;
* Plug a network cable into the &amp;quot;LAN&amp;quot; port on the SPA into your laptop, netbook, or PC.&lt;br /&gt;
** Once your device gets an IP address from the SPA, point your browser to http://192.168.0.1&lt;br /&gt;
*** By default the SPA has no passwords set for User, or Admin.&lt;br /&gt;
&lt;br /&gt;
====WAN Setup====&lt;br /&gt;
&lt;br /&gt;
* Using the image below, set up all the areas in yellow - Summary:&lt;br /&gt;
** Static IP&lt;br /&gt;
** IP - 192.168.80.200&lt;br /&gt;
** Netmask - 255.255.255.0&lt;br /&gt;
** Gateway - 192.168.80.1&lt;br /&gt;
** Hostname - SPA3102&lt;br /&gt;
** Primary DNS - 192.168.80.1&lt;br /&gt;
** Primary NTP - 192.168.80.1&lt;br /&gt;
** Set WAN server to &amp;quot;Yes&amp;quot;&lt;br /&gt;
You can now, and always remember to, click &amp;quot;Apply All Changes&amp;quot; at the bottom, and if you like, disconnect your device from the LAN port, and re-connect to it from your MD or regular PC.&lt;br /&gt;
&lt;br /&gt;
[[Image:Spa3102-wan-setup.png]]&lt;br /&gt;
&lt;br /&gt;
====SIP Setup====&lt;br /&gt;
&lt;br /&gt;
* The only thing we need to change here is the RTP packet size&lt;br /&gt;
** RTP Parameters&lt;br /&gt;
*** RTP Packet Size - 0.020  - !!! Very important to do this !!!&lt;br /&gt;
&lt;br /&gt;
[[Image:Spa3102-sip-status.png]]&lt;br /&gt;
&lt;br /&gt;
====Regional Set Up====&lt;br /&gt;
&lt;br /&gt;
* Clear out all Vertical Service Activation Codes - We want FreePBX/LMCE to control these.&lt;br /&gt;
** Vertical Service Activation Codes&lt;br /&gt;
*** Clear out all codes like shown below.&lt;br /&gt;
&lt;br /&gt;
[[Image:Spa3102-regional-status.png]]&lt;br /&gt;
&lt;br /&gt;
====PSTN Tab====&lt;br /&gt;
&lt;br /&gt;
* Using the image below, set up all the areas in yellow - Summary:&lt;br /&gt;
** Line Enable - Yes&lt;br /&gt;
** SIP Settings&lt;br /&gt;
*** SIP port - 5061&lt;br /&gt;
** Proxy Settings&lt;br /&gt;
*** Proxy - 192.168.80.1&lt;br /&gt;
*** Register Expires - 300&lt;br /&gt;
*** Make Call Without Reg - Yes&lt;br /&gt;
*** Ans Call Without Reg - Yes&lt;br /&gt;
** Subscriber Settings&lt;br /&gt;
*** Display Name - Unknown Caller (this is what is displayed when a call comes in without caller ID info)&lt;br /&gt;
*** UserID - spa3102 (this is what you set when creating the Phone Line in the LinuxMCE webmin)&lt;br /&gt;
*** Password - lmce (this is what you set when creating the Phone Line in the LinuxMCE webmin)&lt;br /&gt;
** Dial Plans&lt;br /&gt;
*** A note here, do not change any of the default (xx.) settings other than Dial Plan 2 !!&lt;br /&gt;
**** Dial Plan 2 - (S0&amp;lt;:XXXXXXXXXX&amp;gt;) - where the X&#039;s are your 10 digit phone number including area code. - note to, that is a zero beside the S&lt;br /&gt;
** VoIP-To-PSTN Gateway Setup&lt;br /&gt;
*** VoIP-To-PSTN Gateway Enable - Yes&lt;br /&gt;
*** VoIP Caller Auth Method - None&lt;br /&gt;
*** VoIP PIN Max Retry - 3&lt;br /&gt;
*** One Stage Dialing - Yes  - Extremely inportant setting !!!&lt;br /&gt;
*** Line 1 VoIP Caller DP - none&lt;br /&gt;
*** VoIP Caller Default DP - none&lt;br /&gt;
*** Line 1 VoIP Caller DP - none&lt;br /&gt;
*** Line 1 Fallback DP - none&lt;br /&gt;
** PSTN-To-VoIP Gateway Setup&lt;br /&gt;
*** PSTN-To-VoIP Gateway Enable - Yes&lt;br /&gt;
*** PSTN Caller Auth Method - none&lt;br /&gt;
*** PSTN Ring Thru Line 1 - No&lt;br /&gt;
*** PSTN PIN Max Retry - 3&lt;br /&gt;
*** PSTN CID For VoIP CID - Yes&lt;br /&gt;
*** PSTN Caller Default DP - 2&lt;br /&gt;
*** Off Hook While Calling VoIP - No&lt;br /&gt;
*** Line 1 Signal Hook Flash To PSTN - Disabled&lt;br /&gt;
** FXO Timer Values (sec)&lt;br /&gt;
*** VoIP Answer Delay - 0 (zero)&lt;br /&gt;
*** PSTN Answer Delay - 3&lt;br /&gt;
*** Detect CPC - No&lt;br /&gt;
** Don&#039;t forget to &amp;quot;Submit All Changes&amp;quot;&lt;br /&gt;
&lt;br /&gt;
PSTN Tab setup complete!!! Congratualtions!! Beer!&lt;br /&gt;
&lt;br /&gt;
[[Image:Spa3102-pstn-1.png]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Spa3102-pstn-2.png]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Spa3102-pstn-3.png]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Spa3102-pstn-4.png]]&lt;br /&gt;
&lt;br /&gt;
=Troubleshooting=&lt;br /&gt;
&lt;br /&gt;
====Dial Rules vs Dial Patterns====&lt;br /&gt;
&lt;br /&gt;
One of the first issues I came across, was getting the &amp;quot;Your call can not be completed as dialed&amp;quot;, and the &amp;quot;All circuits are busy now&amp;quot; Messages.&lt;br /&gt;
Here is what I did to overcome them.&lt;br /&gt;
&lt;br /&gt;
* Dial Rules&lt;br /&gt;
** Log into the LinuxMCE webmin&lt;br /&gt;
*** From the top click Advanced &amp;gt; Configuration &amp;gt; Phones setup to get to the FreePBX admin screen.&lt;br /&gt;
*** In the left click on trunks&lt;br /&gt;
**** In the right click on the trunk you created for the spa3102&lt;br /&gt;
**** Look for Dial Rules:&lt;br /&gt;
**** Clear everything that is in it&lt;br /&gt;
**** Scroll to bottom, click &amp;quot;Submit Changes&amp;quot;&lt;br /&gt;
**** At the top of the FreePBX screen click &amp;quot;Apply Configuration Changes&amp;quot;&lt;br /&gt;
This does several things, including eliminating your significant other saying &amp;quot;Why do I have to Dial a 9 and a 1 to call next door&amp;quot; :)&lt;br /&gt;
&lt;br /&gt;
* Dial Patterns&lt;br /&gt;
** In the left click &amp;quot;Outbound Routes&amp;quot;&lt;br /&gt;
** In the right, click the button for your spa3102 outbound routes&lt;br /&gt;
An explanation here as to the difference between Dial Patterns, and Dial Rules.&lt;br /&gt;
&lt;br /&gt;
Dial Rules are used to add a number/character to, or strip a number/character away from anything dialed on any extension in your home. I did not need anything like this as to dial long distance, I only need enter the area code and the number, no 1 and certainly no 9.&lt;br /&gt;
Dial patterns are how FreePBX knows how to send a particular call to a route. You may have a route just for local long distance, and you may have a route for international calls, and then another for local calls.&lt;br /&gt;
In my cituation, I only need 911, local 7 digit numbers, and long distance 10 digit numbers, so here is what is in my outbound route Dial Pattern:&lt;br /&gt;
** N11  - For 911&lt;br /&gt;
** NXXNXXXXXX - For 10 digit long distance&lt;br /&gt;
** NXXXXXX - for regular old 7 digit local calls&lt;br /&gt;
&lt;br /&gt;
That is it. I only have one trunk, and I only need it to do those 3 types of calls, so why complicate it right?&lt;br /&gt;
There is way more information available at:&lt;br /&gt;
&lt;br /&gt;
[http://support.freepbx.org FreePBX support/Wiki/Forums].&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
&lt;br /&gt;
You should now see something like this when looking at the &amp;quot;Info&amp;quot; tab:&lt;br /&gt;
&lt;br /&gt;
[[Image:Spa3102-pstn-status.png]]&lt;br /&gt;
&lt;br /&gt;
You will notice here that I did not have my phone line plugged in at the time, LMCE was answering calls, and I had not had the routuing set up the way I want.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
All required settings should now be applied. Try to make a test call. If your MD&#039;s are not set up for making some calls, try an IP phone if you have one, or a SIP device, like an Ekiga softphone [[Ekiga]]&lt;br /&gt;
&lt;br /&gt;
In addition to the PSTN setup, I will also do a wiki on configuring the &amp;quot;Phone&amp;quot; jack coming out of the SPA as an extension in LinuxMCE phones set up.&lt;br /&gt;
Located here: [[Linksys_SPA3102_Line_1_Extension_Set_Up#Configure_the_Line_1_Tab]]&lt;br /&gt;
&lt;br /&gt;
====Useful Link Goodness:====&lt;br /&gt;
&lt;br /&gt;
[[Ekiga]] - Excellent write up on getting a softphone setup on your favorite Non-LinuxMCE linux box.&lt;br /&gt;
&lt;br /&gt;
[[Linksys_spa-3102]] - Original SPA3102 page.&lt;br /&gt;
&lt;br /&gt;
[[Linksys_spa3000_pstn_interface]] - Another home-grown wiki on the device&lt;br /&gt;
&lt;br /&gt;
[http://www.freepbx.org/support/documentation/howtos/howto-linksys-spa-3102-sipura-spa-3000-freepbx The FreePBX HowTo that saved what is left of my hair]&lt;br /&gt;
&lt;br /&gt;
Best Regards, &lt;br /&gt;
&lt;br /&gt;
--[[User:Sethj|Sethj]] 21:13, 11 October 2010 (CEST)&lt;/div&gt;</summary>
		<author><name>Pw44</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=PPTP_server&amp;diff=25849</id>
		<title>PPTP server</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=PPTP_server&amp;diff=25849"/>
		<updated>2010-10-10T20:48:06Z</updated>

		<summary type="html">&lt;p&gt;Pw44: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Networking]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
{{versioninfo|810Status=Works|810UpdatedDate=5 October 2010|810UpdatedBy=pw44}}&lt;br /&gt;
&lt;br /&gt;
Setting up a PPTP Server.&lt;br /&gt;
&lt;br /&gt;
The pptp server is the right tool to use for outside access to your internal network.&lt;br /&gt;
While not the most secure VPN solution, PPTP is the most simple to install, configure and connect from windows, and mobile devices. &lt;br /&gt;
&lt;br /&gt;
Reasons for doing it:&lt;br /&gt;
# Having your mobile as an extension of your asterisk server (Iphone, for example, can do it, Nokia can do it via an add on), even from public wifi spots.&lt;br /&gt;
# Being able to remotely access files or anything in your server from anywhere, even from wifi spots.&lt;br /&gt;
# Others, as you wish.&lt;br /&gt;
&lt;br /&gt;
Lets make it simple:&lt;br /&gt;
&lt;br /&gt;
Server Setup - install the pptp server package:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install pptpd&lt;br /&gt;
&lt;br /&gt;
edit the /etc/pptpd.conf file:&lt;br /&gt;
&lt;br /&gt;
 sudo vi /etc/pptpd.conf&lt;br /&gt;
&lt;br /&gt;
and add:&lt;br /&gt;
&lt;br /&gt;
 localip 192.168.80.245,192.168.0.245&lt;br /&gt;
 remoteip 192.168.80.246-250,192.168.0.246-250&lt;br /&gt;
&lt;br /&gt;
where the localip is the address of the server, and the remoteip are the addresses that will be assigned to clients.&lt;br /&gt;
&lt;br /&gt;
edit the /etc/ppp/pptpd-options file:&lt;br /&gt;
&lt;br /&gt;
 sudo vi /etc/ppp/pptpd-options&lt;br /&gt;
&lt;br /&gt;
append the following directives:&lt;br /&gt;
&lt;br /&gt;
 ms-dns 192.168.80.1&lt;br /&gt;
 nobsdcomp&lt;br /&gt;
 noipx&lt;br /&gt;
 mtu 1490&lt;br /&gt;
 mru 1490&lt;br /&gt;
&lt;br /&gt;
Mine looks like:&lt;br /&gt;
&lt;br /&gt;
 name dcerouter&lt;br /&gt;
 refuse-pap&lt;br /&gt;
 refuse-chap&lt;br /&gt;
 refuse-mschap&lt;br /&gt;
 require-mschap-v2&lt;br /&gt;
 require-mppe-128&lt;br /&gt;
 ms-dns 192.168.80.1&lt;br /&gt;
 proxyarp&lt;br /&gt;
 nodefaultroute&lt;br /&gt;
 debug&lt;br /&gt;
 lock&lt;br /&gt;
 nobsdcomp&lt;br /&gt;
&lt;br /&gt;
Add the user credentials for authentication to you chap secrets file:&lt;br /&gt;
&lt;br /&gt;
 sudo vi /etc/ppp/chap-secrets&lt;br /&gt;
&lt;br /&gt;
Add to it the user name + password in the following syntax:&lt;br /&gt;
&lt;br /&gt;
 usernmae &amp;lt;TAB&amp;gt; dcerouter &amp;lt;TAB&amp;gt; users-password &amp;lt;TAB&amp;gt; *&lt;br /&gt;
&lt;br /&gt;
Restart the server for the settings to take affect:&lt;br /&gt;
&lt;br /&gt;
 sudo /etc/init.d/pptpd restart&lt;br /&gt;
&lt;br /&gt;
Firewall rules:&lt;br /&gt;
&lt;br /&gt;
Webadmin -&amp;gt; advanced -&amp;gt; Network -&amp;gt; Firewall Rules: core input for port 1723&lt;br /&gt;
&lt;br /&gt;
You need to append the following lines to /usr/pluto/bin/Network_Firewall.sh, in order to permit GRE protocol flow (needed by PPTP):&lt;br /&gt;
&lt;br /&gt;
 iptables --append INPUT  --protocol 47 --jump ACCEPT&lt;br /&gt;
 iptables --append OUTPUT --protocol 47 --jump ACCEPT&lt;br /&gt;
&lt;br /&gt;
If you also have a router running Tomato or DD-WRT, the following iptables rules shall be applied (these are the ones in my Tomato router): My LinuxMCE has the eth0 setted to 192.168.0.160, defined by static address in my Tomato.&lt;br /&gt;
&lt;br /&gt;
 # init pptp + gre pass thru&lt;br /&gt;
 iptables -t nat -I PREROUTING -p tcp --dport 1723 -j DNAT --to 192.168.0.160:1723&lt;br /&gt;
 iptables -I FORWARD -p tcp -d 192.168.0.160 --dport 1723 -j ACCEPT&lt;br /&gt;
 iptables -t nat -I PREROUTING -p 47 -j DNAT --to 192.168.0.160&lt;br /&gt;
 iptables -I FORWARD -p 47 -d 192.168.0.160 -j ACCEPT&lt;br /&gt;
 &lt;br /&gt;
 iptables -t nat -A PREROUTING -i ppp0 -p tcp -d 0/0 --dport 1723 -j DNAT --to-destination 192.168.0.160&lt;br /&gt;
 iptables -t nat -A PREROUTING -i ppp0 -p gre -d 0/0 -j DNAT --to-destination 192.168.0.160&lt;br /&gt;
 &lt;br /&gt;
 iptables -A FORWARD -i ppp0 -o br0 -p tcp --dport 1723 -d 192.168.0.160 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT&lt;br /&gt;
 iptables -A FORWARD -i br0 -o ppp0 -p tcp -s 192.168.0.160 --sport 1723 -m state --state ESTABLISHED,RELATED -j ACCEPT&lt;br /&gt;
 iptables -A FORWARD -i ppp0 -o br0 -p gre -d 192.168.0.160 -m state --state NEW,ESTABLISHED,RELATED-j ACCEPT&lt;br /&gt;
 iptables -A FORWARD -i br0 -o ppp0 -p gre -s 192.168.0.160 -m state --state ESTABLISHED,RELATED -j ACCEPT&lt;br /&gt;
 # end pptp + gre pass thru&lt;br /&gt;
&lt;br /&gt;
Once done, reload DCERouter, in order that the /usr/pluto/bin/Network_Firewall.sh is reloaded,and if you have Tomato or DD-WRT, reboot it.&lt;br /&gt;
&lt;br /&gt;
Configure your client to use PPTP and test (beyond this wiki).&lt;/div&gt;</summary>
		<author><name>Pw44</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=Fail2ban_-_A_tool_against_brute_force&amp;diff=25848</id>
		<title>Fail2ban - A tool against brute force</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=Fail2ban_-_A_tool_against_brute_force&amp;diff=25848"/>
		<updated>2010-10-10T20:33:39Z</updated>

		<summary type="html">&lt;p&gt;Pw44: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: Tutorials]]&lt;br /&gt;
[[Category: Networking]]&lt;br /&gt;
{{versioninfo|810Status=Works|810UpdatedDate=5 October 2010|810UpdatedBy=pw44}}&lt;br /&gt;
&lt;br /&gt;
Having asterik installed is almost an invitation for others wishing to place calls at your expense.&lt;br /&gt;
&lt;br /&gt;
After configuring my sip trunk, it did not take 2 days and some &amp;quot;smart guy&amp;quot;  was trying to register to take advantage of it, and causing me losses.&lt;br /&gt;
&lt;br /&gt;
Fail2ban prevented it, blocking the attacker with iptables rules.&lt;br /&gt;
&lt;br /&gt;
Installing fail2ban is not complicated and i will describe the steps to have it properly installed and configured, so you can protect your asterisk and other services from brute force attack.&lt;br /&gt;
&lt;br /&gt;
The first thing to do is edit /etc/asterisk/sip.conf and add the following line:&lt;br /&gt;
 alwaysauthreject=yes                                                 &lt;br /&gt;
My sip.conf file looks like:&lt;br /&gt;
 ............&lt;br /&gt;
 [general]&lt;br /&gt;
 #include sip_general_additional.conf&lt;br /&gt;
 &lt;br /&gt;
 bindport = 5060       ; Port to bind to (SIP is 5060)&lt;br /&gt;
 bindaddr = 0.0.0.0    ; Address to bind to (all addresses on machine)&lt;br /&gt;
 &#039;&#039;&#039;alwaysauthreject=yes&#039;&#039;&#039;                                                 &lt;br /&gt;
 disallow=all                                                         &lt;br /&gt;
 allow=ulaw                                                           &lt;br /&gt;
 allow=alaw  &lt;br /&gt;
 .............                    &lt;br /&gt;
Install fail2ban with: &lt;br /&gt;
 sudo apt-get install fail2ban&lt;br /&gt;
&lt;br /&gt;
After is installed, you need to change /etc/asterisk/logger.conf and add the following line under [general] section (You may have to create this before the [logfiles] section). &lt;br /&gt;
&lt;br /&gt;
 [general]&lt;br /&gt;
 dateformat=%F %T&lt;br /&gt;
&lt;br /&gt;
In /etc/asterisk/logger.conf add the following line under the [logfiles] section for asterisk to log NOTICE level events to the syslog (/var/log/messages) as well as its normal log file. These entries in syslog will have a Date/Time stamp that is usable by fail2ban.&lt;br /&gt;
&lt;br /&gt;
 syslog.local0 =&amp;gt; notice &lt;br /&gt;
&lt;br /&gt;
Reload asterisk with:&lt;br /&gt;
&lt;br /&gt;
 asterisk -rx &amp;quot;logger reload&amp;quot; &lt;br /&gt;
&lt;br /&gt;
Configuring fail2ban:&lt;br /&gt;
&lt;br /&gt;
 cd /etc/fail2ban/filter.d&lt;br /&gt;
&lt;br /&gt;
 touch asterisk.conf &lt;br /&gt;
&lt;br /&gt;
 vi asterisk.conf&lt;br /&gt;
&lt;br /&gt;
insert the following (copy &amp;amp; paste)&lt;br /&gt;
&lt;br /&gt;
 # Fail2Ban configuration file&lt;br /&gt;
 #&lt;br /&gt;
 #&lt;br /&gt;
 # $Revision: 250 $&lt;br /&gt;
 #&lt;br /&gt;
 [INCLUDES]&lt;br /&gt;
 # Read common prefixes. If any customizations available -- read them from&lt;br /&gt;
 # common.local&lt;br /&gt;
 #before = common.conf&lt;br /&gt;
 [Definition]&lt;br /&gt;
 #_daemon = asterisk&lt;br /&gt;
 # Option:  failregex&lt;br /&gt;
 # Notes.:  regex to match the password failures messages in the logfile. The&lt;br /&gt;
 #          host must be matched by a group named &amp;quot;host&amp;quot;. The tag &amp;quot;&amp;lt;HOST&amp;gt;&amp;quot; can&lt;br /&gt;
 #          be used for standard IP/hostname matching and is only an alias for&lt;br /&gt;
 #          (?:::f{4,6}:)?(?P&amp;lt;host&amp;gt;\S+)&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 failregex = NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Wrong password&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - No matching peer found&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Username/auth name mismatch&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Device does not match ACL&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&amp;quot; .* failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Peer is not supposed to register&lt;br /&gt;
             NOTICE.* &amp;lt;HOST&amp;gt; failed to authenticate as &#039;.*&#039;$&lt;br /&gt;
             NOTICE.* .*: No registration for peer &#039;.*&#039; \(from &amp;lt;HOST&amp;gt;\)&lt;br /&gt;
             NOTICE.* .*: Host &amp;lt;HOST&amp;gt; failed MD5 authentication for &#039;.*&#039; (.*)&lt;br /&gt;
             NOTICE.* .*: Failed to authenticate user .*@&amp;lt;HOST&amp;gt;.*&lt;br /&gt;
 # Option:  ignoreregex&lt;br /&gt;
 # Notes.:  regex to ignore. If this regex matches, the line is ignored.&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 ignoreregex =&lt;br /&gt;
&lt;br /&gt;
Next edit /etc/fail2ban/jail.conf to include the following section so that it uses the new filter. &lt;br /&gt;
&lt;br /&gt;
 [asterisk-iptables]&lt;br /&gt;
 enabled  = true&lt;br /&gt;
 filter   = asterisk&lt;br /&gt;
 action   = iptables-allports[name=ASTERISK, protocol=all]&lt;br /&gt;
            sendmail-whois[name=ASTERISK, dest=root, sender=fail2ban@example.org]&lt;br /&gt;
 logpath  = /var/log/asterisk/full&lt;br /&gt;
 maxretry = 2&lt;br /&gt;
 bantime = 259200&lt;br /&gt;
&lt;br /&gt;
Locate the line ignoreip in /etc/fail2ban/jail.conf (beginning of the file) and insert the ip&#039;s and / or blocks you want fail2ban to ignore, so you don&#039;t risk banning yourserf or any host in your network.&lt;br /&gt;
&lt;br /&gt;
Mine is defined as follows:&lt;br /&gt;
&lt;br /&gt;
 [DEFAULT]&lt;br /&gt;
 # &amp;quot;ignoreip&amp;quot; can be an IP address, a CIDR mask or a DNS host. Fail2ban will not&lt;br /&gt;
 # ban a host which matches an address in this list. Several addresses can be   &lt;br /&gt;
 # defined using space separator.                                               &lt;br /&gt;
 ignoreip = 127.0.0.1 192.168.80.1 192.168.80.0/24 &lt;br /&gt;
&lt;br /&gt;
To start fail2ban type the following as root:&lt;br /&gt;
&lt;br /&gt;
 /etc/init.d/fail2ban start&lt;br /&gt;
&lt;br /&gt;
Check It&lt;br /&gt;
&lt;br /&gt;
For LinuxMCE, there is needed &amp;quot;patch&amp;quot;, while fail2ban is not part of the distribution.&lt;br /&gt;
&lt;br /&gt;
When LinuxMCE starts, it runs /usr/pluto/bin/Network_Firewall.sh, and this is done AFTER /etc/init.d/fail2ban is started.&lt;br /&gt;
&lt;br /&gt;
So, edit /usr/pluto/bin/Network_Firewall.sh and add the following at the END of this file:&lt;br /&gt;
 &lt;br /&gt;
 /etc/init.d/fail2ban restart&lt;br /&gt;
&lt;br /&gt;
This will make sure that fail2bain is started AFTER the iptables rules from LinuxMCE.&lt;br /&gt;
&lt;br /&gt;
If started properly issue the following command to view your iptables rules:&lt;br /&gt;
&lt;br /&gt;
 iptables -L -v&lt;br /&gt;
&lt;br /&gt;
You should see something like the following for the INPUT chain (this is the ouput of mine)&lt;br /&gt;
&lt;br /&gt;
 Chain INPUT (policy DROP 2241 packets, 160K bytes)              &lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination         &lt;br /&gt;
   372 27264 &#039;&#039;&#039;fail2ban-SSH&#039;&#039;&#039;  tcp  --  any    any     anywhere             anywhere            tcp dpt:ssh                                                                                          &lt;br /&gt;
 1312K  991M &#039;&#039;&#039;fail2ban-ASTERISK&#039;&#039;&#039;  all  --  any    any     anywhere             anywhere            &lt;br /&gt;
  553K   81M ACCEPT     all  --  lo     any     anywhere             anywhere                    &lt;br /&gt;
 1288K 1162M ACCEPT     all  --  any    any     anywhere             anywhere            state RELATED,ESTABLISHED                                                                               &lt;br /&gt;
     9   540 ACCEPT     all  --  any    any     anywhere             anywhere            MARK match 0x1                                                                                          &lt;br /&gt;
     2  1152 ACCEPT     udp  --  any    any     anywhere             anywhere            udp   dpt:bootps                                                                                          &lt;br /&gt;
 19276 5790K ACCEPT     all  --  any    any     192.168.80.0/24      anywhere                    &lt;br /&gt;
     0     0 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:iax                                                                                             &lt;br /&gt;
     4  1795 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:sip                                                                                             &lt;br /&gt;
     0     0 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:2000                                                                                            &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:sieve                                                                                           &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:1723                                                                                            &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:www                                                                                             &lt;br /&gt;
     1    60 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:ssh                                                                                             &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:https                                                                                           &lt;br /&gt;
     1    50 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpts:10001:20000&lt;br /&gt;
     0     0 ACCEPT     gre  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain FORWARD (policy ACCEPT 719K packets, 245M bytes)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
     0     0 TCPMSS     tcp  --  any    ppp+    anywhere             anywhere            tcp flags:SYN,RST/SYN TCPMSS clamp to PMTU&lt;br /&gt;
 Chain OUTPUT (policy ACCEPT 2099K packets, 590M bytes)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
     0     0 ACCEPT     gre  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain &#039;&#039;&#039;fail2ban-ASTERISK&#039;&#039;&#039; (1 references)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
  5091 2125K DROP       all  --  any    any     173.193.194.106-static.reverse.softlayer.com  anywhere&lt;br /&gt;
 1307K  989M RETURN     all  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain &#039;&#039;&#039;fail2ban-SSH&#039;&#039;&#039; (1 references)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
&lt;br /&gt;
If you do not see something similar to that then you have some troubleshooting to, check out /var/log/fail2ban.log.&lt;br /&gt;
&lt;br /&gt;
Example of my /var/log/fai2ban.log (173.193.194.106 is the real address from the attacker fail2ban banned):&lt;br /&gt;
&lt;br /&gt;
 ....&lt;br /&gt;
 2010-09-19 11:12:56,131 fail2ban.filter : INFO   Set maxRetry = 6&lt;br /&gt;
 2010-09-19 11:12:56,133 fail2ban.filter : INFO   Set findtime = 600&lt;br /&gt;
 2010-09-19 11:12:56,133 fail2ban.actions: INFO   Set banTime = 600&lt;br /&gt;
 2010-09-19 11:12:56,138 fail2ban.jail   : INFO   Jail &#039;ssh-iptables&#039; started&lt;br /&gt;
 2010-09-19 11:12:56,139 fail2ban.jail   : INFO   Jail &#039;asterisk-iptables&#039; started&lt;br /&gt;
 2010-09-19 11:12:56,141 fail2ban.jail   : INFO   Jail &#039;apache-tcpwrapper&#039; started&lt;br /&gt;
 2010-09-19 15:33:50,392 fail2ban.actions: WARNING [asterisk-iptables] Ban 173.193.194.106&lt;br /&gt;
 2010-09-19 15:34:50,982 fail2ban.actions: WARNING [asterisk-iptables] 173.193.194.106 already banned&lt;br /&gt;
&lt;br /&gt;
And this is the log (/var/log/asterisk/messages) showing the attack:&lt;br /&gt;
&lt;br /&gt;
 [2010-09-19 15:33:48] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;3235410554&amp;quot;&amp;lt;sip:3235410554@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                           &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;thomas&amp;quot;&amp;lt;sip:thomas@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;arsenal&amp;quot;&amp;lt;sip:arsenal@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;letmein&amp;quot;&amp;lt;sip:letmein@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;liverpool&amp;quot;&amp;lt;sip:liverpool@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;nevermind&amp;quot;&amp;lt;sip:nevermind@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;getmein&amp;quot;&amp;lt;sip:getmein@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;echo&amp;quot;&amp;lt;sip:echo@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;bmw325&amp;quot;&amp;lt;sip:bmw325@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;bmw335&amp;quot;&amp;lt;sip:bmw335@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w3e&amp;quot;&amp;lt;sip:1q2w3e@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w3e4r5t6y&amp;quot;&amp;lt;sip:1q2w3e4r5t6y@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q1q2w2w&amp;quot;&amp;lt;sip:1q1q2w2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w1q2w&amp;quot;&amp;lt;sip:1q2w1q2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w&amp;quot;&amp;lt;sip:1q2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;11q22w&amp;quot;&amp;lt;sip:11q22w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;q1w2&amp;quot;&amp;lt;sip:q1w2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;q1w2e3&amp;quot;&amp;lt;sip:q1w2e3@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;tvv03tvv03&amp;quot;&amp;lt;sip:tvv03tvv03@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                           &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd1&amp;quot;&amp;lt;sip:abcd1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd12&amp;quot;&amp;lt;sip:abcd12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd123&amp;quot;&amp;lt;sip:abcd123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;qq11ww22ee33rr44&amp;quot;&amp;lt;sip:qq11ww22ee33rr44@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1&amp;quot;&amp;lt;sip:sip1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip2&amp;quot;&amp;lt;sip:sip2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip12&amp;quot;&amp;lt;sip:sip12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip123&amp;quot;&amp;lt;sip:sip123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1234&amp;quot;&amp;lt;sip:sip1234@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip12345&amp;quot;&amp;lt;sip:sip12345@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1111&amp;quot;&amp;lt;sip:sip1111@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip222&amp;quot;&amp;lt;sip:sip222@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1qa2ws3ed&amp;quot;&amp;lt;sip:1qa2ws3ed@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1234asdf&amp;quot;&amp;lt;sip:1234asdf@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1a2s3d&amp;quot;&amp;lt;sip:1a2s3d@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1a2s3d4f&amp;quot;&amp;lt;sip:1a2s3d4f@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;asdzxc&amp;quot;&amp;lt;sip:asdzxc@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;123zxc&amp;quot;&amp;lt;sip:123zxc@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1234zxcv&amp;quot;&amp;lt;sip:1234zxcv@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;aazzssxx&amp;quot;&amp;lt;sip:aazzssxx@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;p@ssword&amp;quot;&amp;lt;sip:p@ssword@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;p@ssw0rd&amp;quot;&amp;lt;sip:p@ssw0rd@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;pass1&amp;quot;&amp;lt;sip:pass1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;password3&amp;quot;&amp;lt;sip:password3@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;pass12&amp;quot;&amp;lt;sip:pass12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account&amp;quot;&amp;lt;sip:account@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;passlogin&amp;quot;&amp;lt;sip:passlogin@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account1&amp;quot;&amp;lt;sip:account1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account5&amp;quot;&amp;lt;sip:account5@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account6&amp;quot;&amp;lt;sip:account6@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account123&amp;quot;&amp;lt;sip:account123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account12&amp;quot;&amp;lt;sip:account12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc1&amp;quot;&amp;lt;sip:acc1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc2&amp;quot;&amp;lt;sip:acc2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc12&amp;quot;&amp;lt;sip:acc12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
&lt;br /&gt;
One last tip: you need a MTA, like sendmail or postfix, in order to receive the notifications from fail2ban.&lt;br /&gt;
&lt;br /&gt;
If you have a MTA installed and properly configured, nothing else is needed, but if not, install sendmail&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install sendmail&lt;br /&gt;
&lt;br /&gt;
Then edit the /etc/hosts file and change the line &#039;&#039;&#039;192.168.80.1 dcerouter&#039;&#039;&#039; to read &#039;&#039;&#039;192.168.80.1 dcerouter.localdomain dcerouter&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Doing it, sendmail will start as expected (fast) and mail will properly delivered. If this change is not done, sendmail will take a long time to start, because it does not find the qualified host name, as the log shows:&lt;br /&gt;
&lt;br /&gt;
 Sep 27 13:12:11 dcerouter sendmail[10585]: My unqualified host name (dcerouter) unknown; sleeping for retry&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I hope this helps.&lt;br /&gt;
&lt;br /&gt;
source: &lt;br /&gt;
 http://www.fail2ban.org&lt;br /&gt;
 http://www.voip-info.org/wiki/view/Fail2Ban+(with+iptables)+And+Asterisk&lt;br /&gt;
 http://www.fail2ban.org/wiki/index.php/Asterisk&lt;br /&gt;
&lt;br /&gt;
More protection with iptables:&lt;br /&gt;
 http://sysadminman.net/blog/2010/limiting-sipiax-connections-to-asterisk-with-iptables-1082&lt;/div&gt;</summary>
		<author><name>Pw44</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=Fail2ban_-_A_tool_against_brute_force&amp;diff=25847</id>
		<title>Fail2ban - A tool against brute force</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=Fail2ban_-_A_tool_against_brute_force&amp;diff=25847"/>
		<updated>2010-10-10T20:32:39Z</updated>

		<summary type="html">&lt;p&gt;Pw44: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: Tutorials]]&lt;br /&gt;
[[Category: Networking]]&lt;br /&gt;
{{versioninfo|810Status=Works|810UpdatedDate=5 October 2010|810UpdatedBy=pw44}}&lt;br /&gt;
&lt;br /&gt;
Having asterik installed is almost an invitation for others wishing to place calls at your expense.&lt;br /&gt;
&lt;br /&gt;
After configuring my sip trunk, it did not take 2 days and some &amp;quot;smart guy&amp;quot;  was trying to register to take advantage of it, and causing me losses.&lt;br /&gt;
&lt;br /&gt;
Fail2ban prevented it, blocking the attacker with iptables rules.&lt;br /&gt;
&lt;br /&gt;
Installing fail2ban is not complicated and i will describe the steps to have it properly installed and configured, so you can protect your asterisk and other services from brute force attack.&lt;br /&gt;
&lt;br /&gt;
The first thing to do is edit /etc/asterisk/sip.conf and add the following line:&lt;br /&gt;
 alwaysauthreject=yes                                                 &lt;br /&gt;
My sip.conf file looks like:&lt;br /&gt;
 [general]&lt;br /&gt;
 #include sip_general_additional.conf&lt;br /&gt;
 &lt;br /&gt;
 bindport = 5060       ; Port to bind to (SIP is 5060)&lt;br /&gt;
 bindaddr = 0.0.0.0    ; Address to bind to (all addresses on machine)&lt;br /&gt;
 &#039;&#039;&#039;alwaysauthreject=yes&#039;&#039;&#039;                                                 &lt;br /&gt;
 disallow=all                                                         &lt;br /&gt;
 allow=ulaw                                                           &lt;br /&gt;
 allow=alaw                      &lt;br /&gt;
Install fail2ban with: &lt;br /&gt;
 sudo apt-get install fail2ban&lt;br /&gt;
&lt;br /&gt;
After is installed, you need to change /etc/asterisk/logger.conf and add the following line under [general] section (You may have to create this before the [logfiles] section). &lt;br /&gt;
&lt;br /&gt;
 [general]&lt;br /&gt;
 dateformat=%F %T&lt;br /&gt;
&lt;br /&gt;
In /etc/asterisk/logger.conf add the following line under the [logfiles] section for asterisk to log NOTICE level events to the syslog (/var/log/messages) as well as its normal log file. These entries in syslog will have a Date/Time stamp that is usable by fail2ban.&lt;br /&gt;
&lt;br /&gt;
 syslog.local0 =&amp;gt; notice &lt;br /&gt;
&lt;br /&gt;
Reload asterisk with:&lt;br /&gt;
&lt;br /&gt;
 asterisk -rx &amp;quot;logger reload&amp;quot; &lt;br /&gt;
&lt;br /&gt;
Configuring fail2ban:&lt;br /&gt;
&lt;br /&gt;
 cd /etc/fail2ban/filter.d&lt;br /&gt;
&lt;br /&gt;
 touch asterisk.conf &lt;br /&gt;
&lt;br /&gt;
 vi asterisk.conf&lt;br /&gt;
&lt;br /&gt;
insert the following (copy &amp;amp; paste)&lt;br /&gt;
&lt;br /&gt;
 # Fail2Ban configuration file&lt;br /&gt;
 #&lt;br /&gt;
 #&lt;br /&gt;
 # $Revision: 250 $&lt;br /&gt;
 #&lt;br /&gt;
 [INCLUDES]&lt;br /&gt;
 # Read common prefixes. If any customizations available -- read them from&lt;br /&gt;
 # common.local&lt;br /&gt;
 #before = common.conf&lt;br /&gt;
 [Definition]&lt;br /&gt;
 #_daemon = asterisk&lt;br /&gt;
 # Option:  failregex&lt;br /&gt;
 # Notes.:  regex to match the password failures messages in the logfile. The&lt;br /&gt;
 #          host must be matched by a group named &amp;quot;host&amp;quot;. The tag &amp;quot;&amp;lt;HOST&amp;gt;&amp;quot; can&lt;br /&gt;
 #          be used for standard IP/hostname matching and is only an alias for&lt;br /&gt;
 #          (?:::f{4,6}:)?(?P&amp;lt;host&amp;gt;\S+)&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 failregex = NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Wrong password&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - No matching peer found&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Username/auth name mismatch&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Device does not match ACL&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&amp;quot; .* failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Peer is not supposed to register&lt;br /&gt;
             NOTICE.* &amp;lt;HOST&amp;gt; failed to authenticate as &#039;.*&#039;$&lt;br /&gt;
             NOTICE.* .*: No registration for peer &#039;.*&#039; \(from &amp;lt;HOST&amp;gt;\)&lt;br /&gt;
             NOTICE.* .*: Host &amp;lt;HOST&amp;gt; failed MD5 authentication for &#039;.*&#039; (.*)&lt;br /&gt;
             NOTICE.* .*: Failed to authenticate user .*@&amp;lt;HOST&amp;gt;.*&lt;br /&gt;
 # Option:  ignoreregex&lt;br /&gt;
 # Notes.:  regex to ignore. If this regex matches, the line is ignored.&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 ignoreregex =&lt;br /&gt;
&lt;br /&gt;
Next edit /etc/fail2ban/jail.conf to include the following section so that it uses the new filter. &lt;br /&gt;
&lt;br /&gt;
 [asterisk-iptables]&lt;br /&gt;
 enabled  = true&lt;br /&gt;
 filter   = asterisk&lt;br /&gt;
 action   = iptables-allports[name=ASTERISK, protocol=all]&lt;br /&gt;
            sendmail-whois[name=ASTERISK, dest=root, sender=fail2ban@example.org]&lt;br /&gt;
 logpath  = /var/log/asterisk/full&lt;br /&gt;
 maxretry = 2&lt;br /&gt;
 bantime = 259200&lt;br /&gt;
&lt;br /&gt;
Locate the line ignoreip in /etc/fail2ban/jail.conf (beginning of the file) and insert the ip&#039;s and / or blocks you want fail2ban to ignore, so you don&#039;t risk banning yourserf or any host in your network.&lt;br /&gt;
&lt;br /&gt;
Mine is defined as follows:&lt;br /&gt;
&lt;br /&gt;
 [DEFAULT]&lt;br /&gt;
 # &amp;quot;ignoreip&amp;quot; can be an IP address, a CIDR mask or a DNS host. Fail2ban will not&lt;br /&gt;
 # ban a host which matches an address in this list. Several addresses can be   &lt;br /&gt;
 # defined using space separator.                                               &lt;br /&gt;
 ignoreip = 127.0.0.1 192.168.80.1 192.168.80.0/24 &lt;br /&gt;
&lt;br /&gt;
To start fail2ban type the following as root:&lt;br /&gt;
&lt;br /&gt;
 /etc/init.d/fail2ban start&lt;br /&gt;
&lt;br /&gt;
Check It&lt;br /&gt;
&lt;br /&gt;
For LinuxMCE, there is needed &amp;quot;patch&amp;quot;, while fail2ban is not part of the distribution.&lt;br /&gt;
&lt;br /&gt;
When LinuxMCE starts, it runs /usr/pluto/bin/Network_Firewall.sh, and this is done AFTER /etc/init.d/fail2ban is started.&lt;br /&gt;
&lt;br /&gt;
So, edit /usr/pluto/bin/Network_Firewall.sh and add the following at the END of this file:&lt;br /&gt;
 &lt;br /&gt;
 /etc/init.d/fail2ban restart&lt;br /&gt;
&lt;br /&gt;
This will make sure that fail2bain is started AFTER the iptables rules from LinuxMCE.&lt;br /&gt;
&lt;br /&gt;
If started properly issue the following command to view your iptables rules:&lt;br /&gt;
&lt;br /&gt;
 iptables -L -v&lt;br /&gt;
&lt;br /&gt;
You should see something like the following for the INPUT chain (this is the ouput of mine)&lt;br /&gt;
&lt;br /&gt;
 Chain INPUT (policy DROP 2241 packets, 160K bytes)              &lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination         &lt;br /&gt;
   372 27264 &#039;&#039;&#039;fail2ban-SSH&#039;&#039;&#039;  tcp  --  any    any     anywhere             anywhere            tcp dpt:ssh                                                                                          &lt;br /&gt;
 1312K  991M &#039;&#039;&#039;fail2ban-ASTERISK&#039;&#039;&#039;  all  --  any    any     anywhere             anywhere            &lt;br /&gt;
  553K   81M ACCEPT     all  --  lo     any     anywhere             anywhere                    &lt;br /&gt;
 1288K 1162M ACCEPT     all  --  any    any     anywhere             anywhere            state RELATED,ESTABLISHED                                                                               &lt;br /&gt;
     9   540 ACCEPT     all  --  any    any     anywhere             anywhere            MARK match 0x1                                                                                          &lt;br /&gt;
     2  1152 ACCEPT     udp  --  any    any     anywhere             anywhere            udp   dpt:bootps                                                                                          &lt;br /&gt;
 19276 5790K ACCEPT     all  --  any    any     192.168.80.0/24      anywhere                    &lt;br /&gt;
     0     0 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:iax                                                                                             &lt;br /&gt;
     4  1795 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:sip                                                                                             &lt;br /&gt;
     0     0 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:2000                                                                                            &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:sieve                                                                                           &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:1723                                                                                            &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:www                                                                                             &lt;br /&gt;
     1    60 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:ssh                                                                                             &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:https                                                                                           &lt;br /&gt;
     1    50 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpts:10001:20000&lt;br /&gt;
     0     0 ACCEPT     gre  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain FORWARD (policy ACCEPT 719K packets, 245M bytes)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
     0     0 TCPMSS     tcp  --  any    ppp+    anywhere             anywhere            tcp flags:SYN,RST/SYN TCPMSS clamp to PMTU&lt;br /&gt;
 Chain OUTPUT (policy ACCEPT 2099K packets, 590M bytes)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
     0     0 ACCEPT     gre  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain &#039;&#039;&#039;fail2ban-ASTERISK&#039;&#039;&#039; (1 references)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
  5091 2125K DROP       all  --  any    any     173.193.194.106-static.reverse.softlayer.com  anywhere&lt;br /&gt;
 1307K  989M RETURN     all  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain &#039;&#039;&#039;fail2ban-SSH&#039;&#039;&#039; (1 references)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
&lt;br /&gt;
If you do not see something similar to that then you have some troubleshooting to, check out /var/log/fail2ban.log.&lt;br /&gt;
&lt;br /&gt;
Example of my /var/log/fai2ban.log (173.193.194.106 is the real address from the attacker fail2ban banned):&lt;br /&gt;
&lt;br /&gt;
 ....&lt;br /&gt;
 2010-09-19 11:12:56,131 fail2ban.filter : INFO   Set maxRetry = 6&lt;br /&gt;
 2010-09-19 11:12:56,133 fail2ban.filter : INFO   Set findtime = 600&lt;br /&gt;
 2010-09-19 11:12:56,133 fail2ban.actions: INFO   Set banTime = 600&lt;br /&gt;
 2010-09-19 11:12:56,138 fail2ban.jail   : INFO   Jail &#039;ssh-iptables&#039; started&lt;br /&gt;
 2010-09-19 11:12:56,139 fail2ban.jail   : INFO   Jail &#039;asterisk-iptables&#039; started&lt;br /&gt;
 2010-09-19 11:12:56,141 fail2ban.jail   : INFO   Jail &#039;apache-tcpwrapper&#039; started&lt;br /&gt;
 2010-09-19 15:33:50,392 fail2ban.actions: WARNING [asterisk-iptables] Ban 173.193.194.106&lt;br /&gt;
 2010-09-19 15:34:50,982 fail2ban.actions: WARNING [asterisk-iptables] 173.193.194.106 already banned&lt;br /&gt;
&lt;br /&gt;
And this is the log (/var/log/asterisk/messages) showing the attack:&lt;br /&gt;
&lt;br /&gt;
 [2010-09-19 15:33:48] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;3235410554&amp;quot;&amp;lt;sip:3235410554@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                           &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;thomas&amp;quot;&amp;lt;sip:thomas@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;arsenal&amp;quot;&amp;lt;sip:arsenal@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;letmein&amp;quot;&amp;lt;sip:letmein@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;liverpool&amp;quot;&amp;lt;sip:liverpool@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;nevermind&amp;quot;&amp;lt;sip:nevermind@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;getmein&amp;quot;&amp;lt;sip:getmein@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;echo&amp;quot;&amp;lt;sip:echo@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;bmw325&amp;quot;&amp;lt;sip:bmw325@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;bmw335&amp;quot;&amp;lt;sip:bmw335@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w3e&amp;quot;&amp;lt;sip:1q2w3e@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w3e4r5t6y&amp;quot;&amp;lt;sip:1q2w3e4r5t6y@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q1q2w2w&amp;quot;&amp;lt;sip:1q1q2w2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w1q2w&amp;quot;&amp;lt;sip:1q2w1q2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w&amp;quot;&amp;lt;sip:1q2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;11q22w&amp;quot;&amp;lt;sip:11q22w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;q1w2&amp;quot;&amp;lt;sip:q1w2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;q1w2e3&amp;quot;&amp;lt;sip:q1w2e3@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;tvv03tvv03&amp;quot;&amp;lt;sip:tvv03tvv03@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                           &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd1&amp;quot;&amp;lt;sip:abcd1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd12&amp;quot;&amp;lt;sip:abcd12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd123&amp;quot;&amp;lt;sip:abcd123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;qq11ww22ee33rr44&amp;quot;&amp;lt;sip:qq11ww22ee33rr44@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1&amp;quot;&amp;lt;sip:sip1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip2&amp;quot;&amp;lt;sip:sip2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip12&amp;quot;&amp;lt;sip:sip12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip123&amp;quot;&amp;lt;sip:sip123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1234&amp;quot;&amp;lt;sip:sip1234@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip12345&amp;quot;&amp;lt;sip:sip12345@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1111&amp;quot;&amp;lt;sip:sip1111@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip222&amp;quot;&amp;lt;sip:sip222@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1qa2ws3ed&amp;quot;&amp;lt;sip:1qa2ws3ed@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1234asdf&amp;quot;&amp;lt;sip:1234asdf@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1a2s3d&amp;quot;&amp;lt;sip:1a2s3d@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1a2s3d4f&amp;quot;&amp;lt;sip:1a2s3d4f@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;asdzxc&amp;quot;&amp;lt;sip:asdzxc@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;123zxc&amp;quot;&amp;lt;sip:123zxc@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1234zxcv&amp;quot;&amp;lt;sip:1234zxcv@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;aazzssxx&amp;quot;&amp;lt;sip:aazzssxx@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;p@ssword&amp;quot;&amp;lt;sip:p@ssword@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;p@ssw0rd&amp;quot;&amp;lt;sip:p@ssw0rd@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;pass1&amp;quot;&amp;lt;sip:pass1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;password3&amp;quot;&amp;lt;sip:password3@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;pass12&amp;quot;&amp;lt;sip:pass12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account&amp;quot;&amp;lt;sip:account@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;passlogin&amp;quot;&amp;lt;sip:passlogin@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account1&amp;quot;&amp;lt;sip:account1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account5&amp;quot;&amp;lt;sip:account5@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account6&amp;quot;&amp;lt;sip:account6@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account123&amp;quot;&amp;lt;sip:account123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account12&amp;quot;&amp;lt;sip:account12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc1&amp;quot;&amp;lt;sip:acc1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc2&amp;quot;&amp;lt;sip:acc2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc12&amp;quot;&amp;lt;sip:acc12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
&lt;br /&gt;
One last tip: you need a MTA, like sendmail or postfix, in order to receive the notifications from fail2ban.&lt;br /&gt;
&lt;br /&gt;
If you have a MTA installed and properly configured, nothing else is needed, but if not, install sendmail&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install sendmail&lt;br /&gt;
&lt;br /&gt;
Then edit the /etc/hosts file and change the line &#039;&#039;&#039;192.168.80.1 dcerouter&#039;&#039;&#039; to read &#039;&#039;&#039;192.168.80.1 dcerouter.localdomain dcerouter&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Doing it, sendmail will start as expected (fast) and mail will properly delivered. If this change is not done, sendmail will take a long time to start, because it does not find the qualified host name, as the log shows:&lt;br /&gt;
&lt;br /&gt;
 Sep 27 13:12:11 dcerouter sendmail[10585]: My unqualified host name (dcerouter) unknown; sleeping for retry&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I hope this helps.&lt;br /&gt;
&lt;br /&gt;
source: &lt;br /&gt;
 http://www.fail2ban.org&lt;br /&gt;
 http://www.voip-info.org/wiki/view/Fail2Ban+(with+iptables)+And+Asterisk&lt;br /&gt;
 http://www.fail2ban.org/wiki/index.php/Asterisk&lt;br /&gt;
&lt;br /&gt;
More protection with iptables:&lt;br /&gt;
 http://sysadminman.net/blog/2010/limiting-sipiax-connections-to-asterisk-with-iptables-1082&lt;/div&gt;</summary>
		<author><name>Pw44</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=Fail2ban_-_A_tool_against_brute_force&amp;diff=25846</id>
		<title>Fail2ban - A tool against brute force</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=Fail2ban_-_A_tool_against_brute_force&amp;diff=25846"/>
		<updated>2010-10-10T20:29:04Z</updated>

		<summary type="html">&lt;p&gt;Pw44: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: Tutorials]]&lt;br /&gt;
[[Category: Networking]]&lt;br /&gt;
{{versioninfo|810Status=Works|810UpdatedDate=5 October 2010|810UpdatedBy=pw44}}&lt;br /&gt;
&lt;br /&gt;
Having asterik installed is almost an invitation for others wishing to place calls at your expense.&lt;br /&gt;
&lt;br /&gt;
After configuring my sip trunk, it did not take 2 days and some &amp;quot;smart guy&amp;quot;  was trying to register to take advantage of it, and causing me losses.&lt;br /&gt;
&lt;br /&gt;
Fail2ban prevented it, blocking the attacker with iptables rules.&lt;br /&gt;
&lt;br /&gt;
Installing fail2ban is not complicated and i will describe the steps to have it properly installed and configured, so you can protect your asterisk and other services from brute force attack.&lt;br /&gt;
&lt;br /&gt;
The first thing to do is to edit /etc/asterisk/sip.conf and add the following line:&lt;br /&gt;
&lt;br /&gt;
 alwaysauthreject=yes                                                 &lt;br /&gt;
   &lt;br /&gt;
My sip.conf file looks like:&lt;br /&gt;
&lt;br /&gt;
 [general]&lt;br /&gt;
 #include sip_general_additional.conf&lt;br /&gt;
 &lt;br /&gt;
 bindport = 5060       ; Port to bind to (SIP is 5060)&lt;br /&gt;
 bindaddr = 0.0.0.0    ; Address to bind to (all addresses on machine)&lt;br /&gt;
 &#039;&#039;&#039;alwaysauthreject=yes&#039;&#039;&#039;                                                 &lt;br /&gt;
 disallow=all                                                         &lt;br /&gt;
 allow=ulaw                                                           &lt;br /&gt;
 allow=alaw                      &lt;br /&gt;
                                                &lt;br /&gt;
Install with: &lt;br /&gt;
 sudo apt-get install fail2ban&lt;br /&gt;
&lt;br /&gt;
After is installed, you need to change /etc/asterisk/logger.conf and add the following line under [general] section (You may have to create this before the [logfiles] section). &lt;br /&gt;
&lt;br /&gt;
 [general]&lt;br /&gt;
 dateformat=%F %T&lt;br /&gt;
&lt;br /&gt;
In /etc/asterisk/logger.conf add the following line under the [logfiles] section for asterisk to log NOTICE level events to the syslog (/var/log/messages) as well as its normal log file. These entries in syslog will have a Date/Time stamp that is usable by fail2ban.&lt;br /&gt;
&lt;br /&gt;
 syslog.local0 =&amp;gt; notice &lt;br /&gt;
&lt;br /&gt;
Reload asterisk with:&lt;br /&gt;
&lt;br /&gt;
 asterisk -rx &amp;quot;logger reload&amp;quot; &lt;br /&gt;
&lt;br /&gt;
Configuring fail2ban:&lt;br /&gt;
&lt;br /&gt;
 cd /etc/fail2ban/filter.d&lt;br /&gt;
&lt;br /&gt;
 touch asterisk.conf &lt;br /&gt;
&lt;br /&gt;
 vi asterisk.conf&lt;br /&gt;
&lt;br /&gt;
insert the following (copy &amp;amp; paste)&lt;br /&gt;
&lt;br /&gt;
 # Fail2Ban configuration file&lt;br /&gt;
 #&lt;br /&gt;
 #&lt;br /&gt;
 # $Revision: 250 $&lt;br /&gt;
 #&lt;br /&gt;
 [INCLUDES]&lt;br /&gt;
 # Read common prefixes. If any customizations available -- read them from&lt;br /&gt;
 # common.local&lt;br /&gt;
 #before = common.conf&lt;br /&gt;
 [Definition]&lt;br /&gt;
 #_daemon = asterisk&lt;br /&gt;
 # Option:  failregex&lt;br /&gt;
 # Notes.:  regex to match the password failures messages in the logfile. The&lt;br /&gt;
 #          host must be matched by a group named &amp;quot;host&amp;quot;. The tag &amp;quot;&amp;lt;HOST&amp;gt;&amp;quot; can&lt;br /&gt;
 #          be used for standard IP/hostname matching and is only an alias for&lt;br /&gt;
 #          (?:::f{4,6}:)?(?P&amp;lt;host&amp;gt;\S+)&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 failregex = NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Wrong password&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - No matching peer found&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Username/auth name mismatch&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Device does not match ACL&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&amp;quot; .* failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Peer is not supposed to register&lt;br /&gt;
             NOTICE.* &amp;lt;HOST&amp;gt; failed to authenticate as &#039;.*&#039;$&lt;br /&gt;
             NOTICE.* .*: No registration for peer &#039;.*&#039; \(from &amp;lt;HOST&amp;gt;\)&lt;br /&gt;
             NOTICE.* .*: Host &amp;lt;HOST&amp;gt; failed MD5 authentication for &#039;.*&#039; (.*)&lt;br /&gt;
             NOTICE.* .*: Failed to authenticate user .*@&amp;lt;HOST&amp;gt;.*&lt;br /&gt;
 # Option:  ignoreregex&lt;br /&gt;
 # Notes.:  regex to ignore. If this regex matches, the line is ignored.&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 ignoreregex =&lt;br /&gt;
&lt;br /&gt;
Next edit /etc/fail2ban/jail.conf to include the following section so that it uses the new filter. &lt;br /&gt;
&lt;br /&gt;
 [asterisk-iptables]&lt;br /&gt;
 enabled  = true&lt;br /&gt;
 filter   = asterisk&lt;br /&gt;
 action   = iptables-allports[name=ASTERISK, protocol=all]&lt;br /&gt;
            sendmail-whois[name=ASTERISK, dest=root, sender=fail2ban@example.org]&lt;br /&gt;
 logpath  = /var/log/asterisk/full&lt;br /&gt;
 maxretry = 2&lt;br /&gt;
 bantime = 259200&lt;br /&gt;
&lt;br /&gt;
Locate the line ignoreip in /etc/fail2ban/jail.conf (beginning of the file) and insert the ip&#039;s and / or blocks you want fail2ban to ignore, so you don&#039;t risk banning yourserf or any host in your network.&lt;br /&gt;
&lt;br /&gt;
Mine is defined as follows:&lt;br /&gt;
&lt;br /&gt;
 [DEFAULT]&lt;br /&gt;
 # &amp;quot;ignoreip&amp;quot; can be an IP address, a CIDR mask or a DNS host. Fail2ban will not&lt;br /&gt;
 # ban a host which matches an address in this list. Several addresses can be   &lt;br /&gt;
 # defined using space separator.                                               &lt;br /&gt;
 ignoreip = 127.0.0.1 192.168.80.1 192.168.80.0/24 &lt;br /&gt;
&lt;br /&gt;
To start fail2ban type the following as root:&lt;br /&gt;
&lt;br /&gt;
 /etc/init.d/fail2ban start&lt;br /&gt;
&lt;br /&gt;
Check It&lt;br /&gt;
&lt;br /&gt;
For LinuxMCE, there is needed &amp;quot;patch&amp;quot;, while fail2ban is not part of the distribution.&lt;br /&gt;
&lt;br /&gt;
When LinuxMCE starts, it runs /usr/pluto/bin/Network_Firewall.sh, and this is done AFTER /etc/init.d/fail2ban is started.&lt;br /&gt;
&lt;br /&gt;
So, edit /usr/pluto/bin/Network_Firewall.sh and add the following at the END of this file:&lt;br /&gt;
 &lt;br /&gt;
 /etc/init.d/fail2ban restart&lt;br /&gt;
&lt;br /&gt;
This will make sure that fail2bain is started AFTER the iptables rules from LinuxMCE.&lt;br /&gt;
&lt;br /&gt;
If started properly issue the following command to view your iptables rules:&lt;br /&gt;
&lt;br /&gt;
 iptables -L -v&lt;br /&gt;
&lt;br /&gt;
You should see something like the following for the INPUT chain (this is the ouput of mine)&lt;br /&gt;
&lt;br /&gt;
 Chain INPUT (policy DROP 2241 packets, 160K bytes)              &lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination         &lt;br /&gt;
   372 27264 &#039;&#039;&#039;fail2ban-SSH&#039;&#039;&#039;  tcp  --  any    any     anywhere             anywhere            tcp dpt:ssh                                                                                          &lt;br /&gt;
 1312K  991M &#039;&#039;&#039;fail2ban-ASTERISK&#039;&#039;&#039;  all  --  any    any     anywhere             anywhere            &lt;br /&gt;
  553K   81M ACCEPT     all  --  lo     any     anywhere             anywhere                    &lt;br /&gt;
 1288K 1162M ACCEPT     all  --  any    any     anywhere             anywhere            state RELATED,ESTABLISHED                                                                               &lt;br /&gt;
     9   540 ACCEPT     all  --  any    any     anywhere             anywhere            MARK match 0x1                                                                                          &lt;br /&gt;
     2  1152 ACCEPT     udp  --  any    any     anywhere             anywhere            udp   dpt:bootps                                                                                          &lt;br /&gt;
 19276 5790K ACCEPT     all  --  any    any     192.168.80.0/24      anywhere                    &lt;br /&gt;
     0     0 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:iax                                                                                             &lt;br /&gt;
     4  1795 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:sip                                                                                             &lt;br /&gt;
     0     0 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:2000                                                                                            &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:sieve                                                                                           &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:1723                                                                                            &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:www                                                                                             &lt;br /&gt;
     1    60 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:ssh                                                                                             &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:https                                                                                           &lt;br /&gt;
     1    50 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpts:10001:20000&lt;br /&gt;
     0     0 ACCEPT     gre  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain FORWARD (policy ACCEPT 719K packets, 245M bytes)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
     0     0 TCPMSS     tcp  --  any    ppp+    anywhere             anywhere            tcp flags:SYN,RST/SYN TCPMSS clamp to PMTU&lt;br /&gt;
 Chain OUTPUT (policy ACCEPT 2099K packets, 590M bytes)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
     0     0 ACCEPT     gre  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain &#039;&#039;&#039;fail2ban-ASTERISK&#039;&#039;&#039; (1 references)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
  5091 2125K DROP       all  --  any    any     173.193.194.106-static.reverse.softlayer.com  anywhere&lt;br /&gt;
 1307K  989M RETURN     all  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain &#039;&#039;&#039;fail2ban-SSH&#039;&#039;&#039; (1 references)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
&lt;br /&gt;
If you do not see something similar to that then you have some troubleshooting to, check out /var/log/fail2ban.log.&lt;br /&gt;
&lt;br /&gt;
Example of my /var/log/fai2ban.log (173.193.194.106 is the real address from the attacker fail2ban banned):&lt;br /&gt;
&lt;br /&gt;
 ....&lt;br /&gt;
 2010-09-19 11:12:56,131 fail2ban.filter : INFO   Set maxRetry = 6&lt;br /&gt;
 2010-09-19 11:12:56,133 fail2ban.filter : INFO   Set findtime = 600&lt;br /&gt;
 2010-09-19 11:12:56,133 fail2ban.actions: INFO   Set banTime = 600&lt;br /&gt;
 2010-09-19 11:12:56,138 fail2ban.jail   : INFO   Jail &#039;ssh-iptables&#039; started&lt;br /&gt;
 2010-09-19 11:12:56,139 fail2ban.jail   : INFO   Jail &#039;asterisk-iptables&#039; started&lt;br /&gt;
 2010-09-19 11:12:56,141 fail2ban.jail   : INFO   Jail &#039;apache-tcpwrapper&#039; started&lt;br /&gt;
 2010-09-19 15:33:50,392 fail2ban.actions: WARNING [asterisk-iptables] Ban 173.193.194.106&lt;br /&gt;
 2010-09-19 15:34:50,982 fail2ban.actions: WARNING [asterisk-iptables] 173.193.194.106 already banned&lt;br /&gt;
&lt;br /&gt;
And this is the log (/var/log/asterisk/messages) showing the attack:&lt;br /&gt;
&lt;br /&gt;
 [2010-09-19 15:33:48] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;3235410554&amp;quot;&amp;lt;sip:3235410554@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                           &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;thomas&amp;quot;&amp;lt;sip:thomas@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;arsenal&amp;quot;&amp;lt;sip:arsenal@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;letmein&amp;quot;&amp;lt;sip:letmein@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;liverpool&amp;quot;&amp;lt;sip:liverpool@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;nevermind&amp;quot;&amp;lt;sip:nevermind@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;getmein&amp;quot;&amp;lt;sip:getmein@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;echo&amp;quot;&amp;lt;sip:echo@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;bmw325&amp;quot;&amp;lt;sip:bmw325@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;bmw335&amp;quot;&amp;lt;sip:bmw335@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w3e&amp;quot;&amp;lt;sip:1q2w3e@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w3e4r5t6y&amp;quot;&amp;lt;sip:1q2w3e4r5t6y@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q1q2w2w&amp;quot;&amp;lt;sip:1q1q2w2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w1q2w&amp;quot;&amp;lt;sip:1q2w1q2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w&amp;quot;&amp;lt;sip:1q2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;11q22w&amp;quot;&amp;lt;sip:11q22w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;q1w2&amp;quot;&amp;lt;sip:q1w2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;q1w2e3&amp;quot;&amp;lt;sip:q1w2e3@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;tvv03tvv03&amp;quot;&amp;lt;sip:tvv03tvv03@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                           &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd1&amp;quot;&amp;lt;sip:abcd1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd12&amp;quot;&amp;lt;sip:abcd12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd123&amp;quot;&amp;lt;sip:abcd123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;qq11ww22ee33rr44&amp;quot;&amp;lt;sip:qq11ww22ee33rr44@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1&amp;quot;&amp;lt;sip:sip1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip2&amp;quot;&amp;lt;sip:sip2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip12&amp;quot;&amp;lt;sip:sip12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip123&amp;quot;&amp;lt;sip:sip123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1234&amp;quot;&amp;lt;sip:sip1234@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip12345&amp;quot;&amp;lt;sip:sip12345@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1111&amp;quot;&amp;lt;sip:sip1111@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip222&amp;quot;&amp;lt;sip:sip222@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1qa2ws3ed&amp;quot;&amp;lt;sip:1qa2ws3ed@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1234asdf&amp;quot;&amp;lt;sip:1234asdf@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1a2s3d&amp;quot;&amp;lt;sip:1a2s3d@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1a2s3d4f&amp;quot;&amp;lt;sip:1a2s3d4f@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;asdzxc&amp;quot;&amp;lt;sip:asdzxc@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;123zxc&amp;quot;&amp;lt;sip:123zxc@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1234zxcv&amp;quot;&amp;lt;sip:1234zxcv@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;aazzssxx&amp;quot;&amp;lt;sip:aazzssxx@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;p@ssword&amp;quot;&amp;lt;sip:p@ssword@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;p@ssw0rd&amp;quot;&amp;lt;sip:p@ssw0rd@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;pass1&amp;quot;&amp;lt;sip:pass1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;password3&amp;quot;&amp;lt;sip:password3@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;pass12&amp;quot;&amp;lt;sip:pass12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account&amp;quot;&amp;lt;sip:account@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;passlogin&amp;quot;&amp;lt;sip:passlogin@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account1&amp;quot;&amp;lt;sip:account1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account5&amp;quot;&amp;lt;sip:account5@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account6&amp;quot;&amp;lt;sip:account6@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account123&amp;quot;&amp;lt;sip:account123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account12&amp;quot;&amp;lt;sip:account12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc1&amp;quot;&amp;lt;sip:acc1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc2&amp;quot;&amp;lt;sip:acc2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc12&amp;quot;&amp;lt;sip:acc12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
&lt;br /&gt;
One last tip: you need a MTA, like sendmail or postfix, in order to receive the notifications from fail2ban.&lt;br /&gt;
&lt;br /&gt;
If you have a MTA installed and properly configured, nothing else is needed, but if not, install sendmail&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install sendmail&lt;br /&gt;
&lt;br /&gt;
Then edit the /etc/hosts file and change the line &#039;&#039;&#039;192.168.80.1 dcerouter&#039;&#039;&#039; to read &#039;&#039;&#039;192.168.80.1 dcerouter.localdomain dcerouter&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Doing it, sendmail will start as expected (fast) and mail will properly delivered. If this change is not done, sendmail will take a long time to start, because it does not find the qualified host name, as the log shows:&lt;br /&gt;
&lt;br /&gt;
 Sep 27 13:12:11 dcerouter sendmail[10585]: My unqualified host name (dcerouter) unknown; sleeping for retry&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I hope this helps.&lt;br /&gt;
&lt;br /&gt;
source: &lt;br /&gt;
 http://www.fail2ban.org&lt;br /&gt;
 http://www.voip-info.org/wiki/view/Fail2Ban+(with+iptables)+And+Asterisk&lt;br /&gt;
 http://www.fail2ban.org/wiki/index.php/Asterisk&lt;br /&gt;
&lt;br /&gt;
More protection with iptables:&lt;br /&gt;
 http://sysadminman.net/blog/2010/limiting-sipiax-connections-to-asterisk-with-iptables-1082&lt;/div&gt;</summary>
		<author><name>Pw44</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=PPTP_server&amp;diff=25785</id>
		<title>PPTP server</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=PPTP_server&amp;diff=25785"/>
		<updated>2010-10-06T19:06:48Z</updated>

		<summary type="html">&lt;p&gt;Pw44: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Networking]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
{{versioninfo|810Status=Works|810UpdatedDate=5 October 2010|810UpdatedBy=pw44}}&lt;br /&gt;
&lt;br /&gt;
Setting up a PPTP Server.&lt;br /&gt;
&lt;br /&gt;
The pptp server is the right tool to use for outside access to your internal network.&lt;br /&gt;
While not the most secure VPN solution, PPTP is the most simple to install, configure and connect from windows, and mobile devices. &lt;br /&gt;
&lt;br /&gt;
Reasons for doing it:&lt;br /&gt;
# Having your mobile as an extension of your asterisk server (Iphone, for example, can do it, Nokia can do it via an add on), even from public wifi spots.&lt;br /&gt;
# Being able to remotely access files or anything in your server from anywhere, even from wifi spots.&lt;br /&gt;
# Others, as you wish.&lt;br /&gt;
&lt;br /&gt;
Lets make it simple:&lt;br /&gt;
&lt;br /&gt;
Server Setup - install the pptp server package:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install pptpd&lt;br /&gt;
&lt;br /&gt;
edit the /etc/pptpd.conf file:&lt;br /&gt;
&lt;br /&gt;
 sudo vi /etc/pptpd.conf&lt;br /&gt;
&lt;br /&gt;
and add:&lt;br /&gt;
&lt;br /&gt;
 localip 192.168.80.245,192.168.0.245&lt;br /&gt;
 remoteip 192.168.80.246-250,192.168.0.246-250&lt;br /&gt;
&lt;br /&gt;
where the localip is the address of the server, and the remoteip are the addresses that will be assigned to clients.&lt;br /&gt;
160&lt;br /&gt;
edit the /etc/ppp/pptpd-options file:&lt;br /&gt;
&lt;br /&gt;
 sudo vi /etc/ppp/pptpd-options&lt;br /&gt;
&lt;br /&gt;
append the following directives:&lt;br /&gt;
&lt;br /&gt;
 ms-dns 192.168.80.1&lt;br /&gt;
 nobsdcomp&lt;br /&gt;
 noipx&lt;br /&gt;
 mtu 1490&lt;br /&gt;
 mru 1490&lt;br /&gt;
&lt;br /&gt;
Mine looks like:&lt;br /&gt;
&lt;br /&gt;
 name dcerouter&lt;br /&gt;
 refuse-pap&lt;br /&gt;
 refuse-chap&lt;br /&gt;
 refuse-mschap&lt;br /&gt;
 require-mschap-v2&lt;br /&gt;
 require-mppe-128&lt;br /&gt;
 ms-dns 192.168.80.1&lt;br /&gt;
 proxyarp&lt;br /&gt;
 nodefaultroute&lt;br /&gt;
 debug&lt;br /&gt;
 lock&lt;br /&gt;
 nobsdcomp&lt;br /&gt;
&lt;br /&gt;
Add the user credentials for authentication to you chap secrets file:&lt;br /&gt;
&lt;br /&gt;
 sudo vi /etc/ppp/chap-secrets&lt;br /&gt;
&lt;br /&gt;
Add to it the user name + password in the following syntax:&lt;br /&gt;
&lt;br /&gt;
 usernmae &amp;lt;TAB&amp;gt; dcerouter &amp;lt;TAB&amp;gt; users-password &amp;lt;TAB&amp;gt; *&lt;br /&gt;
&lt;br /&gt;
Restart the server for the settings to take affect:&lt;br /&gt;
&lt;br /&gt;
 sudo /etc/init.d/pptpd restart&lt;br /&gt;
&lt;br /&gt;
Firewall rules:&lt;br /&gt;
&lt;br /&gt;
Webadmin -&amp;gt; advanced -&amp;gt; Network -&amp;gt; Firewall Rules: core input for port 1723&lt;br /&gt;
&lt;br /&gt;
You need to append the following lines to /usr/pluto/bin/Network_Firewall.sh, in order to permit GRE protocol flow (needed by PPTP):&lt;br /&gt;
&lt;br /&gt;
 iptables --append INPUT  --protocol 47 --jump ACCEPT&lt;br /&gt;
 iptables --append OUTPUT --protocol 47 --jump ACCEPT&lt;br /&gt;
&lt;br /&gt;
If you also have a router running Tomato or DD-WRT, the following iptables rules shall be applied (these are the ones in my Tomato router): My LinuxMCE has the eth0 setted to 192.168.0.160, defined by static address in my Tomato.&lt;br /&gt;
&lt;br /&gt;
 # init pptp + gre pass thru&lt;br /&gt;
 iptables -t nat -I PREROUTING -p tcp --dport 1723 -j DNAT --to 192.168.0.160:1723&lt;br /&gt;
 iptables -I FORWARD -p tcp -d 192.168.0.160 --dport 1723 -j ACCEPT&lt;br /&gt;
 iptables -t nat -I PREROUTING -p 47 -j DNAT --to 192.168.0.160&lt;br /&gt;
 iptables -I FORWARD -p 47 -d 192.168.0.160 -j ACCEPT&lt;br /&gt;
 &lt;br /&gt;
 iptables -t nat -A PREROUTING -i ppp0 -p tcp -d 0/0 --dport 1723 -j DNAT --to-destination 192.168.0.160&lt;br /&gt;
 iptables -t nat -A PREROUTING -i ppp0 -p gre -d 0/0 -j DNAT --to-destination 192.168.0.160&lt;br /&gt;
 &lt;br /&gt;
 iptables -A FORWARD -i ppp0 -o br0 -p tcp --dport 1723 -d 192.168.0.160 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT&lt;br /&gt;
 iptables -A FORWARD -i br0 -o ppp0 -p tcp -s 192.168.0.160 --sport 1723 -m state --state ESTABLISHED,RELATED -j ACCEPT&lt;br /&gt;
 iptables -A FORWARD -i ppp0 -o br0 -p gre -d 192.168.0.160 -m state --state NEW,ESTABLISHED,RELATED-j ACCEPT&lt;br /&gt;
 iptables -A FORWARD -i br0 -o ppp0 -p gre -s 192.168.0.160 -m state --state ESTABLISHED,RELATED -j ACCEPT&lt;br /&gt;
 # end pptp + gre pass thru&lt;br /&gt;
&lt;br /&gt;
Once done, reload DCERouter, in order that the /usr/pluto/bin/Network_Firewall.sh is reloaded,and if you have Tomato or DD-WRT, reboot it.&lt;br /&gt;
&lt;br /&gt;
Configure your client to use PPTP and test (beyond this wiki).&lt;/div&gt;</summary>
		<author><name>Pw44</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=Fail2ban_-_A_tool_against_brute_force&amp;diff=25784</id>
		<title>Fail2ban - A tool against brute force</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=Fail2ban_-_A_tool_against_brute_force&amp;diff=25784"/>
		<updated>2010-10-06T19:06:07Z</updated>

		<summary type="html">&lt;p&gt;Pw44: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: Tutorials]]&lt;br /&gt;
[[Category: Networking]]&lt;br /&gt;
{{versioninfo|810Status=Works|810UpdatedDate=5 October 2010|810UpdatedBy=pw44}}&lt;br /&gt;
&lt;br /&gt;
Having asterik installed is almost an invitation for others wishing to place calls at your expense.&lt;br /&gt;
&lt;br /&gt;
After configuring my sip trunk, it did not take 2 days and some &amp;quot;smart guy&amp;quot;  was trying to register to take advantage of it, and causing me losses.&lt;br /&gt;
&lt;br /&gt;
Fail2ban prevented it, blocking the attacker with iptables rules.&lt;br /&gt;
&lt;br /&gt;
Installing fail2ban is not complicated and i will describe the steps to have it properly installed and configured, so you can protect your asterisk and other services from brute force attack.&lt;br /&gt;
&lt;br /&gt;
Install with: &lt;br /&gt;
 sudo apt-get install fail2ban&lt;br /&gt;
&lt;br /&gt;
After is installed, you need to change /etc/asterisk/logger.conf and add the following line under [general] section (You may have to create this before the [logfiles] section). &lt;br /&gt;
&lt;br /&gt;
 [general]&lt;br /&gt;
 dateformat=%F %T&lt;br /&gt;
&lt;br /&gt;
In /etc/asterisk/logger.conf add the following line under the [logfiles] section for asterisk to log NOTICE level events to the syslog (/var/log/messages) as well as its normal log file. These entries in syslog will have a Date/Time stamp that is usable by fail2ban.&lt;br /&gt;
&lt;br /&gt;
 syslog.local0 =&amp;gt; notice &lt;br /&gt;
&lt;br /&gt;
Reload asterisk with:&lt;br /&gt;
&lt;br /&gt;
 asterisk -rx &amp;quot;logger reload&amp;quot; &lt;br /&gt;
&lt;br /&gt;
Configuring fail2ban:&lt;br /&gt;
&lt;br /&gt;
 cd /etc/fail2ban/filter.d&lt;br /&gt;
&lt;br /&gt;
 touch asterisk.conf &lt;br /&gt;
&lt;br /&gt;
 vi asterisk.conf&lt;br /&gt;
&lt;br /&gt;
insert the following (copy &amp;amp; paste)&lt;br /&gt;
&lt;br /&gt;
 # Fail2Ban configuration file&lt;br /&gt;
 #&lt;br /&gt;
 #&lt;br /&gt;
 # $Revision: 250 $&lt;br /&gt;
 #&lt;br /&gt;
 [INCLUDES]&lt;br /&gt;
 # Read common prefixes. If any customizations available -- read them from&lt;br /&gt;
 # common.local&lt;br /&gt;
 #before = common.conf&lt;br /&gt;
 [Definition]&lt;br /&gt;
 #_daemon = asterisk&lt;br /&gt;
 # Option:  failregex&lt;br /&gt;
 # Notes.:  regex to match the password failures messages in the logfile. The&lt;br /&gt;
 #          host must be matched by a group named &amp;quot;host&amp;quot;. The tag &amp;quot;&amp;lt;HOST&amp;gt;&amp;quot; can&lt;br /&gt;
 #          be used for standard IP/hostname matching and is only an alias for&lt;br /&gt;
 #          (?:::f{4,6}:)?(?P&amp;lt;host&amp;gt;\S+)&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 failregex = NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Wrong password&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - No matching peer found&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Username/auth name mismatch&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Device does not match ACL&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&amp;quot; .* failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Peer is not supposed to register&lt;br /&gt;
             NOTICE.* &amp;lt;HOST&amp;gt; failed to authenticate as &#039;.*&#039;$&lt;br /&gt;
             NOTICE.* .*: No registration for peer &#039;.*&#039; \(from &amp;lt;HOST&amp;gt;\)&lt;br /&gt;
             NOTICE.* .*: Host &amp;lt;HOST&amp;gt; failed MD5 authentication for &#039;.*&#039; (.*)&lt;br /&gt;
             NOTICE.* .*: Failed to authenticate user .*@&amp;lt;HOST&amp;gt;.*&lt;br /&gt;
 # Option:  ignoreregex&lt;br /&gt;
 # Notes.:  regex to ignore. If this regex matches, the line is ignored.&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 ignoreregex =&lt;br /&gt;
&lt;br /&gt;
Next edit /etc/fail2ban/jail.conf to include the following section so that it uses the new filter. &lt;br /&gt;
&lt;br /&gt;
 [asterisk-iptables]&lt;br /&gt;
 enabled  = true&lt;br /&gt;
 filter   = asterisk&lt;br /&gt;
 action   = iptables-allports[name=ASTERISK, protocol=all]&lt;br /&gt;
            sendmail-whois[name=ASTERISK, dest=root, sender=fail2ban@example.org]&lt;br /&gt;
 logpath  = /var/log/asterisk/full&lt;br /&gt;
 maxretry = 2&lt;br /&gt;
 bantime = 259200&lt;br /&gt;
&lt;br /&gt;
Locate the line ignoreip in /etc/fail2ban/jail.conf (beginning of the file) and insert the ip&#039;s and / or blocks you want fail2ban to ignore, so you don&#039;t risk banning yourserf or any host in your network.&lt;br /&gt;
&lt;br /&gt;
Mine is defined as follows:&lt;br /&gt;
&lt;br /&gt;
 [DEFAULT]&lt;br /&gt;
 # &amp;quot;ignoreip&amp;quot; can be an IP address, a CIDR mask or a DNS host. Fail2ban will not&lt;br /&gt;
 # ban a host which matches an address in this list. Several addresses can be   &lt;br /&gt;
 # defined using space separator.                                               &lt;br /&gt;
 ignoreip = 127.0.0.1 192.168.80.1 192.168.80.0/24 &lt;br /&gt;
&lt;br /&gt;
To start fail2ban type the following as root:&lt;br /&gt;
&lt;br /&gt;
 /etc/init.d/fail2ban start&lt;br /&gt;
&lt;br /&gt;
Check It&lt;br /&gt;
&lt;br /&gt;
For LinuxMCE, there is needed &amp;quot;patch&amp;quot;, while fail2ban is not part of the distribution.&lt;br /&gt;
&lt;br /&gt;
When LinuxMCE starts, it runs /usr/pluto/bin/Network_Firewall.sh, and this is done AFTER /etc/init.d/fail2ban is started.&lt;br /&gt;
&lt;br /&gt;
So, edit /usr/pluto/bin/Network_Firewall.sh and add the following at the END of this file:&lt;br /&gt;
 &lt;br /&gt;
 /etc/init.d/fail2ban restart&lt;br /&gt;
&lt;br /&gt;
This will make sure that fail2bain is started AFTER the iptables rules from LinuxMCE.&lt;br /&gt;
&lt;br /&gt;
If started properly issue the following command to view your iptables rules:&lt;br /&gt;
&lt;br /&gt;
 iptables -L -v&lt;br /&gt;
&lt;br /&gt;
You should see something like the following for the INPUT chain (this is the ouput of mine)&lt;br /&gt;
&lt;br /&gt;
 Chain INPUT (policy DROP 2241 packets, 160K bytes)              &lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination         &lt;br /&gt;
   372 27264 &#039;&#039;&#039;fail2ban-SSH&#039;&#039;&#039;  tcp  --  any    any     anywhere             anywhere            tcp dpt:ssh                                                                                          &lt;br /&gt;
 1312K  991M &#039;&#039;&#039;fail2ban-ASTERISK&#039;&#039;&#039;  all  --  any    any     anywhere             anywhere            &lt;br /&gt;
  553K   81M ACCEPT     all  --  lo     any     anywhere             anywhere                    &lt;br /&gt;
 1288K 1162M ACCEPT     all  --  any    any     anywhere             anywhere            state RELATED,ESTABLISHED                                                                               &lt;br /&gt;
     9   540 ACCEPT     all  --  any    any     anywhere             anywhere            MARK match 0x1                                                                                          &lt;br /&gt;
     2  1152 ACCEPT     udp  --  any    any     anywhere             anywhere            udp   dpt:bootps                                                                                          &lt;br /&gt;
 19276 5790K ACCEPT     all  --  any    any     192.168.80.0/24      anywhere                    &lt;br /&gt;
     0     0 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:iax                                                                                             &lt;br /&gt;
     4  1795 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:sip                                                                                             &lt;br /&gt;
     0     0 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:2000                                                                                            &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:sieve                                                                                           &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:1723                                                                                            &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:www                                                                                             &lt;br /&gt;
     1    60 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:ssh                                                                                             &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:https                                                                                           &lt;br /&gt;
     1    50 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpts:10001:20000&lt;br /&gt;
     0     0 ACCEPT     gre  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain FORWARD (policy ACCEPT 719K packets, 245M bytes)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
     0     0 TCPMSS     tcp  --  any    ppp+    anywhere             anywhere            tcp flags:SYN,RST/SYN TCPMSS clamp to PMTU&lt;br /&gt;
 Chain OUTPUT (policy ACCEPT 2099K packets, 590M bytes)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
     0     0 ACCEPT     gre  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain &#039;&#039;&#039;fail2ban-ASTERISK&#039;&#039;&#039; (1 references)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
  5091 2125K DROP       all  --  any    any     173.193.194.106-static.reverse.softlayer.com  anywhere&lt;br /&gt;
 1307K  989M RETURN     all  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain &#039;&#039;&#039;fail2ban-SSH&#039;&#039;&#039; (1 references)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
&lt;br /&gt;
If you do not see something similar to that then you have some troubleshooting to, check out /var/log/fail2ban.log.&lt;br /&gt;
&lt;br /&gt;
Example of my /var/log/fai2ban.log (173.193.194.106 is the real address from the attacker fail2ban banned):&lt;br /&gt;
&lt;br /&gt;
 ....&lt;br /&gt;
 2010-09-19 11:12:56,131 fail2ban.filter : INFO   Set maxRetry = 6&lt;br /&gt;
 2010-09-19 11:12:56,133 fail2ban.filter : INFO   Set findtime = 600&lt;br /&gt;
 2010-09-19 11:12:56,133 fail2ban.actions: INFO   Set banTime = 600&lt;br /&gt;
 2010-09-19 11:12:56,138 fail2ban.jail   : INFO   Jail &#039;ssh-iptables&#039; started&lt;br /&gt;
 2010-09-19 11:12:56,139 fail2ban.jail   : INFO   Jail &#039;asterisk-iptables&#039; started&lt;br /&gt;
 2010-09-19 11:12:56,141 fail2ban.jail   : INFO   Jail &#039;apache-tcpwrapper&#039; started&lt;br /&gt;
 2010-09-19 15:33:50,392 fail2ban.actions: WARNING [asterisk-iptables] Ban 173.193.194.106&lt;br /&gt;
 2010-09-19 15:34:50,982 fail2ban.actions: WARNING [asterisk-iptables] 173.193.194.106 already banned&lt;br /&gt;
&lt;br /&gt;
And this is the log (/var/log/asterisk/messages) showing the attack:&lt;br /&gt;
&lt;br /&gt;
 [2010-09-19 15:33:48] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;3235410554&amp;quot;&amp;lt;sip:3235410554@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                           &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;thomas&amp;quot;&amp;lt;sip:thomas@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;arsenal&amp;quot;&amp;lt;sip:arsenal@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;letmein&amp;quot;&amp;lt;sip:letmein@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;liverpool&amp;quot;&amp;lt;sip:liverpool@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;nevermind&amp;quot;&amp;lt;sip:nevermind@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;getmein&amp;quot;&amp;lt;sip:getmein@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;echo&amp;quot;&amp;lt;sip:echo@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;bmw325&amp;quot;&amp;lt;sip:bmw325@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;bmw335&amp;quot;&amp;lt;sip:bmw335@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w3e&amp;quot;&amp;lt;sip:1q2w3e@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w3e4r5t6y&amp;quot;&amp;lt;sip:1q2w3e4r5t6y@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q1q2w2w&amp;quot;&amp;lt;sip:1q1q2w2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w1q2w&amp;quot;&amp;lt;sip:1q2w1q2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w&amp;quot;&amp;lt;sip:1q2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;11q22w&amp;quot;&amp;lt;sip:11q22w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;q1w2&amp;quot;&amp;lt;sip:q1w2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;q1w2e3&amp;quot;&amp;lt;sip:q1w2e3@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;tvv03tvv03&amp;quot;&amp;lt;sip:tvv03tvv03@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                           &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd1&amp;quot;&amp;lt;sip:abcd1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd12&amp;quot;&amp;lt;sip:abcd12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd123&amp;quot;&amp;lt;sip:abcd123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;qq11ww22ee33rr44&amp;quot;&amp;lt;sip:qq11ww22ee33rr44@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1&amp;quot;&amp;lt;sip:sip1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip2&amp;quot;&amp;lt;sip:sip2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip12&amp;quot;&amp;lt;sip:sip12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip123&amp;quot;&amp;lt;sip:sip123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1234&amp;quot;&amp;lt;sip:sip1234@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip12345&amp;quot;&amp;lt;sip:sip12345@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1111&amp;quot;&amp;lt;sip:sip1111@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip222&amp;quot;&amp;lt;sip:sip222@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1qa2ws3ed&amp;quot;&amp;lt;sip:1qa2ws3ed@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1234asdf&amp;quot;&amp;lt;sip:1234asdf@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1a2s3d&amp;quot;&amp;lt;sip:1a2s3d@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1a2s3d4f&amp;quot;&amp;lt;sip:1a2s3d4f@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;asdzxc&amp;quot;&amp;lt;sip:asdzxc@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;123zxc&amp;quot;&amp;lt;sip:123zxc@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1234zxcv&amp;quot;&amp;lt;sip:1234zxcv@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;aazzssxx&amp;quot;&amp;lt;sip:aazzssxx@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;p@ssword&amp;quot;&amp;lt;sip:p@ssword@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;p@ssw0rd&amp;quot;&amp;lt;sip:p@ssw0rd@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;pass1&amp;quot;&amp;lt;sip:pass1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;password3&amp;quot;&amp;lt;sip:password3@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;pass12&amp;quot;&amp;lt;sip:pass12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account&amp;quot;&amp;lt;sip:account@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;passlogin&amp;quot;&amp;lt;sip:passlogin@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account1&amp;quot;&amp;lt;sip:account1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account5&amp;quot;&amp;lt;sip:account5@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account6&amp;quot;&amp;lt;sip:account6@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account123&amp;quot;&amp;lt;sip:account123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account12&amp;quot;&amp;lt;sip:account12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc1&amp;quot;&amp;lt;sip:acc1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc2&amp;quot;&amp;lt;sip:acc2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc12&amp;quot;&amp;lt;sip:acc12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
&lt;br /&gt;
One last tip: you need a MTA, like sendmail or postfix, in order to receive the notifications from fail2ban.&lt;br /&gt;
&lt;br /&gt;
If you have a MTA installed and properly configured, nothing else is needed, but if not, install sendmail&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install sendmail&lt;br /&gt;
&lt;br /&gt;
Then edit the /etc/hosts file and change the line &#039;&#039;&#039;192.168.80.1 dcerouter&#039;&#039;&#039; to read &#039;&#039;&#039;192.168.80.1 dcerouter.localdomain dcerouter&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Doing it, sendmail will start as expected (fast) and mail will properly delivered. If this change is not done, sendmail will take a long time to start, because it does not find the qualified host name, as the log shows:&lt;br /&gt;
&lt;br /&gt;
 Sep 27 13:12:11 dcerouter sendmail[10585]: My unqualified host name (dcerouter) unknown; sleeping for retry&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I hope this helps.&lt;br /&gt;
&lt;br /&gt;
source: &lt;br /&gt;
 http://www.fail2ban.org&lt;br /&gt;
 http://www.voip-info.org/wiki/view/Fail2Ban+(with+iptables)+And+Asterisk&lt;br /&gt;
 http://www.fail2ban.org/wiki/index.php/Asterisk&lt;br /&gt;
&lt;br /&gt;
More protection with iptables:&lt;br /&gt;
 http://sysadminman.net/blog/2010/limiting-sipiax-connections-to-asterisk-with-iptables-1082&lt;/div&gt;</summary>
		<author><name>Pw44</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=Fail2ban_-_A_tool_against_brute_force&amp;diff=25783</id>
		<title>Fail2ban - A tool against brute force</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=Fail2ban_-_A_tool_against_brute_force&amp;diff=25783"/>
		<updated>2010-10-06T19:04:30Z</updated>

		<summary type="html">&lt;p&gt;Pw44: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: Tutorials]]&lt;br /&gt;
[[Category: Networking]]&lt;br /&gt;
{{versioninfo|810Status=??|810UpdatedDate=5 October 2010|810UpdatedBy=pw44}}&lt;br /&gt;
&lt;br /&gt;
Having asterik installed is almost an invitation for others wishing to place calls at your expense.&lt;br /&gt;
&lt;br /&gt;
After configuring my sip trunk, it did not take 2 days and some &amp;quot;smart guy&amp;quot;  was trying to register to take advantage of it, and causing me losses.&lt;br /&gt;
&lt;br /&gt;
Fail2ban prevented it, blocking the attacker with iptables rules.&lt;br /&gt;
&lt;br /&gt;
Installing fail2ban is not complicated and i will describe the steps to have it properly installed and configured, so you can protect your asterisk and other services from brute force attack.&lt;br /&gt;
&lt;br /&gt;
Install with: &lt;br /&gt;
 sudo apt-get install fail2ban&lt;br /&gt;
&lt;br /&gt;
After is installed, you need to change /etc/asterisk/logger.conf and add the following line under [general] section (You may have to create this before the [logfiles] section). &lt;br /&gt;
&lt;br /&gt;
 [general]&lt;br /&gt;
 dateformat=%F %T&lt;br /&gt;
&lt;br /&gt;
In /etc/asterisk/logger.conf add the following line under the [logfiles] section for asterisk to log NOTICE level events to the syslog (/var/log/messages) as well as its normal log file. These entries in syslog will have a Date/Time stamp that is usable by fail2ban.&lt;br /&gt;
&lt;br /&gt;
 syslog.local0 =&amp;gt; notice &lt;br /&gt;
&lt;br /&gt;
Reload asterisk with:&lt;br /&gt;
&lt;br /&gt;
 asterisk -rx &amp;quot;logger reload&amp;quot; &lt;br /&gt;
&lt;br /&gt;
Configuring fail2ban:&lt;br /&gt;
&lt;br /&gt;
 cd /etc/fail2ban/filter.d&lt;br /&gt;
&lt;br /&gt;
 touch asterisk.conf &lt;br /&gt;
&lt;br /&gt;
 vi asterisk.conf&lt;br /&gt;
&lt;br /&gt;
insert the following (copy &amp;amp; paste)&lt;br /&gt;
&lt;br /&gt;
 # Fail2Ban configuration file&lt;br /&gt;
 #&lt;br /&gt;
 #&lt;br /&gt;
 # $Revision: 250 $&lt;br /&gt;
 #&lt;br /&gt;
 [INCLUDES]&lt;br /&gt;
 # Read common prefixes. If any customizations available -- read them from&lt;br /&gt;
 # common.local&lt;br /&gt;
 #before = common.conf&lt;br /&gt;
 [Definition]&lt;br /&gt;
 #_daemon = asterisk&lt;br /&gt;
 # Option:  failregex&lt;br /&gt;
 # Notes.:  regex to match the password failures messages in the logfile. The&lt;br /&gt;
 #          host must be matched by a group named &amp;quot;host&amp;quot;. The tag &amp;quot;&amp;lt;HOST&amp;gt;&amp;quot; can&lt;br /&gt;
 #          be used for standard IP/hostname matching and is only an alias for&lt;br /&gt;
 #          (?:::f{4,6}:)?(?P&amp;lt;host&amp;gt;\S+)&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 failregex = NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Wrong password&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - No matching peer found&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Username/auth name mismatch&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Device does not match ACL&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&amp;quot; .* failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Peer is not supposed to register&lt;br /&gt;
             NOTICE.* &amp;lt;HOST&amp;gt; failed to authenticate as &#039;.*&#039;$&lt;br /&gt;
             NOTICE.* .*: No registration for peer &#039;.*&#039; \(from &amp;lt;HOST&amp;gt;\)&lt;br /&gt;
             NOTICE.* .*: Host &amp;lt;HOST&amp;gt; failed MD5 authentication for &#039;.*&#039; (.*)&lt;br /&gt;
             NOTICE.* .*: Failed to authenticate user .*@&amp;lt;HOST&amp;gt;.*&lt;br /&gt;
 # Option:  ignoreregex&lt;br /&gt;
 # Notes.:  regex to ignore. If this regex matches, the line is ignored.&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 ignoreregex =&lt;br /&gt;
&lt;br /&gt;
Next edit /etc/fail2ban/jail.conf to include the following section so that it uses the new filter. &lt;br /&gt;
&lt;br /&gt;
 [asterisk-iptables]&lt;br /&gt;
 enabled  = true&lt;br /&gt;
 filter   = asterisk&lt;br /&gt;
 action   = iptables-allports[name=ASTERISK, protocol=all]&lt;br /&gt;
            sendmail-whois[name=ASTERISK, dest=root, sender=fail2ban@example.org]&lt;br /&gt;
 logpath  = /var/log/asterisk/full&lt;br /&gt;
 maxretry = 2&lt;br /&gt;
 bantime = 259200&lt;br /&gt;
&lt;br /&gt;
Locate the line ignoreip in /etc/fail2ban/jail.conf (beginning of the file) and insert the ip&#039;s and / or blocks you want fail2ban to ignore, so you don&#039;t risk banning yourserf or any host in your network.&lt;br /&gt;
&lt;br /&gt;
Mine is defined as follows:&lt;br /&gt;
&lt;br /&gt;
 [DEFAULT]&lt;br /&gt;
 # &amp;quot;ignoreip&amp;quot; can be an IP address, a CIDR mask or a DNS host. Fail2ban will not&lt;br /&gt;
 # ban a host which matches an address in this list. Several addresses can be   &lt;br /&gt;
 # defined using space separator.                                               &lt;br /&gt;
 ignoreip = 127.0.0.1 192.168.80.1 192.168.80.0/24 &lt;br /&gt;
&lt;br /&gt;
To start fail2ban type the following as root:&lt;br /&gt;
&lt;br /&gt;
 /etc/init.d/fail2ban start&lt;br /&gt;
&lt;br /&gt;
Check It&lt;br /&gt;
&lt;br /&gt;
For LinuxMCE, there is needed &amp;quot;patch&amp;quot;, while fail2ban is not part of the distribution.&lt;br /&gt;
&lt;br /&gt;
When LinuxMCE starts, it runs /usr/pluto/bin/Network_Firewall.sh, and this is done AFTER /etc/init.d/fail2ban is started.&lt;br /&gt;
&lt;br /&gt;
So, edit /usr/pluto/bin/Network_Firewall.sh and add the following at the END of this file:&lt;br /&gt;
 &lt;br /&gt;
 /etc/init.d/fail2ban restart&lt;br /&gt;
&lt;br /&gt;
This will make sure that fail2bain is started AFTER the iptables rules from LinuxMCE.&lt;br /&gt;
&lt;br /&gt;
If started properly issue the following command to view your iptables rules:&lt;br /&gt;
&lt;br /&gt;
 iptables -L -v&lt;br /&gt;
&lt;br /&gt;
You should see something like the following for the INPUT chain (this is the ouput of mine)&lt;br /&gt;
&lt;br /&gt;
 Chain INPUT (policy DROP 2241 packets, 160K bytes)              &lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination         &lt;br /&gt;
   372 27264 &#039;&#039;&#039;fail2ban-SSH&#039;&#039;&#039;  tcp  --  any    any     anywhere             anywhere            tcp dpt:ssh                                                                                          &lt;br /&gt;
 1312K  991M &#039;&#039;&#039;fail2ban-ASTERISK&#039;&#039;&#039;  all  --  any    any     anywhere             anywhere            &lt;br /&gt;
  553K   81M ACCEPT     all  --  lo     any     anywhere             anywhere                    &lt;br /&gt;
 1288K 1162M ACCEPT     all  --  any    any     anywhere             anywhere            state RELATED,ESTABLISHED                                                                               &lt;br /&gt;
     9   540 ACCEPT     all  --  any    any     anywhere             anywhere            MARK match 0x1                                                                                          &lt;br /&gt;
     2  1152 ACCEPT     udp  --  any    any     anywhere             anywhere            udp   dpt:bootps                                                                                          &lt;br /&gt;
 19276 5790K ACCEPT     all  --  any    any     192.168.80.0/24      anywhere                    &lt;br /&gt;
     0     0 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:iax                                                                                             &lt;br /&gt;
     4  1795 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:sip                                                                                             &lt;br /&gt;
     0     0 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:2000                                                                                            &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:sieve                                                                                           &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:1723                                                                                            &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:www                                                                                             &lt;br /&gt;
     1    60 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:ssh                                                                                             &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:https                                                                                           &lt;br /&gt;
     1    50 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpts:10001:20000&lt;br /&gt;
     0     0 ACCEPT     gre  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain FORWARD (policy ACCEPT 719K packets, 245M bytes)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
     0     0 TCPMSS     tcp  --  any    ppp+    anywhere             anywhere            tcp flags:SYN,RST/SYN TCPMSS clamp to PMTU&lt;br /&gt;
 Chain OUTPUT (policy ACCEPT 2099K packets, 590M bytes)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
     0     0 ACCEPT     gre  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain &#039;&#039;&#039;fail2ban-ASTERISK&#039;&#039;&#039; (1 references)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
  5091 2125K DROP       all  --  any    any     173.193.194.106-static.reverse.softlayer.com  anywhere&lt;br /&gt;
 1307K  989M RETURN     all  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain &#039;&#039;&#039;fail2ban-SSH&#039;&#039;&#039; (1 references)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
&lt;br /&gt;
If you do not see something similar to that then you have some troubleshooting to, check out /var/log/fail2ban.log.&lt;br /&gt;
&lt;br /&gt;
Example of my /var/log/fai2ban.log (173.193.194.106 is the real address from the attacker fail2ban banned):&lt;br /&gt;
&lt;br /&gt;
 ....&lt;br /&gt;
 2010-09-19 11:12:56,131 fail2ban.filter : INFO   Set maxRetry = 6&lt;br /&gt;
 2010-09-19 11:12:56,133 fail2ban.filter : INFO   Set findtime = 600&lt;br /&gt;
 2010-09-19 11:12:56,133 fail2ban.actions: INFO   Set banTime = 600&lt;br /&gt;
 2010-09-19 11:12:56,138 fail2ban.jail   : INFO   Jail &#039;ssh-iptables&#039; started&lt;br /&gt;
 2010-09-19 11:12:56,139 fail2ban.jail   : INFO   Jail &#039;asterisk-iptables&#039; started&lt;br /&gt;
 2010-09-19 11:12:56,141 fail2ban.jail   : INFO   Jail &#039;apache-tcpwrapper&#039; started&lt;br /&gt;
 2010-09-19 15:33:50,392 fail2ban.actions: WARNING [asterisk-iptables] Ban 173.193.194.106&lt;br /&gt;
 2010-09-19 15:34:50,982 fail2ban.actions: WARNING [asterisk-iptables] 173.193.194.106 already banned&lt;br /&gt;
&lt;br /&gt;
And this is the log (/var/log/asterisk/messages) showing the attack:&lt;br /&gt;
&lt;br /&gt;
 [2010-09-19 15:33:48] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;3235410554&amp;quot;&amp;lt;sip:3235410554@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                           &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;thomas&amp;quot;&amp;lt;sip:thomas@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;arsenal&amp;quot;&amp;lt;sip:arsenal@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;letmein&amp;quot;&amp;lt;sip:letmein@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;liverpool&amp;quot;&amp;lt;sip:liverpool@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;nevermind&amp;quot;&amp;lt;sip:nevermind@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;getmein&amp;quot;&amp;lt;sip:getmein@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;echo&amp;quot;&amp;lt;sip:echo@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;bmw325&amp;quot;&amp;lt;sip:bmw325@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;bmw335&amp;quot;&amp;lt;sip:bmw335@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w3e&amp;quot;&amp;lt;sip:1q2w3e@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w3e4r5t6y&amp;quot;&amp;lt;sip:1q2w3e4r5t6y@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q1q2w2w&amp;quot;&amp;lt;sip:1q1q2w2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w1q2w&amp;quot;&amp;lt;sip:1q2w1q2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w&amp;quot;&amp;lt;sip:1q2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;11q22w&amp;quot;&amp;lt;sip:11q22w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;q1w2&amp;quot;&amp;lt;sip:q1w2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;q1w2e3&amp;quot;&amp;lt;sip:q1w2e3@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;tvv03tvv03&amp;quot;&amp;lt;sip:tvv03tvv03@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                           &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd1&amp;quot;&amp;lt;sip:abcd1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd12&amp;quot;&amp;lt;sip:abcd12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd123&amp;quot;&amp;lt;sip:abcd123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;qq11ww22ee33rr44&amp;quot;&amp;lt;sip:qq11ww22ee33rr44@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1&amp;quot;&amp;lt;sip:sip1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip2&amp;quot;&amp;lt;sip:sip2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip12&amp;quot;&amp;lt;sip:sip12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip123&amp;quot;&amp;lt;sip:sip123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1234&amp;quot;&amp;lt;sip:sip1234@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip12345&amp;quot;&amp;lt;sip:sip12345@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1111&amp;quot;&amp;lt;sip:sip1111@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip222&amp;quot;&amp;lt;sip:sip222@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1qa2ws3ed&amp;quot;&amp;lt;sip:1qa2ws3ed@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1234asdf&amp;quot;&amp;lt;sip:1234asdf@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1a2s3d&amp;quot;&amp;lt;sip:1a2s3d@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1a2s3d4f&amp;quot;&amp;lt;sip:1a2s3d4f@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;asdzxc&amp;quot;&amp;lt;sip:asdzxc@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;123zxc&amp;quot;&amp;lt;sip:123zxc@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1234zxcv&amp;quot;&amp;lt;sip:1234zxcv@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;aazzssxx&amp;quot;&amp;lt;sip:aazzssxx@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;p@ssword&amp;quot;&amp;lt;sip:p@ssword@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;p@ssw0rd&amp;quot;&amp;lt;sip:p@ssw0rd@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;pass1&amp;quot;&amp;lt;sip:pass1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;password3&amp;quot;&amp;lt;sip:password3@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;pass12&amp;quot;&amp;lt;sip:pass12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account&amp;quot;&amp;lt;sip:account@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;passlogin&amp;quot;&amp;lt;sip:passlogin@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account1&amp;quot;&amp;lt;sip:account1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account5&amp;quot;&amp;lt;sip:account5@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account6&amp;quot;&amp;lt;sip:account6@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account123&amp;quot;&amp;lt;sip:account123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account12&amp;quot;&amp;lt;sip:account12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc1&amp;quot;&amp;lt;sip:acc1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc2&amp;quot;&amp;lt;sip:acc2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc12&amp;quot;&amp;lt;sip:acc12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
&lt;br /&gt;
One last tip: you need a MTA, like sendmail or postfix, in order to receive the notifications from fail2ban.&lt;br /&gt;
&lt;br /&gt;
If you have a MTA installed and properly configured, nothing else is needed, but if not, install sendmail&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install sendmail&lt;br /&gt;
&lt;br /&gt;
Then edit the /etc/hosts file and change the line &#039;&#039;&#039;192.168.80.1 dcerouter&#039;&#039;&#039; to read &#039;&#039;&#039;192.168.80.1 dcerouter.localdomain dcerouter&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Doing it, sendmail will start as expected (fast) and mail will properly delivered. If this change is not done, sendmail will take a long time to start, because it does not find the qualified host name, as the log shows:&lt;br /&gt;
&lt;br /&gt;
 Sep 27 13:12:11 dcerouter sendmail[10585]: My unqualified host name (dcerouter) unknown; sleeping for retry&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I hope this helps.&lt;br /&gt;
&lt;br /&gt;
source: &lt;br /&gt;
 http://www.fail2ban.org&lt;br /&gt;
 http://www.voip-info.org/wiki/view/Fail2Ban+(with+iptables)+And+Asterisk&lt;br /&gt;
 http://www.fail2ban.org/wiki/index.php/Asterisk&lt;br /&gt;
&lt;br /&gt;
More protection with iptables:&lt;br /&gt;
 http://sysadminman.net/blog/2010/limiting-sipiax-connections-to-asterisk-with-iptables-1082&lt;/div&gt;</summary>
		<author><name>Pw44</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=Fail2ban_-_A_tool_against_brute_force&amp;diff=25782</id>
		<title>Fail2ban - A tool against brute force</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=Fail2ban_-_A_tool_against_brute_force&amp;diff=25782"/>
		<updated>2010-10-06T19:03:14Z</updated>

		<summary type="html">&lt;p&gt;Pw44: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: Tutorials]]&lt;br /&gt;
[[Category: Networking]]&lt;br /&gt;
{{versioninfo|810Status=??|810UpdatedDate=5 October 2010|810UpdatedBy=pw44}}&lt;br /&gt;
&lt;br /&gt;
Having asterik installed is almost an invitation for others wishing to place calls at your expense.&lt;br /&gt;
&lt;br /&gt;
After configuring my sip trunk, it did not take 2 days and some &amp;quot;smart guy&amp;quot;  was trying to register to take advantage of it, and causing me losses.&lt;br /&gt;
&lt;br /&gt;
Fail2ban prevented it, blocking the attacker with iptables rules.&lt;br /&gt;
&lt;br /&gt;
Installing fail2ban is not complicated and i will describe the steps to have it properly installed and configured, so you can protect your asterisk and other services from brute force attack.&lt;br /&gt;
&lt;br /&gt;
Install with: &lt;br /&gt;
 sudo apt-get install fail2ban&lt;br /&gt;
&lt;br /&gt;
After is installed, you need to change /etc/asterisk/logger.conf and add the following line under [general] section (You may have to create this before the [logfiles] section). &lt;br /&gt;
&lt;br /&gt;
 [general]&lt;br /&gt;
 dateformat=%F %T&lt;br /&gt;
&lt;br /&gt;
In /etc/asterisk/logger.conf add the following line under the [logfiles] section for asterisk to log NOTICE level events to the syslog (/var/log/messages) as well as its normal log file. These entries in syslog will have a Date/Time stamp that is usable by fail2ban.&lt;br /&gt;
&lt;br /&gt;
 syslog.local0 =&amp;gt; notice &lt;br /&gt;
&lt;br /&gt;
Reload asterisk with:&lt;br /&gt;
&lt;br /&gt;
 asterisk -rx &amp;quot;logger reload&amp;quot; &lt;br /&gt;
&lt;br /&gt;
Configuring fail2ban:&lt;br /&gt;
&lt;br /&gt;
 cd /etc/fail2ban/filter.d&lt;br /&gt;
&lt;br /&gt;
 touch asterisk.conf &lt;br /&gt;
&lt;br /&gt;
 vi asterisk.conf&lt;br /&gt;
&lt;br /&gt;
insert the following (copy &amp;amp; paste)&lt;br /&gt;
&lt;br /&gt;
 # Fail2Ban configuration file&lt;br /&gt;
 #&lt;br /&gt;
 #&lt;br /&gt;
 # $Revision: 250 $&lt;br /&gt;
 #&lt;br /&gt;
 [INCLUDES]&lt;br /&gt;
 # Read common prefixes. If any customizations available -- read them from&lt;br /&gt;
 # common.local&lt;br /&gt;
 #before = common.conf&lt;br /&gt;
 [Definition]&lt;br /&gt;
 #_daemon = asterisk&lt;br /&gt;
 # Option:  failregex&lt;br /&gt;
 # Notes.:  regex to match the password failures messages in the logfile. The&lt;br /&gt;
 #          host must be matched by a group named &amp;quot;host&amp;quot;. The tag &amp;quot;&amp;lt;HOST&amp;gt;&amp;quot; can&lt;br /&gt;
 #          be used for standard IP/hostname matching and is only an alias for&lt;br /&gt;
 #          (?:::f{4,6}:)?(?P&amp;lt;host&amp;gt;\S+)&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 failregex = NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Wrong password&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - No matching peer found&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Username/auth name mismatch&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Device does not match ACL&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&amp;quot; .* failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Peer is not supposed to register&lt;br /&gt;
             NOTICE.* &amp;lt;HOST&amp;gt; failed to authenticate as &#039;.*&#039;$&lt;br /&gt;
             NOTICE.* .*: No registration for peer &#039;.*&#039; \(from &amp;lt;HOST&amp;gt;\)&lt;br /&gt;
             NOTICE.* .*: Host &amp;lt;HOST&amp;gt; failed MD5 authentication for &#039;.*&#039; (.*)&lt;br /&gt;
             NOTICE.* .*: Failed to authenticate user .*@&amp;lt;HOST&amp;gt;.*&lt;br /&gt;
 # Option:  ignoreregex&lt;br /&gt;
 # Notes.:  regex to ignore. If this regex matches, the line is ignored.&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 ignoreregex =&lt;br /&gt;
&lt;br /&gt;
Next edit /etc/fail2ban/jail.conf to include the following section so that it uses the new filter. &lt;br /&gt;
&lt;br /&gt;
 [asterisk-iptables]&lt;br /&gt;
 enabled  = true&lt;br /&gt;
 filter   = asterisk&lt;br /&gt;
 action   = iptables-allports[name=ASTERISK, protocol=all]&lt;br /&gt;
            sendmail-whois[name=ASTERISK, dest=root, sender=fail2ban@example.org]&lt;br /&gt;
 logpath  = /var/log/asterisk/full&lt;br /&gt;
 maxretry = 2&lt;br /&gt;
 bantime = 259200&lt;br /&gt;
&lt;br /&gt;
Locate the line ignoreip in /etc/fail2ban/jail.conf (beginning of the file) and insert the ip&#039;s and / or blocks you want fail2ban to ignore, so you don&#039;t risk banning yourserf or any host in your network.&lt;br /&gt;
&lt;br /&gt;
Mine is defined as follows:&lt;br /&gt;
&lt;br /&gt;
 [DEFAULT]&lt;br /&gt;
 # &amp;quot;ignoreip&amp;quot; can be an IP address, a CIDR mask or a DNS host. Fail2ban will not&lt;br /&gt;
 # ban a host which matches an address in this list. Several addresses can be   &lt;br /&gt;
 # defined using space separator.                                               &lt;br /&gt;
 ignoreip = 127.0.0.1 192.168.80.1 192.168.80.0/24 &lt;br /&gt;
&lt;br /&gt;
To start fail2ban type the following as root:&lt;br /&gt;
&lt;br /&gt;
 /etc/init.d/fail2ban start&lt;br /&gt;
&lt;br /&gt;
Check It&lt;br /&gt;
&lt;br /&gt;
For LinuxMCE, there is needed &amp;quot;patch&amp;quot;, while fail2ban is not part of the distribution.&lt;br /&gt;
&lt;br /&gt;
When LinuxMCE starts, it runs /usr/pluto/bin/Network_Firewall.sh, and this is done AFTER /etc/init.d/fail2ban is started.&lt;br /&gt;
&lt;br /&gt;
So, edit /usr/pluto/bin/Network_Firewall.sh and add the following at the END of this file:&lt;br /&gt;
 &lt;br /&gt;
 /etc/init.d/fail2ban restart&lt;br /&gt;
&lt;br /&gt;
This will make sure that fail2bain is started AFTER the iptables rules from LinuxMCE.&lt;br /&gt;
&lt;br /&gt;
If started properly issue the following command to view your iptables rules:&lt;br /&gt;
&lt;br /&gt;
 iptables -L -v&lt;br /&gt;
&lt;br /&gt;
You should see something like the following for the INPUT chain (this is the ouput of mine)&lt;br /&gt;
&lt;br /&gt;
 Chain INPUT (policy DROP 2241 packets, 160K bytes)              &lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination         &lt;br /&gt;
   372 27264 &#039;&#039;&#039;fail2ban-SSH&#039;&#039;&#039;  tcp  --  any    any     anywhere             anywhere            tcp dpt:ssh                                                                                          &lt;br /&gt;
 1312K  991M &#039;&#039;&#039;fail2ban-ASTERISK&#039;&#039;&#039;  all  --  any    any     anywhere             anywhere            &lt;br /&gt;
  553K   81M ACCEPT     all  --  lo     any     anywhere             anywhere                    &lt;br /&gt;
 1288K 1162M ACCEPT     all  --  any    any     anywhere             anywhere            state RELATED,ESTABLISHED                                                                               &lt;br /&gt;
     9   540 ACCEPT     all  --  any    any     anywhere             anywhere            MARK match 0x1                                                                                          &lt;br /&gt;
     2  1152 ACCEPT     udp  --  any    any     anywhere             anywhere            udp   dpt:bootps                                                                                          &lt;br /&gt;
 19276 5790K ACCEPT     all  --  any    any     192.168.80.0/24      anywhere                    &lt;br /&gt;
     0     0 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:iax                                                                                             &lt;br /&gt;
     4  1795 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:sip                                                                                             &lt;br /&gt;
     0     0 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:2000                                                                                            &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:sieve                                                                                           &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:1723                                                                                            &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:www                                                                                             &lt;br /&gt;
     1    60 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:ssh                                                                                             &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:https                                                                                           &lt;br /&gt;
     1    50 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpts:10001:20000&lt;br /&gt;
     0     0 ACCEPT     gre  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain FORWARD (policy ACCEPT 719K packets, 245M bytes)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
     0     0 TCPMSS     tcp  --  any    ppp+    anywhere             anywhere            tcp flags:SYN,RST/SYN TCPMSS clamp to PMTU&lt;br /&gt;
 Chain OUTPUT (policy ACCEPT 2099K packets, 590M bytes)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
     0     0 ACCEPT     gre  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain fail2ban-ASTERISK (1 references)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
  5091 2125K DROP       all  --  any    any     173.193.194.106-static.reverse.softlayer.com  anywhere&lt;br /&gt;
 1307K  989M RETURN     all  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain fail2ban-SSH (1 references)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
&lt;br /&gt;
If you do not see something similar to that then you have some troubleshooting to, check out /var/log/fail2ban.log.&lt;br /&gt;
&lt;br /&gt;
Example of my /var/log/fai2ban.log (173.193.194.106 is the real address from the attacker fail2ban banned):&lt;br /&gt;
&lt;br /&gt;
 ....&lt;br /&gt;
 2010-09-19 11:12:56,131 fail2ban.filter : INFO   Set maxRetry = 6&lt;br /&gt;
 2010-09-19 11:12:56,133 fail2ban.filter : INFO   Set findtime = 600&lt;br /&gt;
 2010-09-19 11:12:56,133 fail2ban.actions: INFO   Set banTime = 600&lt;br /&gt;
 2010-09-19 11:12:56,138 fail2ban.jail   : INFO   Jail &#039;ssh-iptables&#039; started&lt;br /&gt;
 2010-09-19 11:12:56,139 fail2ban.jail   : INFO   Jail &#039;asterisk-iptables&#039; started&lt;br /&gt;
 2010-09-19 11:12:56,141 fail2ban.jail   : INFO   Jail &#039;apache-tcpwrapper&#039; started&lt;br /&gt;
 2010-09-19 15:33:50,392 fail2ban.actions: WARNING [asterisk-iptables] Ban 173.193.194.106&lt;br /&gt;
 2010-09-19 15:34:50,982 fail2ban.actions: WARNING [asterisk-iptables] 173.193.194.106 already banned&lt;br /&gt;
&lt;br /&gt;
And this is the log (/var/log/asterisk/messages) showing the attack:&lt;br /&gt;
&lt;br /&gt;
 [2010-09-19 15:33:48] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;3235410554&amp;quot;&amp;lt;sip:3235410554@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                           &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;thomas&amp;quot;&amp;lt;sip:thomas@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;arsenal&amp;quot;&amp;lt;sip:arsenal@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;letmein&amp;quot;&amp;lt;sip:letmein@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;liverpool&amp;quot;&amp;lt;sip:liverpool@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;nevermind&amp;quot;&amp;lt;sip:nevermind@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;getmein&amp;quot;&amp;lt;sip:getmein@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;echo&amp;quot;&amp;lt;sip:echo@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;bmw325&amp;quot;&amp;lt;sip:bmw325@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;bmw335&amp;quot;&amp;lt;sip:bmw335@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w3e&amp;quot;&amp;lt;sip:1q2w3e@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w3e4r5t6y&amp;quot;&amp;lt;sip:1q2w3e4r5t6y@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q1q2w2w&amp;quot;&amp;lt;sip:1q1q2w2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w1q2w&amp;quot;&amp;lt;sip:1q2w1q2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w&amp;quot;&amp;lt;sip:1q2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;11q22w&amp;quot;&amp;lt;sip:11q22w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;q1w2&amp;quot;&amp;lt;sip:q1w2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;q1w2e3&amp;quot;&amp;lt;sip:q1w2e3@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;tvv03tvv03&amp;quot;&amp;lt;sip:tvv03tvv03@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                           &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd1&amp;quot;&amp;lt;sip:abcd1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd12&amp;quot;&amp;lt;sip:abcd12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd123&amp;quot;&amp;lt;sip:abcd123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;qq11ww22ee33rr44&amp;quot;&amp;lt;sip:qq11ww22ee33rr44@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1&amp;quot;&amp;lt;sip:sip1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip2&amp;quot;&amp;lt;sip:sip2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip12&amp;quot;&amp;lt;sip:sip12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip123&amp;quot;&amp;lt;sip:sip123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1234&amp;quot;&amp;lt;sip:sip1234@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip12345&amp;quot;&amp;lt;sip:sip12345@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1111&amp;quot;&amp;lt;sip:sip1111@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip222&amp;quot;&amp;lt;sip:sip222@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1qa2ws3ed&amp;quot;&amp;lt;sip:1qa2ws3ed@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1234asdf&amp;quot;&amp;lt;sip:1234asdf@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1a2s3d&amp;quot;&amp;lt;sip:1a2s3d@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1a2s3d4f&amp;quot;&amp;lt;sip:1a2s3d4f@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;asdzxc&amp;quot;&amp;lt;sip:asdzxc@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;123zxc&amp;quot;&amp;lt;sip:123zxc@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1234zxcv&amp;quot;&amp;lt;sip:1234zxcv@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;aazzssxx&amp;quot;&amp;lt;sip:aazzssxx@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;p@ssword&amp;quot;&amp;lt;sip:p@ssword@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;p@ssw0rd&amp;quot;&amp;lt;sip:p@ssw0rd@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;pass1&amp;quot;&amp;lt;sip:pass1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;password3&amp;quot;&amp;lt;sip:password3@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;pass12&amp;quot;&amp;lt;sip:pass12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account&amp;quot;&amp;lt;sip:account@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;passlogin&amp;quot;&amp;lt;sip:passlogin@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account1&amp;quot;&amp;lt;sip:account1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account5&amp;quot;&amp;lt;sip:account5@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account6&amp;quot;&amp;lt;sip:account6@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account123&amp;quot;&amp;lt;sip:account123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account12&amp;quot;&amp;lt;sip:account12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc1&amp;quot;&amp;lt;sip:acc1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc2&amp;quot;&amp;lt;sip:acc2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc12&amp;quot;&amp;lt;sip:acc12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
&lt;br /&gt;
One last tip: you need a MTA, like sendmail or postfix, in order to receive the notifications from fail2ban.&lt;br /&gt;
&lt;br /&gt;
If you have a MTA installed and properly configured, nothing else is needed, but if not, install sendmail&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install sendmail&lt;br /&gt;
&lt;br /&gt;
Then edit the /etc/hosts file and change the line &#039;&#039;&#039;192.168.80.1 dcerouter&#039;&#039;&#039; to read &#039;&#039;&#039;192.168.80.1 dcerouter.localdomain dcerouter&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Doing it, sendmail will start as expected (fast) and mail will properly delivered. If this change is not done, sendmail will take a long time to start, because it does not find the qualified host name, as the log shows:&lt;br /&gt;
&lt;br /&gt;
 Sep 27 13:12:11 dcerouter sendmail[10585]: My unqualified host name (dcerouter) unknown; sleeping for retry&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I hope this helps.&lt;br /&gt;
&lt;br /&gt;
source: &lt;br /&gt;
 http://www.fail2ban.org&lt;br /&gt;
 http://www.voip-info.org/wiki/view/Fail2Ban+(with+iptables)+And+Asterisk&lt;br /&gt;
 http://www.fail2ban.org/wiki/index.php/Asterisk&lt;br /&gt;
&lt;br /&gt;
More protection with iptables:&lt;br /&gt;
 http://sysadminman.net/blog/2010/limiting-sipiax-connections-to-asterisk-with-iptables-1082&lt;/div&gt;</summary>
		<author><name>Pw44</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=User:Pw44&amp;diff=25761</id>
		<title>User:Pw44</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=User:Pw44&amp;diff=25761"/>
		<updated>2010-10-06T12:58:55Z</updated>

		<summary type="html">&lt;p&gt;Pw44: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:User Setups]]&lt;br /&gt;
&lt;br /&gt;
Initial Hardware Setup:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Asus M3N78-VM with AMD 955&amp;lt;br&amp;gt;&lt;br /&gt;
SPDIF expansion card (Asus SPDIF OUT/COA+OPT)&amp;lt;br&amp;gt;&lt;br /&gt;
2 GB DDR3 800 Mhz&amp;lt;br&amp;gt;&lt;br /&gt;
3 500 GB HD in a RAID 5 conf (mdadm)&amp;lt;br&amp;gt;&lt;br /&gt;
1 320 GB HD boot (1 partition for LMCE, 1 partition for Kubuntu 8.10, both having access to the RAID 5 /dev/md0)&amp;lt;br&amp;gt;&lt;br /&gt;
Gyration Keyboard and air mouse&amp;lt;br&amp;gt;&lt;br /&gt;
USB-UIRT with a Xantech 284D&amp;lt;br&amp;gt;&lt;br /&gt;
Intel Pro 1000 NIC card (internal network)&amp;lt;br&amp;gt;&lt;br /&gt;
Bluetooth dongle - Motorola&amp;lt;br&amp;gt;&lt;br /&gt;
Hauppauge PVR-150 MCE Edition&amp;lt;br&amp;gt;&lt;br /&gt;
Wiimote remote&amp;lt;br&amp;gt;&lt;br /&gt;
Philips 37&amp;quot; LCD HDTV ready (720p) TV&amp;lt;br&amp;gt;&lt;br /&gt;
Yamaha DSP-A1 amplifier&amp;lt;br&amp;gt;&lt;br /&gt;
Linksys SPA-3102&amp;lt;br&amp;gt;&lt;br /&gt;
Linksys PAP2T-NA (x2)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Software&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Prior: LMCE Beta 1 issues:&amp;lt;br&amp;gt;&lt;br /&gt;
- TV overscan (solved)&amp;lt;br&amp;gt;&lt;br /&gt;
- Subtitles (not solved)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now: Beta 2 - time to start all over again - learned with Beta 1.                     &lt;br /&gt;
&lt;br /&gt;
Installation:&lt;br /&gt;
&lt;br /&gt;
Kubuntu 8.10&amp;lt;br&amp;gt;&lt;br /&gt;
-&amp;gt; apt-get update.&amp;lt;br&amp;gt;&lt;br /&gt;
-&amp;gt; apt-get upgrade.&amp;lt;br&amp;gt;&lt;br /&gt;
-&amp;gt; apt-get dist-upgrade.&amp;lt;br&amp;gt;&lt;br /&gt;
All done with the VGA monitor.&amp;lt;br&amp;gt;&lt;br /&gt;
LCD TV is also connected to the mobo&#039;s HDMI video output.&amp;lt;br&amp;gt;&lt;br /&gt;
Running nvidia-settings, LCD TV identified.&amp;lt;br&amp;gt;&lt;br /&gt;
After all is done (installations and reboots), KDE shows up, i disconnect the vga cable, hit CTRL-ALT-Backspace and the video output is redirected to HDMI.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
First problem: video overscan.&amp;lt;br&amp;gt;&lt;br /&gt;
-- Solution: nvidia-settings shows an overscan ruler. Save conf to ~/.nvidia-settings-rc&amp;lt;br&amp;gt;&lt;br /&gt;
HDMI Sound works (KDE welcome sound) - it plays on TV speakers.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Second problem: network interfaces are switched - the mobo interface shows as eth1 and the Gb Intel interface shows eth0.&amp;lt;br&amp;gt;&lt;br /&gt;
-- Solution: edit file /etc/udev/rules.d/70-persistent-net.rules and change eth1 to eth0 on first entry (mobo interface) and change eth0 to eth1 (Gb Intel interface) - after reboot, it works like it should.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
LMCE Beta 2&amp;lt;br&amp;gt;&lt;br /&gt;
connect optical cable from the SPDIF Expansion card (the mobo&#039;s SPDIF does not shows up) to the Yamaha optical in.&amp;lt;br&amp;gt;&lt;br /&gt;
install from internet.&amp;lt;br&amp;gt;&lt;br /&gt;
Reboot.&amp;lt;br&amp;gt;&lt;br /&gt;
AVWizard: HDMI / 720p / UI2 / Optical Spdif.&amp;lt;br&amp;gt;&lt;br /&gt;
Initial setup (Sara).&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Second problem: some files does not play sound.&amp;lt;br&amp;gt;&lt;br /&gt;
-- Solution: http://forum.linuxmce.org/index.php?topic=9194.msg62958#msg62958.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Third problem: H264 mkv and mp4 files plays with no sound, even after renaming to m2ts. After renaming to .m2ts, mplayer is used to play them, subtitles shows up fine, but NO sound.&amp;lt;br&amp;gt;&lt;br /&gt;
-- Solution: http://forum.linuxmce.org/index.php?topic=9653.msg66388#msg66388 - see reply #17&amp;lt;br&amp;gt;&lt;br /&gt;
Sound, subtitles and controls works.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
to be continued.&lt;br /&gt;
&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Pw44</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=PPTP_server&amp;diff=25760</id>
		<title>PPTP server</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=PPTP_server&amp;diff=25760"/>
		<updated>2010-10-06T12:47:31Z</updated>

		<summary type="html">&lt;p&gt;Pw44: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Networking]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
{{versioninfo|810Status=??|810UpdatedDate=5 October 2010|810UpdatedBy=pw44}}&lt;br /&gt;
&lt;br /&gt;
Setting up a PPTP Server.&lt;br /&gt;
&lt;br /&gt;
The pptp server is the right tool to use for outside access to your internal network.&lt;br /&gt;
While not the most secure VPN solution, PPTP is the most simple to install, configure and connect from windows, and mobile devices. &lt;br /&gt;
&lt;br /&gt;
Reasons for doing it:&lt;br /&gt;
# Having your mobile as an extension of your asterisk server (Iphone, for example, can do it, Nokia can do it via an add on), even from public wifi spots.&lt;br /&gt;
# Being able to remotely access files or anything in your server from anywhere, even from wifi spots.&lt;br /&gt;
# Others, as you wish.&lt;br /&gt;
&lt;br /&gt;
Lets make it simple:&lt;br /&gt;
&lt;br /&gt;
Server Setup - install the pptp server package:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install pptpd&lt;br /&gt;
&lt;br /&gt;
edit the /etc/pptpd.conf file:&lt;br /&gt;
&lt;br /&gt;
 sudo vi /etc/pptpd.conf&lt;br /&gt;
&lt;br /&gt;
and add:&lt;br /&gt;
&lt;br /&gt;
 localip 192.168.80.245,192.168.0.245&lt;br /&gt;
 remoteip 192.168.80.246-250,192.168.0.246-250&lt;br /&gt;
&lt;br /&gt;
where the localip is the address of the server, and the remoteip are the addresses that will be assigned to clients.&lt;br /&gt;
160&lt;br /&gt;
edit the /etc/ppp/pptpd-options file:&lt;br /&gt;
&lt;br /&gt;
 sudo vi /etc/ppp/pptpd-options&lt;br /&gt;
&lt;br /&gt;
append the following directives:&lt;br /&gt;
&lt;br /&gt;
 ms-dns 192.168.80.1&lt;br /&gt;
 nobsdcomp&lt;br /&gt;
 noipx&lt;br /&gt;
 mtu 1490&lt;br /&gt;
 mru 1490&lt;br /&gt;
&lt;br /&gt;
Mine looks like:&lt;br /&gt;
&lt;br /&gt;
 name dcerouter&lt;br /&gt;
 refuse-pap&lt;br /&gt;
 refuse-chap&lt;br /&gt;
 refuse-mschap&lt;br /&gt;
 require-mschap-v2&lt;br /&gt;
 require-mppe-128&lt;br /&gt;
 ms-dns 192.168.80.1&lt;br /&gt;
 proxyarp&lt;br /&gt;
 nodefaultroute&lt;br /&gt;
 debug&lt;br /&gt;
 lock&lt;br /&gt;
 nobsdcomp&lt;br /&gt;
&lt;br /&gt;
Add the user credentials for authentication to you chap secrets file:&lt;br /&gt;
&lt;br /&gt;
 sudo vi /etc/ppp/chap-secrets&lt;br /&gt;
&lt;br /&gt;
Add to it the user name + password in the following syntax:&lt;br /&gt;
&lt;br /&gt;
 usernmae &amp;lt;TAB&amp;gt; dcerouter &amp;lt;TAB&amp;gt; users-password &amp;lt;TAB&amp;gt; *&lt;br /&gt;
&lt;br /&gt;
Restart the server for the settings to take affect:&lt;br /&gt;
&lt;br /&gt;
 sudo /etc/init.d/pptpd restart&lt;br /&gt;
&lt;br /&gt;
Firewall rules:&lt;br /&gt;
&lt;br /&gt;
Webadmin -&amp;gt; advanced -&amp;gt; Network -&amp;gt; Firewall Rules: core input for port 1723&lt;br /&gt;
&lt;br /&gt;
You need to append the following lines to /usr/pluto/bin/Network_Firewall.sh, in order to permit GRE protocol flow (needed by PPTP):&lt;br /&gt;
&lt;br /&gt;
 iptables --append INPUT  --protocol 47 --jump ACCEPT&lt;br /&gt;
 iptables --append OUTPUT --protocol 47 --jump ACCEPT&lt;br /&gt;
&lt;br /&gt;
If you also have a router running Tomato or DD-WRT, the following iptables rules shall be applied (these are the ones in my Tomato router): My LinuxMCE has the eth0 setted to 192.168.0.160, defined by static address in my Tomato.&lt;br /&gt;
&lt;br /&gt;
 # init pptp + gre pass thru&lt;br /&gt;
 iptables -t nat -I PREROUTING -p tcp --dport 1723 -j DNAT --to 192.168.0.160:1723&lt;br /&gt;
 iptables -I FORWARD -p tcp -d 192.168.0.160 --dport 1723 -j ACCEPT&lt;br /&gt;
 iptables -t nat -I PREROUTING -p 47 -j DNAT --to 192.168.0.160&lt;br /&gt;
 iptables -I FORWARD -p 47 -d 192.168.0.160 -j ACCEPT&lt;br /&gt;
 &lt;br /&gt;
 iptables -t nat -A PREROUTING -i ppp0 -p tcp -d 0/0 --dport 1723 -j DNAT --to-destination 192.168.0.160&lt;br /&gt;
 iptables -t nat -A PREROUTING -i ppp0 -p gre -d 0/0 -j DNAT --to-destination 192.168.0.160&lt;br /&gt;
 &lt;br /&gt;
 iptables -A FORWARD -i ppp0 -o br0 -p tcp --dport 1723 -d 192.168.0.160 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT&lt;br /&gt;
 iptables -A FORWARD -i br0 -o ppp0 -p tcp -s 192.168.0.160 --sport 1723 -m state --state ESTABLISHED,RELATED -j ACCEPT&lt;br /&gt;
 iptables -A FORWARD -i ppp0 -o br0 -p gre -d 192.168.0.160 -m state --state NEW,ESTABLISHED,RELATED-j ACCEPT&lt;br /&gt;
 iptables -A FORWARD -i br0 -o ppp0 -p gre -s 192.168.0.160 -m state --state ESTABLISHED,RELATED -j ACCEPT&lt;br /&gt;
 # end pptp + gre pass thru&lt;br /&gt;
&lt;br /&gt;
Once done, reload DCERouter, in order that the /usr/pluto/bin/Network_Firewall.sh is reloaded,and if you have Tomato or DD-WRT, reboot it.&lt;br /&gt;
&lt;br /&gt;
Configure your client to use PPTP and test (beyond this wiki).&lt;/div&gt;</summary>
		<author><name>Pw44</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=PPTP_server&amp;diff=25759</id>
		<title>PPTP server</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=PPTP_server&amp;diff=25759"/>
		<updated>2010-10-06T12:46:32Z</updated>

		<summary type="html">&lt;p&gt;Pw44: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Networking]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
{{versioninfo|810Status=??|810UpdatedDate=5 October 2010|810UpdatedBy=pw44}}&lt;br /&gt;
&lt;br /&gt;
Setting up a PPTP Server.&lt;br /&gt;
&lt;br /&gt;
The pptp server is the right tool to use for outside access to your internal network.&lt;br /&gt;
While not the most secure VPN solution, PPTP is the most simple to install, configure and connect from windows, and mobile devices. &lt;br /&gt;
&lt;br /&gt;
Reasons for doing it:&lt;br /&gt;
# Having your mobile as an extension of your asterisk server (Iphone, for example, can do it, Nokia can do it via an add on), even from public wifi spots.&lt;br /&gt;
# Being able to remotely access files or anything in your server from anywhere, even from wifi spots.&lt;br /&gt;
# Others, as you wish.&lt;br /&gt;
&lt;br /&gt;
Lets make it simple:&lt;br /&gt;
&lt;br /&gt;
Server Setup - install the pptp server package:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install pptpd&lt;br /&gt;
&lt;br /&gt;
edit the /etc/pptpd.conf file:&lt;br /&gt;
&lt;br /&gt;
 sudo vi /etc/pptpd.conf&lt;br /&gt;
&lt;br /&gt;
and add:&lt;br /&gt;
&lt;br /&gt;
 localip 192.168.80.245,192.168.0.245&lt;br /&gt;
 remoteip 192.168.80.246-250,192.168.0.246-250&lt;br /&gt;
&lt;br /&gt;
where the localip is the address of the server, and the remoteip are the addresses that will be assigned to clients.&lt;br /&gt;
160&lt;br /&gt;
edit the /etc/ppp/pptpd-options file:&lt;br /&gt;
&lt;br /&gt;
 sudo vi /etc/ppp/pptpd-options&lt;br /&gt;
&lt;br /&gt;
append the following directives:&lt;br /&gt;
&lt;br /&gt;
 ms-dns 192.168.80.1&lt;br /&gt;
 nobsdcomp&lt;br /&gt;
 noipx&lt;br /&gt;
 mtu 1490&lt;br /&gt;
 mru 1490&lt;br /&gt;
&lt;br /&gt;
Mine looks like:&lt;br /&gt;
&lt;br /&gt;
 name pptpd&lt;br /&gt;
 refuse-pap&lt;br /&gt;
 refuse-chap&lt;br /&gt;
 refuse-mschap&lt;br /&gt;
 require-mschap-v2&lt;br /&gt;
 require-mppe-128&lt;br /&gt;
 ms-dns 192.168.80.1&lt;br /&gt;
 proxyarp&lt;br /&gt;
 nodefaultroute&lt;br /&gt;
 debug&lt;br /&gt;
 lock&lt;br /&gt;
 nobsdcomp&lt;br /&gt;
&lt;br /&gt;
Add the user credentials for authentication to you chap secrets file:&lt;br /&gt;
&lt;br /&gt;
 sudo vi /etc/ppp/chap-secrets&lt;br /&gt;
&lt;br /&gt;
Add to it the user name + password in the following syntax:&lt;br /&gt;
&lt;br /&gt;
 usernmae &amp;lt;TAB&amp;gt; pptpd &amp;lt;TAB&amp;gt; users-password &amp;lt;TAB&amp;gt; *&lt;br /&gt;
&lt;br /&gt;
Restart the server for the settings to take affect:&lt;br /&gt;
&lt;br /&gt;
 sudo /etc/init.d/pptpd restart&lt;br /&gt;
&lt;br /&gt;
Firewall rules:&lt;br /&gt;
&lt;br /&gt;
Webadmin -&amp;gt; advanced -&amp;gt; Network -&amp;gt; Firewall Rules: core input for port 1723&lt;br /&gt;
&lt;br /&gt;
You need to append the following lines to /usr/pluto/bin/Network_Firewall.sh, in order to permit GRE protocol flow (needed by PPTP):&lt;br /&gt;
&lt;br /&gt;
 iptables --append INPUT  --protocol 47 --jump ACCEPT&lt;br /&gt;
 iptables --append OUTPUT --protocol 47 --jump ACCEPT&lt;br /&gt;
&lt;br /&gt;
If you also have a router running Tomato or DD-WRT, the following iptables rules shall be applied (these are the ones in my Tomato router): My LinuxMCE has the eth0 setted to 192.168.0.160, defined by static address in my Tomato.&lt;br /&gt;
&lt;br /&gt;
 # init pptp + gre pass thru&lt;br /&gt;
 iptables -t nat -I PREROUTING -p tcp --dport 1723 -j DNAT --to 192.168.0.160:1723&lt;br /&gt;
 iptables -I FORWARD -p tcp -d 192.168.0.160 --dport 1723 -j ACCEPT&lt;br /&gt;
 iptables -t nat -I PREROUTING -p 47 -j DNAT --to 192.168.0.160&lt;br /&gt;
 iptables -I FORWARD -p 47 -d 192.168.0.160 -j ACCEPT&lt;br /&gt;
 &lt;br /&gt;
 iptables -t nat -A PREROUTING -i ppp0 -p tcp -d 0/0 --dport 1723 -j DNAT --to-destination 192.168.0.160&lt;br /&gt;
 iptables -t nat -A PREROUTING -i ppp0 -p gre -d 0/0 -j DNAT --to-destination 192.168.0.160&lt;br /&gt;
 &lt;br /&gt;
 iptables -A FORWARD -i ppp0 -o br0 -p tcp --dport 1723 -d 192.168.0.160 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT&lt;br /&gt;
 iptables -A FORWARD -i br0 -o ppp0 -p tcp -s 192.168.0.160 --sport 1723 -m state --state ESTABLISHED,RELATED -j ACCEPT&lt;br /&gt;
 iptables -A FORWARD -i ppp0 -o br0 -p gre -d 192.168.0.160 -m state --state NEW,ESTABLISHED,RELATED-j ACCEPT&lt;br /&gt;
 iptables -A FORWARD -i br0 -o ppp0 -p gre -s 192.168.0.160 -m state --state ESTABLISHED,RELATED -j ACCEPT&lt;br /&gt;
 # end pptp + gre pass thru&lt;br /&gt;
&lt;br /&gt;
Once done, reload DCERouter, in order that the /usr/pluto/bin/Network_Firewall.sh is reloaded,and if you have Tomato or DD-WRT, reboot it.&lt;br /&gt;
&lt;br /&gt;
Configure your client to use PPTP and test (beyond this wiki).&lt;/div&gt;</summary>
		<author><name>Pw44</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=Fail2ban_-_A_tool_against_brute_force&amp;diff=25756</id>
		<title>Fail2ban - A tool against brute force</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=Fail2ban_-_A_tool_against_brute_force&amp;diff=25756"/>
		<updated>2010-10-05T22:29:46Z</updated>

		<summary type="html">&lt;p&gt;Pw44: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: Tutorials]]&lt;br /&gt;
[[Category: Networking]]&lt;br /&gt;
{{versioninfo|810Status=??|810UpdatedDate=5 October 2010|810UpdatedBy=pw44}}&lt;br /&gt;
&lt;br /&gt;
Having asterik installed is almost an invitation for others wishing to place calls at your expense.&lt;br /&gt;
&lt;br /&gt;
After configuring my sip trunk, it did not take 2 days and some &amp;quot;smart guy&amp;quot;  was trying to register to take advantage of it, and causing me losses.&lt;br /&gt;
&lt;br /&gt;
Fail2ban prevented it, blocking the attacker with iptables rules.&lt;br /&gt;
&lt;br /&gt;
Installing fail2ban is not complicated and i will describe the steps to have it properly installed and configured, so you can protect your asterisk and other services from brute force attack.&lt;br /&gt;
&lt;br /&gt;
Install with: &lt;br /&gt;
 sudo apt-get install fail2ban&lt;br /&gt;
&lt;br /&gt;
After is installed, you need to change /etc/asterisk/logger.conf and add the following line under [general] section (You may have to create this before the [logfiles] section). &lt;br /&gt;
&lt;br /&gt;
 [general]&lt;br /&gt;
 dateformat=%F %T&lt;br /&gt;
&lt;br /&gt;
In /etc/asterisk/logger.conf add the following line under the [logfiles] section for asterisk to log NOTICE level events to the syslog (/var/log/messages) as well as its normal log file. These entries in syslog will have a Date/Time stamp that is usable by fail2ban.&lt;br /&gt;
&lt;br /&gt;
 syslog.local0 =&amp;gt; notice &lt;br /&gt;
&lt;br /&gt;
Reload asterisk with:&lt;br /&gt;
&lt;br /&gt;
 asterisk -rx &amp;quot;logger reload&amp;quot; &lt;br /&gt;
&lt;br /&gt;
Configuring fail2ban:&lt;br /&gt;
&lt;br /&gt;
 cd /etc/fail2ban/filter.d&lt;br /&gt;
&lt;br /&gt;
 touch asterisk.conf &lt;br /&gt;
&lt;br /&gt;
 vi asterisk.conf&lt;br /&gt;
&lt;br /&gt;
insert the following (copy &amp;amp; paste)&lt;br /&gt;
&lt;br /&gt;
 # Fail2Ban configuration file&lt;br /&gt;
 #&lt;br /&gt;
 #&lt;br /&gt;
 # $Revision: 250 $&lt;br /&gt;
 #&lt;br /&gt;
 [INCLUDES]&lt;br /&gt;
 # Read common prefixes. If any customizations available -- read them from&lt;br /&gt;
 # common.local&lt;br /&gt;
 #before = common.conf&lt;br /&gt;
 [Definition]&lt;br /&gt;
 #_daemon = asterisk&lt;br /&gt;
 # Option:  failregex&lt;br /&gt;
 # Notes.:  regex to match the password failures messages in the logfile. The&lt;br /&gt;
 #          host must be matched by a group named &amp;quot;host&amp;quot;. The tag &amp;quot;&amp;lt;HOST&amp;gt;&amp;quot; can&lt;br /&gt;
 #          be used for standard IP/hostname matching and is only an alias for&lt;br /&gt;
 #          (?:::f{4,6}:)?(?P&amp;lt;host&amp;gt;\S+)&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 failregex = NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Wrong password&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - No matching peer found&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Username/auth name mismatch&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Device does not match ACL&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&amp;quot; .* failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Peer is not supposed to register&lt;br /&gt;
             NOTICE.* &amp;lt;HOST&amp;gt; failed to authenticate as &#039;.*&#039;$&lt;br /&gt;
             NOTICE.* .*: No registration for peer &#039;.*&#039; \(from &amp;lt;HOST&amp;gt;\)&lt;br /&gt;
             NOTICE.* .*: Host &amp;lt;HOST&amp;gt; failed MD5 authentication for &#039;.*&#039; (.*)&lt;br /&gt;
             NOTICE.* .*: Failed to authenticate user .*@&amp;lt;HOST&amp;gt;.*&lt;br /&gt;
 # Option:  ignoreregex&lt;br /&gt;
 # Notes.:  regex to ignore. If this regex matches, the line is ignored.&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 ignoreregex =&lt;br /&gt;
&lt;br /&gt;
Next edit /etc/fail2ban/jail.conf to include the following section so that it uses the new filter. &lt;br /&gt;
&lt;br /&gt;
 [asterisk-iptables]&lt;br /&gt;
 enabled  = true&lt;br /&gt;
 filter   = asterisk&lt;br /&gt;
 action   = iptables-allports[name=ASTERISK, protocol=all]&lt;br /&gt;
            sendmail-whois[name=ASTERISK, dest=root, sender=fail2ban@example.org]&lt;br /&gt;
 logpath  = /var/log/asterisk/full&lt;br /&gt;
 maxretry = 2&lt;br /&gt;
 bantime = 259200&lt;br /&gt;
&lt;br /&gt;
Locate the line ignoreip in /etc/fail2ban/jail.conf (beginning of the file) and insert the ip&#039;s and / or blocks you want fail2ban to ignore, so you don&#039;t risk banning yourserf or any host in your network.&lt;br /&gt;
&lt;br /&gt;
Mine is defined as follows:&lt;br /&gt;
&lt;br /&gt;
 [DEFAULT]&lt;br /&gt;
 # &amp;quot;ignoreip&amp;quot; can be an IP address, a CIDR mask or a DNS host. Fail2ban will not&lt;br /&gt;
 # ban a host which matches an address in this list. Several addresses can be   &lt;br /&gt;
 # defined using space separator.                                               &lt;br /&gt;
 ignoreip = 127.0.0.1 192.168.80.1 192.168.80.0 192.168.0.0&lt;br /&gt;
&lt;br /&gt;
To start fail2ban type the following as root:&lt;br /&gt;
&lt;br /&gt;
 /etc/init.d/fail2ban start&lt;br /&gt;
&lt;br /&gt;
Check It&lt;br /&gt;
&lt;br /&gt;
For LinuxMCE, there is needed &amp;quot;patch&amp;quot;, while fail2ban is not part of the distribution.&lt;br /&gt;
&lt;br /&gt;
When LinuxMCE starts, it runs /usr/pluto/bin/Network_Firewall.sh, and this is done AFTER /etc/init.d/fail2ban is started.&lt;br /&gt;
&lt;br /&gt;
So, edit /usr/pluto/bin/Network_Firewall.sh and add the following at the END of this file:&lt;br /&gt;
 &lt;br /&gt;
 /etc/init.d/fail2ban restart&lt;br /&gt;
&lt;br /&gt;
This will make sure that fail2bain is started AFTER the iptables rules from LinuxMCE.&lt;br /&gt;
&lt;br /&gt;
If started properly issue the following command to view your iptables rules:&lt;br /&gt;
&lt;br /&gt;
 iptables -L -v&lt;br /&gt;
&lt;br /&gt;
You should see something like the following for the INPUT chain (this is the ouput of mine)&lt;br /&gt;
&lt;br /&gt;
 Chain INPUT (policy DROP 2241 packets, 160K bytes)              &lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination         &lt;br /&gt;
   372 27264 &#039;&#039;&#039;fail2ban-SSH&#039;&#039;&#039;  tcp  --  any    any     anywhere             anywhere            tcp dpt:ssh                                                                                          &lt;br /&gt;
 1312K  991M &#039;&#039;&#039;fail2ban-ASTERISK&#039;&#039;&#039;  all  --  any    any     anywhere             anywhere            &lt;br /&gt;
  553K   81M ACCEPT     all  --  lo     any     anywhere             anywhere                    &lt;br /&gt;
 1288K 1162M ACCEPT     all  --  any    any     anywhere             anywhere            state RELATED,ESTABLISHED                                                                               &lt;br /&gt;
     9   540 ACCEPT     all  --  any    any     anywhere             anywhere            MARK match 0x1                                                                                          &lt;br /&gt;
     2  1152 ACCEPT     udp  --  any    any     anywhere             anywhere            udp   dpt:bootps                                                                                          &lt;br /&gt;
 19276 5790K ACCEPT     all  --  any    any     192.168.80.0/24      anywhere                    &lt;br /&gt;
     0     0 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:iax                                                                                             &lt;br /&gt;
     4  1795 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:sip                                                                                             &lt;br /&gt;
     0     0 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:2000                                                                                            &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:sieve                                                                                           &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:1723                                                                                            &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:www                                                                                             &lt;br /&gt;
     1    60 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:ssh                                                                                             &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:https                                                                                           &lt;br /&gt;
     1    50 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpts:10001:20000&lt;br /&gt;
     0     0 ACCEPT     gre  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain FORWARD (policy ACCEPT 719K packets, 245M bytes)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
     0     0 TCPMSS     tcp  --  any    ppp+    anywhere             anywhere            tcp flags:SYN,RST/SYN TCPMSS clamp to PMTU&lt;br /&gt;
 Chain OUTPUT (policy ACCEPT 2099K packets, 590M bytes)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
     0     0 ACCEPT     gre  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain fail2ban-ASTERISK (1 references)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
  5091 2125K DROP       all  --  any    any     173.193.194.106-static.reverse.softlayer.com  anywhere&lt;br /&gt;
 1307K  989M RETURN     all  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain fail2ban-SSH (1 references)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
&lt;br /&gt;
If you do not see something similar to that then you have some troubleshooting to, check out /var/log/fail2ban.log.&lt;br /&gt;
&lt;br /&gt;
Example of my /var/log/fai2ban.log (173.193.194.106 is the real address from the attacker fail2ban banned):&lt;br /&gt;
&lt;br /&gt;
 ....&lt;br /&gt;
 2010-09-19 11:12:56,131 fail2ban.filter : INFO   Set maxRetry = 6&lt;br /&gt;
 2010-09-19 11:12:56,133 fail2ban.filter : INFO   Set findtime = 600&lt;br /&gt;
 2010-09-19 11:12:56,133 fail2ban.actions: INFO   Set banTime = 600&lt;br /&gt;
 2010-09-19 11:12:56,138 fail2ban.jail   : INFO   Jail &#039;ssh-iptables&#039; started&lt;br /&gt;
 2010-09-19 11:12:56,139 fail2ban.jail   : INFO   Jail &#039;asterisk-iptables&#039; started&lt;br /&gt;
 2010-09-19 11:12:56,141 fail2ban.jail   : INFO   Jail &#039;apache-tcpwrapper&#039; started&lt;br /&gt;
 2010-09-19 15:33:50,392 fail2ban.actions: WARNING [asterisk-iptables] Ban 173.193.194.106&lt;br /&gt;
 2010-09-19 15:34:50,982 fail2ban.actions: WARNING [asterisk-iptables] 173.193.194.106 already banned&lt;br /&gt;
&lt;br /&gt;
And this is the log (/var/log/asterisk/messages) showing the attack:&lt;br /&gt;
&lt;br /&gt;
 [2010-09-19 15:33:48] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;3235410554&amp;quot;&amp;lt;sip:3235410554@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                           &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;thomas&amp;quot;&amp;lt;sip:thomas@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;arsenal&amp;quot;&amp;lt;sip:arsenal@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;letmein&amp;quot;&amp;lt;sip:letmein@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;liverpool&amp;quot;&amp;lt;sip:liverpool@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;nevermind&amp;quot;&amp;lt;sip:nevermind@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;getmein&amp;quot;&amp;lt;sip:getmein@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;echo&amp;quot;&amp;lt;sip:echo@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;bmw325&amp;quot;&amp;lt;sip:bmw325@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;bmw335&amp;quot;&amp;lt;sip:bmw335@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w3e&amp;quot;&amp;lt;sip:1q2w3e@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w3e4r5t6y&amp;quot;&amp;lt;sip:1q2w3e4r5t6y@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q1q2w2w&amp;quot;&amp;lt;sip:1q1q2w2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w1q2w&amp;quot;&amp;lt;sip:1q2w1q2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w&amp;quot;&amp;lt;sip:1q2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;11q22w&amp;quot;&amp;lt;sip:11q22w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;q1w2&amp;quot;&amp;lt;sip:q1w2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;q1w2e3&amp;quot;&amp;lt;sip:q1w2e3@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;tvv03tvv03&amp;quot;&amp;lt;sip:tvv03tvv03@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                           &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd1&amp;quot;&amp;lt;sip:abcd1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd12&amp;quot;&amp;lt;sip:abcd12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd123&amp;quot;&amp;lt;sip:abcd123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;qq11ww22ee33rr44&amp;quot;&amp;lt;sip:qq11ww22ee33rr44@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1&amp;quot;&amp;lt;sip:sip1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip2&amp;quot;&amp;lt;sip:sip2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip12&amp;quot;&amp;lt;sip:sip12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip123&amp;quot;&amp;lt;sip:sip123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1234&amp;quot;&amp;lt;sip:sip1234@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip12345&amp;quot;&amp;lt;sip:sip12345@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1111&amp;quot;&amp;lt;sip:sip1111@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip222&amp;quot;&amp;lt;sip:sip222@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1qa2ws3ed&amp;quot;&amp;lt;sip:1qa2ws3ed@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1234asdf&amp;quot;&amp;lt;sip:1234asdf@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1a2s3d&amp;quot;&amp;lt;sip:1a2s3d@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1a2s3d4f&amp;quot;&amp;lt;sip:1a2s3d4f@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;asdzxc&amp;quot;&amp;lt;sip:asdzxc@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;123zxc&amp;quot;&amp;lt;sip:123zxc@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1234zxcv&amp;quot;&amp;lt;sip:1234zxcv@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;aazzssxx&amp;quot;&amp;lt;sip:aazzssxx@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;p@ssword&amp;quot;&amp;lt;sip:p@ssword@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;p@ssw0rd&amp;quot;&amp;lt;sip:p@ssw0rd@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;pass1&amp;quot;&amp;lt;sip:pass1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;password3&amp;quot;&amp;lt;sip:password3@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;pass12&amp;quot;&amp;lt;sip:pass12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account&amp;quot;&amp;lt;sip:account@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;passlogin&amp;quot;&amp;lt;sip:passlogin@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account1&amp;quot;&amp;lt;sip:account1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account5&amp;quot;&amp;lt;sip:account5@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account6&amp;quot;&amp;lt;sip:account6@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account123&amp;quot;&amp;lt;sip:account123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account12&amp;quot;&amp;lt;sip:account12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc1&amp;quot;&amp;lt;sip:acc1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc2&amp;quot;&amp;lt;sip:acc2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc12&amp;quot;&amp;lt;sip:acc12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
&lt;br /&gt;
One last tip: you need a MTA, like sendmail or postfix, in order to receive the notifications from fail2ban.&lt;br /&gt;
&lt;br /&gt;
If you have a MTA installed and properly configured, nothing else is needed, but if not, install sendmail&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install sendmail&lt;br /&gt;
&lt;br /&gt;
Then edit the /etc/hosts file and change the line &#039;&#039;&#039;192.168.80.1 dcerouter&#039;&#039;&#039; to read &#039;&#039;&#039;192.168.80.1 dcerouter.localdomain dcerouter&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Doing it, sendmail will start as expected (fast) and mail will properly delivered. If this change is not done, sendmail will take a long time to start, because it does not find the qualified host name, as the log shows:&lt;br /&gt;
&lt;br /&gt;
 Sep 27 13:12:11 dcerouter sendmail[10585]: My unqualified host name (dcerouter) unknown; sleeping for retry&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I hope this helps.&lt;br /&gt;
&lt;br /&gt;
source: &lt;br /&gt;
 http://www.fail2ban.org&lt;br /&gt;
 http://www.voip-info.org/wiki/view/Fail2Ban+(with+iptables)+And+Asterisk&lt;br /&gt;
 http://www.fail2ban.org/wiki/index.php/Asterisk&lt;/div&gt;</summary>
		<author><name>Pw44</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=PPTP_server&amp;diff=25755</id>
		<title>PPTP server</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=PPTP_server&amp;diff=25755"/>
		<updated>2010-10-05T22:28:40Z</updated>

		<summary type="html">&lt;p&gt;Pw44: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Networking]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
{{versioninfo|810Status=??|810UpdatedDate=5 October 2010|810UpdatedBy=pw44}}&lt;br /&gt;
&lt;br /&gt;
Setting up a PPTP Server.&lt;br /&gt;
&lt;br /&gt;
The pptp server is the right tool to use for outside access to your internal network.&lt;br /&gt;
While not the most secure VPN solution, PPTP is the most simple to install, configure and connect from windows, and mobile devices. &lt;br /&gt;
&lt;br /&gt;
Reasons for doing it:&lt;br /&gt;
# Having your mobile as an extension of your asterisk server (Iphone, for example, can do it, Nokia can do it via an add on), even from public wifi spots.&lt;br /&gt;
# Being able to remotely access files or anything in your server from anywhere, even from wifi spots.&lt;br /&gt;
# Others, as you wish.&lt;br /&gt;
&lt;br /&gt;
Lets make it simple:&lt;br /&gt;
&lt;br /&gt;
Server Setup - install the pptp server package:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install pptpd&lt;br /&gt;
&lt;br /&gt;
edit the /etc/pptpd.conf file:&lt;br /&gt;
&lt;br /&gt;
 sudo vi /etc/pptpd.conf&lt;br /&gt;
&lt;br /&gt;
and add:&lt;br /&gt;
&lt;br /&gt;
 localip 192.168.80.245,192.168.0.245&lt;br /&gt;
 remoteip 192.168.80.246-250,192.168.0.246-250&lt;br /&gt;
&lt;br /&gt;
where the localip is the address of the server, and the remoteip are the addresses that will be assigned to clients.&lt;br /&gt;
160&lt;br /&gt;
edit the /etc/ppp/pptpd-options file:&lt;br /&gt;
&lt;br /&gt;
 sudo vi /etc/ppp/pptpd-options&lt;br /&gt;
&lt;br /&gt;
append the following directives:&lt;br /&gt;
&lt;br /&gt;
 ms-dns 192.168.80.1&lt;br /&gt;
 nobsdcomp&lt;br /&gt;
 noipx&lt;br /&gt;
 mtu 1490&lt;br /&gt;
 mru 1490&lt;br /&gt;
&lt;br /&gt;
Mine looks like:&lt;br /&gt;
&lt;br /&gt;
 name pptpd&lt;br /&gt;
 refuse-pap&lt;br /&gt;
 refuse-chap&lt;br /&gt;
 refuse-mschap&lt;br /&gt;
 require-mschap-v2&lt;br /&gt;
 require-mppe-128&lt;br /&gt;
 ms-dns 192.168.80.1&lt;br /&gt;
 proxyarp&lt;br /&gt;
 nodefaultroute&lt;br /&gt;
 debug&lt;br /&gt;
 lock&lt;br /&gt;
 nobsdcomp&lt;br /&gt;
&lt;br /&gt;
Add the user credentials for authentication to you chap secrets file:&lt;br /&gt;
&lt;br /&gt;
 sudo vi /etc/ppp/chap-secrets&lt;br /&gt;
&lt;br /&gt;
Add to it the user name + password in the following syntax:&lt;br /&gt;
&lt;br /&gt;
 usernmae &amp;lt;TAB&amp;gt; * &amp;lt;TAB&amp;gt; users-password &amp;lt;TAB&amp;gt; *&lt;br /&gt;
&lt;br /&gt;
Restart the server for the settings to take affect:&lt;br /&gt;
&lt;br /&gt;
 sudo /etc/init.d/pptpd restart&lt;br /&gt;
&lt;br /&gt;
Firewall rules:&lt;br /&gt;
&lt;br /&gt;
Webadmin -&amp;gt; advanced -&amp;gt; Network -&amp;gt; Firewall Rules: core input for port 1723&lt;br /&gt;
&lt;br /&gt;
You need to append the following lines to /usr/pluto/bin/Network_Firewall.sh, in order to permit GRE protocol flow (needed by PPTP):&lt;br /&gt;
&lt;br /&gt;
 iptables --append INPUT  --protocol 47 --jump ACCEPT&lt;br /&gt;
 iptables --append OUTPUT --protocol 47 --jump ACCEPT&lt;br /&gt;
&lt;br /&gt;
If you also have a router running Tomato or DD-WRT, the following iptables rules shall be applied (these are the ones in my Tomato router): My LinuxMCE has the eth0 setted to 192.168.0.160, defined by static address in my Tomato.&lt;br /&gt;
&lt;br /&gt;
 # init pptp + gre pass thru&lt;br /&gt;
 iptables -t nat -I PREROUTING -p tcp --dport 1723 -j DNAT --to 192.168.0.160:1723&lt;br /&gt;
 iptables -I FORWARD -p tcp -d 192.168.0.160 --dport 1723 -j ACCEPT&lt;br /&gt;
 iptables -t nat -I PREROUTING -p 47 -j DNAT --to 192.168.0.160&lt;br /&gt;
 iptables -I FORWARD -p 47 -d 192.168.0.160 -j ACCEPT&lt;br /&gt;
 &lt;br /&gt;
 iptables -t nat -A PREROUTING -i ppp0 -p tcp -d 0/0 --dport 1723 -j DNAT --to-destination 192.168.0.160&lt;br /&gt;
 iptables -t nat -A PREROUTING -i ppp0 -p gre -d 0/0 -j DNAT --to-destination 192.168.0.160&lt;br /&gt;
 &lt;br /&gt;
 iptables -A FORWARD -i ppp0 -o br0 -p tcp --dport 1723 -d 192.168.0.160 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT&lt;br /&gt;
 iptables -A FORWARD -i br0 -o ppp0 -p tcp -s 192.168.0.160 --sport 1723 -m state --state ESTABLISHED,RELATED -j ACCEPT&lt;br /&gt;
 iptables -A FORWARD -i ppp0 -o br0 -p gre -d 192.168.0.160 -m state --state NEW,ESTABLISHED,RELATED-j ACCEPT&lt;br /&gt;
 iptables -A FORWARD -i br0 -o ppp0 -p gre -s 192.168.0.160 -m state --state ESTABLISHED,RELATED -j ACCEPT&lt;br /&gt;
 # end pptp + gre pass thru&lt;br /&gt;
&lt;br /&gt;
Once done, reload DCERouter, in order that the /usr/pluto/bin/Network_Firewall.sh is reloaded,and if you have Tomato or DD-WRT, reboot it.&lt;br /&gt;
&lt;br /&gt;
Configure your client to use PPTP and test (beyond this wiki).&lt;/div&gt;</summary>
		<author><name>Pw44</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=PPTP_server&amp;diff=25754</id>
		<title>PPTP server</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=PPTP_server&amp;diff=25754"/>
		<updated>2010-10-05T22:24:26Z</updated>

		<summary type="html">&lt;p&gt;Pw44: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Networking]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
&lt;br /&gt;
Setting up a PPTP Server.&lt;br /&gt;
&lt;br /&gt;
The pptp server is the right tool to use for outside access to your internal network.&lt;br /&gt;
While not the most secure VPN solution, PPTP is the most simple to install, configure and connect from windows, and mobile devices. &lt;br /&gt;
&lt;br /&gt;
Reasons for doing it:&lt;br /&gt;
# Having your mobile as an extension of your asterisk server (Iphone, for example, can do it, Nokia can do it via an add on), even from public wifi spots.&lt;br /&gt;
# Being able to remotely access files or anything in your server from anywhere, even from wifi spots.&lt;br /&gt;
# Others, as you wish.&lt;br /&gt;
&lt;br /&gt;
Lets make it simple:&lt;br /&gt;
&lt;br /&gt;
Server Setup - install the pptp server package:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install pptpd&lt;br /&gt;
&lt;br /&gt;
edit the /etc/pptpd.conf file:&lt;br /&gt;
&lt;br /&gt;
 sudo vi /etc/pptpd.conf&lt;br /&gt;
&lt;br /&gt;
and add:&lt;br /&gt;
&lt;br /&gt;
 localip 192.168.80.245,192.168.0.245&lt;br /&gt;
 remoteip 192.168.80.246-250,192.168.0.246-250&lt;br /&gt;
&lt;br /&gt;
where the localip is the address of the server, and the remoteip are the addresses that will be assigned to clients.&lt;br /&gt;
160&lt;br /&gt;
edit the /etc/ppp/pptpd-options file:&lt;br /&gt;
&lt;br /&gt;
 sudo vi /etc/ppp/pptpd-options&lt;br /&gt;
&lt;br /&gt;
append the following directives:&lt;br /&gt;
&lt;br /&gt;
 ms-dns 192.168.80.1&lt;br /&gt;
 nobsdcomp&lt;br /&gt;
 noipx&lt;br /&gt;
 mtu 1490&lt;br /&gt;
 mru 1490&lt;br /&gt;
&lt;br /&gt;
Mine looks like:&lt;br /&gt;
&lt;br /&gt;
 name pptpd&lt;br /&gt;
 refuse-pap&lt;br /&gt;
 refuse-chap&lt;br /&gt;
 refuse-mschap&lt;br /&gt;
 require-mschap-v2&lt;br /&gt;
 require-mppe-128&lt;br /&gt;
 ms-dns 192.168.80.1&lt;br /&gt;
 proxyarp&lt;br /&gt;
 nodefaultroute&lt;br /&gt;
 debug&lt;br /&gt;
 lock&lt;br /&gt;
 nobsdcomp&lt;br /&gt;
&lt;br /&gt;
Add the user credentials for authentication to you chap secrets file:&lt;br /&gt;
&lt;br /&gt;
 sudo vi /etc/ppp/chap-secrets&lt;br /&gt;
&lt;br /&gt;
Add to it the user name + password in the following syntax:&lt;br /&gt;
&lt;br /&gt;
 usernmae &amp;lt;TAB&amp;gt; * &amp;lt;TAB&amp;gt; users-password &amp;lt;TAB&amp;gt; *&lt;br /&gt;
&lt;br /&gt;
Restart the server for the settings to take affect:&lt;br /&gt;
&lt;br /&gt;
 sudo /etc/init.d/pptpd restart&lt;br /&gt;
&lt;br /&gt;
Firewall rules:&lt;br /&gt;
&lt;br /&gt;
Webadmin -&amp;gt; advanced -&amp;gt; Network -&amp;gt; Firewall Rules: core input for port 1723&lt;br /&gt;
&lt;br /&gt;
You need to append the following lines to /usr/pluto/bin/Network_Firewall.sh, in order to permit GRE protocol flow (needed by PPTP):&lt;br /&gt;
&lt;br /&gt;
 iptables --append INPUT  --protocol 47 --jump ACCEPT&lt;br /&gt;
 iptables --append OUTPUT --protocol 47 --jump ACCEPT&lt;br /&gt;
&lt;br /&gt;
If you also have a router running Tomato or DD-WRT, the following iptables rules shall be applied (these are the ones in my Tomato router): My LinuxMCE has the eth0 setted to 192.168.0.160, defined by static address in my Tomato.&lt;br /&gt;
&lt;br /&gt;
 # init pptp + gre pass thru&lt;br /&gt;
 iptables -t nat -I PREROUTING -p tcp --dport 1723 -j DNAT --to 192.168.0.160:1723&lt;br /&gt;
 iptables -I FORWARD -p tcp -d 192.168.0.160 --dport 1723 -j ACCEPT&lt;br /&gt;
 iptables -t nat -I PREROUTING -p 47 -j DNAT --to 192.168.0.160&lt;br /&gt;
 iptables -I FORWARD -p 47 -d 192.168.0.160 -j ACCEPT&lt;br /&gt;
 &lt;br /&gt;
 iptables -t nat -A PREROUTING -i ppp0 -p tcp -d 0/0 --dport 1723 -j DNAT --to-destination 192.168.0.160&lt;br /&gt;
 iptables -t nat -A PREROUTING -i ppp0 -p gre -d 0/0 -j DNAT --to-destination 192.168.0.160&lt;br /&gt;
 &lt;br /&gt;
 iptables -A FORWARD -i ppp0 -o br0 -p tcp --dport 1723 -d 192.168.0.160 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT&lt;br /&gt;
 iptables -A FORWARD -i br0 -o ppp0 -p tcp -s 192.168.0.160 --sport 1723 -m state --state ESTABLISHED,RELATED -j ACCEPT&lt;br /&gt;
 iptables -A FORWARD -i ppp0 -o br0 -p gre -d 192.168.0.160 -m state --state NEW,ESTABLISHED,RELATED-j ACCEPT&lt;br /&gt;
 iptables -A FORWARD -i br0 -o ppp0 -p gre -s 192.168.0.160 -m state --state ESTABLISHED,RELATED -j ACCEPT&lt;br /&gt;
 # end pptp + gre pass thru&lt;br /&gt;
&lt;br /&gt;
Once done, reload DCERouter, in order that the /usr/pluto/bin/Network_Firewall.sh is reloaded,and if you have Tomato or DD-WRT, reboot it.&lt;br /&gt;
&lt;br /&gt;
Configure your client to use PPTP and test (beyond this wiki).&lt;/div&gt;</summary>
		<author><name>Pw44</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=PPTP_server&amp;diff=25753</id>
		<title>PPTP server</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=PPTP_server&amp;diff=25753"/>
		<updated>2010-10-05T22:22:18Z</updated>

		<summary type="html">&lt;p&gt;Pw44: New page: Setting up a PPTP Server.  The pptp server is the right tool to use for outside access to your internal network. While not the most secure VPN solution, PPTP is the most simple to install,...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Setting up a PPTP Server.&lt;br /&gt;
&lt;br /&gt;
The pptp server is the right tool to use for outside access to your internal network.&lt;br /&gt;
While not the most secure VPN solution, PPTP is the most simple to install, configure and connect from windows, and mobile devices. &lt;br /&gt;
&lt;br /&gt;
Reasons for doing it:&lt;br /&gt;
# Having your mobile as an extension of your asterisk server (Iphone, for example, can do it, Nokia can do it via an add on), even from public wifi spots.&lt;br /&gt;
# Being able to remotely access files or anything in your server from anywhere, even from wifi spots.&lt;br /&gt;
# Others, as you wish.&lt;br /&gt;
&lt;br /&gt;
Lets make it simple:&lt;br /&gt;
&lt;br /&gt;
Server Setup - install the pptp server package:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install pptpd&lt;br /&gt;
&lt;br /&gt;
edit the /etc/pptpd.conf file:&lt;br /&gt;
&lt;br /&gt;
 sudo vi /etc/pptpd.conf&lt;br /&gt;
&lt;br /&gt;
and add:&lt;br /&gt;
&lt;br /&gt;
 localip 192.168.80.245,192.168.0.245&lt;br /&gt;
 remoteip 192.168.80.246-250,192.168.0.246-250&lt;br /&gt;
&lt;br /&gt;
where the localip is the address of the server, and the remoteip are the addresses that will be assigned to clients.&lt;br /&gt;
160&lt;br /&gt;
edit the /etc/ppp/pptpd-options file:&lt;br /&gt;
&lt;br /&gt;
 sudo vi /etc/ppp/pptpd-options&lt;br /&gt;
&lt;br /&gt;
append the following directives:&lt;br /&gt;
&lt;br /&gt;
 ms-dns 192.168.80.1&lt;br /&gt;
 nobsdcomp&lt;br /&gt;
 noipx&lt;br /&gt;
 mtu 1490&lt;br /&gt;
 mru 1490&lt;br /&gt;
&lt;br /&gt;
Mine looks like:&lt;br /&gt;
&lt;br /&gt;
 name pptpd&lt;br /&gt;
 refuse-pap&lt;br /&gt;
 refuse-chap&lt;br /&gt;
 refuse-mschap&lt;br /&gt;
 require-mschap-v2&lt;br /&gt;
 require-mppe-128&lt;br /&gt;
 ms-dns 192.168.80.1&lt;br /&gt;
 proxyarp&lt;br /&gt;
 nodefaultroute&lt;br /&gt;
 debug&lt;br /&gt;
 lock&lt;br /&gt;
 nobsdcomp&lt;br /&gt;
&lt;br /&gt;
Add the user credentials for authentication to you chap secrets file:&lt;br /&gt;
&lt;br /&gt;
 sudo vi /etc/ppp/chap-secrets&lt;br /&gt;
&lt;br /&gt;
Add to it the user name + password in the following syntax:&lt;br /&gt;
&lt;br /&gt;
 usernmae &amp;lt;TAB&amp;gt; * &amp;lt;TAB&amp;gt; users-password &amp;lt;TAB&amp;gt; *&lt;br /&gt;
&lt;br /&gt;
Restart the server for the settings to take affect:&lt;br /&gt;
&lt;br /&gt;
 sudo /etc/init.d/pptpd restart&lt;br /&gt;
&lt;br /&gt;
Firewall rules:&lt;br /&gt;
&lt;br /&gt;
Webadmin -&amp;gt; advanced -&amp;gt; Network -&amp;gt; Firewall Rules: core input for port 1723&lt;br /&gt;
&lt;br /&gt;
You need to append the following lines to /usr/pluto/bin/Network_Firewall.sh, in order to permit GRE protocol flow (needed by PPTP):&lt;br /&gt;
&lt;br /&gt;
 iptables --append INPUT  --protocol 47 --jump ACCEPT&lt;br /&gt;
 iptables --append OUTPUT --protocol 47 --jump ACCEPT&lt;br /&gt;
&lt;br /&gt;
If you also have a router running Tomato or DD-WRT, the following iptables rules shall be applied (these are the ones in my Tomato router): My LinuxMCE has the eth0 setted to 192.168.0.160, defined by static address in my Tomato.&lt;br /&gt;
&lt;br /&gt;
 # init pptp + gre pass thru&lt;br /&gt;
 iptables -t nat -I PREROUTING -p tcp --dport 1723 -j DNAT --to 192.168.0.160:1723&lt;br /&gt;
 iptables -I FORWARD -p tcp -d 192.168.0.160 --dport 1723 -j ACCEPT&lt;br /&gt;
 iptables -t nat -I PREROUTING -p 47 -j DNAT --to 192.168.0.160&lt;br /&gt;
 iptables -I FORWARD -p 47 -d 192.168.0.160 -j ACCEPT&lt;br /&gt;
 &lt;br /&gt;
 iptables -t nat -A PREROUTING -i ppp0 -p tcp -d 0/0 --dport 1723 -j DNAT --to-destination 192.168.0.160&lt;br /&gt;
 iptables -t nat -A PREROUTING -i ppp0 -p gre -d 0/0 -j DNAT --to-destination 192.168.0.160&lt;br /&gt;
 &lt;br /&gt;
 iptables -A FORWARD -i ppp0 -o br0 -p tcp --dport 1723 -d 192.168.0.160 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT&lt;br /&gt;
 iptables -A FORWARD -i br0 -o ppp0 -p tcp -s 192.168.0.160 --sport 1723 -m state --state ESTABLISHED,RELATED -j ACCEPT&lt;br /&gt;
 iptables -A FORWARD -i ppp0 -o br0 -p gre -d 192.168.0.160 -m state --state NEW,ESTABLISHED,RELATED-j ACCEPT&lt;br /&gt;
 iptables -A FORWARD -i br0 -o ppp0 -p gre -s 192.168.0.160 -m state --state ESTABLISHED,RELATED -j ACCEPT&lt;br /&gt;
 # end pptp + gre pass thru&lt;br /&gt;
&lt;br /&gt;
Once done, reload DCERouter, in order that the /usr/pluto/bin/Network_Firewall.sh is reloaded,and if you have Tomato or DD-WRT, reboot it.&lt;br /&gt;
&lt;br /&gt;
Configure your client to use PPTP and test (beyond this wiki).&lt;/div&gt;</summary>
		<author><name>Pw44</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=Fail2ban_-_A_tool_against_brute_force&amp;diff=25171</id>
		<title>Fail2ban - A tool against brute force</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=Fail2ban_-_A_tool_against_brute_force&amp;diff=25171"/>
		<updated>2010-09-27T16:34:34Z</updated>

		<summary type="html">&lt;p&gt;Pw44: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: Tutorials]]&lt;br /&gt;
&lt;br /&gt;
Having asterik installed is almost an invitation for others wishing to place calls at your expense.&lt;br /&gt;
&lt;br /&gt;
After configuring my sip trunk, it did not take 2 days and some &amp;quot;smart guy&amp;quot;  was trying to register to take advantage of it, and causing me losses.&lt;br /&gt;
&lt;br /&gt;
Fail2ban prevented it, blocking the attacker with iptables rules.&lt;br /&gt;
&lt;br /&gt;
Installing fail2ban is not complicated and i will describe the steps to have it properly installed and configured, so you can protect your asterisk and other services from brute force attack.&lt;br /&gt;
&lt;br /&gt;
Install with: &lt;br /&gt;
 sudo apt-get install fail2ban&lt;br /&gt;
&lt;br /&gt;
After is installed, you need to change /etc/asterisk/logger.conf and add the following line under [general] section (You may have to create this before the [logfiles] section). &lt;br /&gt;
&lt;br /&gt;
 [general]&lt;br /&gt;
 dateformat=%F %T&lt;br /&gt;
&lt;br /&gt;
In /etc/asterisk/logger.conf add the following line under the [logfiles] section for asterisk to log NOTICE level events to the syslog (/var/log/messages) as well as its normal log file. These entries in syslog will have a Date/Time stamp that is usable by fail2ban.&lt;br /&gt;
&lt;br /&gt;
 syslog.local0 =&amp;gt; notice &lt;br /&gt;
&lt;br /&gt;
Reload asterisk with:&lt;br /&gt;
&lt;br /&gt;
 asterisk -rx &amp;quot;logger reload&amp;quot; &lt;br /&gt;
&lt;br /&gt;
Configuring fail2ban:&lt;br /&gt;
&lt;br /&gt;
 cd /etc/fail2ban/filter.d&lt;br /&gt;
&lt;br /&gt;
 touch asterisk.conf &lt;br /&gt;
&lt;br /&gt;
 vi asterisk.conf&lt;br /&gt;
&lt;br /&gt;
insert the following (copy &amp;amp; paste)&lt;br /&gt;
&lt;br /&gt;
 # Fail2Ban configuration file&lt;br /&gt;
 #&lt;br /&gt;
 #&lt;br /&gt;
 # $Revision: 250 $&lt;br /&gt;
 #&lt;br /&gt;
 [INCLUDES]&lt;br /&gt;
 # Read common prefixes. If any customizations available -- read them from&lt;br /&gt;
 # common.local&lt;br /&gt;
 #before = common.conf&lt;br /&gt;
 [Definition]&lt;br /&gt;
 #_daemon = asterisk&lt;br /&gt;
 # Option:  failregex&lt;br /&gt;
 # Notes.:  regex to match the password failures messages in the logfile. The&lt;br /&gt;
 #          host must be matched by a group named &amp;quot;host&amp;quot;. The tag &amp;quot;&amp;lt;HOST&amp;gt;&amp;quot; can&lt;br /&gt;
 #          be used for standard IP/hostname matching and is only an alias for&lt;br /&gt;
 #          (?:::f{4,6}:)?(?P&amp;lt;host&amp;gt;\S+)&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 failregex = NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Wrong password&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - No matching peer found&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Username/auth name mismatch&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Device does not match ACL&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&amp;quot; .* failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Peer is not supposed to register&lt;br /&gt;
             NOTICE.* &amp;lt;HOST&amp;gt; failed to authenticate as &#039;.*&#039;$&lt;br /&gt;
             NOTICE.* .*: No registration for peer &#039;.*&#039; \(from &amp;lt;HOST&amp;gt;\)&lt;br /&gt;
             NOTICE.* .*: Host &amp;lt;HOST&amp;gt; failed MD5 authentication for &#039;.*&#039; (.*)&lt;br /&gt;
             NOTICE.* .*: Failed to authenticate user .*@&amp;lt;HOST&amp;gt;.*&lt;br /&gt;
 # Option:  ignoreregex&lt;br /&gt;
 # Notes.:  regex to ignore. If this regex matches, the line is ignored.&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 ignoreregex =&lt;br /&gt;
&lt;br /&gt;
Next edit /etc/fail2ban/jail.conf to include the following section so that it uses the new filter. &lt;br /&gt;
&lt;br /&gt;
 [asterisk-iptables]&lt;br /&gt;
 enabled  = true&lt;br /&gt;
 filter   = asterisk&lt;br /&gt;
 action   = iptables-allports[name=ASTERISK, protocol=all]&lt;br /&gt;
            sendmail-whois[name=ASTERISK, dest=root, sender=fail2ban@example.org]&lt;br /&gt;
 logpath  = /var/log/asterisk/full&lt;br /&gt;
 maxretry = 2&lt;br /&gt;
 bantime = 259200&lt;br /&gt;
&lt;br /&gt;
Locate the line ignoreip in /etc/fail2ban/jail.conf (beginning of the file) and insert the ip&#039;s and / or blocks you want fail2ban to ignore, so you don&#039;t risk banning yourserf or any host in your network.&lt;br /&gt;
&lt;br /&gt;
Mine is defined as follows:&lt;br /&gt;
&lt;br /&gt;
 [DEFAULT]&lt;br /&gt;
 # &amp;quot;ignoreip&amp;quot; can be an IP address, a CIDR mask or a DNS host. Fail2ban will not&lt;br /&gt;
 # ban a host which matches an address in this list. Several addresses can be   &lt;br /&gt;
 # defined using space separator.                                               &lt;br /&gt;
 ignoreip = 127.0.0.1 192.168.80.1 192.168.80.0 192.168.0.0&lt;br /&gt;
&lt;br /&gt;
To start fail2ban type the following as root:&lt;br /&gt;
&lt;br /&gt;
 /etc/init.d/fail2ban start&lt;br /&gt;
&lt;br /&gt;
Check It&lt;br /&gt;
&lt;br /&gt;
For LinuxMCE, there is needed &amp;quot;patch&amp;quot;, while fail2ban is not part of the distribution.&lt;br /&gt;
&lt;br /&gt;
When LinuxMCE starts, it runs /usr/pluto/bin/Network_Firewall.sh, and this is done AFTER /etc/init.d/fail2ban is started.&lt;br /&gt;
&lt;br /&gt;
So, edit /usr/pluto/bin/Network_Firewall.sh and add the following at the END of this file:&lt;br /&gt;
 &lt;br /&gt;
 /etc/init.d/fail2ban restart&lt;br /&gt;
&lt;br /&gt;
This will make sure that fail2bain is started AFTER the iptables rules from LinuxMCE.&lt;br /&gt;
&lt;br /&gt;
If started properly issue the following command to view your iptables rules:&lt;br /&gt;
&lt;br /&gt;
 iptables -L -v&lt;br /&gt;
&lt;br /&gt;
You should see something like the following for the INPUT chain (this is the ouput of mine)&lt;br /&gt;
&lt;br /&gt;
 Chain INPUT (policy DROP 2241 packets, 160K bytes)              &lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination         &lt;br /&gt;
   372 27264 &#039;&#039;&#039;fail2ban-SSH&#039;&#039;&#039;  tcp  --  any    any     anywhere             anywhere            tcp dpt:ssh                                                                                          &lt;br /&gt;
 1312K  991M &#039;&#039;&#039;fail2ban-ASTERISK&#039;&#039;&#039;  all  --  any    any     anywhere             anywhere            &lt;br /&gt;
  553K   81M ACCEPT     all  --  lo     any     anywhere             anywhere                    &lt;br /&gt;
 1288K 1162M ACCEPT     all  --  any    any     anywhere             anywhere            state RELATED,ESTABLISHED                                                                               &lt;br /&gt;
     9   540 ACCEPT     all  --  any    any     anywhere             anywhere            MARK match 0x1                                                                                          &lt;br /&gt;
     2  1152 ACCEPT     udp  --  any    any     anywhere             anywhere            udp   dpt:bootps                                                                                          &lt;br /&gt;
 19276 5790K ACCEPT     all  --  any    any     192.168.80.0/24      anywhere                    &lt;br /&gt;
     0     0 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:iax                                                                                             &lt;br /&gt;
     4  1795 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:sip                                                                                             &lt;br /&gt;
     0     0 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:2000                                                                                            &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:sieve                                                                                           &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:1723                                                                                            &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:www                                                                                             &lt;br /&gt;
     1    60 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:ssh                                                                                             &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:https                                                                                           &lt;br /&gt;
     1    50 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpts:10001:20000&lt;br /&gt;
     0     0 ACCEPT     gre  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain FORWARD (policy ACCEPT 719K packets, 245M bytes)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
     0     0 TCPMSS     tcp  --  any    ppp+    anywhere             anywhere            tcp flags:SYN,RST/SYN TCPMSS clamp to PMTU&lt;br /&gt;
 Chain OUTPUT (policy ACCEPT 2099K packets, 590M bytes)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
     0     0 ACCEPT     gre  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain fail2ban-ASTERISK (1 references)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
  5091 2125K DROP       all  --  any    any     173.193.194.106-static.reverse.softlayer.com  anywhere&lt;br /&gt;
 1307K  989M RETURN     all  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain fail2ban-SSH (1 references)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
&lt;br /&gt;
If you do not see something similar to that then you have some troubleshooting to, check out /var/log/fail2ban.log.&lt;br /&gt;
&lt;br /&gt;
Example of my /var/log/fai2ban.log (173.193.194.106 is the real address from the attacker fail2ban banned):&lt;br /&gt;
&lt;br /&gt;
 ....&lt;br /&gt;
 2010-09-19 11:12:56,131 fail2ban.filter : INFO   Set maxRetry = 6&lt;br /&gt;
 2010-09-19 11:12:56,133 fail2ban.filter : INFO   Set findtime = 600&lt;br /&gt;
 2010-09-19 11:12:56,133 fail2ban.actions: INFO   Set banTime = 600&lt;br /&gt;
 2010-09-19 11:12:56,138 fail2ban.jail   : INFO   Jail &#039;ssh-iptables&#039; started&lt;br /&gt;
 2010-09-19 11:12:56,139 fail2ban.jail   : INFO   Jail &#039;asterisk-iptables&#039; started&lt;br /&gt;
 2010-09-19 11:12:56,141 fail2ban.jail   : INFO   Jail &#039;apache-tcpwrapper&#039; started&lt;br /&gt;
 2010-09-19 15:33:50,392 fail2ban.actions: WARNING [asterisk-iptables] Ban 173.193.194.106&lt;br /&gt;
 2010-09-19 15:34:50,982 fail2ban.actions: WARNING [asterisk-iptables] 173.193.194.106 already banned&lt;br /&gt;
&lt;br /&gt;
And this is the log (/var/log/asterisk/messages) showing the attack:&lt;br /&gt;
&lt;br /&gt;
 [2010-09-19 15:33:48] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;3235410554&amp;quot;&amp;lt;sip:3235410554@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                           &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;thomas&amp;quot;&amp;lt;sip:thomas@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;arsenal&amp;quot;&amp;lt;sip:arsenal@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;letmein&amp;quot;&amp;lt;sip:letmein@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;liverpool&amp;quot;&amp;lt;sip:liverpool@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;nevermind&amp;quot;&amp;lt;sip:nevermind@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;getmein&amp;quot;&amp;lt;sip:getmein@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;echo&amp;quot;&amp;lt;sip:echo@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;bmw325&amp;quot;&amp;lt;sip:bmw325@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;bmw335&amp;quot;&amp;lt;sip:bmw335@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w3e&amp;quot;&amp;lt;sip:1q2w3e@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w3e4r5t6y&amp;quot;&amp;lt;sip:1q2w3e4r5t6y@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q1q2w2w&amp;quot;&amp;lt;sip:1q1q2w2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w1q2w&amp;quot;&amp;lt;sip:1q2w1q2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w&amp;quot;&amp;lt;sip:1q2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;11q22w&amp;quot;&amp;lt;sip:11q22w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;q1w2&amp;quot;&amp;lt;sip:q1w2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;q1w2e3&amp;quot;&amp;lt;sip:q1w2e3@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;tvv03tvv03&amp;quot;&amp;lt;sip:tvv03tvv03@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                           &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd1&amp;quot;&amp;lt;sip:abcd1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd12&amp;quot;&amp;lt;sip:abcd12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd123&amp;quot;&amp;lt;sip:abcd123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;qq11ww22ee33rr44&amp;quot;&amp;lt;sip:qq11ww22ee33rr44@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1&amp;quot;&amp;lt;sip:sip1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip2&amp;quot;&amp;lt;sip:sip2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip12&amp;quot;&amp;lt;sip:sip12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip123&amp;quot;&amp;lt;sip:sip123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1234&amp;quot;&amp;lt;sip:sip1234@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip12345&amp;quot;&amp;lt;sip:sip12345@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1111&amp;quot;&amp;lt;sip:sip1111@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip222&amp;quot;&amp;lt;sip:sip222@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1qa2ws3ed&amp;quot;&amp;lt;sip:1qa2ws3ed@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1234asdf&amp;quot;&amp;lt;sip:1234asdf@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1a2s3d&amp;quot;&amp;lt;sip:1a2s3d@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1a2s3d4f&amp;quot;&amp;lt;sip:1a2s3d4f@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;asdzxc&amp;quot;&amp;lt;sip:asdzxc@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;123zxc&amp;quot;&amp;lt;sip:123zxc@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1234zxcv&amp;quot;&amp;lt;sip:1234zxcv@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;aazzssxx&amp;quot;&amp;lt;sip:aazzssxx@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;p@ssword&amp;quot;&amp;lt;sip:p@ssword@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;p@ssw0rd&amp;quot;&amp;lt;sip:p@ssw0rd@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;pass1&amp;quot;&amp;lt;sip:pass1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;password3&amp;quot;&amp;lt;sip:password3@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;pass12&amp;quot;&amp;lt;sip:pass12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account&amp;quot;&amp;lt;sip:account@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;passlogin&amp;quot;&amp;lt;sip:passlogin@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account1&amp;quot;&amp;lt;sip:account1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account5&amp;quot;&amp;lt;sip:account5@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account6&amp;quot;&amp;lt;sip:account6@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account123&amp;quot;&amp;lt;sip:account123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account12&amp;quot;&amp;lt;sip:account12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc1&amp;quot;&amp;lt;sip:acc1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc2&amp;quot;&amp;lt;sip:acc2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc12&amp;quot;&amp;lt;sip:acc12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
&lt;br /&gt;
One last tip: you need a MTA, like sendmail or postfix, in order to receive the notifications from fail2ban.&lt;br /&gt;
&lt;br /&gt;
If you have a MTA installed and properly configured, nothing else is needed, but if not, install sendmail&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install sendmail&lt;br /&gt;
&lt;br /&gt;
Then edit the /etc/hosts file and change the line &#039;&#039;&#039;192.168.80.1 dcerouter&#039;&#039;&#039; to read &#039;&#039;&#039;192.168.80.1 dcerouter.localdomain dcerouter&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Doing it, sendmail will start as expected (fast) and mail will properly delivered. If this change is not done, sendmail will take a long time to start, because it does not find the qualified host name, as the log shows:&lt;br /&gt;
&lt;br /&gt;
 Sep 27 13:12:11 dcerouter sendmail[10585]: My unqualified host name (dcerouter) unknown; sleeping for retry&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I hope this helps.&lt;br /&gt;
&lt;br /&gt;
source: &lt;br /&gt;
 http://www.fail2ban.org&lt;br /&gt;
 http://www.voip-info.org/wiki/view/Fail2Ban+(with+iptables)+And+Asterisk&lt;br /&gt;
 http://www.fail2ban.org/wiki/index.php/Asterisk&lt;/div&gt;</summary>
		<author><name>Pw44</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=Fail2ban_-_A_tool_against_brute_force&amp;diff=25170</id>
		<title>Fail2ban - A tool against brute force</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=Fail2ban_-_A_tool_against_brute_force&amp;diff=25170"/>
		<updated>2010-09-27T16:33:45Z</updated>

		<summary type="html">&lt;p&gt;Pw44: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: Tutorials]]&lt;br /&gt;
&lt;br /&gt;
Having asterik installed is almost an invitation for others wishing to place calls at your expense.&lt;br /&gt;
&lt;br /&gt;
After configuring my sip trunk, it did not take 2 days and some &amp;quot;smart guy&amp;quot;  was trying to register to take advantage of it, and causing me losses.&lt;br /&gt;
&lt;br /&gt;
Fail2ban prevented it, blocking the attacker with iptables rules.&lt;br /&gt;
&lt;br /&gt;
Installing fail2ban is not complicated and i will describe the steps to have it properly installed and configured, so you can protect your asterisk and other services from brute force attack.&lt;br /&gt;
&lt;br /&gt;
Install with: &lt;br /&gt;
 sudo apt-get install fail2ban&lt;br /&gt;
&lt;br /&gt;
After is installed, you need to change /etc/asterisk/logger.conf and add the following line under [general] section (You may have to create this before the [logfiles] section). &lt;br /&gt;
&lt;br /&gt;
 [general]&lt;br /&gt;
 dateformat=%F %T&lt;br /&gt;
&lt;br /&gt;
In /etc/asterisk/logger.conf add the following line under the [logfiles] section for asterisk to log NOTICE level events to the syslog (/var/log/messages) as well as its normal log file. These entries in syslog will have a Date/Time stamp that is usable by fail2ban.&lt;br /&gt;
&lt;br /&gt;
 syslog.local0 =&amp;gt; notice &lt;br /&gt;
&lt;br /&gt;
Reload asterisk with:&lt;br /&gt;
&lt;br /&gt;
 asterisk -rx &amp;quot;logger reload&amp;quot; &lt;br /&gt;
&lt;br /&gt;
Configuring fail2ban:&lt;br /&gt;
&lt;br /&gt;
 cd /etc/fail2ban/filter.d&lt;br /&gt;
&lt;br /&gt;
 touch asterisk.conf &lt;br /&gt;
&lt;br /&gt;
 vi asterisk.conf&lt;br /&gt;
&lt;br /&gt;
insert the following (copy &amp;amp; paste)&lt;br /&gt;
&lt;br /&gt;
 # Fail2Ban configuration file&lt;br /&gt;
 #&lt;br /&gt;
 #&lt;br /&gt;
 # $Revision: 250 $&lt;br /&gt;
 #&lt;br /&gt;
 [INCLUDES]&lt;br /&gt;
 # Read common prefixes. If any customizations available -- read them from&lt;br /&gt;
 # common.local&lt;br /&gt;
 #before = common.conf&lt;br /&gt;
 [Definition]&lt;br /&gt;
 #_daemon = asterisk&lt;br /&gt;
 # Option:  failregex&lt;br /&gt;
 # Notes.:  regex to match the password failures messages in the logfile. The&lt;br /&gt;
 #          host must be matched by a group named &amp;quot;host&amp;quot;. The tag &amp;quot;&amp;lt;HOST&amp;gt;&amp;quot; can&lt;br /&gt;
 #          be used for standard IP/hostname matching and is only an alias for&lt;br /&gt;
 #          (?:::f{4,6}:)?(?P&amp;lt;host&amp;gt;\S+)&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 failregex = NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Wrong password&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - No matching peer found&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Username/auth name mismatch&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Device does not match ACL&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&amp;quot; .* failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Peer is not supposed to register&lt;br /&gt;
             NOTICE.* &amp;lt;HOST&amp;gt; failed to authenticate as &#039;.*&#039;$&lt;br /&gt;
             NOTICE.* .*: No registration for peer &#039;.*&#039; \(from &amp;lt;HOST&amp;gt;\)&lt;br /&gt;
             NOTICE.* .*: Host &amp;lt;HOST&amp;gt; failed MD5 authentication for &#039;.*&#039; (.*)&lt;br /&gt;
             NOTICE.* .*: Failed to authenticate user .*@&amp;lt;HOST&amp;gt;.*&lt;br /&gt;
 # Option:  ignoreregex&lt;br /&gt;
 # Notes.:  regex to ignore. If this regex matches, the line is ignored.&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 ignoreregex =&lt;br /&gt;
&lt;br /&gt;
Next edit /etc/fail2ban/jail.conf to include the following section so that it uses the new filter. &lt;br /&gt;
&lt;br /&gt;
 [asterisk-iptables]&lt;br /&gt;
 enabled  = true&lt;br /&gt;
 filter   = asterisk&lt;br /&gt;
 action   = iptables-allports[name=ASTERISK, protocol=all]&lt;br /&gt;
            sendmail-whois[name=ASTERISK, dest=root, sender=fail2ban@example.org]&lt;br /&gt;
 logpath  = /var/log/asterisk/full&lt;br /&gt;
 maxretry = 2&lt;br /&gt;
 bantime = 259200&lt;br /&gt;
&lt;br /&gt;
Locate the line ignoreip in /etc/fail2ban/jail.conf (beginning of the file) and insert the ip&#039;s and / or blocks you want fail2ban to ignore, so you don&#039;t risk banning yourserf or any host in your network.&lt;br /&gt;
&lt;br /&gt;
Mine is defined as follows:&lt;br /&gt;
&lt;br /&gt;
 [DEFAULT]&lt;br /&gt;
 # &amp;quot;ignoreip&amp;quot; can be an IP address, a CIDR mask or a DNS host. Fail2ban will not&lt;br /&gt;
 # ban a host which matches an address in this list. Several addresses can be   &lt;br /&gt;
 # defined using space separator.                                               &lt;br /&gt;
 ignoreip = 127.0.0.1 192.168.80.1 192.168.80.0 192.168.0.0&lt;br /&gt;
&lt;br /&gt;
To start fail2ban type the following as root:&lt;br /&gt;
&lt;br /&gt;
 /etc/init.d/fail2ban start&lt;br /&gt;
&lt;br /&gt;
Check It&lt;br /&gt;
&lt;br /&gt;
For LinuxMCE, there is needed &amp;quot;patch&amp;quot;, while fail2ban is not part of the distribution.&lt;br /&gt;
&lt;br /&gt;
When LinuxMCE starts, it runs /usr/pluto/bin/Network_Firewall.sh, and this is done AFTER /etc/init.d/fail2ban is started.&lt;br /&gt;
&lt;br /&gt;
So, edit /usr/pluto/bin/Network_Firewall.sh and add the following at the END of this file:&lt;br /&gt;
 &lt;br /&gt;
 /etc/init.d/fail2ban restart&lt;br /&gt;
&lt;br /&gt;
This will make sure that fail2bain is started AFTER the iptables rules from LinuxMCE.&lt;br /&gt;
&lt;br /&gt;
If started properly issue the following command to view your iptables rules:&lt;br /&gt;
&lt;br /&gt;
 iptables -L -v&lt;br /&gt;
&lt;br /&gt;
You should see something like the following for the INPUT chain (this is the ouput of mine)&lt;br /&gt;
&lt;br /&gt;
 Chain INPUT (policy DROP 2241 packets, 160K bytes)              &lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination         &lt;br /&gt;
   372 27264 &#039;&#039;&#039;fail2ban-SSH&#039;&#039;&#039;  tcp  --  any    any     anywhere             anywhere            tcp dpt:ssh                                                                                          &lt;br /&gt;
 1312K  991M &#039;&#039;&#039;fail2ban-ASTERISK&#039;&#039;&#039;  all  --  any    any     anywhere             anywhere            &lt;br /&gt;
  553K   81M ACCEPT     all  --  lo     any     anywhere             anywhere                    &lt;br /&gt;
 1288K 1162M ACCEPT     all  --  any    any     anywhere             anywhere            state RELATED,ESTABLISHED                                                                               &lt;br /&gt;
     9   540 ACCEPT     all  --  any    any     anywhere             anywhere            MARK match 0x1                                                                                          &lt;br /&gt;
     2  1152 ACCEPT     udp  --  any    any     anywhere             anywhere            udp   dpt:bootps                                                                                          &lt;br /&gt;
 19276 5790K ACCEPT     all  --  any    any     192.168.80.0/24      anywhere                    &lt;br /&gt;
     0     0 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:iax                                                                                             &lt;br /&gt;
     4  1795 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:sip                                                                                             &lt;br /&gt;
     0     0 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:2000                                                                                            &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:sieve                                                                                           &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:1723                                                                                            &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:www                                                                                             &lt;br /&gt;
     1    60 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:ssh                                                                                             &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:https                                                                                           &lt;br /&gt;
     1    50 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpts:10001:20000&lt;br /&gt;
     0     0 ACCEPT     gre  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain FORWARD (policy ACCEPT 719K packets, 245M bytes)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
     0     0 TCPMSS     tcp  --  any    ppp+    anywhere             anywhere            tcp flags:SYN,RST/SYN TCPMSS clamp to PMTU&lt;br /&gt;
 Chain OUTPUT (policy ACCEPT 2099K packets, 590M bytes)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
     0     0 ACCEPT     gre  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain fail2ban-ASTERISK (1 references)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
  5091 2125K DROP       all  --  any    any     173.193.194.106-static.reverse.softlayer.com  anywhere&lt;br /&gt;
 1307K  989M RETURN     all  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain fail2ban-SSH (1 references)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
&lt;br /&gt;
If you do not see something similar to that then you have some troubleshooting to, check out /var/log/fail2ban.log.&lt;br /&gt;
&lt;br /&gt;
Example of my /var/log/fai2ban.log (173.193.194.106 is the real address from the attacker fail2ban banned):&lt;br /&gt;
&lt;br /&gt;
 ....&lt;br /&gt;
 2010-09-19 11:12:56,131 fail2ban.filter : INFO   Set maxRetry = 6&lt;br /&gt;
 2010-09-19 11:12:56,133 fail2ban.filter : INFO   Set findtime = 600&lt;br /&gt;
 2010-09-19 11:12:56,133 fail2ban.actions: INFO   Set banTime = 600&lt;br /&gt;
 2010-09-19 11:12:56,138 fail2ban.jail   : INFO   Jail &#039;ssh-iptables&#039; started&lt;br /&gt;
 2010-09-19 11:12:56,139 fail2ban.jail   : INFO   Jail &#039;asterisk-iptables&#039; started&lt;br /&gt;
 2010-09-19 11:12:56,141 fail2ban.jail   : INFO   Jail &#039;apache-tcpwrapper&#039; started&lt;br /&gt;
 2010-09-19 15:33:50,392 fail2ban.actions: WARNING [asterisk-iptables] Ban 173.193.194.106&lt;br /&gt;
 2010-09-19 15:34:50,982 fail2ban.actions: WARNING [asterisk-iptables] 173.193.194.106 already banned&lt;br /&gt;
&lt;br /&gt;
And this is the log (/var/log/asterisk/messages) showing the attack:&lt;br /&gt;
&lt;br /&gt;
 [2010-09-19 15:33:48] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;3235410554&amp;quot;&amp;lt;sip:3235410554@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                           &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;thomas&amp;quot;&amp;lt;sip:thomas@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;arsenal&amp;quot;&amp;lt;sip:arsenal@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;letmein&amp;quot;&amp;lt;sip:letmein@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;liverpool&amp;quot;&amp;lt;sip:liverpool@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;nevermind&amp;quot;&amp;lt;sip:nevermind@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;getmein&amp;quot;&amp;lt;sip:getmein@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;echo&amp;quot;&amp;lt;sip:echo@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;bmw325&amp;quot;&amp;lt;sip:bmw325@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;bmw335&amp;quot;&amp;lt;sip:bmw335@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w3e&amp;quot;&amp;lt;sip:1q2w3e@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w3e4r5t6y&amp;quot;&amp;lt;sip:1q2w3e4r5t6y@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q1q2w2w&amp;quot;&amp;lt;sip:1q1q2w2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w1q2w&amp;quot;&amp;lt;sip:1q2w1q2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w&amp;quot;&amp;lt;sip:1q2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;11q22w&amp;quot;&amp;lt;sip:11q22w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;q1w2&amp;quot;&amp;lt;sip:q1w2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;q1w2e3&amp;quot;&amp;lt;sip:q1w2e3@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;tvv03tvv03&amp;quot;&amp;lt;sip:tvv03tvv03@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                           &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd1&amp;quot;&amp;lt;sip:abcd1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd12&amp;quot;&amp;lt;sip:abcd12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd123&amp;quot;&amp;lt;sip:abcd123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;qq11ww22ee33rr44&amp;quot;&amp;lt;sip:qq11ww22ee33rr44@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1&amp;quot;&amp;lt;sip:sip1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip2&amp;quot;&amp;lt;sip:sip2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip12&amp;quot;&amp;lt;sip:sip12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip123&amp;quot;&amp;lt;sip:sip123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1234&amp;quot;&amp;lt;sip:sip1234@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip12345&amp;quot;&amp;lt;sip:sip12345@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1111&amp;quot;&amp;lt;sip:sip1111@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip222&amp;quot;&amp;lt;sip:sip222@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1qa2ws3ed&amp;quot;&amp;lt;sip:1qa2ws3ed@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1234asdf&amp;quot;&amp;lt;sip:1234asdf@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1a2s3d&amp;quot;&amp;lt;sip:1a2s3d@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1a2s3d4f&amp;quot;&amp;lt;sip:1a2s3d4f@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;asdzxc&amp;quot;&amp;lt;sip:asdzxc@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;123zxc&amp;quot;&amp;lt;sip:123zxc@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1234zxcv&amp;quot;&amp;lt;sip:1234zxcv@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;aazzssxx&amp;quot;&amp;lt;sip:aazzssxx@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;p@ssword&amp;quot;&amp;lt;sip:p@ssword@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;p@ssw0rd&amp;quot;&amp;lt;sip:p@ssw0rd@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;pass1&amp;quot;&amp;lt;sip:pass1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;password3&amp;quot;&amp;lt;sip:password3@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;pass12&amp;quot;&amp;lt;sip:pass12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account&amp;quot;&amp;lt;sip:account@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;passlogin&amp;quot;&amp;lt;sip:passlogin@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account1&amp;quot;&amp;lt;sip:account1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account5&amp;quot;&amp;lt;sip:account5@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account6&amp;quot;&amp;lt;sip:account6@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account123&amp;quot;&amp;lt;sip:account123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account12&amp;quot;&amp;lt;sip:account12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc1&amp;quot;&amp;lt;sip:acc1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc2&amp;quot;&amp;lt;sip:acc2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc12&amp;quot;&amp;lt;sip:acc12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
&lt;br /&gt;
One last tip: you nedd a MTA, like sendmail or postfix, in order to receive the notifications from fail2ban.&lt;br /&gt;
&lt;br /&gt;
If you have a MTA installed and properly configured, nothing else is needed, but if not, install sendmail&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install sendmail&lt;br /&gt;
&lt;br /&gt;
Then edit the /etc/hosts file and change the line &#039;&#039;&#039;192.168.80.1 dcerouter&#039;&#039;&#039; to read &#039;&#039;&#039;192.168.80.1 dcerouter.localdomain dcerouter&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Doing it, sendmail will start as expected (fast) and mail will properly delivered. If this change is not done, sendmail will take a long time to start, because it does not find the qualified host name, as the log shows:&lt;br /&gt;
&lt;br /&gt;
 Sep 27 13:12:11 dcerouter sendmail[10585]: My unqualified host name (dcerouter) unknown; sleeping for retry&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I hope this helps.&lt;br /&gt;
&lt;br /&gt;
source: &lt;br /&gt;
 http://www.fail2ban.org&lt;br /&gt;
 http://www.voip-info.org/wiki/view/Fail2Ban+(with+iptables)+And+Asterisk&lt;br /&gt;
 http://www.fail2ban.org/wiki/index.php/Asterisk&lt;/div&gt;</summary>
		<author><name>Pw44</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=Fail2ban_-_A_tool_against_brute_force&amp;diff=25169</id>
		<title>Fail2ban - A tool against brute force</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=Fail2ban_-_A_tool_against_brute_force&amp;diff=25169"/>
		<updated>2010-09-27T16:32:17Z</updated>

		<summary type="html">&lt;p&gt;Pw44: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: Tutorials]]&lt;br /&gt;
&lt;br /&gt;
Having asterik installed is almost an invitation for others wishing to place calls at your expense.&lt;br /&gt;
&lt;br /&gt;
After configuring my sip trunk, it did not take 2 days and some &amp;quot;smart guy&amp;quot;  was trying to register to take advantage of it, and causing me losses.&lt;br /&gt;
&lt;br /&gt;
Fail2ban prevented it, blocking the attacker with iptables rules.&lt;br /&gt;
&lt;br /&gt;
Installing fail2ban is not complicated and i will describe the steps to have it properly installed and configured, so you can protect your asterisk and other services from brute force attack.&lt;br /&gt;
&lt;br /&gt;
Install with: &lt;br /&gt;
 sudo apt-get install fail2ban&lt;br /&gt;
&lt;br /&gt;
After is installed, you need to change /etc/asterisk/logger.conf and add the following line under [general] section (You may have to create this before the [logfiles] section). &lt;br /&gt;
&lt;br /&gt;
 [general]&lt;br /&gt;
 dateformat=%F %T&lt;br /&gt;
&lt;br /&gt;
In /etc/asterisk/logger.conf add the following line under the [logfiles] section for asterisk to log NOTICE level events to the syslog (/var/log/messages) as well as its normal log file. These entries in syslog will have a Date/Time stamp that is usable by fail2ban.&lt;br /&gt;
&lt;br /&gt;
 syslog.local0 =&amp;gt; notice &lt;br /&gt;
&lt;br /&gt;
Reload asterisk with:&lt;br /&gt;
&lt;br /&gt;
 asterisk -rx &amp;quot;logger reload&amp;quot; &lt;br /&gt;
&lt;br /&gt;
Configuring fail2ban:&lt;br /&gt;
&lt;br /&gt;
 cd /etc/fail2ban/filter.d&lt;br /&gt;
&lt;br /&gt;
 touch asterisk.conf &lt;br /&gt;
&lt;br /&gt;
 vi asterisk.conf&lt;br /&gt;
&lt;br /&gt;
insert the following (copy &amp;amp; paste)&lt;br /&gt;
&lt;br /&gt;
 # Fail2Ban configuration file&lt;br /&gt;
 #&lt;br /&gt;
 #&lt;br /&gt;
 # $Revision: 250 $&lt;br /&gt;
 #&lt;br /&gt;
 [INCLUDES]&lt;br /&gt;
 # Read common prefixes. If any customizations available -- read them from&lt;br /&gt;
 # common.local&lt;br /&gt;
 #before = common.conf&lt;br /&gt;
 [Definition]&lt;br /&gt;
 #_daemon = asterisk&lt;br /&gt;
 # Option:  failregex&lt;br /&gt;
 # Notes.:  regex to match the password failures messages in the logfile. The&lt;br /&gt;
 #          host must be matched by a group named &amp;quot;host&amp;quot;. The tag &amp;quot;&amp;lt;HOST&amp;gt;&amp;quot; can&lt;br /&gt;
 #          be used for standard IP/hostname matching and is only an alias for&lt;br /&gt;
 #          (?:::f{4,6}:)?(?P&amp;lt;host&amp;gt;\S+)&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 failregex = NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Wrong password&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - No matching peer found&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Username/auth name mismatch&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Device does not match ACL&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&amp;quot; .* failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Peer is not supposed to register&lt;br /&gt;
             NOTICE.* &amp;lt;HOST&amp;gt; failed to authenticate as &#039;.*&#039;$&lt;br /&gt;
             NOTICE.* .*: No registration for peer &#039;.*&#039; \(from &amp;lt;HOST&amp;gt;\)&lt;br /&gt;
             NOTICE.* .*: Host &amp;lt;HOST&amp;gt; failed MD5 authentication for &#039;.*&#039; (.*)&lt;br /&gt;
             NOTICE.* .*: Failed to authenticate user .*@&amp;lt;HOST&amp;gt;.*&lt;br /&gt;
 # Option:  ignoreregex&lt;br /&gt;
 # Notes.:  regex to ignore. If this regex matches, the line is ignored.&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 ignoreregex =&lt;br /&gt;
&lt;br /&gt;
Next edit /etc/fail2ban/jail.conf to include the following section so that it uses the new filter. &lt;br /&gt;
&lt;br /&gt;
 [asterisk-iptables]&lt;br /&gt;
 enabled  = true&lt;br /&gt;
 filter   = asterisk&lt;br /&gt;
 action   = iptables-allports[name=ASTERISK, protocol=all]&lt;br /&gt;
            sendmail-whois[name=ASTERISK, dest=root, sender=fail2ban@example.org]&lt;br /&gt;
 logpath  = /var/log/asterisk/full&lt;br /&gt;
 maxretry = 2&lt;br /&gt;
 bantime = 259200&lt;br /&gt;
&lt;br /&gt;
Locate the line ignoreip in /etc/fail2ban/jail.conf (beginning of the file) and insert the ip&#039;s and / or blocks you want fail2ban to ignore, so you don&#039;t risk banning yourserf or any host in your network.&lt;br /&gt;
&lt;br /&gt;
Mine is defined as follows:&lt;br /&gt;
&lt;br /&gt;
 [DEFAULT]&lt;br /&gt;
 # &amp;quot;ignoreip&amp;quot; can be an IP address, a CIDR mask or a DNS host. Fail2ban will not&lt;br /&gt;
 # ban a host which matches an address in this list. Several addresses can be   &lt;br /&gt;
 # defined using space separator.                                               &lt;br /&gt;
 ignoreip = 127.0.0.1 192.168.80.1 192.168.80.0 192.168.0.0&lt;br /&gt;
&lt;br /&gt;
To start fail2ban type the following as root:&lt;br /&gt;
&lt;br /&gt;
 /etc/init.d/fail2ban start&lt;br /&gt;
&lt;br /&gt;
Check It&lt;br /&gt;
&lt;br /&gt;
For LinuxMCE, there is needed &amp;quot;patch&amp;quot;, while fail2ban is not part of the distribution.&lt;br /&gt;
&lt;br /&gt;
When LinuxMCE starts, it runs /usr/pluto/bin/Network_Firewall.sh, and this is done AFTER /etc/init.d/fail2ban is run.&lt;br /&gt;
&lt;br /&gt;
So, edit /usr/pluto/bin/Network_Firewall.sh and add the following at the END of this file:&lt;br /&gt;
 &lt;br /&gt;
 /etc/init.d/fail2ban restart&lt;br /&gt;
&lt;br /&gt;
This will make sure that fail2bain is started AFTER the iptables rules from LinuxMCE.&lt;br /&gt;
&lt;br /&gt;
If started properly issue the following command to view your iptables rules:&lt;br /&gt;
&lt;br /&gt;
 iptables -L -v&lt;br /&gt;
&lt;br /&gt;
You should see something like the following for the INPUT chain (this is the ouput of mine)&lt;br /&gt;
&lt;br /&gt;
 Chain INPUT (policy DROP 2241 packets, 160K bytes)              &lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination         &lt;br /&gt;
   372 27264 &#039;&#039;&#039;fail2ban-SSH&#039;&#039;&#039;  tcp  --  any    any     anywhere             anywhere            tcp dpt:ssh                                                                                          &lt;br /&gt;
 1312K  991M &#039;&#039;&#039;fail2ban-ASTERISK&#039;&#039;&#039;  all  --  any    any     anywhere             anywhere            &lt;br /&gt;
  553K   81M ACCEPT     all  --  lo     any     anywhere             anywhere                    &lt;br /&gt;
 1288K 1162M ACCEPT     all  --  any    any     anywhere             anywhere            state RELATED,ESTABLISHED                                                                               &lt;br /&gt;
     9   540 ACCEPT     all  --  any    any     anywhere             anywhere            MARK match 0x1                                                                                          &lt;br /&gt;
     2  1152 ACCEPT     udp  --  any    any     anywhere             anywhere            udp   dpt:bootps                                                                                          &lt;br /&gt;
 19276 5790K ACCEPT     all  --  any    any     192.168.80.0/24      anywhere                    &lt;br /&gt;
     0     0 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:iax                                                                                             &lt;br /&gt;
     4  1795 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:sip                                                                                             &lt;br /&gt;
     0     0 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:2000                                                                                            &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:sieve                                                                                           &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:1723                                                                                            &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:www                                                                                             &lt;br /&gt;
     1    60 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:ssh                                                                                             &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:https                                                                                           &lt;br /&gt;
     1    50 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpts:10001:20000&lt;br /&gt;
     0     0 ACCEPT     gre  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain FORWARD (policy ACCEPT 719K packets, 245M bytes)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
     0     0 TCPMSS     tcp  --  any    ppp+    anywhere             anywhere            tcp flags:SYN,RST/SYN TCPMSS clamp to PMTU&lt;br /&gt;
 Chain OUTPUT (policy ACCEPT 2099K packets, 590M bytes)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
     0     0 ACCEPT     gre  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain fail2ban-ASTERISK (1 references)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
  5091 2125K DROP       all  --  any    any     173.193.194.106-static.reverse.softlayer.com  anywhere&lt;br /&gt;
 1307K  989M RETURN     all  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain fail2ban-SSH (1 references)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
&lt;br /&gt;
If you do not see something similar to that then you have some troubleshooting to, check out /var/log/fail2ban.log.&lt;br /&gt;
&lt;br /&gt;
Example of my /var/log/fai2ban.log (173.193.194.106 is the real address from the attacker fail2ban banned):&lt;br /&gt;
&lt;br /&gt;
 ....&lt;br /&gt;
 2010-09-19 11:12:56,131 fail2ban.filter : INFO   Set maxRetry = 6&lt;br /&gt;
 2010-09-19 11:12:56,133 fail2ban.filter : INFO   Set findtime = 600&lt;br /&gt;
 2010-09-19 11:12:56,133 fail2ban.actions: INFO   Set banTime = 600&lt;br /&gt;
 2010-09-19 11:12:56,138 fail2ban.jail   : INFO   Jail &#039;ssh-iptables&#039; started&lt;br /&gt;
 2010-09-19 11:12:56,139 fail2ban.jail   : INFO   Jail &#039;asterisk-iptables&#039; started&lt;br /&gt;
 2010-09-19 11:12:56,141 fail2ban.jail   : INFO   Jail &#039;apache-tcpwrapper&#039; started&lt;br /&gt;
 2010-09-19 15:33:50,392 fail2ban.actions: WARNING [asterisk-iptables] Ban 173.193.194.106&lt;br /&gt;
 2010-09-19 15:34:50,982 fail2ban.actions: WARNING [asterisk-iptables] 173.193.194.106 already banned&lt;br /&gt;
&lt;br /&gt;
And this is the log (/var/log/asterisk/messages) showing the attack:&lt;br /&gt;
&lt;br /&gt;
 [2010-09-19 15:33:48] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;3235410554&amp;quot;&amp;lt;sip:3235410554@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                           &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;thomas&amp;quot;&amp;lt;sip:thomas@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;arsenal&amp;quot;&amp;lt;sip:arsenal@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;letmein&amp;quot;&amp;lt;sip:letmein@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;liverpool&amp;quot;&amp;lt;sip:liverpool@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;nevermind&amp;quot;&amp;lt;sip:nevermind@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;getmein&amp;quot;&amp;lt;sip:getmein@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;echo&amp;quot;&amp;lt;sip:echo@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;bmw325&amp;quot;&amp;lt;sip:bmw325@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;bmw335&amp;quot;&amp;lt;sip:bmw335@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w3e&amp;quot;&amp;lt;sip:1q2w3e@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w3e4r5t6y&amp;quot;&amp;lt;sip:1q2w3e4r5t6y@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q1q2w2w&amp;quot;&amp;lt;sip:1q1q2w2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w1q2w&amp;quot;&amp;lt;sip:1q2w1q2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w&amp;quot;&amp;lt;sip:1q2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;11q22w&amp;quot;&amp;lt;sip:11q22w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;q1w2&amp;quot;&amp;lt;sip:q1w2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;q1w2e3&amp;quot;&amp;lt;sip:q1w2e3@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;tvv03tvv03&amp;quot;&amp;lt;sip:tvv03tvv03@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                           &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd1&amp;quot;&amp;lt;sip:abcd1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd12&amp;quot;&amp;lt;sip:abcd12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd123&amp;quot;&amp;lt;sip:abcd123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;qq11ww22ee33rr44&amp;quot;&amp;lt;sip:qq11ww22ee33rr44@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1&amp;quot;&amp;lt;sip:sip1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip2&amp;quot;&amp;lt;sip:sip2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip12&amp;quot;&amp;lt;sip:sip12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip123&amp;quot;&amp;lt;sip:sip123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1234&amp;quot;&amp;lt;sip:sip1234@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip12345&amp;quot;&amp;lt;sip:sip12345@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1111&amp;quot;&amp;lt;sip:sip1111@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip222&amp;quot;&amp;lt;sip:sip222@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1qa2ws3ed&amp;quot;&amp;lt;sip:1qa2ws3ed@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1234asdf&amp;quot;&amp;lt;sip:1234asdf@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1a2s3d&amp;quot;&amp;lt;sip:1a2s3d@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1a2s3d4f&amp;quot;&amp;lt;sip:1a2s3d4f@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;asdzxc&amp;quot;&amp;lt;sip:asdzxc@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;123zxc&amp;quot;&amp;lt;sip:123zxc@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1234zxcv&amp;quot;&amp;lt;sip:1234zxcv@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;aazzssxx&amp;quot;&amp;lt;sip:aazzssxx@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;p@ssword&amp;quot;&amp;lt;sip:p@ssword@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;p@ssw0rd&amp;quot;&amp;lt;sip:p@ssw0rd@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;pass1&amp;quot;&amp;lt;sip:pass1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;password3&amp;quot;&amp;lt;sip:password3@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;pass12&amp;quot;&amp;lt;sip:pass12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account&amp;quot;&amp;lt;sip:account@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;passlogin&amp;quot;&amp;lt;sip:passlogin@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account1&amp;quot;&amp;lt;sip:account1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account5&amp;quot;&amp;lt;sip:account5@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account6&amp;quot;&amp;lt;sip:account6@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account123&amp;quot;&amp;lt;sip:account123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account12&amp;quot;&amp;lt;sip:account12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc1&amp;quot;&amp;lt;sip:acc1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc2&amp;quot;&amp;lt;sip:acc2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc12&amp;quot;&amp;lt;sip:acc12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
&lt;br /&gt;
One last tip: you nedd a MTA, like sendmail or postfix, in order to receive the notifications from fail2ban.&lt;br /&gt;
&lt;br /&gt;
If you have a MTA installed and properly configured, nothing else is needed, but if not, install sendmail&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install sendmail&lt;br /&gt;
&lt;br /&gt;
Then edit the /etc/hosts file and change the line &#039;&#039;&#039;192.168.80.1 dcerouter&#039;&#039;&#039; to read &#039;&#039;&#039;192.168.80.1 dcerouter.localdomain dcerouter&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Doing it, sendmail will start as expected (fast) and mail will properly delivered. If this change is not done, sendmail will take a long time to start, because it does not find the qualified host name, as the log shows:&lt;br /&gt;
&lt;br /&gt;
 Sep 27 13:12:11 dcerouter sendmail[10585]: My unqualified host name (dcerouter) unknown; sleeping for retry&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I hope this helps.&lt;br /&gt;
&lt;br /&gt;
source: &lt;br /&gt;
 http://www.fail2ban.org&lt;br /&gt;
 http://www.voip-info.org/wiki/view/Fail2Ban+(with+iptables)+And+Asterisk&lt;br /&gt;
 http://www.fail2ban.org/wiki/index.php/Asterisk&lt;/div&gt;</summary>
		<author><name>Pw44</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=Fail2ban_-_A_tool_against_brute_force&amp;diff=25094</id>
		<title>Fail2ban - A tool against brute force</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=Fail2ban_-_A_tool_against_brute_force&amp;diff=25094"/>
		<updated>2010-09-20T16:22:26Z</updated>

		<summary type="html">&lt;p&gt;Pw44: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: Tutorials]]&lt;br /&gt;
&lt;br /&gt;
Having asterik installed is almost an invitation for others wishing to place calls at your expense.&lt;br /&gt;
&lt;br /&gt;
After configuring my sip trunk, it did not take 2 days and some &amp;quot;smart guy&amp;quot;  was trying to register to take advantage of it, and causing me losses.&lt;br /&gt;
&lt;br /&gt;
Fail2ban prevented it, blocking the attacker with iptables rules.&lt;br /&gt;
&lt;br /&gt;
Installing fail2ban is not complicated and i will describe the steps to have it properly installed and configured, so you can protect your asterisk and other services from brute force attack.&lt;br /&gt;
&lt;br /&gt;
Install with: &lt;br /&gt;
 sudo apt-get install fail2ban&lt;br /&gt;
&lt;br /&gt;
After is installed, you need to change /etc/asterisk/logger.conf and add the following line under [general] section (You may have to create this before the [logfiles] section). &lt;br /&gt;
&lt;br /&gt;
 [general]&lt;br /&gt;
 dateformat=%F %T&lt;br /&gt;
&lt;br /&gt;
In /etc/asterisk/logger.conf add the following line under the [logfiles] section for asterisk to log NOTICE level events to the syslog (/var/log/messages) as well as its normal log file. These entries in syslog will have a Date/Time stamp that is usable by fail2ban.&lt;br /&gt;
&lt;br /&gt;
 syslog.local0 =&amp;gt; notice &lt;br /&gt;
&lt;br /&gt;
Reload asterisk with:&lt;br /&gt;
&lt;br /&gt;
 asterisk -rx &amp;quot;logger reload&amp;quot; &lt;br /&gt;
&lt;br /&gt;
Configuring fail2ban:&lt;br /&gt;
&lt;br /&gt;
 cd /etc/fail2ban/filter.d&lt;br /&gt;
&lt;br /&gt;
 touch asterisk.conf &lt;br /&gt;
&lt;br /&gt;
 vi asterisk.conf&lt;br /&gt;
&lt;br /&gt;
insert the following (copy &amp;amp; paste)&lt;br /&gt;
&lt;br /&gt;
 # Fail2Ban configuration file&lt;br /&gt;
 #&lt;br /&gt;
 #&lt;br /&gt;
 # $Revision: 250 $&lt;br /&gt;
 #&lt;br /&gt;
 [INCLUDES]&lt;br /&gt;
 # Read common prefixes. If any customizations available -- read them from&lt;br /&gt;
 # common.local&lt;br /&gt;
 #before = common.conf&lt;br /&gt;
 [Definition]&lt;br /&gt;
 #_daemon = asterisk&lt;br /&gt;
 # Option:  failregex&lt;br /&gt;
 # Notes.:  regex to match the password failures messages in the logfile. The&lt;br /&gt;
 #          host must be matched by a group named &amp;quot;host&amp;quot;. The tag &amp;quot;&amp;lt;HOST&amp;gt;&amp;quot; can&lt;br /&gt;
 #          be used for standard IP/hostname matching and is only an alias for&lt;br /&gt;
 #          (?:::f{4,6}:)?(?P&amp;lt;host&amp;gt;\S+)&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 failregex = NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Wrong password&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - No matching peer found&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Username/auth name mismatch&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Device does not match ACL&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&amp;quot; .* failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Peer is not supposed to register&lt;br /&gt;
             NOTICE.* &amp;lt;HOST&amp;gt; failed to authenticate as &#039;.*&#039;$&lt;br /&gt;
             NOTICE.* .*: No registration for peer &#039;.*&#039; \(from &amp;lt;HOST&amp;gt;\)&lt;br /&gt;
             NOTICE.* .*: Host &amp;lt;HOST&amp;gt; failed MD5 authentication for &#039;.*&#039; (.*)&lt;br /&gt;
             NOTICE.* .*: Failed to authenticate user .*@&amp;lt;HOST&amp;gt;.*&lt;br /&gt;
 # Option:  ignoreregex&lt;br /&gt;
 # Notes.:  regex to ignore. If this regex matches, the line is ignored.&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 ignoreregex =&lt;br /&gt;
&lt;br /&gt;
Next edit /etc/fail2ban/jail.conf to include the following section so that it uses the new filter. &lt;br /&gt;
&lt;br /&gt;
 [asterisk-iptables]&lt;br /&gt;
 enabled  = true&lt;br /&gt;
 filter   = asterisk&lt;br /&gt;
 action   = iptables-allports[name=ASTERISK, protocol=all]&lt;br /&gt;
            sendmail-whois[name=ASTERISK, dest=root, sender=fail2ban@example.org]&lt;br /&gt;
 logpath  = /var/log/asterisk/full&lt;br /&gt;
 maxretry = 2&lt;br /&gt;
 bantime = 259200&lt;br /&gt;
&lt;br /&gt;
Locate the line ignoreip in /etc/fail2ban/jail.conf (beginning of the file) and insert the ip&#039;s and / or blocks you want fail2ban to ignore, so you don&#039;t risk banning yourserf or any host in your network.&lt;br /&gt;
&lt;br /&gt;
Mine is defined as follows:&lt;br /&gt;
&lt;br /&gt;
 [DEFAULT]&lt;br /&gt;
 # &amp;quot;ignoreip&amp;quot; can be an IP address, a CIDR mask or a DNS host. Fail2ban will not&lt;br /&gt;
 # ban a host which matches an address in this list. Several addresses can be   &lt;br /&gt;
 # defined using space separator.                                               &lt;br /&gt;
 ignoreip = 127.0.0.1 192.168.80.1 192.168.80.0 192.168.0.0&lt;br /&gt;
&lt;br /&gt;
To start fail2ban type the following as root:&lt;br /&gt;
&lt;br /&gt;
/etc/init.d/fail2ban start&lt;br /&gt;
&lt;br /&gt;
Check It&lt;br /&gt;
&lt;br /&gt;
If started properly issue the following command to view your iptables rules:&lt;br /&gt;
&lt;br /&gt;
 iptables -L -v&lt;br /&gt;
&lt;br /&gt;
You should see something like the following for the INPUT chain (this is the ouput of mine)&lt;br /&gt;
&lt;br /&gt;
 Chain INPUT (policy DROP 2241 packets, 160K bytes)              &lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination         &lt;br /&gt;
   372 27264 &#039;&#039;&#039;fail2ban-SSH&#039;&#039;&#039;  tcp  --  any    any     anywhere             anywhere            tcp dpt:ssh                                                                                          &lt;br /&gt;
 1312K  991M &#039;&#039;&#039;fail2ban-ASTERISK&#039;&#039;&#039;  all  --  any    any     anywhere             anywhere            &lt;br /&gt;
  553K   81M ACCEPT     all  --  lo     any     anywhere             anywhere                    &lt;br /&gt;
 1288K 1162M ACCEPT     all  --  any    any     anywhere             anywhere            state RELATED,ESTABLISHED                                                                               &lt;br /&gt;
     9   540 ACCEPT     all  --  any    any     anywhere             anywhere            MARK match 0x1                                                                                          &lt;br /&gt;
     2  1152 ACCEPT     udp  --  any    any     anywhere             anywhere            udp   dpt:bootps                                                                                          &lt;br /&gt;
 19276 5790K ACCEPT     all  --  any    any     192.168.80.0/24      anywhere                    &lt;br /&gt;
     0     0 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:iax                                                                                             &lt;br /&gt;
     4  1795 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:sip                                                                                             &lt;br /&gt;
     0     0 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:2000                                                                                            &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:sieve                                                                                           &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:1723                                                                                            &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:www                                                                                             &lt;br /&gt;
     1    60 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:ssh                                                                                             &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:https                                                                                           &lt;br /&gt;
     1    50 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpts:10001:20000&lt;br /&gt;
     0     0 ACCEPT     gre  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain FORWARD (policy ACCEPT 719K packets, 245M bytes)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
     0     0 TCPMSS     tcp  --  any    ppp+    anywhere             anywhere            tcp flags:SYN,RST/SYN TCPMSS clamp to PMTU&lt;br /&gt;
 Chain OUTPUT (policy ACCEPT 2099K packets, 590M bytes)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
     0     0 ACCEPT     gre  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain fail2ban-ASTERISK (1 references)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
  5091 2125K DROP       all  --  any    any     173.193.194.106-static.reverse.softlayer.com  anywhere&lt;br /&gt;
 1307K  989M RETURN     all  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain fail2ban-SSH (1 references)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
&lt;br /&gt;
If you do not see something similar to that then you have some troubleshooting to, check out /var/log/fail2ban.log.&lt;br /&gt;
&lt;br /&gt;
Example of my /var/log/fai2ban.log (173.193.194.106 is the real address from the attacker fail2ban banned):&lt;br /&gt;
&lt;br /&gt;
 ....&lt;br /&gt;
 2010-09-19 11:12:56,131 fail2ban.filter : INFO   Set maxRetry = 6&lt;br /&gt;
 2010-09-19 11:12:56,133 fail2ban.filter : INFO   Set findtime = 600&lt;br /&gt;
 2010-09-19 11:12:56,133 fail2ban.actions: INFO   Set banTime = 600&lt;br /&gt;
 2010-09-19 11:12:56,138 fail2ban.jail   : INFO   Jail &#039;ssh-iptables&#039; started&lt;br /&gt;
 2010-09-19 11:12:56,139 fail2ban.jail   : INFO   Jail &#039;asterisk-iptables&#039; started&lt;br /&gt;
 2010-09-19 11:12:56,141 fail2ban.jail   : INFO   Jail &#039;apache-tcpwrapper&#039; started&lt;br /&gt;
 2010-09-19 15:33:50,392 fail2ban.actions: WARNING [asterisk-iptables] Ban 173.193.194.106&lt;br /&gt;
 2010-09-19 15:34:50,982 fail2ban.actions: WARNING [asterisk-iptables] 173.193.194.106 already banned&lt;br /&gt;
&lt;br /&gt;
And this is the log (/var/log/asterisk/messages) showing the attack:&lt;br /&gt;
&lt;br /&gt;
 [2010-09-19 15:33:48] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;3235410554&amp;quot;&amp;lt;sip:3235410554@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                           &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;thomas&amp;quot;&amp;lt;sip:thomas@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;arsenal&amp;quot;&amp;lt;sip:arsenal@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;letmein&amp;quot;&amp;lt;sip:letmein@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;liverpool&amp;quot;&amp;lt;sip:liverpool@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;nevermind&amp;quot;&amp;lt;sip:nevermind@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;getmein&amp;quot;&amp;lt;sip:getmein@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;echo&amp;quot;&amp;lt;sip:echo@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;bmw325&amp;quot;&amp;lt;sip:bmw325@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;bmw335&amp;quot;&amp;lt;sip:bmw335@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w3e&amp;quot;&amp;lt;sip:1q2w3e@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w3e4r5t6y&amp;quot;&amp;lt;sip:1q2w3e4r5t6y@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q1q2w2w&amp;quot;&amp;lt;sip:1q1q2w2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w1q2w&amp;quot;&amp;lt;sip:1q2w1q2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w&amp;quot;&amp;lt;sip:1q2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;11q22w&amp;quot;&amp;lt;sip:11q22w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;q1w2&amp;quot;&amp;lt;sip:q1w2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;q1w2e3&amp;quot;&amp;lt;sip:q1w2e3@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;tvv03tvv03&amp;quot;&amp;lt;sip:tvv03tvv03@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                           &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd1&amp;quot;&amp;lt;sip:abcd1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd12&amp;quot;&amp;lt;sip:abcd12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd123&amp;quot;&amp;lt;sip:abcd123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;qq11ww22ee33rr44&amp;quot;&amp;lt;sip:qq11ww22ee33rr44@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1&amp;quot;&amp;lt;sip:sip1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip2&amp;quot;&amp;lt;sip:sip2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip12&amp;quot;&amp;lt;sip:sip12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip123&amp;quot;&amp;lt;sip:sip123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1234&amp;quot;&amp;lt;sip:sip1234@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip12345&amp;quot;&amp;lt;sip:sip12345@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1111&amp;quot;&amp;lt;sip:sip1111@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip222&amp;quot;&amp;lt;sip:sip222@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1qa2ws3ed&amp;quot;&amp;lt;sip:1qa2ws3ed@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1234asdf&amp;quot;&amp;lt;sip:1234asdf@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1a2s3d&amp;quot;&amp;lt;sip:1a2s3d@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1a2s3d4f&amp;quot;&amp;lt;sip:1a2s3d4f@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;asdzxc&amp;quot;&amp;lt;sip:asdzxc@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;123zxc&amp;quot;&amp;lt;sip:123zxc@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1234zxcv&amp;quot;&amp;lt;sip:1234zxcv@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;aazzssxx&amp;quot;&amp;lt;sip:aazzssxx@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;p@ssword&amp;quot;&amp;lt;sip:p@ssword@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;p@ssw0rd&amp;quot;&amp;lt;sip:p@ssw0rd@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;pass1&amp;quot;&amp;lt;sip:pass1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;password3&amp;quot;&amp;lt;sip:password3@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;pass12&amp;quot;&amp;lt;sip:pass12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account&amp;quot;&amp;lt;sip:account@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;passlogin&amp;quot;&amp;lt;sip:passlogin@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account1&amp;quot;&amp;lt;sip:account1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account5&amp;quot;&amp;lt;sip:account5@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account6&amp;quot;&amp;lt;sip:account6@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account123&amp;quot;&amp;lt;sip:account123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account12&amp;quot;&amp;lt;sip:account12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc1&amp;quot;&amp;lt;sip:acc1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc2&amp;quot;&amp;lt;sip:acc2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc12&amp;quot;&amp;lt;sip:acc12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
&lt;br /&gt;
I hope this helps.&lt;br /&gt;
&lt;br /&gt;
source: &lt;br /&gt;
 http://www.fail2ban.org&lt;br /&gt;
 http://www.voip-info.org/wiki/view/Fail2Ban+(with+iptables)+And+Asterisk&lt;br /&gt;
 http://www.fail2ban.org/wiki/index.php/Asterisk&lt;/div&gt;</summary>
		<author><name>Pw44</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=Sipgate.co.uk&amp;diff=25093</id>
		<title>Sipgate.co.uk</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=Sipgate.co.uk&amp;diff=25093"/>
		<updated>2010-09-20T13:52:06Z</updated>

		<summary type="html">&lt;p&gt;Pw44: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=SIPGATE.CO.UK=&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;CAVEAT&#039;&#039;&#039;==&lt;br /&gt;
:1)this guide is what worked for me, It is intentionally &amp;quot;dumbed down&amp;quot; because.&lt;br /&gt;
::a) I have no indepth knowledge and,&lt;br /&gt;
::b)it&#039;s intended for the totally virgin Windows&#039; refugee with negligible cli experience and limited typing skills&lt;br /&gt;
&lt;br /&gt;
:2)If it insults your intelligence, and you get nothing from it &#039;&#039;&#039;GOOD&#039;&#039;&#039;...it means you&#039;ve been lucky enough to have gained a fair amount of knowledge....&#039;&#039;&#039;USE&#039;&#039;&#039; it &amp;amp; when you&#039;ve found the answer to your problem, &#039;&#039;&#039;PLEASE&#039;&#039;&#039; come back &amp;amp; share it with us lesser mortals&lt;br /&gt;
&lt;br /&gt;
:3)All credit for any accuracy goes to Zaerc and Colinjones &lt;br /&gt;
:4)I&#039;ve cut and pasted most of the material,and hopefully credited the sources, :if not, my apologies for plaugiarising your work.&lt;br /&gt;
:5) ALL errors are mine, please do not repeat them without giving me credit   : )&lt;br /&gt;
* ASSUMPTIONS      uk user, ISP= British TelecoN, router/modem= BT.HomeHub,   dynamic IP address (section on static should work but I can&#039;t test)  ......you may have to modify for any other combination&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;&#039;&#039;&#039;PREPARE&#039;&#039;&#039;&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
::READ, READ , READ....check out  the links at the end for good starting points&lt;br /&gt;
*get fixed in your mind that &amp;quot;external ip&amp;quot;in all(?) mon-LMCE   docs means the internet isp provided ip.NOT the ip of your Hybrid&#039;s &amp;quot;external&amp;quot; nic, ie the one that connects to the router&lt;br /&gt;
*get a pen &amp;amp;paper....make a clear note of settings as you go along ...DON&#039;T trust to memory....&lt;br /&gt;
*bookmark usefull sites...open atleast four tabs in firefox for: google, pluto web admin,forums, homeHub  adminpage, and put their bookmarks on the toolbar,don&#039;t close tabs/firefox  on shutdown/reloads ....restore last session when  you restart firefox.&lt;br /&gt;
* beware of hidden html code when cutting/pasting&lt;br /&gt;
&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;GET INFO&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;voip provider&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
*google &amp;quot;free voip&amp;quot;   to find a provider, preferably free, pay as you go, free phone No. .. in your preffered region, according to your anticipated usage ..  #check out the forums at VOXILLA for uptodate good/bad guys ...&lt;br /&gt;
::I chose SIPGATE&amp;gt;CO&amp;gt;UK &#039;cos it ticked all the boxes and there is some barebones wiki material/and a ready made trunk  allready.&lt;br /&gt;
:::Register ,print off your details,.. your loginP/wd/user name for the website are NEVER used in any of this setup ...you&#039;ll need the 7 digit numeric sipID  (usernam trunk id ), 7 digit sip password, the only place the actual localDID is used is for caller  ID  ?????CHECK????&lt;br /&gt;
&lt;br /&gt;
*IF YOU CAN..-.beg, borrow, or  steal, a windows  laptop and install Xlite from  spgate/settigs/help centre--it comes pre configured, - test the connection out. ::TEST   IN and OUT  using landline/mobile ....bear in mind the Sipgate online status page is &#039;&#039;&#039;only valid at login&#039;&#039;&#039; time.so you may have to log out and back in to check your installation&#039;s registration.&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;Dynamic DNS&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
Choose a Dynamic  domain name sever provider , loads on google, get a free one,&lt;br /&gt;
*READ help/howtos&lt;br /&gt;
::(I chose DynDNS ,free , well known and it makes life a bit easier later) READ the instructions -&lt;br /&gt;
::* register -- wait for login e-mail (2 mins)&lt;br /&gt;
::* choose any (host)name for your hybrid,choose an extension  eg. homeip.net-- take the wild card option,&lt;br /&gt;
::*--set IP type either static/dynamic..set ttl according to IP type.....&lt;br /&gt;
::*find the providers test apps and follow instructions,&lt;br /&gt;
:::TEST  name resolution , &lt;br /&gt;
:::CHECK for any blocked ports, make a note of current dynamic IP address.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;BT HomeHub&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
* Does your internet connection have a static or a dynamic ip address ?&lt;br /&gt;
::If it&#039;s dynamic (most domestic BT BROADBAND)  and you don&#039;t  begrudge them the extra £5 pcm you pay for the privelige,get them to change it to static.wait for notificatin/check  in HOMEHUB  that it&#039;s in effect. It will make installation simpler, and allegedly is more reliable than alternatives.&lt;br /&gt;
::........at the same time get them to disable their own voip service, &#039;&#039;&#039;and&#039;&#039;&#039; do it yourself as well ,-if you are using their supplied HomeHub........&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
::::login =&amp;gt; advanced =&amp;gt; telephony=&amp;gt; uncheck the &amp;quot;enable telephony &amp;quot; box (no idea if the textphone option has an impact.) &lt;br /&gt;
&#039;&#039;&#039;YOU MUST disable BT BROADBAND TALK&#039;&#039;&#039;&lt;br /&gt;
:::: while youre in Hub admin, go into IP Adresses and  note the range of DHCP pool  (mine is LAN_private	192.168.1.64 - 192.168.1.237	  &amp;amp; Gateway   (your HOMEHUB ) 192.168.1.254&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;NAT&#039;&#039;&#039;===&lt;br /&gt;
::*admin/advanced/application sharing / create new game/Manual Entry of Port Maps /&lt;br /&gt;
:::&#039;&#039;&#039;name&#039;&#039;&#039;(I used &amp;quot;sipserver&amp;quot;)...   click &#039;&#039;&#039;next&#039;&#039;&#039;&lt;br /&gt;
:::: check the  new name is correct&lt;br /&gt;
&lt;br /&gt;
::::::click &#039;&#039;&#039;ENTER&#039;&#039;&#039;&lt;br /&gt;
:::fill in the boxes, as follows&lt;br /&gt;
:::::protocl UDP  from5060   to 5080   translate to  5060      Trigger protocol  ANY   Trigger  Port leave blank    ADD&lt;br /&gt;
:::::protocl UDP  from10000  to 20000  translate to  10001     Trigger protocol  ANY   Trigger  Port leave blank    ADD&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&lt;br /&gt;
CHECK SETTINGS&#039;&#039;&#039;  its a &#039;&#039;&#039;PITA&#039;&#039;&#039;to do it later&lt;br /&gt;
&lt;br /&gt;
Click &#039;&#039;&#039;APPLY&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;MISC&#039;&#039;&#039;===  &lt;br /&gt;
 &lt;br /&gt;
:GOTO  FIREWALL .. set at standard&lt;br /&gt;
:GOTO  DEVICES .. establish which entry is the HYBRID ,it SHOULD be the one at the IP youset for it earlier (if it shows a mac address, check in Pluto admin/network/network settings for a match)&lt;br /&gt;
&lt;br /&gt;
CLICK &#039;&#039;&#039;EDIT&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::CHANGE name to the hostname you picked at DynDNS earlier,just the name not the  (for e.g.  .is-a-geek.net)&lt;br /&gt;
:::GAME or SERVICE &#039;&#039;&#039; dropdown&#039;&#039;&#039; ...... pick the application  ( &amp;quot;sipserver&amp;quot;)   you created earlier..&lt;br /&gt;
CLICK &#039;&#039;&#039;ADD&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE&#039;&#039;&#039;  if you need to edit the &amp;quot;application&amp;quot; in anyway, you must first unassign it from your Hybrid, make the  alterations, then remember to reassign it to the hybrid&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=&#039;&#039;&#039;LMCE&#039;&#039;&#039;=&lt;br /&gt;
&lt;br /&gt;
:::: go into Web (pluto) admin on your core/Hybrid,login (your password is whatever you  entered as first user  during initial AV wizard)&lt;br /&gt;
&lt;br /&gt;
*-wizard/ basic/keyboard setup.. and select relevant country (if you haven&#039;t &lt;br /&gt;
allready) ../   update button&lt;br /&gt;
==Network settings==:&lt;br /&gt;
*-wizard/advanced/network/network settings .... change  radio button to use a static IP address &lt;br /&gt;
**fill in cores/Hybrids ip address as 192.165.2.X  where X is outside  the private lan dhcp pool for e.g 250 &lt;br /&gt;
:::subnetmask 255.255.255.0 &lt;br /&gt;
:::gateway/dns1/dns2  all same  as your HomeHubs address   (probably) 192.168.1.254&lt;br /&gt;
:::::::&#039;&#039;&#039;press green UPDATE button&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;Firewall&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
*- advanced/network/firewall rules... and use the boxes untill the rules look exactly like this,&lt;br /&gt;
:::::&#039;&#039;&#039;BE PATIENT &amp;amp; ACCURATE&#039;&#039;&#039; ....sometimes the progress bar seems to&lt;br /&gt;
:::::::freeze...leave it alone untill it&#039;s done it&#039;s  thing&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:udp....4569 to 0.......0...............core_input..............Delete&lt;br /&gt;
:udp....5060 to 0.......0...............core_input..............Delete&lt;br /&gt;
:udp....2000 to 0.......0...............core_input..............Delete&lt;br /&gt;
:tcp....2000 to 0.......0...............core_input..............Delete&lt;br /&gt;
:tcp....3877 to 3877....3877...192.168.80.1...port_forward......Delete&lt;br /&gt;
:udp....10001 to 20000 	0...............core_input..............Delete&lt;br /&gt;
(port 4569 is iax protocol  5060 is sip   10001to 20000 carries the audio   NB some docs say use 10000 rather than 10001&#039;&#039;&#039; don&#039;t&#039;&#039;&#039; FreePBX uses that for it&#039;s web panel&lt;br /&gt;
&lt;br /&gt;
*-wizard/restart/reload router  (not strictly necessary in this case but it is in others ,-get into the habit,- it doesn&#039;t cost you anything, besides, its time for tea/smoke /sex whatever takes your fancy.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;Phone Lines&#039;&#039;&#039;==&lt;br /&gt;
:GOTO ... pluto admin/wizard /devices/phone lines&lt;br /&gt;
*1)&#039;&#039;&#039;Check&#039;&#039;&#039; When dialing a local number, automatically prepend the area code and specify the areacode you would like to have prepended when dialing a local number, for instance  mine is 0114  (sheffield)&lt;br /&gt;
*2. &#039;&#039;&#039;Uncheck&#039;&#039;&#039; Also prepend a digit (1 for US/Canada, 0 for Europe) (also optional).&lt;br /&gt;
*3. Local Number Length 7 (the default). &lt;br /&gt;
&lt;br /&gt;
::::::Hit the &#039;&#039;&#039;Update&#039;&#039;&#039; button.&lt;br /&gt;
:Choose provider sipgate (try for free, pay as you go)&lt;br /&gt;
&lt;br /&gt;
*1. Username &amp;lt;&#039;&#039;&#039;SipID&#039;&#039;&#039; from provider....&amp;gt;&lt;br /&gt;
*2. Password &#039;&#039;&#039;SipPassword&#039;&#039;&#039;from provider&amp;gt;&lt;br /&gt;
*3. Phone number &amp;lt;&#039;&#039;&#039;SipID&#039;&#039;&#039; from provider...  AGAIN......NOT the DID ie local number.&amp;gt;&lt;br /&gt;
*4. Host  &amp;lt;sipgate.co.uk&amp;gt;&lt;br /&gt;
*5.  Hit the &#039;&#039;&#039;Submit&#039;&#039;&#039; button.&lt;br /&gt;
*6. Hit the &#039;&#039;&#039;Deactivate Automatic Configuration button&#039;&#039;&#039; and the following Yes button.&lt;br /&gt;
*7. Click the &#039;&#039;&#039;click here&#039;&#039;&#039; link (next to &amp;quot;Manual configuration activated. To configure AMP, click&amp;quot;)&lt;br /&gt;
*8. Click Trunks, and Trunk SIP/sipgate&lt;br /&gt;
*9. Under &amp;quot;Outgoing Dial Rules&amp;quot; change Dial Rules to  &lt;br /&gt;
 112&lt;br /&gt;
 999&lt;br /&gt;
 0114+XXXXXXX&lt;br /&gt;
 9|.&lt;br /&gt;
&lt;br /&gt;
:1. This will recognize 112,999, the emergency numbers&lt;br /&gt;
:2. Seven digit local numbers will get 0114 prepended.&lt;br /&gt;
:3  A nine will dial out no matter how many digits. &lt;br /&gt;
:4You now can (optionally) modify other settings to your liking as well, however do NOT change the Trunk Name (leave it at the default sipgate). When done hit &#039;&#039;&#039;Submit Changes&#039;&#039;&#039;.&lt;br /&gt;
:5Click &#039;&#039;&#039;Reload Required Apply Configuration Changes&#039;&#039;&#039;&lt;br /&gt;
: and &#039;&#039;&#039;Continue with reload.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
GOTO  Go back to pluto admin/Wizard &amp;gt; Devices &amp;gt; Phone Lines and hit the &#039;&#039;&#039;Activate Automatic Configuration button&#039;&#039;&#039;, followed by the &#039;&#039;&#039;Yes and keep my advanced settings&#039;&#039;&#039; button.&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;FreePBX&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
:GOTO ... pluto admin/wizard /advanced/config./phone setup , which puts you into FreePBX webadmin&lt;br /&gt;
&lt;br /&gt;
*CLICK  &#039;&#039;&#039;&amp;quot;TRUNKS&amp;quot;&#039;&#039;&#039; on left hand side&lt;br /&gt;
*CLICK  &#039;&#039;&#039;&amp;quot;sipgate&amp;quot;&#039;&#039;&#039; on right hand side&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;CHECK&#039;&#039;&#039; settings are as below&lt;br /&gt;
&lt;br /&gt;
PEER DETAILS&lt;br /&gt;
 allow=alaw&amp;amp;alaw&amp;amp;ulaw&amp;amp;g729&amp;amp;gsm&amp;amp;slinear&lt;br /&gt;
 auth=md5&lt;br /&gt;
 authuser=&#039;&#039;&#039;SIP ID&#039;&#039;&#039;&lt;br /&gt;
 callerid=&#039;&#039;&#039;SIP ID&#039;&#039;&#039;&lt;br /&gt;
 canreinvite=no&lt;br /&gt;
 context=from-trunk&lt;br /&gt;
 dtmfmode=inband&lt;br /&gt;
 fromdomain=&#039;&#039;&#039;sipgate.co.uk&#039;&#039;&#039;&lt;br /&gt;
 fromuser=&#039;&#039;&#039;SIP ID&#039;&#039;&#039;&lt;br /&gt;
 host=&#039;&#039;&#039;sipgate.co.uk&#039;&#039;&#039;&lt;br /&gt;
 insecure=very&lt;br /&gt;
 nat=&#039;&#039;&#039;yes&#039;&#039;&#039;&lt;br /&gt;
 qualify=no&lt;br /&gt;
 secret=&#039;&#039;&#039;SIP Pwd&#039;&#039;&#039;&lt;br /&gt;
 type=peer&lt;br /&gt;
 user=&#039;&#039;&#039;SIP ID&#039;&#039;&#039;&lt;br /&gt;
 username=&#039;&#039;&#039;SIP ID&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
USER CONTEXT&lt;br /&gt;
 &#039;&#039;&#039;SIP ID&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
USER DETAILS&lt;br /&gt;
 allow=alaw&amp;amp;alaw&amp;amp;ulaw&amp;amp;g729&amp;amp;gsm&amp;amp;slinear&lt;br /&gt;
 auth=md5&lt;br /&gt;
 authuser=&#039;&#039;&#039;SIP ID&#039;&#039;&#039;&lt;br /&gt;
 callerid=&#039;&#039;&#039;SIP ID&#039;&#039;&#039;&lt;br /&gt;
 canreinvite=no&lt;br /&gt;
 context=from-trunk&lt;br /&gt;
 dtmfmode=inband&lt;br /&gt;
 fromdomain=&#039;&#039;&#039;sipgate.co.uk&#039;&#039;&#039;&lt;br /&gt;
 fromuser=&#039;&#039;&#039;SIP ID&#039;&#039;&#039;&lt;br /&gt;
 host=&#039;&#039;&#039;sipgate.co.uk&#039;&#039;&#039;&lt;br /&gt;
 insecure=very&lt;br /&gt;
 nat=&#039;&#039;&#039;yes&#039;&#039;&#039;&lt;br /&gt;
 qualify=no&lt;br /&gt;
 secret=&#039;&#039;&#039;SIP Pwd&#039;&#039;&#039;&lt;br /&gt;
 type=user&lt;br /&gt;
 user=&#039;&#039;&#039;SIP ID&#039;&#039;&#039;&lt;br /&gt;
 username=&#039;&#039;&#039;SIP ID&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
REGISTER STRING&lt;br /&gt;
 &#039;&#039;&#039;SIP ID:SIP password@sipgate.co.uk/SIP ID&lt;br /&gt;
&#039;&#039;&#039;&lt;br /&gt;
:::click &#039;&#039;&#039;submit button&#039;&#039;&#039;&lt;br /&gt;
::::then..&lt;br /&gt;
:::click&#039;&#039;&#039;orange config bar&#039;&#039;&#039; at top of page&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;make sure&#039;&#039;&#039; pluto admin/advanced/configuration/phones setup.....&lt;br /&gt;
FreePBX...../outbound route / 0sipgate           settings    are as below&lt;br /&gt;
&lt;br /&gt;
...trunk sequence    0  (drop down =) &#039;&#039;&#039;SIP/sipgate&#039;&#039;&#039;&lt;br /&gt;
:::click &#039;&#039;&#039;submit button&#039;&#039;&#039;&lt;br /&gt;
::::then..&lt;br /&gt;
:::click&#039;&#039;&#039;orange config bar&#039;&#039;&#039; at top of page&lt;br /&gt;
&lt;br /&gt;
=&#039;&#039;&#039;Asterisk&#039;&#039;&#039;=&lt;br /&gt;
&lt;br /&gt;
[(RIP-OFF FROM)    &amp;lt;nowiki&amp;gt;freepbx.org/support/documentation/howtos/howto-resolving-audio-problems]&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;DYNAMIC ADDRESS&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
####NEED TO CHECK/change  file  PERMISSIONS     ????HOW&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Once you get a DynDNS or other address that identifies your system on the Internet, put it in your etc/hosts file. For example, if you are assigned foo.dyndns.net, then open etc/hosts in your favorite text editor &lt;br /&gt;
(I use joe...it&#039;s very simple....konsole/...........sudoapt-get install joe)&lt;br /&gt;
::::* joe /etc/hosts&lt;br /&gt;
&lt;br /&gt;
:::::::(use  UP, DOWN, LEFT RIGHT arrows to navigate,  Ctrl k x to save  Ctrl h for help)&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;127.0.0.1 localhost&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DO NOT REMOVE OR CHANGE THAT LINE.&#039;&#039;&#039; On a NEW line directly underneath it, place this line:&lt;br /&gt;
&#039;&#039;&#039;&lt;br /&gt;
127.0.0.1 foo.dyndns.net&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
But substitute &#039;&#039;&#039;YOUR address&#039;&#039;&#039;, of course......&lt;br /&gt;
&lt;br /&gt;
:::::&#039;&#039;&#039;save &amp;amp; exit&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Add some information to your /etc/asterisk/sip_nat.conf file&lt;br /&gt;
&lt;br /&gt;
####NEED TO CHECK PERMISSIONS     ????HOW&lt;br /&gt;
&lt;br /&gt;
sudo joe /etc/asterisk/sip_nat.conf..................(your password is linuxmce)&lt;br /&gt;
 &lt;br /&gt;
 nat=yes&lt;br /&gt;
 externhost=YOUR FULL DynDNS  address e.g  dummy.is-a-geek.net&lt;br /&gt;
 externrefresh=10&lt;br /&gt;
 localnet=192.168.80.0/255.255.255.0&lt;br /&gt;
&lt;br /&gt;
:::::&#039;&#039;&#039;save and exit&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;STATIC ADDRESS&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Make use that your system knows its own name.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
####NEED TO CHECK/change  file  PERMISSIONS     ????HOW&lt;br /&gt;
&lt;br /&gt;
Once you get a DynDNS or other address that identifies your system on the Internet, put it in your etc/hosts file. For example, if you are assigned foo.dyndns.net, then open etc/hosts in your favorite text editor &lt;br /&gt;
I use joe...it&#039;s very simple....konsole/...........sudoapt-get install joe&lt;br /&gt;
                                 joe /etc/hosts&lt;br /&gt;
&lt;br /&gt;
(use  UP, DOWN, LEFT RIGHT arrows to navigate,  Ctrl k x to save  Ctrl h for help)&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;127.0.0.1 localhost&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DO NOT REMOVE OR CHANGE THAT LINE.&#039;&#039;&#039; On a NEW line directly underneath it, place this line:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;127.0.0.1 foo.dyndns.net&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
But substitute &#039;&#039;&#039;YOUR address&#039;&#039;&#039;, of course......save &amp;amp; exit&lt;br /&gt;
&lt;br /&gt;
Add some information to your /etc/asterisk/sip_nat.conf file&lt;br /&gt;
&lt;br /&gt;
####NEED TO CHECK PERMISSIONS     ????HOW&lt;br /&gt;
&lt;br /&gt;
 sudo joe /etc/asterisk/sip_nat.conf..................(your password is linuxmce)&lt;br /&gt;
nat=yes&lt;br /&gt;
externip=your.external.dotted.IPaddess&lt;br /&gt;
&lt;br /&gt;
fromdomain=YOUR DynDNS name in full&lt;br /&gt;
localnet=192.168.80.0/255.255.255.0&lt;br /&gt;
&lt;br /&gt;
::::&#039;&#039;&#039;save and exit&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;ALL&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
Check your  /etc/asterisk/rtp.conf file&lt;br /&gt;
&lt;br /&gt;
sudo joe /etc/asterisk/rtp.conf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It should contain these two lines:&lt;br /&gt;
&lt;br /&gt;
rtpstart=10001&lt;br /&gt;
&lt;br /&gt;
rtpend=20000&lt;br /&gt;
&lt;br /&gt;
&amp;quot;If the port values are any different, change them. N.B. These MUST match what you opened in your firewall, and DO NOT start with port 10000, because it conflicts with usage in FreePBX  Webmin &lt;br /&gt;
Some people feel the need to open fewer than 10,000 ports. I don&#039;t recommend this because six months from now when you start having audio problems you may not remember that you opened fewer than the recommended number of ports, and may spend hours troubleshooting the issue. But if you are simply obsessive about open ports, remember that each open SIP connection may require as many as FOUR concurrent ports, so don&#039;t cut it down to some ridiculously small number. For the non-paranoid, I suggest sticking with the recommendations above (and remember, if a hacker is looking at ports on your system, he&#039;s going to scan ALL of them, so having fewer UDP ports open really doesn&#039;t make you any more secure).&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
::::&#039;&#039;&#039;save &amp;amp; exit&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=&#039;&#039;&#039;Keeping Asterisk current&#039;&#039;&#039;=&lt;br /&gt;
You can use this sh script. run it from the crontab, maybe every 4 hours and on boot..&lt;br /&gt;
&lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 # get current ip of the router&lt;br /&gt;
 CURRENT_IP=`/usr/bin/lynx -dump http://www.netins.net/dialup/tools/my_ip.shtml | grep -A2 &amp;quot;Your  current IP Address is:&amp;quot; | tail -n2 | tr -d &#039; &#039;`&lt;br /&gt;
 # update the sip_nat.conf and re-read configs&lt;br /&gt;
 echo &amp;quot;externip=$CURRENT_IP&amp;quot; &amp;gt; /tmp/sip_nat.conf&lt;br /&gt;
 echo &amp;quot;localnet=192.168.80.0/255.255.255.0&amp;quot; &amp;gt;&amp;gt; /tmp/sip_nat.conf&lt;br /&gt;
 echo &amp;quot;externrefresh=5&amp;quot; &amp;gt;&amp;gt; /tmp/sip_nat.conf&lt;br /&gt;
 echo &amp;quot;localnet=192.168.80.0/255.255.255.0&amp;quot;  &amp;gt;&amp;gt; /tmp/sip_nat.conf&lt;br /&gt;
 cat /tmp/sip_nat.conf &amp;gt; /etc/asterisk/sip_nat.conf&lt;br /&gt;
 chown asterisk.asterisk /etc/asterisk/sip_nat.conf&lt;br /&gt;
 asterisk -rx reload&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
PERL SCRIPT from/www.freepbx.org/support/documentation/howtos/howto-resolving-audio-problems&lt;br /&gt;
&lt;br /&gt;
when i tried this it threw errors.....needs a linux man for this section}}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;YOU&#039;RE ALMOST DONE !&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
exit Konsole&lt;br /&gt;
 GOTO ... pluto admin/wizard /advanced/config./phone setup&lt;br /&gt;
&lt;br /&gt;
if the orange bar is showing in FreePBX &#039;&#039;&#039;click it&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
GOTO        pluto admin/wizard/restart/ &#039;&#039;&#039;click reboot&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
GET TEA...(smoke/ have sex etc)&lt;br /&gt;
&lt;br /&gt;
pickup cell/landline&lt;br /&gt;
dial the local number sipgate gave you.....the rest , if it works should be obvious&lt;br /&gt;
&lt;br /&gt;
==TROUBLESHOOTING==&lt;br /&gt;
&lt;br /&gt;
if it does&#039;nt work&lt;br /&gt;
{A   run perl checkip.pl}&lt;br /&gt;
&lt;br /&gt;
1  check your ISP hasn&#039;t changed your IP address&lt;br /&gt;
2  check everything, form square one   for typos&lt;br /&gt;
3  goto Dyndns and run their name resolver&lt;br /&gt;
4  consider posting in user forum-- AFTER you&#039;ve had a break, freshened up, and RECHECKED EVERYTHING CAREFULLY&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;ONCE YOU&#039;RE RUNNING&#039;&#039;&#039;==&lt;br /&gt;
TEST TEST TEST&lt;br /&gt;
*read up on dial plans and tweak to your own desires&lt;br /&gt;
*read up on extensions/mds/voicemail/IVRs and  configure to your own desires&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;PLEASE&#039;&#039;&#039; &lt;br /&gt;
*.....keep it simple and test each step as you go -it makes troubleshooting so much easier&lt;br /&gt;
*--- take notes, post/wiki any new knowledge&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;LINKS&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
BT HomeHub.........................http://www.frequencycast.co.uk/homehub.html&lt;br /&gt;
WIKI...............................http://wiki.linuxmce.org/index.php/Category:Phone_Lines&lt;br /&gt;
:::::::::::::::::::::::::::::::::::http://wiki.linuxmce.org/index.php/LinuxMCE_telecom_features&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreePBX.............................http://www.freepbx.org/support/documentation&lt;br /&gt;
other voip providers/setups.........http://www.freepbx.org/support/documentation/howtos/howto-setting-up-voip-provider-trunks&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
THE O&#039;reiley book..................http://www.digium.com/elqNow/elqRedir.htm?ref=http://downloads.oreilly.com/books/9780596510480.pdf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Telecom]]&lt;br /&gt;
[[Category: Phone Lines]]&lt;br /&gt;
[[Category: Tutorials]]&lt;br /&gt;
[[Category: VOIP Setups]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A&lt;br /&gt;
&amp;lt;nowiki&amp;gt;Insert non-formatted text here&amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Pw44</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=Sipgate.co.uk&amp;diff=25092</id>
		<title>Sipgate.co.uk</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=Sipgate.co.uk&amp;diff=25092"/>
		<updated>2010-09-20T13:48:48Z</updated>

		<summary type="html">&lt;p&gt;Pw44: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=SIPGATE.CO.UK=&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;CAVEAT&#039;&#039;&#039;==&lt;br /&gt;
:1)this guide is what worked for me, It is intentionally &amp;quot;dumbed down&amp;quot; because.&lt;br /&gt;
::a) I have no indepth knowledge and,&lt;br /&gt;
::b)it&#039;s intended for the totally virgin Windows&#039; refugee with negligible cli experience and limited typing skills&lt;br /&gt;
&lt;br /&gt;
:2)If it insults your intelligence, and you get nothing from it &#039;&#039;&#039;GOOD&#039;&#039;&#039;...it means you&#039;ve been lucky enough to have gained a fair amount of knowledge....&#039;&#039;&#039;USE&#039;&#039;&#039; it &amp;amp; when you&#039;ve found the answer to your problem, &#039;&#039;&#039;PLEASE&#039;&#039;&#039; come back &amp;amp; share it with us lesser mortals&lt;br /&gt;
&lt;br /&gt;
:3)All credit for any accuracy goes to Zaerc and Colinjones &lt;br /&gt;
:4)I&#039;ve cut and pasted most of the material,and hopefully credited the sources, :if not, my apologies for plaugiarising your work.&lt;br /&gt;
:5) ALL errors are mine, please do not repeat them without giving me credit   : )&lt;br /&gt;
* ASSUMPTIONS      uk user, ISP= British TelecoN, router/modem= BT.HomeHub,   dynamic IP address (section on static should work but I can&#039;t test)  ......you may have to modify for any other combination&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;&#039;&#039;&#039;PREPARE&#039;&#039;&#039;&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
::READ, READ , READ....check out  the links at the end for good starting points&lt;br /&gt;
*get fixed in your mind that &amp;quot;external ip&amp;quot;in all(?) mon-LMCE   docs means the internet isp provided ip.NOT the ip of your Hybrid&#039;s &amp;quot;external&amp;quot; nic, ie the one that connects to the router&lt;br /&gt;
*get a pen &amp;amp;paper....make a clear note of settings as you go along ...DON&#039;T trust to memory....&lt;br /&gt;
*bookmark usefull sites...open atleast four tabs in firefox for: google, pluto web admin,forums, homeHub  adminpage, and put their bookmarks on the toolbar,don&#039;t close tabs/firefox  on shutdown/reloads ....restore last session when  you restart firefox.&lt;br /&gt;
* beware of hidden html code when cutting/pasting&lt;br /&gt;
&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;GET INFO&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;voip provider&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
*google &amp;quot;free voip&amp;quot;   to find a provider, preferably free, pay as you go, free phone No. .. in your preffered region, according to your anticipated usage ..  #check out the forums at VOXILLA for uptodate good/bad guys ...&lt;br /&gt;
::I chose SIPGATE&amp;gt;CO&amp;gt;UK &#039;cos it ticked all the boxes and there is some barebones wiki material/and a ready made trunk  allready.&lt;br /&gt;
:::Register ,print off your details,.. your loginP/wd/user name for the website are NEVER used in any of this setup ...you&#039;ll need the 7 digit numeric sipID  (usernam trunk id ), 7 digit sip password, the only place the actual localDID is used is for caller  ID  ?????CHECK????&lt;br /&gt;
&lt;br /&gt;
*IF YOU CAN..-.beg, borrow, or  steal, a windows  laptop and install Xlite from  spgate/settigs/help centre--it comes pre configured, - test the connection out. ::TEST   IN and OUT  using landline/mobile ....bear in mind the Sipgate online status page is &#039;&#039;&#039;only valid at login&#039;&#039;&#039; time.so you may have to log out and back in to check your installation&#039;s registration.&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;Dynamic DNS&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
Choose a Dynamic  domain name sever provider , loads on google, get a free one,&lt;br /&gt;
*READ help/howtos&lt;br /&gt;
::(I chose DynDNS ,free , well known and it makes life a bit easier later) READ the instructions -&lt;br /&gt;
::* register -- wait for login e-mail (2 mins)&lt;br /&gt;
::* choose any (host)name for your hybrid,choose an extension  eg. homeip.net-- take the wild card option,&lt;br /&gt;
::*--set IP type either static/dynamic..set ttl according to IP type.....&lt;br /&gt;
::*find the providers test apps and follow instructions,&lt;br /&gt;
:::TEST  name resolution , &lt;br /&gt;
:::CHECK for any blocked ports, make a note of current dynamic IP address.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;BT HomeHub&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
* Does your internet connection have a static or a dynamic ip address ?&lt;br /&gt;
::If it&#039;s dynamic (most domestic BT BROADBAND)  and you don&#039;t  begrudge them the extra £5 pcm you pay for the privelige,get them to change it to static.wait for notificatin/check  in HOMEHUB  that it&#039;s in effect. It will make installation simpler, and allegedly is more reliable than alternatives.&lt;br /&gt;
::........at the same time get them to disable their own voip service, &#039;&#039;&#039;and&#039;&#039;&#039; do it yourself as well ,-if you are using their supplied HomeHub........&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
::::login =&amp;gt; advanced =&amp;gt; telephony=&amp;gt; uncheck the &amp;quot;enable telephony &amp;quot; box (no idea if the textphone option has an impact.) &lt;br /&gt;
&#039;&#039;&#039;YOU MUST disable BT BROADBAND TALK&#039;&#039;&#039;&lt;br /&gt;
:::: while youre in Hub admin, go into IP Adresses and  note the range of DHCP pool  (mine is LAN_private	192.168.1.64 - 192.168.1.237	  &amp;amp; Gateway   (your HOMEHUB ) 192.168.1.254&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;NAT&#039;&#039;&#039;===&lt;br /&gt;
::*admin/advanced/application sharing / create new game/Manual Entry of Port Maps /&lt;br /&gt;
:::&#039;&#039;&#039;name&#039;&#039;&#039;(I used &amp;quot;sipserver&amp;quot;)...   click &#039;&#039;&#039;next&#039;&#039;&#039;&lt;br /&gt;
:::: check the  new name is correct&lt;br /&gt;
&lt;br /&gt;
::::::click &#039;&#039;&#039;ENTER&#039;&#039;&#039;&lt;br /&gt;
:::fill in the boxes, as follows&lt;br /&gt;
:::::protocl UDP  from5060   to 5080   translate to  5060      Trigger protocol  ANY   Trigger  Port leave blank    ADD&lt;br /&gt;
:::::protocl UDP  from10000  to 20000  translate to  10001     Trigger protocol  ANY   Trigger  Port leave blank    ADD&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&lt;br /&gt;
CHECK SETTINGS&#039;&#039;&#039;  its a &#039;&#039;&#039;PITA&#039;&#039;&#039;to do it later&lt;br /&gt;
&lt;br /&gt;
Click &#039;&#039;&#039;APPLY&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;MISC&#039;&#039;&#039;===  &lt;br /&gt;
 &lt;br /&gt;
:GOTO  FIREWALL .. set at standard&lt;br /&gt;
:GOTO  DEVICES .. establish which entry is the HYBRID ,it SHOULD be the one at the IP youset for it earlier (if it shows a mac address, check in Pluto admin/network/network settings for a match)&lt;br /&gt;
&lt;br /&gt;
CLICK &#039;&#039;&#039;EDIT&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::CHANGE name to the hostname you picked at DynDNS earlier,just the name not the  (for e.g.  .is-a-geek.net)&lt;br /&gt;
:::GAME or SERVICE &#039;&#039;&#039; dropdown&#039;&#039;&#039; ...... pick the application  ( &amp;quot;sipserver&amp;quot;)   you created earlier..&lt;br /&gt;
CLICK &#039;&#039;&#039;ADD&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE&#039;&#039;&#039;  if you need to edit the &amp;quot;application&amp;quot; in anyway, you must first unassign it from your Hybrid, make the  alterations, then remember to reassign it to the hybrid&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=&#039;&#039;&#039;LMCE&#039;&#039;&#039;=&lt;br /&gt;
&lt;br /&gt;
:::: go into Web (pluto) admin on your core/Hybrid,login (your password is whatever you  entered as first user  during initial AV wizard)&lt;br /&gt;
&lt;br /&gt;
*-wizard/ basic/keyboard setup.. and select relevant country (if you haven&#039;t &lt;br /&gt;
allready) ../   update button&lt;br /&gt;
==Network settings==:&lt;br /&gt;
*-wizard/advanced/network/network settings .... change  radio button to use a static IP address &lt;br /&gt;
**fill in cores/Hybrids ip address as 192.165.2.X  where X is outside  the private lan dhcp pool for e.g 250 &lt;br /&gt;
:::subnetmask 255.255.255.0 &lt;br /&gt;
:::gateway/dns1/dns2  all same  as your HomeHubs address   (probably) 192.168.1.254&lt;br /&gt;
:::::::&#039;&#039;&#039;press green UPDATE button&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;Firewall&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
*- advanced/network/firewall rules... and use the boxes untill the rules look exactly like this,&lt;br /&gt;
:::::&#039;&#039;&#039;BE PATIENT &amp;amp; ACCURATE&#039;&#039;&#039; ....sometimes the progress bar seems to&lt;br /&gt;
:::::::freeze...leave it alone untill it&#039;s done it&#039;s  thing&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:udp....4569 to 0.......0...............core_input..............Delete&lt;br /&gt;
:udp....5060 to 0.......0...............core_input..............Delete&lt;br /&gt;
:udp....2000 to 0.......0...............core_input..............Delete&lt;br /&gt;
:tcp....2000 to 0.......0...............core_input..............Delete&lt;br /&gt;
:tcp....3877 to 3877....3877...192.168.80.1...port_forward......Delete&lt;br /&gt;
:udp....10001 to 20000 	0...............core_input..............Delete&lt;br /&gt;
(port 4569 is iax protocol  5060 is sip   10001to 20000 carries the audio   NB some docs say use 10000 rather than 10001&#039;&#039;&#039; don&#039;t&#039;&#039;&#039; FreePBX uses that for it&#039;s web panel&lt;br /&gt;
&lt;br /&gt;
*-wizard/restart/reload router  (not strictly necessary in this case but it is in others ,-get into the habit,- it doesn&#039;t cost you anything, besides, its time for tea/smoke /sex whatever takes your fancy.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;Phone Lines&#039;&#039;&#039;==&lt;br /&gt;
:GOTO ... pluto admin/wizard /devices/phone lines&lt;br /&gt;
*1)&#039;&#039;&#039;Check&#039;&#039;&#039; When dialing a local number, automatically prepend the area code and specify the areacode you would like to have prepended when dialing a local number, for instance  mine is 0114  (sheffield)&lt;br /&gt;
*2. &#039;&#039;&#039;Uncheck&#039;&#039;&#039; Also prepend a digit (1 for US/Canada, 0 for Europe) (also optional).&lt;br /&gt;
*3. Local Number Length 7 (the default). &lt;br /&gt;
&lt;br /&gt;
::::::Hit the &#039;&#039;&#039;Update&#039;&#039;&#039; button.&lt;br /&gt;
:Choose provider sipgate (try for free, pay as you go)&lt;br /&gt;
&lt;br /&gt;
*1. Username &amp;lt;&#039;&#039;&#039;SipID&#039;&#039;&#039; from provider....&amp;gt;&lt;br /&gt;
*2. Password &#039;&#039;&#039;SipPassword&#039;&#039;&#039;from provider&amp;gt;&lt;br /&gt;
*3. Phone number &amp;lt;&#039;&#039;&#039;SipID&#039;&#039;&#039; from provider...  AGAIN......NOT the DID ie local number.&amp;gt;&lt;br /&gt;
*4. Host  &amp;lt;sipgate.co.uk&amp;gt;&lt;br /&gt;
*5.  Hit the &#039;&#039;&#039;Submit&#039;&#039;&#039; button.&lt;br /&gt;
*6. Hit the &#039;&#039;&#039;Deactivate Automatic Configuration button&#039;&#039;&#039; and the following Yes button.&lt;br /&gt;
*7. Click the &#039;&#039;&#039;click here&#039;&#039;&#039; link (next to &amp;quot;Manual configuration activated. To configure AMP, click&amp;quot;)&lt;br /&gt;
*8. Click Trunks, and Trunk SIP/sipgate&lt;br /&gt;
*9. Under &amp;quot;Outgoing Dial Rules&amp;quot; change Dial Rules to  &lt;br /&gt;
 112&lt;br /&gt;
 999&lt;br /&gt;
 0114+XXXXXXX&lt;br /&gt;
 9|.&lt;br /&gt;
&lt;br /&gt;
:1. This will recognize 112,999, the emergency numbers&lt;br /&gt;
:2. Seven digit local numbers will get 0114 prepended.&lt;br /&gt;
:3  A nine will dial out no matter how many digits. &lt;br /&gt;
:4You now can (optionally) modify other settings to your liking as well, however do NOT change the Trunk Name (leave it at the default sipgate). When done hit &#039;&#039;&#039;Submit Changes&#039;&#039;&#039;.&lt;br /&gt;
:5Click &#039;&#039;&#039;Reload Required Apply Configuration Changes&#039;&#039;&#039;&lt;br /&gt;
: and &#039;&#039;&#039;Continue with reload.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
GOTO  Go back to pluto admin/Wizard &amp;gt; Devices &amp;gt; Phone Lines and hit the &#039;&#039;&#039;Activate Automatic Configuration button&#039;&#039;&#039;, followed by the &#039;&#039;&#039;Yes and keep my advanced settings&#039;&#039;&#039; button.&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;FreePBX&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
:GOTO ... pluto admin/wizard /advanced/config./phone setup , which puts you into FreePBX webadmin&lt;br /&gt;
&lt;br /&gt;
*CLICK  &#039;&#039;&#039;&amp;quot;TRUNKS&amp;quot;&#039;&#039;&#039; on left hand side&lt;br /&gt;
*CLICK  &#039;&#039;&#039;&amp;quot;sipgate&amp;quot;&#039;&#039;&#039; on right hand side&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;CHECK&#039;&#039;&#039; settings are as below&lt;br /&gt;
&lt;br /&gt;
PEER DETAILS&lt;br /&gt;
 allow=alaw&amp;amp;alaw&amp;amp;ulaw&amp;amp;g729&amp;amp;gsm&amp;amp;slinear&lt;br /&gt;
 auth=md5&lt;br /&gt;
 authuser=&#039;&#039;&#039;SIP ID&#039;&#039;&#039;&lt;br /&gt;
 callerid=&#039;&#039;&#039;SIP ID&#039;&#039;&#039;&lt;br /&gt;
 canreinvite=no&lt;br /&gt;
 context=from-trunk&lt;br /&gt;
 dtmfmode=inband&lt;br /&gt;
 fromdomain=&#039;&#039;&#039;sipgate.co.uk&#039;&#039;&#039;&lt;br /&gt;
 fromuser=&#039;&#039;&#039;SIP ID&#039;&#039;&#039;&lt;br /&gt;
 host=&#039;&#039;&#039;sipgate.co.uk&#039;&#039;&#039;&lt;br /&gt;
 insecure=very&lt;br /&gt;
 nat=&#039;&#039;&#039;yes&#039;&#039;&#039;&lt;br /&gt;
 qualify=no&lt;br /&gt;
 secret=&#039;&#039;&#039;SIP Pwd&#039;&#039;&#039;&lt;br /&gt;
 type=peer&lt;br /&gt;
 user=&#039;&#039;&#039;SIP ID&#039;&#039;&#039;&lt;br /&gt;
 username=&#039;&#039;&#039;SIP ID&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
USER CONTEXT&lt;br /&gt;
 &#039;&#039;&#039;SIP ID&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
USER DETAILS&lt;br /&gt;
 allow=alaw&amp;amp;alaw&amp;amp;ulaw&amp;amp;g729&amp;amp;gsm&amp;amp;slinear&lt;br /&gt;
 auth=md5&lt;br /&gt;
 authuser=&#039;&#039;&#039;SIP ID&#039;&#039;&#039;&lt;br /&gt;
 callerid=&#039;&#039;&#039;SIP ID&#039;&#039;&#039;&lt;br /&gt;
 canreinvite=no&lt;br /&gt;
 context=from-trunk&lt;br /&gt;
 dtmfmode=inband&lt;br /&gt;
 fromdomain=&#039;&#039;&#039;sipgate.co.uk&#039;&#039;&#039;&lt;br /&gt;
 fromuser=&#039;&#039;&#039;SIP ID&#039;&#039;&#039;&lt;br /&gt;
 host=&#039;&#039;&#039;sipgate.co.uk&#039;&#039;&#039;&lt;br /&gt;
 insecure=very&lt;br /&gt;
 nat=&#039;&#039;&#039;yes&#039;&#039;&#039;&lt;br /&gt;
 qualify=no&lt;br /&gt;
 secret=&#039;&#039;&#039;SIP Pwd&#039;&#039;&#039;&lt;br /&gt;
 type=user&lt;br /&gt;
 user=&#039;&#039;&#039;SIP ID&#039;&#039;&#039;&lt;br /&gt;
 username=&#039;&#039;&#039;SIP ID&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
REGISTER STRING&lt;br /&gt;
 &#039;&#039;&#039;SIP ID:SIP password@sipgate.co.uk/SIP ID&lt;br /&gt;
&#039;&#039;&#039;&lt;br /&gt;
:::click &#039;&#039;&#039;submit button&#039;&#039;&#039;&lt;br /&gt;
::::then..&lt;br /&gt;
:::click&#039;&#039;&#039;orange config bar&#039;&#039;&#039; at top of page&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;make sure&#039;&#039;&#039; pluto admin/advanced/configuration/phones setup.....&lt;br /&gt;
FreePBX...../outbound route / 0sipgate           settings    are as below&lt;br /&gt;
&lt;br /&gt;
...trunk sequence    0  (drop down =) &#039;&#039;&#039;SIP/sipgate&#039;&#039;&#039;&lt;br /&gt;
:::click &#039;&#039;&#039;submit button&#039;&#039;&#039;&lt;br /&gt;
::::then..&lt;br /&gt;
:::click&#039;&#039;&#039;orange config bar&#039;&#039;&#039; at top of page&lt;br /&gt;
&lt;br /&gt;
=&#039;&#039;&#039;Asterisk&#039;&#039;&#039;=&lt;br /&gt;
&lt;br /&gt;
[(RIP-OFF FROM)    &amp;lt;nowiki&amp;gt;freepbx.org/support/documentation/howtos/howto-resolving-audio-problems]&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;DYNAMIC ADDRESS&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
####NEED TO CHECK/change  file  PERMISSIONS     ????HOW&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Once you get a DynDNS or other address that identifies your system on the Internet, put it in your etc/hosts file. For example, if you are assigned foo.dyndns.net, then open etc/hosts in your favorite text editor &lt;br /&gt;
(I use joe...it&#039;s very simple....konsole/...........sudoapt-get install joe)&lt;br /&gt;
::::* joe /etc/hosts&lt;br /&gt;
&lt;br /&gt;
:::::::(use  UP, DOWN, LEFT RIGHT arrows to navigate,  Ctrl k x to save  Ctrl h for help)&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;127.0.0.1 localhost&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DO NOT REMOVE OR CHANGE THAT LINE.&#039;&#039;&#039; On a NEW line directly underneath it, place this line:&lt;br /&gt;
&#039;&#039;&#039;&lt;br /&gt;
127.0.0.1 foo.dyndns.net&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
But substitute &#039;&#039;&#039;YOUR address&#039;&#039;&#039;, of course......&lt;br /&gt;
&lt;br /&gt;
:::::&#039;&#039;&#039;save &amp;amp; exit&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Add some information to your /etc/asterisk/sip_nat.conf file&lt;br /&gt;
&lt;br /&gt;
####NEED TO CHECK PERMISSIONS     ????HOW&lt;br /&gt;
&lt;br /&gt;
 sudo joe /etc/asterisk/sip_nat.conf..................(your password is linuxmce)&lt;br /&gt;
nat=yes&lt;br /&gt;
externhost=YOUR FULL DynDNS  address e.g  dummy.is-a-geek.net&lt;br /&gt;
externrefresh=10&lt;br /&gt;
localnet=192.168.80.0/255.255.255.0&lt;br /&gt;
&lt;br /&gt;
:::::&#039;&#039;&#039;save and exit&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;STATIC ADDRESS&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Make use that your system knows its own name.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
####NEED TO CHECK/change  file  PERMISSIONS     ????HOW&lt;br /&gt;
&lt;br /&gt;
Once you get a DynDNS or other address that identifies your system on the Internet, put it in your etc/hosts file. For example, if you are assigned foo.dyndns.net, then open etc/hosts in your favorite text editor &lt;br /&gt;
I use joe...it&#039;s very simple....konsole/...........sudoapt-get install joe&lt;br /&gt;
                                 joe /etc/hosts&lt;br /&gt;
&lt;br /&gt;
(use  UP, DOWN, LEFT RIGHT arrows to navigate,  Ctrl k x to save  Ctrl h for help)&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;127.0.0.1 localhost&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DO NOT REMOVE OR CHANGE THAT LINE.&#039;&#039;&#039; On a NEW line directly underneath it, place this line:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;127.0.0.1 foo.dyndns.net&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
But substitute &#039;&#039;&#039;YOUR address&#039;&#039;&#039;, of course......save &amp;amp; exit&lt;br /&gt;
&lt;br /&gt;
Add some information to your /etc/asterisk/sip_nat.conf file&lt;br /&gt;
&lt;br /&gt;
####NEED TO CHECK PERMISSIONS     ????HOW&lt;br /&gt;
&lt;br /&gt;
 sudo joe /etc/asterisk/sip_nat.conf..................(your password is linuxmce)&lt;br /&gt;
nat=yes&lt;br /&gt;
externip=your.external.dotted.IPaddess&lt;br /&gt;
&lt;br /&gt;
fromdomain=YOUR DynDNS name in full&lt;br /&gt;
localnet=192.168.80.0/255.255.255.0&lt;br /&gt;
&lt;br /&gt;
::::&#039;&#039;&#039;save and exit&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;ALL&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
Check your  /etc/asterisk/rtp.conf file&lt;br /&gt;
&lt;br /&gt;
sudo joe /etc/asterisk/rtp.conf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It should contain these two lines:&lt;br /&gt;
&lt;br /&gt;
rtpstart=10001&lt;br /&gt;
&lt;br /&gt;
rtpend=20000&lt;br /&gt;
&lt;br /&gt;
&amp;quot;If the port values are any different, change them. N.B. These MUST match what you opened in your firewall, and DO NOT start with port 10000, because it conflicts with usage in FreePBX  Webmin &lt;br /&gt;
Some people feel the need to open fewer than 10,000 ports. I don&#039;t recommend this because six months from now when you start having audio problems you may not remember that you opened fewer than the recommended number of ports, and may spend hours troubleshooting the issue. But if you are simply obsessive about open ports, remember that each open SIP connection may require as many as FOUR concurrent ports, so don&#039;t cut it down to some ridiculously small number. For the non-paranoid, I suggest sticking with the recommendations above (and remember, if a hacker is looking at ports on your system, he&#039;s going to scan ALL of them, so having fewer UDP ports open really doesn&#039;t make you any more secure).&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
::::&#039;&#039;&#039;save &amp;amp; exit&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=&#039;&#039;&#039;Keeping Asterisk current&#039;&#039;&#039;=&lt;br /&gt;
You can use this sh script. run it from the crontab, maybe every 4 hours and on boot..&lt;br /&gt;
&lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 # get current ip of the router&lt;br /&gt;
 CURRENT_IP=`/usr/bin/lynx -dump http://www.netins.net/dialup/tools/my_ip.shtml | grep -A2 &amp;quot;Your  current IP Address is:&amp;quot; | tail -n2 | tr -d &#039; &#039;`&lt;br /&gt;
 # update the sip_nat.conf and re-read configs&lt;br /&gt;
 echo &amp;quot;externip=$CURRENT_IP&amp;quot; &amp;gt; /tmp/sip_nat.conf&lt;br /&gt;
 echo &amp;quot;localnet=192.168.80.0/255.255.255.0&amp;quot; &amp;gt;&amp;gt; /tmp/sip_nat.conf&lt;br /&gt;
 echo &amp;quot;externrefresh=5&amp;quot; &amp;gt;&amp;gt; /tmp/sip_nat.conf&lt;br /&gt;
 echo &amp;quot;localnet=192.168.80.0/255.255.255.0&amp;quot;  &amp;gt;&amp;gt; /tmp/sip_nat.conf&lt;br /&gt;
 cat /tmp/sip_nat.conf &amp;gt; /etc/asterisk/sip_nat.conf&lt;br /&gt;
 chown asterisk.asterisk /etc/asterisk/sip_nat.conf&lt;br /&gt;
 asterisk -rx reload&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
PERL SCRIPT from/www.freepbx.org/support/documentation/howtos/howto-resolving-audio-problems&lt;br /&gt;
&lt;br /&gt;
when i tried this it threw errors.....needs a linux man for this section}}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;YOU&#039;RE ALMOST DONE !&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
exit Konsole&lt;br /&gt;
 GOTO ... pluto admin/wizard /advanced/config./phone setup&lt;br /&gt;
&lt;br /&gt;
if the orange bar is showing in FreePBX &#039;&#039;&#039;click it&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
GOTO        pluto admin/wizard/restart/ &#039;&#039;&#039;click reboot&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
GET TEA...(smoke/ have sex etc)&lt;br /&gt;
&lt;br /&gt;
pickup cell/landline&lt;br /&gt;
dial the local number sipgate gave you.....the rest , if it works should be obvious&lt;br /&gt;
&lt;br /&gt;
==TROUBLESHOOTING==&lt;br /&gt;
&lt;br /&gt;
if it does&#039;nt work&lt;br /&gt;
{A   run perl checkip.pl}&lt;br /&gt;
&lt;br /&gt;
1  check your ISP hasn&#039;t changed your IP address&lt;br /&gt;
2  check everything, form square one   for typos&lt;br /&gt;
3  goto Dyndns and run their name resolver&lt;br /&gt;
4  consider posting in user forum-- AFTER you&#039;ve had a break, freshened up, and RECHECKED EVERYTHING CAREFULLY&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;ONCE YOU&#039;RE RUNNING&#039;&#039;&#039;==&lt;br /&gt;
TEST TEST TEST&lt;br /&gt;
*read up on dial plans and tweak to your own desires&lt;br /&gt;
*read up on extensions/mds/voicemail/IVRs and  configure to your own desires&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;PLEASE&#039;&#039;&#039; &lt;br /&gt;
*.....keep it simple and test each step as you go -it makes troubleshooting so much easier&lt;br /&gt;
*--- take notes, post/wiki any new knowledge&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;LINKS&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
BT HomeHub.........................http://www.frequencycast.co.uk/homehub.html&lt;br /&gt;
WIKI...............................http://wiki.linuxmce.org/index.php/Category:Phone_Lines&lt;br /&gt;
:::::::::::::::::::::::::::::::::::http://wiki.linuxmce.org/index.php/LinuxMCE_telecom_features&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreePBX.............................http://www.freepbx.org/support/documentation&lt;br /&gt;
other voip providers/setups.........http://www.freepbx.org/support/documentation/howtos/howto-setting-up-voip-provider-trunks&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
THE O&#039;reiley book..................http://www.digium.com/elqNow/elqRedir.htm?ref=http://downloads.oreilly.com/books/9780596510480.pdf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Telecom]]&lt;br /&gt;
[[Category: Phone Lines]]&lt;br /&gt;
[[Category: Tutorials]]&lt;br /&gt;
[[Category: VOIP Setups]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A&lt;br /&gt;
&amp;lt;nowiki&amp;gt;Insert non-formatted text here&amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Pw44</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=Sipgate.co.uk&amp;diff=25091</id>
		<title>Sipgate.co.uk</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=Sipgate.co.uk&amp;diff=25091"/>
		<updated>2010-09-20T13:43:13Z</updated>

		<summary type="html">&lt;p&gt;Pw44: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=SIPGATE.CO.UK=&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;CAVEAT&#039;&#039;&#039;==&lt;br /&gt;
:1)this guide is what worked for me, It is intentionally &amp;quot;dumbed down&amp;quot; because.&lt;br /&gt;
::a) I have no indepth knowledge and,&lt;br /&gt;
::b)it&#039;s intended for the totally virgin Windows&#039; refugee with negligible cli experience and limited typing skills&lt;br /&gt;
&lt;br /&gt;
:2)If it insults your intelligence, and you get nothing from it &#039;&#039;&#039;GOOD&#039;&#039;&#039;...it means you&#039;ve been lucky enough to have gained a fair amount of knowledge....&#039;&#039;&#039;USE&#039;&#039;&#039; it &amp;amp; when you&#039;ve found the answer to your problem, &#039;&#039;&#039;PLEASE&#039;&#039;&#039; come back &amp;amp; share it with us lesser mortals&lt;br /&gt;
&lt;br /&gt;
:3)All credit for any accuracy goes to Zaerc and Colinjones &lt;br /&gt;
:4)I&#039;ve cut and pasted most of the material,and hopefully credited the sources, :if not, my apologies for plaugiarising your work.&lt;br /&gt;
:5) ALL errors are mine, please do not repeat them without giving me credit   : )&lt;br /&gt;
* ASSUMPTIONS      uk user, ISP= British TelecoN, router/modem= BT.HomeHub,   dynamic IP address (section on static should work but I can&#039;t test)  ......you may have to modify for any other combination&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;&#039;&#039;&#039;PREPARE&#039;&#039;&#039;&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
::READ, READ , READ....check out  the links at the end for good starting points&lt;br /&gt;
*get fixed in your mind that &amp;quot;external ip&amp;quot;in all(?) mon-LMCE   docs means the internet isp provided ip.NOT the ip of your Hybrid&#039;s &amp;quot;external&amp;quot; nic, ie the one that connects to the router&lt;br /&gt;
*get a pen &amp;amp;paper....make a clear note of settings as you go along ...DON&#039;T trust to memory....&lt;br /&gt;
*bookmark usefull sites...open atleast four tabs in firefox for: google, pluto web admin,forums, homeHub  adminpage, and put their bookmarks on the toolbar,don&#039;t close tabs/firefox  on shutdown/reloads ....restore last session when  you restart firefox.&lt;br /&gt;
* beware of hidden html code when cutting/pasting&lt;br /&gt;
&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;GET INFO&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;voip provider&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
*google &amp;quot;free voip&amp;quot;   to find a provider, preferably free, pay as you go, free phone No. .. in your preffered region, according to your anticipated usage ..  #check out the forums at VOXILLA for uptodate good/bad guys ...&lt;br /&gt;
::I chose SIPGATE&amp;gt;CO&amp;gt;UK &#039;cos it ticked all the boxes and there is some barebones wiki material/and a ready made trunk  allready.&lt;br /&gt;
:::Register ,print off your details,.. your loginP/wd/user name for the website are NEVER used in any of this setup ...you&#039;ll need the 7 digit numeric sipID  (usernam trunk id ), 7 digit sip password, the only place the actual localDID is used is for caller  ID  ?????CHECK????&lt;br /&gt;
&lt;br /&gt;
*IF YOU CAN..-.beg, borrow, or  steal, a windows  laptop and install Xlite from  spgate/settigs/help centre--it comes pre configured, - test the connection out. ::TEST   IN and OUT  using landline/mobile ....bear in mind the Sipgate online status page is &#039;&#039;&#039;only valid at login&#039;&#039;&#039; time.so you may have to log out and back in to check your installation&#039;s registration.&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;Dynamic DNS&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
Choose a Dynamic  domain name sever provider , loads on google, get a free one,&lt;br /&gt;
*READ help/howtos&lt;br /&gt;
::(I chose DynDNS ,free , well known and it makes life a bit easier later) READ the instructions -&lt;br /&gt;
::* register -- wait for login e-mail (2 mins)&lt;br /&gt;
::* choose any (host)name for your hybrid,choose an extension  eg. homeip.net-- take the wild card option,&lt;br /&gt;
::*--set IP type either static/dynamic..set ttl according to IP type.....&lt;br /&gt;
::*find the providers test apps and follow instructions,&lt;br /&gt;
:::TEST  name resolution , &lt;br /&gt;
:::CHECK for any blocked ports, make a note of current dynamic IP address.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;BT HomeHub&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
* Does your internet connection have a static or a dynamic ip address ?&lt;br /&gt;
::If it&#039;s dynamic (most domestic BT BROADBAND)  and you don&#039;t  begrudge them the extra £5 pcm you pay for the privelige,get them to change it to static.wait for notificatin/check  in HOMEHUB  that it&#039;s in effect. It will make installation simpler, and allegedly is more reliable than alternatives.&lt;br /&gt;
::........at the same time get them to disable their own voip service, &#039;&#039;&#039;and&#039;&#039;&#039; do it yourself as well ,-if you are using their supplied HomeHub........&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
::::login =&amp;gt; advanced =&amp;gt; telephony=&amp;gt; uncheck the &amp;quot;enable telephony &amp;quot; box (no idea if the textphone option has an impact.) &lt;br /&gt;
&#039;&#039;&#039;YOU MUST disable BT BROADBAND TALK&#039;&#039;&#039;&lt;br /&gt;
:::: while youre in Hub admin, go into IP Adresses and  note the range of DHCP pool  (mine is LAN_private	192.168.1.64 - 192.168.1.237	  &amp;amp; Gateway   (your HOMEHUB ) 192.168.1.254&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;NAT&#039;&#039;&#039;===&lt;br /&gt;
::*admin/advanced/application sharing / create new game/Manual Entry of Port Maps /&lt;br /&gt;
:::&#039;&#039;&#039;name&#039;&#039;&#039;(I used &amp;quot;sipserver&amp;quot;)...   click &#039;&#039;&#039;next&#039;&#039;&#039;&lt;br /&gt;
:::: check the  new name is correct&lt;br /&gt;
&lt;br /&gt;
::::::click &#039;&#039;&#039;ENTER&#039;&#039;&#039;&lt;br /&gt;
:::fill in the boxes, as follows&lt;br /&gt;
:::::protocl UDP  from5060   to 5080   translate to  5060      Trigger protocol  ANY   Trigger  Port leave blank    ADD&lt;br /&gt;
:::::protocl UDP  from10000  to 20000  translate to  10001     Trigger protocol  ANY   Trigger  Port leave blank    ADD&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&lt;br /&gt;
CHECK SETTINGS&#039;&#039;&#039;  its a &#039;&#039;&#039;PITA&#039;&#039;&#039;to do it later&lt;br /&gt;
&lt;br /&gt;
Click &#039;&#039;&#039;APPLY&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;MISC&#039;&#039;&#039;===  &lt;br /&gt;
 &lt;br /&gt;
:GOTO  FIREWALL .. set at standard&lt;br /&gt;
:GOTO  DEVICES .. establish which entry is the HYBRID ,it SHOULD be the one at the IP youset for it earlier (if it shows a mac address, check in Pluto admin/network/network settings for a match)&lt;br /&gt;
&lt;br /&gt;
CLICK &#039;&#039;&#039;EDIT&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::CHANGE name to the hostname you picked at DynDNS earlier,just the name not the  (for e.g.  .is-a-geek.net)&lt;br /&gt;
:::GAME or SERVICE &#039;&#039;&#039; dropdown&#039;&#039;&#039; ...... pick the application  ( &amp;quot;sipserver&amp;quot;)   you created earlier..&lt;br /&gt;
CLICK &#039;&#039;&#039;ADD&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE&#039;&#039;&#039;  if you need to edit the &amp;quot;application&amp;quot; in anyway, you must first unassign it from your Hybrid, make the  alterations, then remember to reassign it to the hybrid&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=&#039;&#039;&#039;LMCE&#039;&#039;&#039;=&lt;br /&gt;
&lt;br /&gt;
:::: go into Web (pluto) admin on your core/Hybrid,login (your password is whatever you  entered as first user  during initial AV wizard)&lt;br /&gt;
&lt;br /&gt;
*-wizard/ basic/keyboard setup.. and select relevant country (if you haven&#039;t &lt;br /&gt;
allready) ../   update button&lt;br /&gt;
==Network settings==:&lt;br /&gt;
*-wizard/advanced/network/network settings .... change  radio button to use a static IP address &lt;br /&gt;
**fill in cores/Hybrids ip address as 192.165.2.X  where X is outside  the private lan dhcp pool for e.g 250 &lt;br /&gt;
:::subnetmask 255.255.255.0 &lt;br /&gt;
:::gateway/dns1/dns2  all same  as your HomeHubs address   (probably) 192.168.1.254&lt;br /&gt;
:::::::&#039;&#039;&#039;press green UPDATE button&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;Firewall&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
*- advanced/network/firewall rules... and use the boxes untill the rules look exactly like this,&lt;br /&gt;
:::::&#039;&#039;&#039;BE PATIENT &amp;amp; ACCURATE&#039;&#039;&#039; ....sometimes the progress bar seems to&lt;br /&gt;
:::::::freeze...leave it alone untill it&#039;s done it&#039;s  thing&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:udp....4569 to 0.......0...............core_input..............Delete&lt;br /&gt;
:udp....5060 to 0.......0...............core_input..............Delete&lt;br /&gt;
:udp....2000 to 0.......0...............core_input..............Delete&lt;br /&gt;
:tcp....2000 to 0.......0...............core_input..............Delete&lt;br /&gt;
:tcp....3877 to 3877....3877...192.168.80.1...port_forward......Delete&lt;br /&gt;
:udp....10001 to 20000 	0...............core_input..............Delete&lt;br /&gt;
(port 4569 is iax protocol  5060 is sip   10001to 20000 carries the audio   NB some docs say use 10000 rather than 10001&#039;&#039;&#039; don&#039;t&#039;&#039;&#039; FreePBX uses that for it&#039;s web panel&lt;br /&gt;
&lt;br /&gt;
*-wizard/restart/reload router  (not strictly necessary in this case but it is in others ,-get into the habit,- it doesn&#039;t cost you anything, besides, its time for tea/smoke /sex whatever takes your fancy.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;Phone Lines&#039;&#039;&#039;==&lt;br /&gt;
:GOTO ... pluto admin/wizard /devices/phone lines&lt;br /&gt;
*1)&#039;&#039;&#039;Check&#039;&#039;&#039; When dialing a local number, automatically prepend the area code and specify the areacode you would like to have prepended when dialing a local number, for instance  mine is 0114  (sheffield)&lt;br /&gt;
*2. &#039;&#039;&#039;Uncheck&#039;&#039;&#039; Also prepend a digit (1 for US/Canada, 0 for Europe) (also optional).&lt;br /&gt;
*3. Local Number Length 7 (the default). &lt;br /&gt;
&lt;br /&gt;
::::::Hit the &#039;&#039;&#039;Update&#039;&#039;&#039; button.&lt;br /&gt;
:Choose provider sipgate (try for free, pay as you go)&lt;br /&gt;
&lt;br /&gt;
*1. Username &amp;lt;&#039;&#039;&#039;SipID&#039;&#039;&#039; from provider....&amp;gt;&lt;br /&gt;
*2. Password &#039;&#039;&#039;SipPassword&#039;&#039;&#039;from provider&amp;gt;&lt;br /&gt;
*3. Phone number &amp;lt;&#039;&#039;&#039;SipID&#039;&#039;&#039; from provider...  AGAIN......NOT the DID ie local number.&amp;gt;&lt;br /&gt;
*4. Host  &amp;lt;sipgate.co.uk&amp;gt;&lt;br /&gt;
*5.  Hit the &#039;&#039;&#039;Submit&#039;&#039;&#039; button.&lt;br /&gt;
*6. Hit the &#039;&#039;&#039;Deactivate Automatic Configuration button&#039;&#039;&#039; and the following Yes button.&lt;br /&gt;
*7. Click the &#039;&#039;&#039;click here&#039;&#039;&#039; link (next to &amp;quot;Manual configuration activated. To configure AMP, click&amp;quot;)&lt;br /&gt;
*8. Click Trunks, and Trunk SIP/sipgate&lt;br /&gt;
*9. Under &amp;quot;Outgoing Dial Rules&amp;quot; change Dial Rules to  &lt;br /&gt;
&lt;br /&gt;
::::112&lt;br /&gt;
::::999&lt;br /&gt;
::::0114+XXXXXXX&lt;br /&gt;
::::9|.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:::::1. This will recognize 112,999, the emergency numbers&lt;br /&gt;
:::::2. Seven digit local numbers will get 0114 prepended.&lt;br /&gt;
:::::3  A nine will dial out no matter how many digits. &lt;br /&gt;
:::::4You now can (optionally) modify other settings to your liking as well, however do NOT change the Trunk Name (leave it at the default sipgate). When done hit &#039;&#039;&#039;Submit Changes&#039;&#039;&#039;.&lt;br /&gt;
:::::5Click &#039;&#039;&#039;Reload Required Apply Configuration Changes&#039;&#039;&#039;&lt;br /&gt;
::::::: and &#039;&#039;&#039;Continue with reload.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
GOTO  Go back to pluto admin/Wizard &amp;gt; Devices &amp;gt; Phone Lines and hit the &#039;&#039;&#039;Activate Automatic Configuration button&#039;&#039;&#039;, followed by the &#039;&#039;&#039;Yes and keep my advanced settings&#039;&#039;&#039; button.&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;FreePBX&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
:GOTO ... pluto admin/wizard /advanced/config./phone setup , which puts you into FreePBX webadmin&lt;br /&gt;
&lt;br /&gt;
*CLICK  &#039;&#039;&#039;&amp;quot;TRUNKS&amp;quot;&#039;&#039;&#039; on left hand side&lt;br /&gt;
*CLICK  &#039;&#039;&#039;&amp;quot;sipgate&amp;quot;&#039;&#039;&#039; on right hand side&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;CHECK&#039;&#039;&#039; settings are as below&lt;br /&gt;
&lt;br /&gt;
PEER DETAILS&lt;br /&gt;
allow=alaw&amp;amp;alaw&amp;amp;ulaw&amp;amp;g729&amp;amp;gsm&amp;amp;slinear&lt;br /&gt;
auth=md5&lt;br /&gt;
authuser=&#039;&#039;&#039;SIP ID&#039;&#039;&#039;&lt;br /&gt;
callerid=&#039;&#039;&#039;SIP ID&#039;&#039;&#039;&lt;br /&gt;
canreinvite=no&lt;br /&gt;
context=from-trunk&lt;br /&gt;
dtmfmode=inband&lt;br /&gt;
fromdomain=&#039;&#039;&#039;sipgate.co.uk&#039;&#039;&#039;&lt;br /&gt;
fromuser=&#039;&#039;&#039;SIP ID&#039;&#039;&#039;&lt;br /&gt;
host=&#039;&#039;&#039;sipgate.co.uk&#039;&#039;&#039;&lt;br /&gt;
insecure=very&lt;br /&gt;
nat=&#039;&#039;&#039;yes&#039;&#039;&#039;&lt;br /&gt;
qualify=no&lt;br /&gt;
secret=&#039;&#039;&#039;SIP Pwd&#039;&#039;&#039;&lt;br /&gt;
type=peer&lt;br /&gt;
user=&#039;&#039;&#039;SIP ID&#039;&#039;&#039;&lt;br /&gt;
username=&#039;&#039;&#039;SIP ID&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
USER CONTEXT&lt;br /&gt;
&#039;&#039;&#039;SIP ID&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
USER DETAILS&lt;br /&gt;
&lt;br /&gt;
allow=alaw&amp;amp;alaw&amp;amp;ulaw&amp;amp;g729&amp;amp;gsm&amp;amp;slinear&lt;br /&gt;
auth=md5&lt;br /&gt;
authuser=&#039;&#039;&#039;SIP ID&#039;&#039;&#039;&lt;br /&gt;
callerid=&#039;&#039;&#039;SIP ID&#039;&#039;&#039;&lt;br /&gt;
canreinvite=no&lt;br /&gt;
context=from-trunk&lt;br /&gt;
dtmfmode=inband&lt;br /&gt;
fromdomain=&#039;&#039;&#039;sipgate.co.uk&#039;&#039;&#039;&lt;br /&gt;
fromuser=&#039;&#039;&#039;SIP ID&#039;&#039;&#039;&lt;br /&gt;
host=&#039;&#039;&#039;sipgate.co.uk&#039;&#039;&#039;&lt;br /&gt;
insecure=very&lt;br /&gt;
nat=&#039;&#039;&#039;yes&#039;&#039;&#039;&lt;br /&gt;
qualify=no&lt;br /&gt;
secret=&#039;&#039;&#039;SIP Pwd&#039;&#039;&#039;&lt;br /&gt;
type=user&lt;br /&gt;
user=&#039;&#039;&#039;SIP ID&#039;&#039;&#039;&lt;br /&gt;
username=&#039;&#039;&#039;SIP ID&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
REGISTER STRING&lt;br /&gt;
&#039;&#039;&#039;SIP ID:SIP password@sipgate.co.uk/SIP ID&lt;br /&gt;
&#039;&#039;&#039;&lt;br /&gt;
:::click &#039;&#039;&#039;submit button&#039;&#039;&#039;&lt;br /&gt;
::::then..&lt;br /&gt;
:::click&#039;&#039;&#039;orange config bar&#039;&#039;&#039; at top of page&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;make sure&#039;&#039;&#039; pluto admin/advanced/configuration/phones setup.....&lt;br /&gt;
FreePBX...../outbound route / 0sipgate           settings    are as below&lt;br /&gt;
&lt;br /&gt;
...trunk sequence    0  (drop down =) &#039;&#039;&#039;SIP/sipgate&#039;&#039;&#039;&lt;br /&gt;
:::click &#039;&#039;&#039;submit button&#039;&#039;&#039;&lt;br /&gt;
::::then..&lt;br /&gt;
:::click&#039;&#039;&#039;orange config bar&#039;&#039;&#039; at top of page&lt;br /&gt;
&lt;br /&gt;
=&#039;&#039;&#039;Asterisk&#039;&#039;&#039;=&lt;br /&gt;
&lt;br /&gt;
[(RIP-OFF FROM)    &amp;lt;nowiki&amp;gt;freepbx.org/support/documentation/howtos/howto-resolving-audio-problems]&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;DYNAMIC ADDRESS&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
####NEED TO CHECK/change  file  PERMISSIONS     ????HOW&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Once you get a DynDNS or other address that identifies your system on the Internet, put it in your etc/hosts file. For example, if you are assigned foo.dyndns.net, then open etc/hosts in your favorite text editor &lt;br /&gt;
(I use joe...it&#039;s very simple....konsole/...........sudoapt-get install joe)&lt;br /&gt;
::::* joe /etc/hosts&lt;br /&gt;
&lt;br /&gt;
:::::::(use  UP, DOWN, LEFT RIGHT arrows to navigate,  Ctrl k x to save  Ctrl h for help)&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;127.0.0.1 localhost&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DO NOT REMOVE OR CHANGE THAT LINE.&#039;&#039;&#039; On a NEW line directly underneath it, place this line:&lt;br /&gt;
&#039;&#039;&#039;&lt;br /&gt;
127.0.0.1 foo.dyndns.net&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
But substitute &#039;&#039;&#039;YOUR address&#039;&#039;&#039;, of course......&lt;br /&gt;
&lt;br /&gt;
:::::&#039;&#039;&#039;save &amp;amp; exit&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Add some information to your /etc/asterisk/sip_nat.conf file&lt;br /&gt;
&lt;br /&gt;
####NEED TO CHECK PERMISSIONS     ????HOW&lt;br /&gt;
&lt;br /&gt;
 sudo joe /etc/asterisk/sip_nat.conf..................(your password is linuxmce)&lt;br /&gt;
nat=yes&lt;br /&gt;
externhost=YOUR FULL DynDNS  address e.g  dummy.is-a-geek.net&lt;br /&gt;
externrefresh=10&lt;br /&gt;
localnet=192.168.80.0/255.255.255.0&lt;br /&gt;
&lt;br /&gt;
:::::&#039;&#039;&#039;save and exit&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;STATIC ADDRESS&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Make use that your system knows its own name.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
####NEED TO CHECK/change  file  PERMISSIONS     ????HOW&lt;br /&gt;
&lt;br /&gt;
Once you get a DynDNS or other address that identifies your system on the Internet, put it in your etc/hosts file. For example, if you are assigned foo.dyndns.net, then open etc/hosts in your favorite text editor &lt;br /&gt;
I use joe...it&#039;s very simple....konsole/...........sudoapt-get install joe&lt;br /&gt;
                                 joe /etc/hosts&lt;br /&gt;
&lt;br /&gt;
(use  UP, DOWN, LEFT RIGHT arrows to navigate,  Ctrl k x to save  Ctrl h for help)&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;127.0.0.1 localhost&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DO NOT REMOVE OR CHANGE THAT LINE.&#039;&#039;&#039; On a NEW line directly underneath it, place this line:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;127.0.0.1 foo.dyndns.net&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
But substitute &#039;&#039;&#039;YOUR address&#039;&#039;&#039;, of course......save &amp;amp; exit&lt;br /&gt;
&lt;br /&gt;
Add some information to your /etc/asterisk/sip_nat.conf file&lt;br /&gt;
&lt;br /&gt;
####NEED TO CHECK PERMISSIONS     ????HOW&lt;br /&gt;
&lt;br /&gt;
 sudo joe /etc/asterisk/sip_nat.conf..................(your password is linuxmce)&lt;br /&gt;
nat=yes&lt;br /&gt;
externip=your.external.dotted.IPaddess&lt;br /&gt;
&lt;br /&gt;
fromdomain=YOUR DynDNS name in full&lt;br /&gt;
localnet=192.168.80.0/255.255.255.0&lt;br /&gt;
&lt;br /&gt;
::::&#039;&#039;&#039;save and exit&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;ALL&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
Check your  /etc/asterisk/rtp.conf file&lt;br /&gt;
&lt;br /&gt;
sudo joe /etc/asterisk/rtp.conf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It should contain these two lines:&lt;br /&gt;
&lt;br /&gt;
rtpstart=10001&lt;br /&gt;
&lt;br /&gt;
rtpend=20000&lt;br /&gt;
&lt;br /&gt;
&amp;quot;If the port values are any different, change them. N.B. These MUST match what you opened in your firewall, and DO NOT start with port 10000, because it conflicts with usage in FreePBX  Webmin &lt;br /&gt;
Some people feel the need to open fewer than 10,000 ports. I don&#039;t recommend this because six months from now when you start having audio problems you may not remember that you opened fewer than the recommended number of ports, and may spend hours troubleshooting the issue. But if you are simply obsessive about open ports, remember that each open SIP connection may require as many as FOUR concurrent ports, so don&#039;t cut it down to some ridiculously small number. For the non-paranoid, I suggest sticking with the recommendations above (and remember, if a hacker is looking at ports on your system, he&#039;s going to scan ALL of them, so having fewer UDP ports open really doesn&#039;t make you any more secure).&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
::::&#039;&#039;&#039;save &amp;amp; exit&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=&#039;&#039;&#039;Keeping Asterisk current&#039;&#039;&#039;=&lt;br /&gt;
You can use this sh script. run it from the crontab, maybe every 4 hours and on boot..&lt;br /&gt;
&lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 # get current ip of the router&lt;br /&gt;
 CURRENT_IP=`/usr/bin/lynx -dump http://www.netins.net/dialup/tools/my_ip.shtml | grep -A2 &amp;quot;Your  current IP Address is:&amp;quot; | tail -n2 | tr -d &#039; &#039;`&lt;br /&gt;
 # update the sip_nat.conf and re-read configs&lt;br /&gt;
 echo &amp;quot;externip=$CURRENT_IP&amp;quot; &amp;gt; /tmp/sip_nat.conf&lt;br /&gt;
 echo &amp;quot;localnet=192.168.80.0/255.255.255.0&amp;quot; &amp;gt;&amp;gt; /tmp/sip_nat.conf&lt;br /&gt;
 echo &amp;quot;externrefresh=5&amp;quot; &amp;gt;&amp;gt; /tmp/sip_nat.conf&lt;br /&gt;
 echo &amp;quot;localnet=192.168.80.0/255.255.255.0&amp;quot;  &amp;gt;&amp;gt; /tmp/sip_nat.conf&lt;br /&gt;
 cat /tmp/sip_nat.conf &amp;gt; /etc/asterisk/sip_nat.conf&lt;br /&gt;
 chown asterisk.asterisk /etc/asterisk/sip_nat.conf&lt;br /&gt;
 asterisk -rx reload&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
PERL SCRIPT from/www.freepbx.org/support/documentation/howtos/howto-resolving-audio-problems&lt;br /&gt;
&lt;br /&gt;
when i tried this it threw errors.....needs a linux man for this section}}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;YOU&#039;RE ALMOST DONE !&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
exit Konsole&lt;br /&gt;
 GOTO ... pluto admin/wizard /advanced/config./phone setup&lt;br /&gt;
&lt;br /&gt;
if the orange bar is showing in FreePBX &#039;&#039;&#039;click it&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
GOTO        pluto admin/wizard/restart/ &#039;&#039;&#039;click reboot&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
GET TEA...(smoke/ have sex etc)&lt;br /&gt;
&lt;br /&gt;
pickup cell/landline&lt;br /&gt;
dial the local number sipgate gave you.....the rest , if it works should be obvious&lt;br /&gt;
&lt;br /&gt;
==TROUBLESHOOTING==&lt;br /&gt;
&lt;br /&gt;
if it does&#039;nt work&lt;br /&gt;
{A   run perl checkip.pl}&lt;br /&gt;
&lt;br /&gt;
1  check your ISP hasn&#039;t changed your IP address&lt;br /&gt;
2  check everything, form square one   for typos&lt;br /&gt;
3  goto Dyndns and run their name resolver&lt;br /&gt;
4  consider posting in user forum-- AFTER you&#039;ve had a break, freshened up, and RECHECKED EVERYTHING CAREFULLY&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;ONCE YOU&#039;RE RUNNING&#039;&#039;&#039;==&lt;br /&gt;
TEST TEST TEST&lt;br /&gt;
*read up on dial plans and tweak to your own desires&lt;br /&gt;
*read up on extensions/mds/voicemail/IVRs and  configure to your own desires&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;PLEASE&#039;&#039;&#039; &lt;br /&gt;
*.....keep it simple and test each step as you go -it makes troubleshooting so much easier&lt;br /&gt;
*--- take notes, post/wiki any new knowledge&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;LINKS&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
BT HomeHub.........................http://www.frequencycast.co.uk/homehub.html&lt;br /&gt;
WIKI...............................http://wiki.linuxmce.org/index.php/Category:Phone_Lines&lt;br /&gt;
:::::::::::::::::::::::::::::::::::http://wiki.linuxmce.org/index.php/LinuxMCE_telecom_features&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreePBX.............................http://www.freepbx.org/support/documentation&lt;br /&gt;
other voip providers/setups.........http://www.freepbx.org/support/documentation/howtos/howto-setting-up-voip-provider-trunks&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
THE O&#039;reiley book..................http://www.digium.com/elqNow/elqRedir.htm?ref=http://downloads.oreilly.com/books/9780596510480.pdf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Telecom]]&lt;br /&gt;
[[Category: Phone Lines]]&lt;br /&gt;
[[Category: Tutorials]]&lt;br /&gt;
[[Category: VOIP Setups]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A&lt;br /&gt;
&amp;lt;nowiki&amp;gt;Insert non-formatted text here&amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Pw44</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=Fail2ban_-_A_tool_against_brute_force&amp;diff=25090</id>
		<title>Fail2ban - A tool against brute force</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=Fail2ban_-_A_tool_against_brute_force&amp;diff=25090"/>
		<updated>2010-09-20T13:40:45Z</updated>

		<summary type="html">&lt;p&gt;Pw44: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: Tutorials]]&lt;br /&gt;
&lt;br /&gt;
Having asterik installed is almost an invitation for others wishing to place calls at your expense.&lt;br /&gt;
&lt;br /&gt;
After configuring my sip trunk, it did not take 2 days and some &amp;quot;smart guy&amp;quot;  was trying to register to take advantage of it, and causing me losses.&lt;br /&gt;
&lt;br /&gt;
Fail2ban prevented it, blocking the attacker with iptables rules.&lt;br /&gt;
&lt;br /&gt;
Installing fail2ban is not complicated and i will describe the steps to have it properly installed and configured, so you can protect your asterisk and other services from brute force attack.&lt;br /&gt;
&lt;br /&gt;
Install with: &lt;br /&gt;
 sudo apt-get install fail2ban&lt;br /&gt;
&lt;br /&gt;
After is installed, you need to change /etc/asterisk/logger.conf and add the following line under [general] section (You may have to create this before the [logfiles] section). &lt;br /&gt;
&lt;br /&gt;
 [general]&lt;br /&gt;
 dateformat=%F %T&lt;br /&gt;
&lt;br /&gt;
In /etc/asterisk/logger.conf add the following line under the [logfiles] section for asterisk to log NOTICE level events to the syslog (/var/log/messages) as well as its normal log file. These entries in syslog will have a Date/Time stamp that is usable by fail2ban.&lt;br /&gt;
&lt;br /&gt;
 syslog.local0 =&amp;gt; notice &lt;br /&gt;
&lt;br /&gt;
Reload asterisk with:&lt;br /&gt;
&lt;br /&gt;
 asterisk -rx &amp;quot;logger reload&amp;quot; &lt;br /&gt;
&lt;br /&gt;
Configuring fail2ban:&lt;br /&gt;
&lt;br /&gt;
 cd /etc/fail2ban/filter.d&lt;br /&gt;
&lt;br /&gt;
 touch asterisk.conf &lt;br /&gt;
&lt;br /&gt;
 vi asterisk.conf&lt;br /&gt;
&lt;br /&gt;
insert the following (copy &amp;amp; paste)&lt;br /&gt;
&lt;br /&gt;
 # Fail2Ban configuration file&lt;br /&gt;
 #&lt;br /&gt;
 #&lt;br /&gt;
 # $Revision: 250 $&lt;br /&gt;
 #&lt;br /&gt;
 [INCLUDES]&lt;br /&gt;
 # Read common prefixes. If any customizations available -- read them from&lt;br /&gt;
 # common.local&lt;br /&gt;
 #before = common.conf&lt;br /&gt;
 [Definition]&lt;br /&gt;
 #_daemon = asterisk&lt;br /&gt;
 # Option:  failregex&lt;br /&gt;
 # Notes.:  regex to match the password failures messages in the logfile. The&lt;br /&gt;
 #          host must be matched by a group named &amp;quot;host&amp;quot;. The tag &amp;quot;&amp;lt;HOST&amp;gt;&amp;quot; can&lt;br /&gt;
 #          be used for standard IP/hostname matching and is only an alias for&lt;br /&gt;
 #          (?:::f{4,6}:)?(?P&amp;lt;host&amp;gt;\S+)&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 failregex = NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Wrong password&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - No matching peer found&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Username/auth name mismatch&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Device does not match ACL&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&amp;quot; .* failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Peer is not supposed to register&lt;br /&gt;
             NOTICE.* &amp;lt;HOST&amp;gt; failed to authenticate as &#039;.*&#039;$&lt;br /&gt;
             NOTICE.* .*: No registration for peer &#039;.*&#039; \(from &amp;lt;HOST&amp;gt;\)&lt;br /&gt;
             NOTICE.* .*: Host &amp;lt;HOST&amp;gt; failed MD5 authentication for &#039;.*&#039; (.*)&lt;br /&gt;
             NOTICE.* .*: Failed to authenticate user .*@&amp;lt;HOST&amp;gt;.*&lt;br /&gt;
 # Option:  ignoreregex&lt;br /&gt;
 # Notes.:  regex to ignore. If this regex matches, the line is ignored.&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 ignoreregex =&lt;br /&gt;
&lt;br /&gt;
Next edit /etc/fail2ban/jail.conf to include the following section so that it uses the new filter. &lt;br /&gt;
&lt;br /&gt;
 [asterisk-iptables]&lt;br /&gt;
 enabled  = true&lt;br /&gt;
 filter   = asterisk&lt;br /&gt;
 action   = iptables-allports[name=ASTERISK, protocol=all]&lt;br /&gt;
            sendmail-whois[name=ASTERISK, dest=root, sender=fail2ban@example.org]&lt;br /&gt;
 logpath  = /var/log/asterisk/full&lt;br /&gt;
 maxretry = 5&lt;br /&gt;
 bantime = 259200&lt;br /&gt;
&lt;br /&gt;
Locate the line ignoreip in /etc/fail2ban/jail.conf (beginning of the file) and insert the ip&#039;s and / or blocks you want fail2ban to ignore, so you don&#039;t risk banning yourserf or any host in your network.&lt;br /&gt;
&lt;br /&gt;
Mine is defined as follows:&lt;br /&gt;
&lt;br /&gt;
 [DEFAULT]&lt;br /&gt;
 # &amp;quot;ignoreip&amp;quot; can be an IP address, a CIDR mask or a DNS host. Fail2ban will not&lt;br /&gt;
 # ban a host which matches an address in this list. Several addresses can be   &lt;br /&gt;
 # defined using space separator.                                               &lt;br /&gt;
 ignoreip = 127.0.0.1 192.168.80.1 192.168.80.0 192.168.0.0&lt;br /&gt;
&lt;br /&gt;
To start fail2ban type the following as root:&lt;br /&gt;
&lt;br /&gt;
/etc/init.d/fail2ban start&lt;br /&gt;
&lt;br /&gt;
Check It&lt;br /&gt;
&lt;br /&gt;
If started properly issue the following command to view your iptables rules:&lt;br /&gt;
&lt;br /&gt;
 iptables -L -v&lt;br /&gt;
&lt;br /&gt;
You should see something like the following for the INPUT chain (this is the ouput of mine)&lt;br /&gt;
&lt;br /&gt;
 Chain INPUT (policy DROP 2241 packets, 160K bytes)              &lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination         &lt;br /&gt;
   372 27264 &#039;&#039;&#039;fail2ban-SSH&#039;&#039;&#039;  tcp  --  any    any     anywhere             anywhere            tcp dpt:ssh                                                                                          &lt;br /&gt;
 1312K  991M &#039;&#039;&#039;fail2ban-ASTERISK&#039;&#039;&#039;  all  --  any    any     anywhere             anywhere            &lt;br /&gt;
  553K   81M ACCEPT     all  --  lo     any     anywhere             anywhere                    &lt;br /&gt;
 1288K 1162M ACCEPT     all  --  any    any     anywhere             anywhere            state RELATED,ESTABLISHED                                                                               &lt;br /&gt;
     9   540 ACCEPT     all  --  any    any     anywhere             anywhere            MARK match 0x1                                                                                          &lt;br /&gt;
     2  1152 ACCEPT     udp  --  any    any     anywhere             anywhere            udp   dpt:bootps                                                                                          &lt;br /&gt;
 19276 5790K ACCEPT     all  --  any    any     192.168.80.0/24      anywhere                    &lt;br /&gt;
     0     0 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:iax                                                                                             &lt;br /&gt;
     4  1795 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:sip                                                                                             &lt;br /&gt;
     0     0 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:2000                                                                                            &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:sieve                                                                                           &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:1723                                                                                            &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:www                                                                                             &lt;br /&gt;
     1    60 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:ssh                                                                                             &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:https                                                                                           &lt;br /&gt;
     1    50 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpts:10001:20000&lt;br /&gt;
     0     0 ACCEPT     gre  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain FORWARD (policy ACCEPT 719K packets, 245M bytes)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
     0     0 TCPMSS     tcp  --  any    ppp+    anywhere             anywhere            tcp flags:SYN,RST/SYN TCPMSS clamp to PMTU&lt;br /&gt;
 Chain OUTPUT (policy ACCEPT 2099K packets, 590M bytes)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
     0     0 ACCEPT     gre  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain fail2ban-ASTERISK (1 references)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
  5091 2125K DROP       all  --  any    any     173.193.194.106-static.reverse.softlayer.com  anywhere&lt;br /&gt;
 1307K  989M RETURN     all  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain fail2ban-SSH (1 references)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
&lt;br /&gt;
If you do not see something similar to that then you have some troubleshooting to, check out /var/log/fail2ban.log.&lt;br /&gt;
&lt;br /&gt;
Example of my /var/log/fai2ban.log (173.193.194.106 is the real address from the attacker fail2ban banned):&lt;br /&gt;
&lt;br /&gt;
 ....&lt;br /&gt;
 2010-09-19 11:12:56,131 fail2ban.filter : INFO   Set maxRetry = 6&lt;br /&gt;
 2010-09-19 11:12:56,133 fail2ban.filter : INFO   Set findtime = 600&lt;br /&gt;
 2010-09-19 11:12:56,133 fail2ban.actions: INFO   Set banTime = 600&lt;br /&gt;
 2010-09-19 11:12:56,138 fail2ban.jail   : INFO   Jail &#039;ssh-iptables&#039; started&lt;br /&gt;
 2010-09-19 11:12:56,139 fail2ban.jail   : INFO   Jail &#039;asterisk-iptables&#039; started&lt;br /&gt;
 2010-09-19 11:12:56,141 fail2ban.jail   : INFO   Jail &#039;apache-tcpwrapper&#039; started&lt;br /&gt;
 2010-09-19 15:33:50,392 fail2ban.actions: WARNING [asterisk-iptables] Ban 173.193.194.106&lt;br /&gt;
 2010-09-19 15:34:50,982 fail2ban.actions: WARNING [asterisk-iptables] 173.193.194.106 already banned&lt;br /&gt;
&lt;br /&gt;
And this is the log (/var/log/asterisk/messages) showing the attack:&lt;br /&gt;
&lt;br /&gt;
 [2010-09-19 15:33:48] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;3235410554&amp;quot;&amp;lt;sip:3235410554@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                           &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;thomas&amp;quot;&amp;lt;sip:thomas@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;arsenal&amp;quot;&amp;lt;sip:arsenal@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;letmein&amp;quot;&amp;lt;sip:letmein@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;liverpool&amp;quot;&amp;lt;sip:liverpool@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;nevermind&amp;quot;&amp;lt;sip:nevermind@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;getmein&amp;quot;&amp;lt;sip:getmein@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;echo&amp;quot;&amp;lt;sip:echo@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;bmw325&amp;quot;&amp;lt;sip:bmw325@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;bmw335&amp;quot;&amp;lt;sip:bmw335@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w3e&amp;quot;&amp;lt;sip:1q2w3e@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w3e4r5t6y&amp;quot;&amp;lt;sip:1q2w3e4r5t6y@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q1q2w2w&amp;quot;&amp;lt;sip:1q1q2w2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w1q2w&amp;quot;&amp;lt;sip:1q2w1q2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w&amp;quot;&amp;lt;sip:1q2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;11q22w&amp;quot;&amp;lt;sip:11q22w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;q1w2&amp;quot;&amp;lt;sip:q1w2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;q1w2e3&amp;quot;&amp;lt;sip:q1w2e3@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;tvv03tvv03&amp;quot;&amp;lt;sip:tvv03tvv03@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                           &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd1&amp;quot;&amp;lt;sip:abcd1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd12&amp;quot;&amp;lt;sip:abcd12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd123&amp;quot;&amp;lt;sip:abcd123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;qq11ww22ee33rr44&amp;quot;&amp;lt;sip:qq11ww22ee33rr44@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1&amp;quot;&amp;lt;sip:sip1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip2&amp;quot;&amp;lt;sip:sip2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip12&amp;quot;&amp;lt;sip:sip12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip123&amp;quot;&amp;lt;sip:sip123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1234&amp;quot;&amp;lt;sip:sip1234@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip12345&amp;quot;&amp;lt;sip:sip12345@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1111&amp;quot;&amp;lt;sip:sip1111@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip222&amp;quot;&amp;lt;sip:sip222@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1qa2ws3ed&amp;quot;&amp;lt;sip:1qa2ws3ed@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1234asdf&amp;quot;&amp;lt;sip:1234asdf@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1a2s3d&amp;quot;&amp;lt;sip:1a2s3d@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1a2s3d4f&amp;quot;&amp;lt;sip:1a2s3d4f@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;asdzxc&amp;quot;&amp;lt;sip:asdzxc@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;123zxc&amp;quot;&amp;lt;sip:123zxc@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1234zxcv&amp;quot;&amp;lt;sip:1234zxcv@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;aazzssxx&amp;quot;&amp;lt;sip:aazzssxx@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;p@ssword&amp;quot;&amp;lt;sip:p@ssword@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;p@ssw0rd&amp;quot;&amp;lt;sip:p@ssw0rd@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;pass1&amp;quot;&amp;lt;sip:pass1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;password3&amp;quot;&amp;lt;sip:password3@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;pass12&amp;quot;&amp;lt;sip:pass12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account&amp;quot;&amp;lt;sip:account@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;passlogin&amp;quot;&amp;lt;sip:passlogin@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account1&amp;quot;&amp;lt;sip:account1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account5&amp;quot;&amp;lt;sip:account5@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account6&amp;quot;&amp;lt;sip:account6@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account123&amp;quot;&amp;lt;sip:account123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account12&amp;quot;&amp;lt;sip:account12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc1&amp;quot;&amp;lt;sip:acc1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc2&amp;quot;&amp;lt;sip:acc2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc12&amp;quot;&amp;lt;sip:acc12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
&lt;br /&gt;
I hope this helps.&lt;br /&gt;
&lt;br /&gt;
source: &lt;br /&gt;
 http://www.fail2ban.org&lt;br /&gt;
 http://www.voip-info.org/wiki/view/Fail2Ban+(with+iptables)+And+Asterisk&lt;br /&gt;
 http://www.fail2ban.org/wiki/index.php/Asterisk&lt;/div&gt;</summary>
		<author><name>Pw44</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=Fail2ban_-_A_tool_against_brute_force&amp;diff=25086</id>
		<title>Fail2ban - A tool against brute force</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=Fail2ban_-_A_tool_against_brute_force&amp;diff=25086"/>
		<updated>2010-09-20T00:56:12Z</updated>

		<summary type="html">&lt;p&gt;Pw44: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: Tutorials]]&lt;br /&gt;
&lt;br /&gt;
Having asterik installed is almost an invitation for others wishing to place calls at your expense.&lt;br /&gt;
&lt;br /&gt;
After configuring my sip trunk, it did not take 2 days and some &amp;quot;smart guy&amp;quot;  was trying to register to take advantage of it, and causing me losses.&lt;br /&gt;
&lt;br /&gt;
Fail2ban prevented it, blocking the attacker with iptables rules.&lt;br /&gt;
&lt;br /&gt;
Installing fail2ban is not complicated and i will describe the steps to have it properly installed and configured, so you can protect your asterisk and other services from brute force attack.&lt;br /&gt;
&lt;br /&gt;
Install with: &lt;br /&gt;
 sudo apt-get install fail2ban&lt;br /&gt;
&lt;br /&gt;
After is installed, you need to change /etc/asterisk/logger.conf and add the following line under [general] section (You may have to create this before the [logfiles] section). &lt;br /&gt;
&lt;br /&gt;
 [general]&lt;br /&gt;
 dateformat=%F %T&lt;br /&gt;
&lt;br /&gt;
In /etc/asterisk/logger.conf add the following line under the [logfiles] section for asterisk to log NOTICE level events to the syslog (/var/log/messages) as well as its normal log file. These entries in syslog will have a Date/Time stamp that is usable by fail2ban.&lt;br /&gt;
&lt;br /&gt;
 syslog.local0 =&amp;gt; notice &lt;br /&gt;
&lt;br /&gt;
Reload asterisk with:&lt;br /&gt;
&lt;br /&gt;
 asterisk -rx &amp;quot;logger reload&amp;quot; &lt;br /&gt;
&lt;br /&gt;
Configuring fail2ban:&lt;br /&gt;
&lt;br /&gt;
 cd /etc/fail2ban/filter.d&lt;br /&gt;
&lt;br /&gt;
 touch asterisk.conf &lt;br /&gt;
&lt;br /&gt;
 vi asterisk.conf&lt;br /&gt;
&lt;br /&gt;
insert the following (copy &amp;amp; paste)&lt;br /&gt;
&lt;br /&gt;
 # Fail2Ban configuration file&lt;br /&gt;
 #&lt;br /&gt;
 #&lt;br /&gt;
 # $Revision: 250 $&lt;br /&gt;
 #&lt;br /&gt;
 [INCLUDES]&lt;br /&gt;
 # Read common prefixes. If any customizations available -- read them from&lt;br /&gt;
 # common.local&lt;br /&gt;
 #before = common.conf&lt;br /&gt;
 [Definition]&lt;br /&gt;
 #_daemon = asterisk&lt;br /&gt;
 # Option:  failregex&lt;br /&gt;
 # Notes.:  regex to match the password failures messages in the logfile. The&lt;br /&gt;
 #          host must be matched by a group named &amp;quot;host&amp;quot;. The tag &amp;quot;&amp;lt;HOST&amp;gt;&amp;quot; can&lt;br /&gt;
 #          be used for standard IP/hostname matching and is only an alias for&lt;br /&gt;
 #          (?:::f{4,6}:)?(?P&amp;lt;host&amp;gt;\S+)&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 failregex = NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Wrong password&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - No matching peer found&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Username/auth name mismatch&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Device does not match ACL&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&amp;quot; .* failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Peer is not supposed to register&lt;br /&gt;
             NOTICE.* &amp;lt;HOST&amp;gt; failed to authenticate as &#039;.*&#039;$&lt;br /&gt;
             NOTICE.* .*: No registration for peer &#039;.*&#039; \(from &amp;lt;HOST&amp;gt;\)&lt;br /&gt;
             NOTICE.* .*: Host &amp;lt;HOST&amp;gt; failed MD5 authentication for &#039;.*&#039; (.*)&lt;br /&gt;
             NOTICE.* .*: Failed to authenticate user .*@&amp;lt;HOST&amp;gt;.*&lt;br /&gt;
 # Option:  ignoreregex&lt;br /&gt;
 # Notes.:  regex to ignore. If this regex matches, the line is ignored.&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 ignoreregex =&lt;br /&gt;
&lt;br /&gt;
Next edit /etc/fail2ban/jail.conf to include the following section so that it uses the new filter. &lt;br /&gt;
&lt;br /&gt;
 [asterisk-iptables]&lt;br /&gt;
 enabled  = true&lt;br /&gt;
 filter   = asterisk&lt;br /&gt;
 action   = iptables-allports[name=ASTERISK, protocol=all]&lt;br /&gt;
            sendmail-whois[name=ASTERISK, dest=root, sender=fail2ban@example.org]&lt;br /&gt;
 logpath  = /var/log/asterisk/full&lt;br /&gt;
 maxretry = 5&lt;br /&gt;
 bantime = 259200&lt;br /&gt;
&lt;br /&gt;
Locate the line ignoreip in /etc/fail2ban/jail.conf (beginning of the file) and insert the ip&#039;s and / or blocks you want fail2ban to ignore, so you don&#039;t risk banning yourserf or any host in your network.&lt;br /&gt;
&lt;br /&gt;
Mine is defined as follows:&lt;br /&gt;
&lt;br /&gt;
 [DEFAULT]&lt;br /&gt;
 # &amp;quot;ignoreip&amp;quot; can be an IP address, a CIDR mask or a DNS host. Fail2ban will not&lt;br /&gt;
 # ban a host which matches an address in this list. Several addresses can be   &lt;br /&gt;
 # defined using space separator.                                               &lt;br /&gt;
 ignoreip = 127.0.0.1 192.168.80.1 192.168.80.0 192.168.0.0&lt;br /&gt;
&lt;br /&gt;
To start fail2ban type the following as root:&lt;br /&gt;
&lt;br /&gt;
/etc/init.d/fail2ban start&lt;br /&gt;
&lt;br /&gt;
Check It&lt;br /&gt;
&lt;br /&gt;
If started properly issue the following command to view your iptables rules:&lt;br /&gt;
&lt;br /&gt;
 iptables -L -v&lt;br /&gt;
&lt;br /&gt;
You should see something like the following for the INPUT chain (this is the ouput of mine)&lt;br /&gt;
&lt;br /&gt;
 Chain INPUT (policy DROP 2241 packets, 160K bytes)              &lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination         &lt;br /&gt;
   372 27264 &#039;&#039;&#039;fail2ban-SSH&#039;&#039;&#039;  tcp  --  any    any     anywhere             anywhere            tcp dpt:ssh                                                                                          &lt;br /&gt;
 1312K  991M &#039;&#039;&#039;fail2ban-ASTERISK&#039;&#039;&#039;  all  --  any    any     anywhere             anywhere            &lt;br /&gt;
  553K   81M ACCEPT     all  --  lo     any     anywhere             anywhere                    &lt;br /&gt;
 1288K 1162M ACCEPT     all  --  any    any     anywhere             anywhere            state RELATED,ESTABLISHED                                                                               &lt;br /&gt;
     9   540 ACCEPT     all  --  any    any     anywhere             anywhere            MARK match 0x1                                                                                          &lt;br /&gt;
     2  1152 ACCEPT     udp  --  any    any     anywhere             anywhere            udp   dpt:bootps                                                                                          &lt;br /&gt;
 19276 5790K ACCEPT     all  --  any    any     192.168.80.0/24      anywhere                    &lt;br /&gt;
     0     0 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:iax                                                                                             &lt;br /&gt;
     4  1795 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:sip                                                                                             &lt;br /&gt;
     0     0 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:2000                                                                                            &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:sieve                                                                                           &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:1723                                                                                            &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:www                                                                                             &lt;br /&gt;
     1    60 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:ssh                                                                                             &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:https                                                                                           &lt;br /&gt;
     1    50 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpts:10001:20000&lt;br /&gt;
     0     0 ACCEPT     gre  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain FORWARD (policy ACCEPT 719K packets, 245M bytes)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
     0     0 TCPMSS     tcp  --  any    ppp+    anywhere             anywhere            tcp flags:SYN,RST/SYN TCPMSS clamp to PMTU&lt;br /&gt;
 Chain OUTPUT (policy ACCEPT 2099K packets, 590M bytes)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
     0     0 ACCEPT     gre  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain fail2ban-ASTERISK (1 references)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
  5091 2125K DROP       all  --  any    any     173.193.194.106-static.reverse.softlayer.com  anywhere&lt;br /&gt;
 1307K  989M RETURN     all  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain fail2ban-SSH (1 references)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
&lt;br /&gt;
If you do not see something similar to that then you have some troubleshooting to, check out /var/log/fail2ban.log.&lt;br /&gt;
&lt;br /&gt;
Example of my /var/log/fai2ban.log (173.193.194.106 is the real address from the attacker fail2ban banned):&lt;br /&gt;
&lt;br /&gt;
 ....&lt;br /&gt;
 2010-09-19 11:12:56,131 fail2ban.filter : INFO   Set maxRetry = 6&lt;br /&gt;
 2010-09-19 11:12:56,133 fail2ban.filter : INFO   Set findtime = 600&lt;br /&gt;
 2010-09-19 11:12:56,133 fail2ban.actions: INFO   Set banTime = 600&lt;br /&gt;
 2010-09-19 11:12:56,138 fail2ban.jail   : INFO   Jail &#039;ssh-iptables&#039; started&lt;br /&gt;
 2010-09-19 11:12:56,139 fail2ban.jail   : INFO   Jail &#039;asterisk-iptables&#039; started&lt;br /&gt;
 2010-09-19 11:12:56,141 fail2ban.jail   : INFO   Jail &#039;apache-tcpwrapper&#039; started&lt;br /&gt;
 2010-09-19 15:33:50,392 fail2ban.actions: WARNING [asterisk-iptables] Ban 173.193.194.106&lt;br /&gt;
 2010-09-19 15:34:50,982 fail2ban.actions: WARNING [asterisk-iptables] 173.193.194.106 already banned&lt;br /&gt;
&lt;br /&gt;
And this is the log (/var/log/asterisk/messages) showing the attack:&lt;br /&gt;
&lt;br /&gt;
 [2010-09-19 15:33:48] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;3235410554&amp;quot;&amp;lt;sip:3235410554@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                           &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;thomas&amp;quot;&amp;lt;sip:thomas@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;arsenal&amp;quot;&amp;lt;sip:arsenal@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;letmein&amp;quot;&amp;lt;sip:letmein@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;liverpool&amp;quot;&amp;lt;sip:liverpool@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;nevermind&amp;quot;&amp;lt;sip:nevermind@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;getmein&amp;quot;&amp;lt;sip:getmein@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;echo&amp;quot;&amp;lt;sip:echo@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;bmw325&amp;quot;&amp;lt;sip:bmw325@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;bmw335&amp;quot;&amp;lt;sip:bmw335@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w3e&amp;quot;&amp;lt;sip:1q2w3e@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w3e4r5t6y&amp;quot;&amp;lt;sip:1q2w3e4r5t6y@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q1q2w2w&amp;quot;&amp;lt;sip:1q1q2w2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w1q2w&amp;quot;&amp;lt;sip:1q2w1q2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w&amp;quot;&amp;lt;sip:1q2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;11q22w&amp;quot;&amp;lt;sip:11q22w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;q1w2&amp;quot;&amp;lt;sip:q1w2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;q1w2e3&amp;quot;&amp;lt;sip:q1w2e3@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;tvv03tvv03&amp;quot;&amp;lt;sip:tvv03tvv03@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                           &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd1&amp;quot;&amp;lt;sip:abcd1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd12&amp;quot;&amp;lt;sip:abcd12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd123&amp;quot;&amp;lt;sip:abcd123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;qq11ww22ee33rr44&amp;quot;&amp;lt;sip:qq11ww22ee33rr44@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1&amp;quot;&amp;lt;sip:sip1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip2&amp;quot;&amp;lt;sip:sip2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip12&amp;quot;&amp;lt;sip:sip12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip123&amp;quot;&amp;lt;sip:sip123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1234&amp;quot;&amp;lt;sip:sip1234@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip12345&amp;quot;&amp;lt;sip:sip12345@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1111&amp;quot;&amp;lt;sip:sip1111@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip222&amp;quot;&amp;lt;sip:sip222@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1qa2ws3ed&amp;quot;&amp;lt;sip:1qa2ws3ed@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1234asdf&amp;quot;&amp;lt;sip:1234asdf@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1a2s3d&amp;quot;&amp;lt;sip:1a2s3d@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1a2s3d4f&amp;quot;&amp;lt;sip:1a2s3d4f@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;asdzxc&amp;quot;&amp;lt;sip:asdzxc@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;123zxc&amp;quot;&amp;lt;sip:123zxc@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1234zxcv&amp;quot;&amp;lt;sip:1234zxcv@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;aazzssxx&amp;quot;&amp;lt;sip:aazzssxx@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;p@ssword&amp;quot;&amp;lt;sip:p@ssword@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;p@ssw0rd&amp;quot;&amp;lt;sip:p@ssw0rd@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;pass1&amp;quot;&amp;lt;sip:pass1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;password3&amp;quot;&amp;lt;sip:password3@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;pass12&amp;quot;&amp;lt;sip:pass12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account&amp;quot;&amp;lt;sip:account@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;passlogin&amp;quot;&amp;lt;sip:passlogin@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account1&amp;quot;&amp;lt;sip:account1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account5&amp;quot;&amp;lt;sip:account5@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account6&amp;quot;&amp;lt;sip:account6@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account123&amp;quot;&amp;lt;sip:account123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account12&amp;quot;&amp;lt;sip:account12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc1&amp;quot;&amp;lt;sip:acc1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc2&amp;quot;&amp;lt;sip:acc2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc12&amp;quot;&amp;lt;sip:acc12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
&lt;br /&gt;
I hope this helps.&lt;br /&gt;
&lt;br /&gt;
source: http://www.voip-info.org/wiki/view/Fail2Ban+(with+iptables)+And+Asterisk&lt;/div&gt;</summary>
		<author><name>Pw44</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=Fail2ban_-_A_tool_against_brute_force&amp;diff=25085</id>
		<title>Fail2ban - A tool against brute force</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=Fail2ban_-_A_tool_against_brute_force&amp;diff=25085"/>
		<updated>2010-09-20T00:54:02Z</updated>

		<summary type="html">&lt;p&gt;Pw44: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: Tutorials]]&lt;br /&gt;
&lt;br /&gt;
Having asterik installed is almost an invitation for others wishing to place calls at your expense.&lt;br /&gt;
&lt;br /&gt;
After configuring my sip trunk, it did not take 2 days and some &amp;quot;smart guy&amp;quot;  was trying to register to take advantage of it, and causing me losses.&lt;br /&gt;
&lt;br /&gt;
Fail2ban prevented it, blocking the attacker with iptables rules.&lt;br /&gt;
&lt;br /&gt;
Installing fail2ban is not complicated and i will describe the steps to have it properly installed and configured, so you can protect your asterisk and other services from brute force attack.&lt;br /&gt;
&lt;br /&gt;
Install with: &lt;br /&gt;
 sudo apt-get install fail2ban&lt;br /&gt;
&lt;br /&gt;
After is installed, you need to change /etc/asterisk/logger.conf and add the following line under [general] section (You may have to create this before the [logfiles] section). &lt;br /&gt;
&lt;br /&gt;
 [general]&lt;br /&gt;
 dateformat=%F %T&lt;br /&gt;
&lt;br /&gt;
In /etc/asterisk/logger.conf add the following line under the [logfiles] section for asterisk to log NOTICE level events to the syslog (/var/log/messages) as well as its normal log file. These entries in syslog will have a Date/Time stamp that is usable by Fail2Ban.&lt;br /&gt;
&lt;br /&gt;
 syslog.local0 =&amp;gt; notice &lt;br /&gt;
&lt;br /&gt;
Reload asterisk with:&lt;br /&gt;
&lt;br /&gt;
 asterisk -rx &amp;quot;logger reload&amp;quot; &lt;br /&gt;
&lt;br /&gt;
Configuring fail2ban:&lt;br /&gt;
&lt;br /&gt;
 cd /etc/fail2ban/filter.d&lt;br /&gt;
&lt;br /&gt;
 touch asterisk.conf &lt;br /&gt;
&lt;br /&gt;
 vi asterisk.conf&lt;br /&gt;
&lt;br /&gt;
insert the following (copy &amp;amp; paste)&lt;br /&gt;
&lt;br /&gt;
 # Fail2Ban configuration file&lt;br /&gt;
 #&lt;br /&gt;
 #&lt;br /&gt;
 # $Revision: 250 $&lt;br /&gt;
 #&lt;br /&gt;
 [INCLUDES]&lt;br /&gt;
 # Read common prefixes. If any customizations available -- read them from&lt;br /&gt;
 # common.local&lt;br /&gt;
 #before = common.conf&lt;br /&gt;
 [Definition]&lt;br /&gt;
 #_daemon = asterisk&lt;br /&gt;
 # Option:  failregex&lt;br /&gt;
 # Notes.:  regex to match the password failures messages in the logfile. The&lt;br /&gt;
 #          host must be matched by a group named &amp;quot;host&amp;quot;. The tag &amp;quot;&amp;lt;HOST&amp;gt;&amp;quot; can&lt;br /&gt;
 #          be used for standard IP/hostname matching and is only an alias for&lt;br /&gt;
 #          (?:::f{4,6}:)?(?P&amp;lt;host&amp;gt;\S+)&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 failregex = NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Wrong password&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - No matching peer found&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Username/auth name mismatch&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Device does not match ACL&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&amp;quot; .* failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Peer is not supposed to register&lt;br /&gt;
             NOTICE.* &amp;lt;HOST&amp;gt; failed to authenticate as &#039;.*&#039;$&lt;br /&gt;
             NOTICE.* .*: No registration for peer &#039;.*&#039; \(from &amp;lt;HOST&amp;gt;\)&lt;br /&gt;
             NOTICE.* .*: Host &amp;lt;HOST&amp;gt; failed MD5 authentication for &#039;.*&#039; (.*)&lt;br /&gt;
             NOTICE.* .*: Failed to authenticate user .*@&amp;lt;HOST&amp;gt;.*&lt;br /&gt;
 # Option:  ignoreregex&lt;br /&gt;
 # Notes.:  regex to ignore. If this regex matches, the line is ignored.&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 ignoreregex =&lt;br /&gt;
&lt;br /&gt;
Next edit /etc/fail2ban/jail.conf to include the following section so that it uses the new filter. &lt;br /&gt;
&lt;br /&gt;
 [asterisk-iptables]&lt;br /&gt;
 enabled  = true&lt;br /&gt;
 filter   = asterisk&lt;br /&gt;
 action   = iptables-allports[name=ASTERISK, protocol=all]&lt;br /&gt;
            sendmail-whois[name=ASTERISK, dest=root, sender=fail2ban@example.org]&lt;br /&gt;
 logpath  = /var/log/asterisk/full&lt;br /&gt;
 maxretry = 5&lt;br /&gt;
 bantime = 259200&lt;br /&gt;
&lt;br /&gt;
Locate the line ignoreip in /etc/fail2ban/jail.conf (beginning of the file) and insert the ip&#039;s and / or blocks you want fail2ban to ignore, so you don&#039;t risk banning yourserf or any host in your network.&lt;br /&gt;
&lt;br /&gt;
Mine is defined as follows:&lt;br /&gt;
&lt;br /&gt;
 [DEFAULT]&lt;br /&gt;
 # &amp;quot;ignoreip&amp;quot; can be an IP address, a CIDR mask or a DNS host. Fail2ban will not&lt;br /&gt;
 # ban a host which matches an address in this list. Several addresses can be   &lt;br /&gt;
 # defined using space separator.                                               &lt;br /&gt;
 ignoreip = 127.0.0.1 192.168.80.1 192.168.80.0 192.168.0.0&lt;br /&gt;
&lt;br /&gt;
To start Fail2Ban type the following as root:&lt;br /&gt;
&lt;br /&gt;
/etc/init.d/fail2ban start&lt;br /&gt;
&lt;br /&gt;
Check It&lt;br /&gt;
&lt;br /&gt;
If started properly issue the following command to view your iptables rules:&lt;br /&gt;
&lt;br /&gt;
 iptables -L -v&lt;br /&gt;
&lt;br /&gt;
You should see something like the following for the INPUT chain (this is the ouput of mine)&lt;br /&gt;
&lt;br /&gt;
 Chain INPUT (policy DROP 2241 packets, 160K bytes)              &lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination         &lt;br /&gt;
   372 27264 &#039;&#039;&#039;fail2ban-SSH&#039;&#039;&#039;  tcp  --  any    any     anywhere             anywhere            tcp dpt:ssh                                                                                          &lt;br /&gt;
 1312K  991M &#039;&#039;&#039;fail2ban-ASTERISK&#039;&#039;&#039;  all  --  any    any     anywhere             anywhere            &lt;br /&gt;
  553K   81M ACCEPT     all  --  lo     any     anywhere             anywhere                    &lt;br /&gt;
 1288K 1162M ACCEPT     all  --  any    any     anywhere             anywhere            state RELATED,ESTABLISHED                                                                               &lt;br /&gt;
     9   540 ACCEPT     all  --  any    any     anywhere             anywhere            MARK match 0x1                                                                                          &lt;br /&gt;
     2  1152 ACCEPT     udp  --  any    any     anywhere             anywhere            udp   dpt:bootps                                                                                          &lt;br /&gt;
 19276 5790K ACCEPT     all  --  any    any     192.168.80.0/24      anywhere                    &lt;br /&gt;
     0     0 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:iax                                                                                             &lt;br /&gt;
     4  1795 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:sip                                                                                             &lt;br /&gt;
     0     0 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:2000                                                                                            &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:sieve                                                                                           &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:1723                                                                                            &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:www                                                                                             &lt;br /&gt;
     1    60 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:ssh                                                                                             &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:https                                                                                           &lt;br /&gt;
     1    50 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpts:10001:20000&lt;br /&gt;
     0     0 ACCEPT     gre  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain FORWARD (policy ACCEPT 719K packets, 245M bytes)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
     0     0 TCPMSS     tcp  --  any    ppp+    anywhere             anywhere            tcp flags:SYN,RST/SYN TCPMSS clamp to PMTU&lt;br /&gt;
 Chain OUTPUT (policy ACCEPT 2099K packets, 590M bytes)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
     0     0 ACCEPT     gre  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain fail2ban-ASTERISK (1 references)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
  5091 2125K DROP       all  --  any    any     173.193.194.106-static.reverse.softlayer.com  anywhere&lt;br /&gt;
 1307K  989M RETURN     all  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain fail2ban-SSH (1 references)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
&lt;br /&gt;
If you do not see something similar to that then you have some troubleshooting to, check out /var/log/fail2ban.log.&lt;br /&gt;
&lt;br /&gt;
Example of my /var/log/fai2ban.log (173.193.194.106 is the real address from the attacker fail2ban banned):&lt;br /&gt;
&lt;br /&gt;
 ....&lt;br /&gt;
 2010-09-19 11:12:56,131 fail2ban.filter : INFO   Set maxRetry = 6&lt;br /&gt;
 2010-09-19 11:12:56,133 fail2ban.filter : INFO   Set findtime = 600&lt;br /&gt;
 2010-09-19 11:12:56,133 fail2ban.actions: INFO   Set banTime = 600&lt;br /&gt;
 2010-09-19 11:12:56,138 fail2ban.jail   : INFO   Jail &#039;ssh-iptables&#039; started&lt;br /&gt;
 2010-09-19 11:12:56,139 fail2ban.jail   : INFO   Jail &#039;asterisk-iptables&#039; started&lt;br /&gt;
 2010-09-19 11:12:56,141 fail2ban.jail   : INFO   Jail &#039;apache-tcpwrapper&#039; started&lt;br /&gt;
 2010-09-19 15:33:50,392 fail2ban.actions: WARNING [asterisk-iptables] Ban 173.193.194.106&lt;br /&gt;
 2010-09-19 15:34:50,982 fail2ban.actions: WARNING [asterisk-iptables] 173.193.194.106 already banned&lt;br /&gt;
&lt;br /&gt;
And this is the log (/var/log/asterisk/messages) showing the attack:&lt;br /&gt;
&lt;br /&gt;
 [2010-09-19 15:33:48] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;3235410554&amp;quot;&amp;lt;sip:3235410554@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                           &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;thomas&amp;quot;&amp;lt;sip:thomas@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;arsenal&amp;quot;&amp;lt;sip:arsenal@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;letmein&amp;quot;&amp;lt;sip:letmein@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;liverpool&amp;quot;&amp;lt;sip:liverpool@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;nevermind&amp;quot;&amp;lt;sip:nevermind@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;getmein&amp;quot;&amp;lt;sip:getmein@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;echo&amp;quot;&amp;lt;sip:echo@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;bmw325&amp;quot;&amp;lt;sip:bmw325@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;bmw335&amp;quot;&amp;lt;sip:bmw335@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w3e&amp;quot;&amp;lt;sip:1q2w3e@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w3e4r5t6y&amp;quot;&amp;lt;sip:1q2w3e4r5t6y@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q1q2w2w&amp;quot;&amp;lt;sip:1q1q2w2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w1q2w&amp;quot;&amp;lt;sip:1q2w1q2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w&amp;quot;&amp;lt;sip:1q2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;11q22w&amp;quot;&amp;lt;sip:11q22w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;q1w2&amp;quot;&amp;lt;sip:q1w2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;q1w2e3&amp;quot;&amp;lt;sip:q1w2e3@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;tvv03tvv03&amp;quot;&amp;lt;sip:tvv03tvv03@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                           &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd1&amp;quot;&amp;lt;sip:abcd1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd12&amp;quot;&amp;lt;sip:abcd12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd123&amp;quot;&amp;lt;sip:abcd123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;qq11ww22ee33rr44&amp;quot;&amp;lt;sip:qq11ww22ee33rr44@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1&amp;quot;&amp;lt;sip:sip1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip2&amp;quot;&amp;lt;sip:sip2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip12&amp;quot;&amp;lt;sip:sip12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip123&amp;quot;&amp;lt;sip:sip123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1234&amp;quot;&amp;lt;sip:sip1234@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip12345&amp;quot;&amp;lt;sip:sip12345@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1111&amp;quot;&amp;lt;sip:sip1111@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip222&amp;quot;&amp;lt;sip:sip222@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1qa2ws3ed&amp;quot;&amp;lt;sip:1qa2ws3ed@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1234asdf&amp;quot;&amp;lt;sip:1234asdf@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1a2s3d&amp;quot;&amp;lt;sip:1a2s3d@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1a2s3d4f&amp;quot;&amp;lt;sip:1a2s3d4f@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;asdzxc&amp;quot;&amp;lt;sip:asdzxc@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;123zxc&amp;quot;&amp;lt;sip:123zxc@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1234zxcv&amp;quot;&amp;lt;sip:1234zxcv@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;aazzssxx&amp;quot;&amp;lt;sip:aazzssxx@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;p@ssword&amp;quot;&amp;lt;sip:p@ssword@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;p@ssw0rd&amp;quot;&amp;lt;sip:p@ssw0rd@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;pass1&amp;quot;&amp;lt;sip:pass1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;password3&amp;quot;&amp;lt;sip:password3@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;pass12&amp;quot;&amp;lt;sip:pass12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account&amp;quot;&amp;lt;sip:account@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;passlogin&amp;quot;&amp;lt;sip:passlogin@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account1&amp;quot;&amp;lt;sip:account1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account5&amp;quot;&amp;lt;sip:account5@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account6&amp;quot;&amp;lt;sip:account6@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account123&amp;quot;&amp;lt;sip:account123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account12&amp;quot;&amp;lt;sip:account12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc1&amp;quot;&amp;lt;sip:acc1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc2&amp;quot;&amp;lt;sip:acc2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc12&amp;quot;&amp;lt;sip:acc12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
&lt;br /&gt;
I hope this helps.&lt;br /&gt;
&lt;br /&gt;
source: http://www.voip-info.org/wiki/view/Fail2Ban+(with+iptables)+And+Asterisk&lt;/div&gt;</summary>
		<author><name>Pw44</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=Fail2ban_-_A_tool_against_brute_force&amp;diff=25084</id>
		<title>Fail2ban - A tool against brute force</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=Fail2ban_-_A_tool_against_brute_force&amp;diff=25084"/>
		<updated>2010-09-20T00:37:28Z</updated>

		<summary type="html">&lt;p&gt;Pw44: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: Tutorials]]&lt;br /&gt;
&lt;br /&gt;
Having asterik installed is almost an invitation for others wishing to place calls at your expense.&lt;br /&gt;
&lt;br /&gt;
After configuring my sip trunk, it did not take 2 days and some &amp;quot;smart guy&amp;quot;  was trying to register to take advantage of it, and causing me losses.&lt;br /&gt;
&lt;br /&gt;
Fail2ban prevented it, blocking the attacker with iptables rules.&lt;br /&gt;
&lt;br /&gt;
Installing fail2ban is not complicated and i will describe the steps to have it properly installed and configured, so you can protect your asterisk and other services from brute force attack.&lt;br /&gt;
&lt;br /&gt;
Install with: &lt;br /&gt;
 sudo apt-get install fail2ban&lt;br /&gt;
&lt;br /&gt;
After is installed, you need to change /etc/asterisk/logger.conf and add the following line under [general] section (You may have to create this before the [logfiles] section). &lt;br /&gt;
&lt;br /&gt;
 [general]&lt;br /&gt;
 dateformat=%F %T&lt;br /&gt;
&lt;br /&gt;
In /etc/asterisk/logger.conf add the following line under the [logfiles] section for Asterisk to log NOTICE level events to the syslog (/var/log/messages) as well as its normal log file. These entries in syslog will have a Date/Time stamp that is usable by Fail2Ban.&lt;br /&gt;
&lt;br /&gt;
 syslog.local0 =&amp;gt; notice &lt;br /&gt;
&lt;br /&gt;
Reload asterisk with:&lt;br /&gt;
&lt;br /&gt;
 asterisk -rx &amp;quot;logger reload&amp;quot; &lt;br /&gt;
&lt;br /&gt;
Configuring fail2ban:&lt;br /&gt;
&lt;br /&gt;
 cd /etc/fail2ban/filter.d&lt;br /&gt;
&lt;br /&gt;
 touch asterisk.conf &lt;br /&gt;
&lt;br /&gt;
 vi asterisk.conf&lt;br /&gt;
&lt;br /&gt;
insert the following (copy &amp;amp; paste)&lt;br /&gt;
&lt;br /&gt;
 # Fail2Ban configuration file&lt;br /&gt;
 #&lt;br /&gt;
 #&lt;br /&gt;
 # $Revision: 250 $&lt;br /&gt;
 #&lt;br /&gt;
 [INCLUDES]&lt;br /&gt;
 # Read common prefixes. If any customizations available -- read them from&lt;br /&gt;
 # common.local&lt;br /&gt;
 #before = common.conf&lt;br /&gt;
 [Definition]&lt;br /&gt;
 #_daemon = asterisk&lt;br /&gt;
 # Option:  failregex&lt;br /&gt;
 # Notes.:  regex to match the password failures messages in the logfile. The&lt;br /&gt;
 #          host must be matched by a group named &amp;quot;host&amp;quot;. The tag &amp;quot;&amp;lt;HOST&amp;gt;&amp;quot; can&lt;br /&gt;
 #          be used for standard IP/hostname matching and is only an alias for&lt;br /&gt;
 #          (?:::f{4,6}:)?(?P&amp;lt;host&amp;gt;\S+)&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 failregex = NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Wrong password&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - No matching peer found&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Username/auth name mismatch&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Device does not match ACL&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&amp;quot; .* failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Peer is not supposed to register&lt;br /&gt;
             NOTICE.* &amp;lt;HOST&amp;gt; failed to authenticate as &#039;.*&#039;$&lt;br /&gt;
             NOTICE.* .*: No registration for peer &#039;.*&#039; \(from &amp;lt;HOST&amp;gt;\)&lt;br /&gt;
             NOTICE.* .*: Host &amp;lt;HOST&amp;gt; failed MD5 authentication for &#039;.*&#039; (.*)&lt;br /&gt;
             NOTICE.* .*: Failed to authenticate user .*@&amp;lt;HOST&amp;gt;.*&lt;br /&gt;
 # Option:  ignoreregex&lt;br /&gt;
 # Notes.:  regex to ignore. If this regex matches, the line is ignored.&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 ignoreregex =&lt;br /&gt;
&lt;br /&gt;
Next edit /etc/fail2ban/jail.conf to include the following section so that it uses the new filter. &lt;br /&gt;
&lt;br /&gt;
 [asterisk-iptables]&lt;br /&gt;
 enabled  = true&lt;br /&gt;
 filter   = asterisk&lt;br /&gt;
 action   = iptables-allports[name=ASTERISK, protocol=all]&lt;br /&gt;
            sendmail-whois[name=ASTERISK, dest=root, sender=fail2ban@example.org]&lt;br /&gt;
 logpath  = /var/log/asterisk/full&lt;br /&gt;
 maxretry = 5&lt;br /&gt;
 bantime = 259200&lt;br /&gt;
&lt;br /&gt;
Locate the line ignoreip in /etc/fail2ban/jail.conf (beginning of the file) and insert the ip&#039;s and / or blocks you want fail2ban to ignore, so you don&#039;t risk banning yourserf or any host in your network.&lt;br /&gt;
&lt;br /&gt;
Mine is defined as follows:&lt;br /&gt;
&lt;br /&gt;
 [DEFAULT]&lt;br /&gt;
 # &amp;quot;ignoreip&amp;quot; can be an IP address, a CIDR mask or a DNS host. Fail2ban will not&lt;br /&gt;
 # ban a host which matches an address in this list. Several addresses can be   &lt;br /&gt;
 # defined using space separator.                                               &lt;br /&gt;
 ignoreip = 127.0.0.1 192.168.80.1 192.168.80.0 192.168.0.0&lt;br /&gt;
&lt;br /&gt;
To start Fail2Ban type the following as root:&lt;br /&gt;
&lt;br /&gt;
/etc/init.d/fail2ban start&lt;br /&gt;
&lt;br /&gt;
Check It&lt;br /&gt;
&lt;br /&gt;
If started properly issue the following command to view your iptables rules:&lt;br /&gt;
&lt;br /&gt;
 iptables -L -v&lt;br /&gt;
&lt;br /&gt;
You should see something like the following for the INPUT chain (this is the ouput of mine)&lt;br /&gt;
&lt;br /&gt;
 Chain INPUT (policy DROP 2241 packets, 160K bytes)              &lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination         &lt;br /&gt;
   372 27264 &#039;&#039;&#039;fail2ban-SSH&#039;&#039;&#039;  tcp  --  any    any     anywhere             anywhere            tcp dpt:ssh                                                                                          &lt;br /&gt;
 1312K  991M &#039;&#039;&#039;fail2ban-ASTERISK&#039;&#039;&#039;  all  --  any    any     anywhere             anywhere            &lt;br /&gt;
  553K   81M ACCEPT     all  --  lo     any     anywhere             anywhere                    &lt;br /&gt;
 1288K 1162M ACCEPT     all  --  any    any     anywhere             anywhere            state RELATED,ESTABLISHED                                                                               &lt;br /&gt;
     9   540 ACCEPT     all  --  any    any     anywhere             anywhere            MARK match 0x1                                                                                          &lt;br /&gt;
     2  1152 ACCEPT     udp  --  any    any     anywhere             anywhere            udp   dpt:bootps                                                                                          &lt;br /&gt;
 19276 5790K ACCEPT     all  --  any    any     192.168.80.0/24      anywhere                    &lt;br /&gt;
     0     0 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:iax                                                                                             &lt;br /&gt;
     4  1795 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:sip                                                                                             &lt;br /&gt;
     0     0 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:2000                                                                                            &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:sieve                                                                                           &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:1723                                                                                            &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:www                                                                                             &lt;br /&gt;
     1    60 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:ssh                                                                                             &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:https                                                                                           &lt;br /&gt;
     1    50 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpts:10001:20000&lt;br /&gt;
     0     0 ACCEPT     gre  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain FORWARD (policy ACCEPT 719K packets, 245M bytes)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
     0     0 TCPMSS     tcp  --  any    ppp+    anywhere             anywhere            tcp flags:SYN,RST/SYN TCPMSS clamp to PMTU&lt;br /&gt;
 Chain OUTPUT (policy ACCEPT 2099K packets, 590M bytes)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
     0     0 ACCEPT     gre  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain fail2ban-ASTERISK (1 references)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
  5091 2125K DROP       all  --  any    any     173.193.194.106-static.reverse.softlayer.com  anywhere&lt;br /&gt;
 1307K  989M RETURN     all  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain fail2ban-SSH (1 references)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
&lt;br /&gt;
If you do not see something similar to that then you have some troubleshooting to, check out /var/log/fail2ban.log.&lt;br /&gt;
&lt;br /&gt;
Example of my /var/log/fai2ban.log (173.193.194.106 is the real address from the attacker fail2ban banned):&lt;br /&gt;
&lt;br /&gt;
 ....&lt;br /&gt;
 2010-09-19 11:12:56,131 fail2ban.filter : INFO   Set maxRetry = 6&lt;br /&gt;
 2010-09-19 11:12:56,133 fail2ban.filter : INFO   Set findtime = 600&lt;br /&gt;
 2010-09-19 11:12:56,133 fail2ban.actions: INFO   Set banTime = 600&lt;br /&gt;
 2010-09-19 11:12:56,138 fail2ban.jail   : INFO   Jail &#039;ssh-iptables&#039; started&lt;br /&gt;
 2010-09-19 11:12:56,139 fail2ban.jail   : INFO   Jail &#039;asterisk-iptables&#039; started&lt;br /&gt;
 2010-09-19 11:12:56,141 fail2ban.jail   : INFO   Jail &#039;apache-tcpwrapper&#039; started&lt;br /&gt;
 2010-09-19 15:33:50,392 fail2ban.actions: WARNING [asterisk-iptables] Ban 173.193.194.106&lt;br /&gt;
 2010-09-19 15:34:50,982 fail2ban.actions: WARNING [asterisk-iptables] 173.193.194.106 already banned&lt;br /&gt;
&lt;br /&gt;
And this is the log (/var/log/asterisk/messages) showing the attack:&lt;br /&gt;
&lt;br /&gt;
 [2010-09-19 15:33:48] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;3235410554&amp;quot;&amp;lt;sip:3235410554@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                           &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;thomas&amp;quot;&amp;lt;sip:thomas@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;arsenal&amp;quot;&amp;lt;sip:arsenal@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;letmein&amp;quot;&amp;lt;sip:letmein@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;liverpool&amp;quot;&amp;lt;sip:liverpool@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;nevermind&amp;quot;&amp;lt;sip:nevermind@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;getmein&amp;quot;&amp;lt;sip:getmein@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;echo&amp;quot;&amp;lt;sip:echo@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;bmw325&amp;quot;&amp;lt;sip:bmw325@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;bmw335&amp;quot;&amp;lt;sip:bmw335@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w3e&amp;quot;&amp;lt;sip:1q2w3e@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w3e4r5t6y&amp;quot;&amp;lt;sip:1q2w3e4r5t6y@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q1q2w2w&amp;quot;&amp;lt;sip:1q1q2w2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w1q2w&amp;quot;&amp;lt;sip:1q2w1q2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w&amp;quot;&amp;lt;sip:1q2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;11q22w&amp;quot;&amp;lt;sip:11q22w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;q1w2&amp;quot;&amp;lt;sip:q1w2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;q1w2e3&amp;quot;&amp;lt;sip:q1w2e3@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;tvv03tvv03&amp;quot;&amp;lt;sip:tvv03tvv03@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                           &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd1&amp;quot;&amp;lt;sip:abcd1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd12&amp;quot;&amp;lt;sip:abcd12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd123&amp;quot;&amp;lt;sip:abcd123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;qq11ww22ee33rr44&amp;quot;&amp;lt;sip:qq11ww22ee33rr44@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1&amp;quot;&amp;lt;sip:sip1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip2&amp;quot;&amp;lt;sip:sip2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip12&amp;quot;&amp;lt;sip:sip12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip123&amp;quot;&amp;lt;sip:sip123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1234&amp;quot;&amp;lt;sip:sip1234@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip12345&amp;quot;&amp;lt;sip:sip12345@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1111&amp;quot;&amp;lt;sip:sip1111@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip222&amp;quot;&amp;lt;sip:sip222@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1qa2ws3ed&amp;quot;&amp;lt;sip:1qa2ws3ed@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1234asdf&amp;quot;&amp;lt;sip:1234asdf@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1a2s3d&amp;quot;&amp;lt;sip:1a2s3d@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1a2s3d4f&amp;quot;&amp;lt;sip:1a2s3d4f@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;asdzxc&amp;quot;&amp;lt;sip:asdzxc@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;123zxc&amp;quot;&amp;lt;sip:123zxc@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1234zxcv&amp;quot;&amp;lt;sip:1234zxcv@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;aazzssxx&amp;quot;&amp;lt;sip:aazzssxx@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;p@ssword&amp;quot;&amp;lt;sip:p@ssword@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;p@ssw0rd&amp;quot;&amp;lt;sip:p@ssw0rd@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;pass1&amp;quot;&amp;lt;sip:pass1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;password3&amp;quot;&amp;lt;sip:password3@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;pass12&amp;quot;&amp;lt;sip:pass12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account&amp;quot;&amp;lt;sip:account@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;passlogin&amp;quot;&amp;lt;sip:passlogin@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account1&amp;quot;&amp;lt;sip:account1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account5&amp;quot;&amp;lt;sip:account5@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account6&amp;quot;&amp;lt;sip:account6@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account123&amp;quot;&amp;lt;sip:account123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account12&amp;quot;&amp;lt;sip:account12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc1&amp;quot;&amp;lt;sip:acc1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc2&amp;quot;&amp;lt;sip:acc2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc12&amp;quot;&amp;lt;sip:acc12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
&lt;br /&gt;
I hope this helps.&lt;br /&gt;
&lt;br /&gt;
source: http://www.voip-info.org/wiki/view/Fail2Ban+(with+iptables)+And+Asterisk&lt;/div&gt;</summary>
		<author><name>Pw44</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=Fail2ban_tool_against_brute_force&amp;diff=25083</id>
		<title>Fail2ban tool against brute force</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=Fail2ban_tool_against_brute_force&amp;diff=25083"/>
		<updated>2010-09-20T00:34:24Z</updated>

		<summary type="html">&lt;p&gt;Pw44: Fail2ban tool against brute force moved to Fail2ban - A tool against brute force: Title was revised&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Fail2ban - A tool against brute force]]&lt;/div&gt;</summary>
		<author><name>Pw44</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=Fail2ban_-_A_tool_against_brute_force&amp;diff=25082</id>
		<title>Fail2ban - A tool against brute force</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=Fail2ban_-_A_tool_against_brute_force&amp;diff=25082"/>
		<updated>2010-09-20T00:34:24Z</updated>

		<summary type="html">&lt;p&gt;Pw44: Fail2ban tool against brute force moved to Fail2ban - A tool against brute force: Title was revised&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: Tutorials]]&lt;br /&gt;
&lt;br /&gt;
Having asterik installed is almost an invitation for others wishing to place calls at your expense.&lt;br /&gt;
&lt;br /&gt;
After configuring my sip trunk, i did not take 2 days and someone was trying to register to take advantage of it.&lt;br /&gt;
&lt;br /&gt;
Fail2ban prevented it, blocking the attacker with iptables rules.&lt;br /&gt;
&lt;br /&gt;
Installing fail2ban is not complicated and i will describe the steps to have it properly installed and configured, so you can protect your asterisk and other services from brute force attack.&lt;br /&gt;
&lt;br /&gt;
Install with: &lt;br /&gt;
 sudo apt-get install fail2ban&lt;br /&gt;
&lt;br /&gt;
After is installed, you need to change /etc/asterisk/logger.conf and add the following line under [general] section (You may have to create this before the [logfiles] section). &lt;br /&gt;
&lt;br /&gt;
 [general]&lt;br /&gt;
 dateformat=%F %T&lt;br /&gt;
&lt;br /&gt;
In /etc/asterisk/logger.conf add the following line under the [logfiles] section for Asterisk to log NOTICE level events to the syslog (/var/log/messages) as well as its normal log file. These entries in syslog will have a Date/Time stamp that is usable by Fail2Ban.&lt;br /&gt;
&lt;br /&gt;
 syslog.local0 =&amp;gt; notice &lt;br /&gt;
&lt;br /&gt;
Reload asterisk with:&lt;br /&gt;
&lt;br /&gt;
 asterisk -rx &amp;quot;logger reload&amp;quot; &lt;br /&gt;
&lt;br /&gt;
Configuring fail2ban:&lt;br /&gt;
&lt;br /&gt;
 cd /etc/fail2ban/filter.d&lt;br /&gt;
&lt;br /&gt;
 touch asterisk.conf &lt;br /&gt;
&lt;br /&gt;
 vi asterisk.conf&lt;br /&gt;
&lt;br /&gt;
insert the following (copy &amp;amp; paste)&lt;br /&gt;
&lt;br /&gt;
 # Fail2Ban configuration file&lt;br /&gt;
 #&lt;br /&gt;
 #&lt;br /&gt;
 # $Revision: 250 $&lt;br /&gt;
 #&lt;br /&gt;
 [INCLUDES]&lt;br /&gt;
 # Read common prefixes. If any customizations available -- read them from&lt;br /&gt;
 # common.local&lt;br /&gt;
 #before = common.conf&lt;br /&gt;
 [Definition]&lt;br /&gt;
 #_daemon = asterisk&lt;br /&gt;
 # Option:  failregex&lt;br /&gt;
 # Notes.:  regex to match the password failures messages in the logfile. The&lt;br /&gt;
 #          host must be matched by a group named &amp;quot;host&amp;quot;. The tag &amp;quot;&amp;lt;HOST&amp;gt;&amp;quot; can&lt;br /&gt;
 #          be used for standard IP/hostname matching and is only an alias for&lt;br /&gt;
 #          (?:::f{4,6}:)?(?P&amp;lt;host&amp;gt;\S+)&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 failregex = NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Wrong password&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - No matching peer found&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Username/auth name mismatch&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Device does not match ACL&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&amp;quot; .* failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Peer is not supposed to register&lt;br /&gt;
             NOTICE.* &amp;lt;HOST&amp;gt; failed to authenticate as &#039;.*&#039;$&lt;br /&gt;
             NOTICE.* .*: No registration for peer &#039;.*&#039; \(from &amp;lt;HOST&amp;gt;\)&lt;br /&gt;
             NOTICE.* .*: Host &amp;lt;HOST&amp;gt; failed MD5 authentication for &#039;.*&#039; (.*)&lt;br /&gt;
             NOTICE.* .*: Failed to authenticate user .*@&amp;lt;HOST&amp;gt;.*&lt;br /&gt;
 # Option:  ignoreregex&lt;br /&gt;
 # Notes.:  regex to ignore. If this regex matches, the line is ignored.&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 ignoreregex =&lt;br /&gt;
&lt;br /&gt;
Next edit /etc/fail2ban/jail.conf to include the following section so that it uses the new filter. &lt;br /&gt;
&lt;br /&gt;
 [asterisk-iptables]&lt;br /&gt;
 enabled  = true&lt;br /&gt;
 filter   = asterisk&lt;br /&gt;
 action   = iptables-allports[name=ASTERISK, protocol=all]&lt;br /&gt;
            sendmail-whois[name=ASTERISK, dest=root, sender=fail2ban@example.org]&lt;br /&gt;
 logpath  = /var/log/asterisk/full&lt;br /&gt;
 maxretry = 5&lt;br /&gt;
 bantime = 259200&lt;br /&gt;
&lt;br /&gt;
Locate the line ignoreip in /etc/fail2ban/jail.conf (beginning of the file) and insert the ip&#039;s and / or blocks you want fail2ban to ignore, so you don&#039;t risk banning yourserf or any host in your network.&lt;br /&gt;
&lt;br /&gt;
Mine is defined as follows:&lt;br /&gt;
&lt;br /&gt;
 [DEFAULT]&lt;br /&gt;
 # &amp;quot;ignoreip&amp;quot; can be an IP address, a CIDR mask or a DNS host. Fail2ban will not&lt;br /&gt;
 # ban a host which matches an address in this list. Several addresses can be   &lt;br /&gt;
 # defined using space separator.                                               &lt;br /&gt;
 ignoreip = 127.0.0.1 192.168.80.1 192.168.80.0 192.168.0.0&lt;br /&gt;
&lt;br /&gt;
To start Fail2Ban type the following as root:&lt;br /&gt;
&lt;br /&gt;
/etc/init.d/fail2ban start&lt;br /&gt;
&lt;br /&gt;
Check It&lt;br /&gt;
&lt;br /&gt;
If started properly issue the following command to view your iptables rules:&lt;br /&gt;
&lt;br /&gt;
 iptables -L -v&lt;br /&gt;
&lt;br /&gt;
You should see something like the following for the INPUT chain (this is the ouput of mine)&lt;br /&gt;
&lt;br /&gt;
 Chain INPUT (policy DROP 2241 packets, 160K bytes)              &lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination         &lt;br /&gt;
   372 27264 &#039;&#039;&#039;fail2ban-SSH&#039;&#039;&#039;  tcp  --  any    any     anywhere             anywhere            tcp dpt:ssh                                                                                          &lt;br /&gt;
 1312K  991M &#039;&#039;&#039;fail2ban-ASTERISK&#039;&#039;&#039;  all  --  any    any     anywhere             anywhere            &lt;br /&gt;
  553K   81M ACCEPT     all  --  lo     any     anywhere             anywhere                    &lt;br /&gt;
 1288K 1162M ACCEPT     all  --  any    any     anywhere             anywhere            state RELATED,ESTABLISHED                                                                               &lt;br /&gt;
     9   540 ACCEPT     all  --  any    any     anywhere             anywhere            MARK match 0x1                                                                                          &lt;br /&gt;
     2  1152 ACCEPT     udp  --  any    any     anywhere             anywhere            udp   dpt:bootps                                                                                          &lt;br /&gt;
 19276 5790K ACCEPT     all  --  any    any     192.168.80.0/24      anywhere                    &lt;br /&gt;
     0     0 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:iax                                                                                             &lt;br /&gt;
     4  1795 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:sip                                                                                             &lt;br /&gt;
     0     0 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:2000                                                                                            &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:sieve                                                                                           &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:1723                                                                                            &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:www                                                                                             &lt;br /&gt;
     1    60 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:ssh                                                                                             &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:https                                                                                           &lt;br /&gt;
     1    50 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpts:10001:20000&lt;br /&gt;
     0     0 ACCEPT     gre  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain FORWARD (policy ACCEPT 719K packets, 245M bytes)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
     0     0 TCPMSS     tcp  --  any    ppp+    anywhere             anywhere            tcp flags:SYN,RST/SYN TCPMSS clamp to PMTU&lt;br /&gt;
 Chain OUTPUT (policy ACCEPT 2099K packets, 590M bytes)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
     0     0 ACCEPT     gre  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain fail2ban-ASTERISK (1 references)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
  5091 2125K DROP       all  --  any    any     173.193.194.106-static.reverse.softlayer.com  anywhere&lt;br /&gt;
 1307K  989M RETURN     all  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain fail2ban-SSH (1 references)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
&lt;br /&gt;
If you do not see something similar to that then you have some troubleshooting to, check out /var/log/fail2ban.log.&lt;br /&gt;
&lt;br /&gt;
Example of my /var/log/fai2ban.log (173.193.194.106 is the real address from the attacker fail2ban banned):&lt;br /&gt;
&lt;br /&gt;
 ....&lt;br /&gt;
 2010-09-19 11:12:56,131 fail2ban.filter : INFO   Set maxRetry = 6&lt;br /&gt;
 2010-09-19 11:12:56,133 fail2ban.filter : INFO   Set findtime = 600&lt;br /&gt;
 2010-09-19 11:12:56,133 fail2ban.actions: INFO   Set banTime = 600&lt;br /&gt;
 2010-09-19 11:12:56,138 fail2ban.jail   : INFO   Jail &#039;ssh-iptables&#039; started&lt;br /&gt;
 2010-09-19 11:12:56,139 fail2ban.jail   : INFO   Jail &#039;asterisk-iptables&#039; started&lt;br /&gt;
 2010-09-19 11:12:56,141 fail2ban.jail   : INFO   Jail &#039;apache-tcpwrapper&#039; started&lt;br /&gt;
 2010-09-19 15:33:50,392 fail2ban.actions: WARNING [asterisk-iptables] Ban 173.193.194.106&lt;br /&gt;
 2010-09-19 15:34:50,982 fail2ban.actions: WARNING [asterisk-iptables] 173.193.194.106 already banned&lt;br /&gt;
&lt;br /&gt;
And this is the log (/var/log/asterisk/messages) showing the attack:&lt;br /&gt;
&lt;br /&gt;
 [2010-09-19 15:33:48] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;3235410554&amp;quot;&amp;lt;sip:3235410554@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                           &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;thomas&amp;quot;&amp;lt;sip:thomas@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;arsenal&amp;quot;&amp;lt;sip:arsenal@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;letmein&amp;quot;&amp;lt;sip:letmein@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;liverpool&amp;quot;&amp;lt;sip:liverpool@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;nevermind&amp;quot;&amp;lt;sip:nevermind@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;getmein&amp;quot;&amp;lt;sip:getmein@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;echo&amp;quot;&amp;lt;sip:echo@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;bmw325&amp;quot;&amp;lt;sip:bmw325@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;bmw335&amp;quot;&amp;lt;sip:bmw335@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w3e&amp;quot;&amp;lt;sip:1q2w3e@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w3e4r5t6y&amp;quot;&amp;lt;sip:1q2w3e4r5t6y@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q1q2w2w&amp;quot;&amp;lt;sip:1q1q2w2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w1q2w&amp;quot;&amp;lt;sip:1q2w1q2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w&amp;quot;&amp;lt;sip:1q2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;11q22w&amp;quot;&amp;lt;sip:11q22w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;q1w2&amp;quot;&amp;lt;sip:q1w2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;q1w2e3&amp;quot;&amp;lt;sip:q1w2e3@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;tvv03tvv03&amp;quot;&amp;lt;sip:tvv03tvv03@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                           &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd1&amp;quot;&amp;lt;sip:abcd1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd12&amp;quot;&amp;lt;sip:abcd12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd123&amp;quot;&amp;lt;sip:abcd123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;qq11ww22ee33rr44&amp;quot;&amp;lt;sip:qq11ww22ee33rr44@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1&amp;quot;&amp;lt;sip:sip1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip2&amp;quot;&amp;lt;sip:sip2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip12&amp;quot;&amp;lt;sip:sip12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip123&amp;quot;&amp;lt;sip:sip123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1234&amp;quot;&amp;lt;sip:sip1234@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip12345&amp;quot;&amp;lt;sip:sip12345@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1111&amp;quot;&amp;lt;sip:sip1111@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip222&amp;quot;&amp;lt;sip:sip222@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1qa2ws3ed&amp;quot;&amp;lt;sip:1qa2ws3ed@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1234asdf&amp;quot;&amp;lt;sip:1234asdf@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1a2s3d&amp;quot;&amp;lt;sip:1a2s3d@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1a2s3d4f&amp;quot;&amp;lt;sip:1a2s3d4f@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;asdzxc&amp;quot;&amp;lt;sip:asdzxc@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;123zxc&amp;quot;&amp;lt;sip:123zxc@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1234zxcv&amp;quot;&amp;lt;sip:1234zxcv@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;aazzssxx&amp;quot;&amp;lt;sip:aazzssxx@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;p@ssword&amp;quot;&amp;lt;sip:p@ssword@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;p@ssw0rd&amp;quot;&amp;lt;sip:p@ssw0rd@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;pass1&amp;quot;&amp;lt;sip:pass1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;password3&amp;quot;&amp;lt;sip:password3@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;pass12&amp;quot;&amp;lt;sip:pass12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account&amp;quot;&amp;lt;sip:account@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;passlogin&amp;quot;&amp;lt;sip:passlogin@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account1&amp;quot;&amp;lt;sip:account1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account5&amp;quot;&amp;lt;sip:account5@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account6&amp;quot;&amp;lt;sip:account6@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account123&amp;quot;&amp;lt;sip:account123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account12&amp;quot;&amp;lt;sip:account12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc1&amp;quot;&amp;lt;sip:acc1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc2&amp;quot;&amp;lt;sip:acc2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc12&amp;quot;&amp;lt;sip:acc12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
&lt;br /&gt;
I hope this helps.&lt;br /&gt;
&lt;br /&gt;
source: http://www.voip-info.org/wiki/view/Fail2Ban+(with+iptables)+And+Asterisk&lt;/div&gt;</summary>
		<author><name>Pw44</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=Fail2ban_-_A_tool_against_brute_force&amp;diff=25081</id>
		<title>Fail2ban - A tool against brute force</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=Fail2ban_-_A_tool_against_brute_force&amp;diff=25081"/>
		<updated>2010-09-20T00:33:20Z</updated>

		<summary type="html">&lt;p&gt;Pw44: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: Tutorials]]&lt;br /&gt;
&lt;br /&gt;
Having asterik installed is almost an invitation for others wishing to place calls at your expense.&lt;br /&gt;
&lt;br /&gt;
After configuring my sip trunk, i did not take 2 days and someone was trying to register to take advantage of it.&lt;br /&gt;
&lt;br /&gt;
Fail2ban prevented it, blocking the attacker with iptables rules.&lt;br /&gt;
&lt;br /&gt;
Installing fail2ban is not complicated and i will describe the steps to have it properly installed and configured, so you can protect your asterisk and other services from brute force attack.&lt;br /&gt;
&lt;br /&gt;
Install with: &lt;br /&gt;
 sudo apt-get install fail2ban&lt;br /&gt;
&lt;br /&gt;
After is installed, you need to change /etc/asterisk/logger.conf and add the following line under [general] section (You may have to create this before the [logfiles] section). &lt;br /&gt;
&lt;br /&gt;
 [general]&lt;br /&gt;
 dateformat=%F %T&lt;br /&gt;
&lt;br /&gt;
In /etc/asterisk/logger.conf add the following line under the [logfiles] section for Asterisk to log NOTICE level events to the syslog (/var/log/messages) as well as its normal log file. These entries in syslog will have a Date/Time stamp that is usable by Fail2Ban.&lt;br /&gt;
&lt;br /&gt;
 syslog.local0 =&amp;gt; notice &lt;br /&gt;
&lt;br /&gt;
Reload asterisk with:&lt;br /&gt;
&lt;br /&gt;
 asterisk -rx &amp;quot;logger reload&amp;quot; &lt;br /&gt;
&lt;br /&gt;
Configuring fail2ban:&lt;br /&gt;
&lt;br /&gt;
 cd /etc/fail2ban/filter.d&lt;br /&gt;
&lt;br /&gt;
 touch asterisk.conf &lt;br /&gt;
&lt;br /&gt;
 vi asterisk.conf&lt;br /&gt;
&lt;br /&gt;
insert the following (copy &amp;amp; paste)&lt;br /&gt;
&lt;br /&gt;
 # Fail2Ban configuration file&lt;br /&gt;
 #&lt;br /&gt;
 #&lt;br /&gt;
 # $Revision: 250 $&lt;br /&gt;
 #&lt;br /&gt;
 [INCLUDES]&lt;br /&gt;
 # Read common prefixes. If any customizations available -- read them from&lt;br /&gt;
 # common.local&lt;br /&gt;
 #before = common.conf&lt;br /&gt;
 [Definition]&lt;br /&gt;
 #_daemon = asterisk&lt;br /&gt;
 # Option:  failregex&lt;br /&gt;
 # Notes.:  regex to match the password failures messages in the logfile. The&lt;br /&gt;
 #          host must be matched by a group named &amp;quot;host&amp;quot;. The tag &amp;quot;&amp;lt;HOST&amp;gt;&amp;quot; can&lt;br /&gt;
 #          be used for standard IP/hostname matching and is only an alias for&lt;br /&gt;
 #          (?:::f{4,6}:)?(?P&amp;lt;host&amp;gt;\S+)&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 failregex = NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Wrong password&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - No matching peer found&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Username/auth name mismatch&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Device does not match ACL&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&amp;quot; .* failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Peer is not supposed to register&lt;br /&gt;
             NOTICE.* &amp;lt;HOST&amp;gt; failed to authenticate as &#039;.*&#039;$&lt;br /&gt;
             NOTICE.* .*: No registration for peer &#039;.*&#039; \(from &amp;lt;HOST&amp;gt;\)&lt;br /&gt;
             NOTICE.* .*: Host &amp;lt;HOST&amp;gt; failed MD5 authentication for &#039;.*&#039; (.*)&lt;br /&gt;
             NOTICE.* .*: Failed to authenticate user .*@&amp;lt;HOST&amp;gt;.*&lt;br /&gt;
 # Option:  ignoreregex&lt;br /&gt;
 # Notes.:  regex to ignore. If this regex matches, the line is ignored.&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 ignoreregex =&lt;br /&gt;
&lt;br /&gt;
Next edit /etc/fail2ban/jail.conf to include the following section so that it uses the new filter. &lt;br /&gt;
&lt;br /&gt;
 [asterisk-iptables]&lt;br /&gt;
 enabled  = true&lt;br /&gt;
 filter   = asterisk&lt;br /&gt;
 action   = iptables-allports[name=ASTERISK, protocol=all]&lt;br /&gt;
            sendmail-whois[name=ASTERISK, dest=root, sender=fail2ban@example.org]&lt;br /&gt;
 logpath  = /var/log/asterisk/full&lt;br /&gt;
 maxretry = 5&lt;br /&gt;
 bantime = 259200&lt;br /&gt;
&lt;br /&gt;
Locate the line ignoreip in /etc/fail2ban/jail.conf (beginning of the file) and insert the ip&#039;s and / or blocks you want fail2ban to ignore, so you don&#039;t risk banning yourserf or any host in your network.&lt;br /&gt;
&lt;br /&gt;
Mine is defined as follows:&lt;br /&gt;
&lt;br /&gt;
 [DEFAULT]&lt;br /&gt;
 # &amp;quot;ignoreip&amp;quot; can be an IP address, a CIDR mask or a DNS host. Fail2ban will not&lt;br /&gt;
 # ban a host which matches an address in this list. Several addresses can be   &lt;br /&gt;
 # defined using space separator.                                               &lt;br /&gt;
 ignoreip = 127.0.0.1 192.168.80.1 192.168.80.0 192.168.0.0&lt;br /&gt;
&lt;br /&gt;
To start Fail2Ban type the following as root:&lt;br /&gt;
&lt;br /&gt;
/etc/init.d/fail2ban start&lt;br /&gt;
&lt;br /&gt;
Check It&lt;br /&gt;
&lt;br /&gt;
If started properly issue the following command to view your iptables rules:&lt;br /&gt;
&lt;br /&gt;
 iptables -L -v&lt;br /&gt;
&lt;br /&gt;
You should see something like the following for the INPUT chain (this is the ouput of mine)&lt;br /&gt;
&lt;br /&gt;
 Chain INPUT (policy DROP 2241 packets, 160K bytes)              &lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination         &lt;br /&gt;
   372 27264 &#039;&#039;&#039;fail2ban-SSH&#039;&#039;&#039;  tcp  --  any    any     anywhere             anywhere            tcp dpt:ssh                                                                                          &lt;br /&gt;
 1312K  991M &#039;&#039;&#039;fail2ban-ASTERISK&#039;&#039;&#039;  all  --  any    any     anywhere             anywhere            &lt;br /&gt;
  553K   81M ACCEPT     all  --  lo     any     anywhere             anywhere                    &lt;br /&gt;
 1288K 1162M ACCEPT     all  --  any    any     anywhere             anywhere            state RELATED,ESTABLISHED                                                                               &lt;br /&gt;
     9   540 ACCEPT     all  --  any    any     anywhere             anywhere            MARK match 0x1                                                                                          &lt;br /&gt;
     2  1152 ACCEPT     udp  --  any    any     anywhere             anywhere            udp   dpt:bootps                                                                                          &lt;br /&gt;
 19276 5790K ACCEPT     all  --  any    any     192.168.80.0/24      anywhere                    &lt;br /&gt;
     0     0 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:iax                                                                                             &lt;br /&gt;
     4  1795 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:sip                                                                                             &lt;br /&gt;
     0     0 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:2000                                                                                            &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:sieve                                                                                           &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:1723                                                                                            &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:www                                                                                             &lt;br /&gt;
     1    60 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:ssh                                                                                             &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:https                                                                                           &lt;br /&gt;
     1    50 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpts:10001:20000&lt;br /&gt;
     0     0 ACCEPT     gre  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain FORWARD (policy ACCEPT 719K packets, 245M bytes)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
     0     0 TCPMSS     tcp  --  any    ppp+    anywhere             anywhere            tcp flags:SYN,RST/SYN TCPMSS clamp to PMTU&lt;br /&gt;
 Chain OUTPUT (policy ACCEPT 2099K packets, 590M bytes)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
     0     0 ACCEPT     gre  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain fail2ban-ASTERISK (1 references)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
  5091 2125K DROP       all  --  any    any     173.193.194.106-static.reverse.softlayer.com  anywhere&lt;br /&gt;
 1307K  989M RETURN     all  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain fail2ban-SSH (1 references)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
&lt;br /&gt;
If you do not see something similar to that then you have some troubleshooting to, check out /var/log/fail2ban.log.&lt;br /&gt;
&lt;br /&gt;
Example of my /var/log/fai2ban.log (173.193.194.106 is the real address from the attacker fail2ban banned):&lt;br /&gt;
&lt;br /&gt;
 ....&lt;br /&gt;
 2010-09-19 11:12:56,131 fail2ban.filter : INFO   Set maxRetry = 6&lt;br /&gt;
 2010-09-19 11:12:56,133 fail2ban.filter : INFO   Set findtime = 600&lt;br /&gt;
 2010-09-19 11:12:56,133 fail2ban.actions: INFO   Set banTime = 600&lt;br /&gt;
 2010-09-19 11:12:56,138 fail2ban.jail   : INFO   Jail &#039;ssh-iptables&#039; started&lt;br /&gt;
 2010-09-19 11:12:56,139 fail2ban.jail   : INFO   Jail &#039;asterisk-iptables&#039; started&lt;br /&gt;
 2010-09-19 11:12:56,141 fail2ban.jail   : INFO   Jail &#039;apache-tcpwrapper&#039; started&lt;br /&gt;
 2010-09-19 15:33:50,392 fail2ban.actions: WARNING [asterisk-iptables] Ban 173.193.194.106&lt;br /&gt;
 2010-09-19 15:34:50,982 fail2ban.actions: WARNING [asterisk-iptables] 173.193.194.106 already banned&lt;br /&gt;
&lt;br /&gt;
And this is the log (/var/log/asterisk/messages) showing the attack:&lt;br /&gt;
&lt;br /&gt;
 [2010-09-19 15:33:48] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;3235410554&amp;quot;&amp;lt;sip:3235410554@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                           &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;thomas&amp;quot;&amp;lt;sip:thomas@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;arsenal&amp;quot;&amp;lt;sip:arsenal@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;letmein&amp;quot;&amp;lt;sip:letmein@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;liverpool&amp;quot;&amp;lt;sip:liverpool@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;nevermind&amp;quot;&amp;lt;sip:nevermind@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;getmein&amp;quot;&amp;lt;sip:getmein@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;echo&amp;quot;&amp;lt;sip:echo@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;bmw325&amp;quot;&amp;lt;sip:bmw325@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;bmw335&amp;quot;&amp;lt;sip:bmw335@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w3e&amp;quot;&amp;lt;sip:1q2w3e@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w3e4r5t6y&amp;quot;&amp;lt;sip:1q2w3e4r5t6y@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q1q2w2w&amp;quot;&amp;lt;sip:1q1q2w2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w1q2w&amp;quot;&amp;lt;sip:1q2w1q2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w&amp;quot;&amp;lt;sip:1q2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;11q22w&amp;quot;&amp;lt;sip:11q22w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;q1w2&amp;quot;&amp;lt;sip:q1w2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;q1w2e3&amp;quot;&amp;lt;sip:q1w2e3@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;tvv03tvv03&amp;quot;&amp;lt;sip:tvv03tvv03@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                           &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd1&amp;quot;&amp;lt;sip:abcd1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd12&amp;quot;&amp;lt;sip:abcd12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd123&amp;quot;&amp;lt;sip:abcd123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;qq11ww22ee33rr44&amp;quot;&amp;lt;sip:qq11ww22ee33rr44@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1&amp;quot;&amp;lt;sip:sip1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip2&amp;quot;&amp;lt;sip:sip2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip12&amp;quot;&amp;lt;sip:sip12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip123&amp;quot;&amp;lt;sip:sip123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1234&amp;quot;&amp;lt;sip:sip1234@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip12345&amp;quot;&amp;lt;sip:sip12345@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1111&amp;quot;&amp;lt;sip:sip1111@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip222&amp;quot;&amp;lt;sip:sip222@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1qa2ws3ed&amp;quot;&amp;lt;sip:1qa2ws3ed@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1234asdf&amp;quot;&amp;lt;sip:1234asdf@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1a2s3d&amp;quot;&amp;lt;sip:1a2s3d@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1a2s3d4f&amp;quot;&amp;lt;sip:1a2s3d4f@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;asdzxc&amp;quot;&amp;lt;sip:asdzxc@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;123zxc&amp;quot;&amp;lt;sip:123zxc@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1234zxcv&amp;quot;&amp;lt;sip:1234zxcv@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;aazzssxx&amp;quot;&amp;lt;sip:aazzssxx@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;p@ssword&amp;quot;&amp;lt;sip:p@ssword@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;p@ssw0rd&amp;quot;&amp;lt;sip:p@ssw0rd@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;pass1&amp;quot;&amp;lt;sip:pass1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;password3&amp;quot;&amp;lt;sip:password3@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;pass12&amp;quot;&amp;lt;sip:pass12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account&amp;quot;&amp;lt;sip:account@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;passlogin&amp;quot;&amp;lt;sip:passlogin@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account1&amp;quot;&amp;lt;sip:account1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account5&amp;quot;&amp;lt;sip:account5@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account6&amp;quot;&amp;lt;sip:account6@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account123&amp;quot;&amp;lt;sip:account123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account12&amp;quot;&amp;lt;sip:account12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc1&amp;quot;&amp;lt;sip:acc1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc2&amp;quot;&amp;lt;sip:acc2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc12&amp;quot;&amp;lt;sip:acc12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
&lt;br /&gt;
I hope this helps.&lt;br /&gt;
&lt;br /&gt;
source: http://www.voip-info.org/wiki/view/Fail2Ban+(with+iptables)+And+Asterisk&lt;/div&gt;</summary>
		<author><name>Pw44</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=Fail2ban_-_A_tool_against_brute_force&amp;diff=25080</id>
		<title>Fail2ban - A tool against brute force</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=Fail2ban_-_A_tool_against_brute_force&amp;diff=25080"/>
		<updated>2010-09-20T00:31:56Z</updated>

		<summary type="html">&lt;p&gt;Pw44: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: Tutorials]]&lt;br /&gt;
&lt;br /&gt;
Having asterik installed is almost an invitation for others wishing to place calls at your expense.&lt;br /&gt;
&lt;br /&gt;
After configuring my sip trunk, i did not take 2 days and someone was trying to register to take advantage of it.&lt;br /&gt;
&lt;br /&gt;
Fail2ban prevented it, blocking the attacker with iptables rules.&lt;br /&gt;
&lt;br /&gt;
Installing fail2ban is not complicated and i will describe the steps to have it properly installed and configured, so you can protect your asterisk and other services from brute force attack.&lt;br /&gt;
&lt;br /&gt;
Install with: &lt;br /&gt;
 sudo apt-get install fail2ban&lt;br /&gt;
&lt;br /&gt;
After is installed, you need to change /etc/asterisk/logger.conf and add the following line under [general] section (You may have to create this before the [logfiles] section). &lt;br /&gt;
&lt;br /&gt;
 [general]&lt;br /&gt;
 dateformat=%F %T&lt;br /&gt;
&lt;br /&gt;
In /etc/asterisk/logger.conf add the following line under the [logfiles] section for Asterisk to log NOTICE level events to the syslog (/var/log/messages) as well as its normal log file. These entries in syslog will have a Date/Time stamp that is usable by Fail2Ban.&lt;br /&gt;
&lt;br /&gt;
 syslog.local0 =&amp;gt; notice &lt;br /&gt;
&lt;br /&gt;
Reload asterisk with:&lt;br /&gt;
&lt;br /&gt;
 asterisk -rx &amp;quot;logger reload&amp;quot; &lt;br /&gt;
&lt;br /&gt;
Configuring fail2ban:&lt;br /&gt;
&lt;br /&gt;
 cd /etc/fail2ban/filter.d&lt;br /&gt;
&lt;br /&gt;
 touch asterisk.conf &lt;br /&gt;
&lt;br /&gt;
 vi asterisk.conf&lt;br /&gt;
&lt;br /&gt;
insert the following (copy &amp;amp; paste)&lt;br /&gt;
&lt;br /&gt;
 # Fail2Ban configuration file&lt;br /&gt;
 #&lt;br /&gt;
 #&lt;br /&gt;
 # $Revision: 250 $&lt;br /&gt;
 #&lt;br /&gt;
 [INCLUDES]&lt;br /&gt;
 # Read common prefixes. If any customizations available -- read them from&lt;br /&gt;
 # common.local&lt;br /&gt;
 #before = common.conf&lt;br /&gt;
 [Definition]&lt;br /&gt;
 #_daemon = asterisk&lt;br /&gt;
 # Option:  failregex&lt;br /&gt;
 # Notes.:  regex to match the password failures messages in the logfile. The&lt;br /&gt;
 #          host must be matched by a group named &amp;quot;host&amp;quot;. The tag &amp;quot;&amp;lt;HOST&amp;gt;&amp;quot; can&lt;br /&gt;
 #          be used for standard IP/hostname matching and is only an alias for&lt;br /&gt;
 #          (?:::f{4,6}:)?(?P&amp;lt;host&amp;gt;\S+)&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 failregex = NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Wrong password&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - No matching peer found&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Username/auth name mismatch&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Device does not match ACL&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&amp;quot; .* failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Peer is not supposed to register&lt;br /&gt;
             NOTICE.* &amp;lt;HOST&amp;gt; failed to authenticate as &#039;.*&#039;$&lt;br /&gt;
             NOTICE.* .*: No registration for peer &#039;.*&#039; \(from &amp;lt;HOST&amp;gt;\)&lt;br /&gt;
             NOTICE.* .*: Host &amp;lt;HOST&amp;gt; failed MD5 authentication for &#039;.*&#039; (.*)&lt;br /&gt;
             NOTICE.* .*: Failed to authenticate user .*@&amp;lt;HOST&amp;gt;.*&lt;br /&gt;
 # Option:  ignoreregex&lt;br /&gt;
 # Notes.:  regex to ignore. If this regex matches, the line is ignored.&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 ignoreregex =&lt;br /&gt;
&lt;br /&gt;
Next edit /etc/fail2ban/jail.conf to include the following section so that it uses the new filter. &lt;br /&gt;
&lt;br /&gt;
 [asterisk-iptables]&lt;br /&gt;
 enabled  = true&lt;br /&gt;
 filter   = asterisk&lt;br /&gt;
 action   = iptables-allports[name=ASTERISK, protocol=all]&lt;br /&gt;
            sendmail-whois[name=ASTERISK, dest=root, sender=fail2ban@example.org]&lt;br /&gt;
 logpath  = /var/log/asterisk/full&lt;br /&gt;
 maxretry = 5&lt;br /&gt;
 bantime = 259200&lt;br /&gt;
&lt;br /&gt;
Locate the line ignoreip in /etc/fail2ban/jail.conf (beginning of the file) and insert the ip&#039;s and / or blocks you want fail2ban to ignore, so you don&#039;t risk banning yourserf or any host in your network.&lt;br /&gt;
&lt;br /&gt;
Mine is defined as follows:&lt;br /&gt;
&lt;br /&gt;
 [DEFAULT]&lt;br /&gt;
 # &amp;quot;ignoreip&amp;quot; can be an IP address, a CIDR mask or a DNS host. Fail2ban will not&lt;br /&gt;
 # ban a host which matches an address in this list. Several addresses can be   &lt;br /&gt;
 # defined using space separator.                                               &lt;br /&gt;
 ignoreip = 127.0.0.1 192.168.80.1 192.168.80.0 192.168.0.0&lt;br /&gt;
&lt;br /&gt;
To start Fail2Ban type the following as root:&lt;br /&gt;
&lt;br /&gt;
/etc/init.d/fail2ban start&lt;br /&gt;
&lt;br /&gt;
Check It&lt;br /&gt;
&lt;br /&gt;
If started properly issue the following command to view your iptables rules:&lt;br /&gt;
&lt;br /&gt;
 iptables -L -v&lt;br /&gt;
&lt;br /&gt;
You should see something like the following for the INPUT chain (this is the ouput of mine)&lt;br /&gt;
&lt;br /&gt;
 Chain INPUT (policy DROP 2241 packets, 160K bytes)              &lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination         &lt;br /&gt;
   372 27264 &#039;&#039;&#039;fail2ban-SSH&#039;&#039;&#039;  tcp  --  any    any     anywhere             anywhere            tcp dpt:ssh                                                                                          &lt;br /&gt;
 1312K  991M &#039;&#039;&#039;fail2ban-ASTERISK&#039;&#039;&#039;  all  --  any    any     anywhere             anywhere            &lt;br /&gt;
  553K   81M ACCEPT     all  --  lo     any     anywhere             anywhere                    &lt;br /&gt;
 1288K 1162M ACCEPT     all  --  any    any     anywhere             anywhere            state RELATED,ESTABLISHED                                                                               &lt;br /&gt;
     9   540 ACCEPT     all  --  any    any     anywhere             anywhere            MARK match 0x1                                                                                          &lt;br /&gt;
     2  1152 ACCEPT     udp  --  any    any     anywhere             anywhere            udp   dpt:bootps                                                                                          &lt;br /&gt;
 19276 5790K ACCEPT     all  --  any    any     192.168.80.0/24      anywhere                    &lt;br /&gt;
     0     0 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:iax                                                                                             &lt;br /&gt;
     4  1795 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:sip                                                                                             &lt;br /&gt;
     0     0 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:2000                                                                                            &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:sieve                                                                                           &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:1723                                                                                            &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:www                                                                                             &lt;br /&gt;
     1    60 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:ssh                                                                                             &lt;br /&gt;
     0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            tcp dpt:https                                                                                           &lt;br /&gt;
     1    50 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpts:10001:20000&lt;br /&gt;
     0     0 ACCEPT     gre  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain FORWARD (policy ACCEPT 719K packets, 245M bytes)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
     0     0 TCPMSS     tcp  --  any    ppp+    anywhere             anywhere            tcp flags:SYN,RST/SYN TCPMSS clamp to PMTU&lt;br /&gt;
 Chain OUTPUT (policy ACCEPT 2099K packets, 590M bytes)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
     0     0 ACCEPT     gre  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain fail2ban-ASTERISK (1 references)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
  5091 2125K DROP       all  --  any    any     173.193.194.106-static.reverse.softlayer.com  anywhere&lt;br /&gt;
 1307K  989M RETURN     all  --  any    any     anywhere             anywhere&lt;br /&gt;
 Chain fail2ban-SSH (1 references)&lt;br /&gt;
  pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
&lt;br /&gt;
If you do not seem something similar to that then you have some troubleshooting to, check out /var/log/fail2ban.log.&lt;br /&gt;
&lt;br /&gt;
Example of my /var/log/fai2ban.log (173.193.194.106 is the real address from the attacker fail2ban banned):&lt;br /&gt;
&lt;br /&gt;
 ....&lt;br /&gt;
 2010-09-19 11:12:56,131 fail2ban.filter : INFO   Set maxRetry = 6&lt;br /&gt;
 2010-09-19 11:12:56,133 fail2ban.filter : INFO   Set findtime = 600&lt;br /&gt;
 2010-09-19 11:12:56,133 fail2ban.actions: INFO   Set banTime = 600&lt;br /&gt;
 2010-09-19 11:12:56,138 fail2ban.jail   : INFO   Jail &#039;ssh-iptables&#039; started&lt;br /&gt;
 2010-09-19 11:12:56,139 fail2ban.jail   : INFO   Jail &#039;asterisk-iptables&#039; started&lt;br /&gt;
 2010-09-19 11:12:56,141 fail2ban.jail   : INFO   Jail &#039;apache-tcpwrapper&#039; started&lt;br /&gt;
 2010-09-19 15:33:50,392 fail2ban.actions: WARNING [asterisk-iptables] Ban 173.193.194.106&lt;br /&gt;
 2010-09-19 15:34:50,982 fail2ban.actions: WARNING [asterisk-iptables] 173.193.194.106 already banned&lt;br /&gt;
&lt;br /&gt;
And this is the log (/var/log/asterisk/messages) showing the attack:&lt;br /&gt;
&lt;br /&gt;
 [2010-09-19 15:33:48] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;3235410554&amp;quot;&amp;lt;sip:3235410554@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                           &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;thomas&amp;quot;&amp;lt;sip:thomas@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;arsenal&amp;quot;&amp;lt;sip:arsenal@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;letmein&amp;quot;&amp;lt;sip:letmein@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;liverpool&amp;quot;&amp;lt;sip:liverpool@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;nevermind&amp;quot;&amp;lt;sip:nevermind@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;getmein&amp;quot;&amp;lt;sip:getmein@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;echo&amp;quot;&amp;lt;sip:echo@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;bmw325&amp;quot;&amp;lt;sip:bmw325@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;bmw335&amp;quot;&amp;lt;sip:bmw335@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w3e&amp;quot;&amp;lt;sip:1q2w3e@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w3e4r5t6y&amp;quot;&amp;lt;sip:1q2w3e4r5t6y@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q1q2w2w&amp;quot;&amp;lt;sip:1q1q2w2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w1q2w&amp;quot;&amp;lt;sip:1q2w1q2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1q2w&amp;quot;&amp;lt;sip:1q2w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;11q22w&amp;quot;&amp;lt;sip:11q22w@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;q1w2&amp;quot;&amp;lt;sip:q1w2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;q1w2e3&amp;quot;&amp;lt;sip:q1w2e3@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;tvv03tvv03&amp;quot;&amp;lt;sip:tvv03tvv03@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                           &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd1&amp;quot;&amp;lt;sip:abcd1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd12&amp;quot;&amp;lt;sip:abcd12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;abcd123&amp;quot;&amp;lt;sip:abcd123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;qq11ww22ee33rr44&amp;quot;&amp;lt;sip:qq11ww22ee33rr44@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1&amp;quot;&amp;lt;sip:sip1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip2&amp;quot;&amp;lt;sip:sip2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                       &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip12&amp;quot;&amp;lt;sip:sip12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip123&amp;quot;&amp;lt;sip:sip123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1234&amp;quot;&amp;lt;sip:sip1234@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip12345&amp;quot;&amp;lt;sip:sip12345@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip1111&amp;quot;&amp;lt;sip:sip1111@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                 &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;sip222&amp;quot;&amp;lt;sip:sip222@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:49] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1qa2ws3ed&amp;quot;&amp;lt;sip:1qa2ws3ed@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1234asdf&amp;quot;&amp;lt;sip:1234asdf@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1a2s3d&amp;quot;&amp;lt;sip:1a2s3d@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1a2s3d4f&amp;quot;&amp;lt;sip:1a2s3d4f@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;asdzxc&amp;quot;&amp;lt;sip:asdzxc@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;123zxc&amp;quot;&amp;lt;sip:123zxc@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                   &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;1234zxcv&amp;quot;&amp;lt;sip:1234zxcv@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;aazzssxx&amp;quot;&amp;lt;sip:aazzssxx@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;p@ssword&amp;quot;&amp;lt;sip:p@ssword@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;p@ssw0rd&amp;quot;&amp;lt;sip:p@ssw0rd@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                               &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;pass1&amp;quot;&amp;lt;sip:pass1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                                     &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;password3&amp;quot;&amp;lt;sip:password3@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found                             &lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;pass12&amp;quot;&amp;lt;sip:pass12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account&amp;quot;&amp;lt;sip:account@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;passlogin&amp;quot;&amp;lt;sip:passlogin@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account1&amp;quot;&amp;lt;sip:account1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account5&amp;quot;&amp;lt;sip:account5@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account6&amp;quot;&amp;lt;sip:account6@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account123&amp;quot;&amp;lt;sip:account123@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;account12&amp;quot;&amp;lt;sip:account12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc1&amp;quot;&amp;lt;sip:acc1@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc2&amp;quot;&amp;lt;sip:acc2@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
 [2010-09-19 15:33:50] NOTICE[26690] chan_sip.c: Registration from &#039;&amp;quot;acc12&amp;quot;&amp;lt;sip:acc12@201.29.213.245&amp;gt;&#039; failed for &#039;173.193.194.106&#039; - No matching peer found&lt;br /&gt;
&lt;br /&gt;
I hope this helps.&lt;br /&gt;
&lt;br /&gt;
source: http://www.voip-info.org/wiki/view/Fail2Ban+(with+iptables)+And+Asterisk&lt;/div&gt;</summary>
		<author><name>Pw44</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=Fail2ban_-_A_tool_against_brute_force&amp;diff=25079</id>
		<title>Fail2ban - A tool against brute force</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=Fail2ban_-_A_tool_against_brute_force&amp;diff=25079"/>
		<updated>2010-09-20T00:16:55Z</updated>

		<summary type="html">&lt;p&gt;Pw44: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: Tutorials]]&lt;br /&gt;
&lt;br /&gt;
Having asterik installed is almost an invitation for others wishing to place calls at your expense.&lt;br /&gt;
&lt;br /&gt;
After configuring my sip trunk, i did not take 2 days and someone was trying to register to take advantage of it.&lt;br /&gt;
&lt;br /&gt;
Fail2ban prevented it, blocking the attacker with iptables rules.&lt;br /&gt;
&lt;br /&gt;
Installing fail2ban is not complicated and i will describe the steps to have it properly installed and configured, so you can protect your asterisk and other services from brute force attack.&lt;br /&gt;
&lt;br /&gt;
Install with: &lt;br /&gt;
 sudo apt-get install fail2ban&lt;br /&gt;
&lt;br /&gt;
After is installed, you need to change /etc/asterisk/logger.conf and add the following line under [general] section (You may have to create this before the [logfiles] section). &lt;br /&gt;
&lt;br /&gt;
 [general]&lt;br /&gt;
 dateformat=%F %T&lt;br /&gt;
&lt;br /&gt;
In /etc/asterisk/logger.conf add the following line under the [logfiles] section for Asterisk to log NOTICE level events to the syslog (/var/log/messages) as well as its normal log file. These entries in syslog will have a Date/Time stamp that is usable by Fail2Ban.&lt;br /&gt;
&lt;br /&gt;
 syslog.local0 =&amp;gt; notice &lt;br /&gt;
&lt;br /&gt;
Reload asterisk with:&lt;br /&gt;
&lt;br /&gt;
 asterisk -rx &amp;quot;logger reload&amp;quot; &lt;br /&gt;
&lt;br /&gt;
Configuring fail2ban:&lt;br /&gt;
&lt;br /&gt;
 cd /etc/fail2ban/filter.d&lt;br /&gt;
&lt;br /&gt;
 touch asterisk.conf &lt;br /&gt;
&lt;br /&gt;
 vi asterisk.conf&lt;br /&gt;
&lt;br /&gt;
insert the following (copy &amp;amp; paste)&lt;br /&gt;
&lt;br /&gt;
 # Fail2Ban configuration file&lt;br /&gt;
 #&lt;br /&gt;
 #&lt;br /&gt;
 # $Revision: 250 $&lt;br /&gt;
 #&lt;br /&gt;
 [INCLUDES]&lt;br /&gt;
 # Read common prefixes. If any customizations available -- read them from&lt;br /&gt;
 # common.local&lt;br /&gt;
 #before = common.conf&lt;br /&gt;
 [Definition]&lt;br /&gt;
 #_daemon = asterisk&lt;br /&gt;
 # Option:  failregex&lt;br /&gt;
 # Notes.:  regex to match the password failures messages in the logfile. The&lt;br /&gt;
 #          host must be matched by a group named &amp;quot;host&amp;quot;. The tag &amp;quot;&amp;lt;HOST&amp;gt;&amp;quot; can&lt;br /&gt;
 #          be used for standard IP/hostname matching and is only an alias for&lt;br /&gt;
 #          (?:::f{4,6}:)?(?P&amp;lt;host&amp;gt;\S+)&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 failregex = NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Wrong password&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - No matching peer found&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Username/auth name mismatch&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Device does not match ACL&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&amp;quot; .* failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Peer is not supposed to register&lt;br /&gt;
             NOTICE.* &amp;lt;HOST&amp;gt; failed to authenticate as &#039;.*&#039;$&lt;br /&gt;
             NOTICE.* .*: No registration for peer &#039;.*&#039; \(from &amp;lt;HOST&amp;gt;\)&lt;br /&gt;
             NOTICE.* .*: Host &amp;lt;HOST&amp;gt; failed MD5 authentication for &#039;.*&#039; (.*)&lt;br /&gt;
             NOTICE.* .*: Failed to authenticate user .*@&amp;lt;HOST&amp;gt;.*&lt;br /&gt;
 # Option:  ignoreregex&lt;br /&gt;
 # Notes.:  regex to ignore. If this regex matches, the line is ignored.&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 ignoreregex =&lt;br /&gt;
&lt;br /&gt;
Next edit /etc/fail2ban/jail.conf to include the following section so that it uses the new filter. &lt;br /&gt;
&lt;br /&gt;
 [asterisk-iptables]&lt;br /&gt;
 enabled  = true&lt;br /&gt;
 filter   = asterisk&lt;br /&gt;
 action   = iptables-allports[name=ASTERISK, protocol=all]&lt;br /&gt;
            sendmail-whois[name=ASTERISK, dest=root, sender=fail2ban@example.org]&lt;br /&gt;
 logpath  = /var/log/asterisk/full&lt;br /&gt;
 maxretry = 5&lt;br /&gt;
 bantime = 259200&lt;br /&gt;
&lt;br /&gt;
Locate the line ignoreip in /etc/fail2ban/jail.conf (beginning of the file) and insert the ip&#039;s and / or blocks you want fail2ban to ignore, so you don&#039;t risk banning yourserf or any host in your network.&lt;br /&gt;
&lt;br /&gt;
Mine is defined as follows:&lt;br /&gt;
&lt;br /&gt;
 [DEFAULT]&lt;br /&gt;
 # &amp;quot;ignoreip&amp;quot; can be an IP address, a CIDR mask or a DNS host. Fail2ban will not&lt;br /&gt;
 # ban a host which matches an address in this list. Several addresses can be   &lt;br /&gt;
 # defined using space separator.                                               &lt;br /&gt;
 ignoreip = 127.0.0.1 192.168.80.1 192.168.80.0 192.168.0.0&lt;br /&gt;
&lt;br /&gt;
To start Fail2Ban type the following as root:&lt;br /&gt;
&lt;br /&gt;
/etc/init.d/fail2ban start&lt;br /&gt;
&lt;br /&gt;
Check It&lt;br /&gt;
&lt;br /&gt;
If started properly issue the following command to view your iptables rules:&lt;br /&gt;
&lt;br /&gt;
 iptables -L -v&lt;br /&gt;
&lt;br /&gt;
You should see something like the following for the INPUT chain &lt;br /&gt;
&lt;br /&gt;
 Chain INPUT (policy ACCEPT 0 packets, 0 bytes)&lt;br /&gt;
 pkts bytes target     prot opt in     out     source               destination         &lt;br /&gt;
 2104K  414M fail2ban-ASTERISK  all  —  any    any     anywhere             anywhere&lt;br /&gt;
&lt;br /&gt;
If you do not seem something similar to that then you have some troubleshooting to, check out /var/log/fail2ban.log.&lt;br /&gt;
&lt;br /&gt;
I hope this helps.&lt;br /&gt;
&lt;br /&gt;
source: http://www.voip-info.org/wiki/view/Fail2Ban+(with+iptables)+And+Asterisk&lt;/div&gt;</summary>
		<author><name>Pw44</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=Fail2ban_-_A_tool_against_brute_force&amp;diff=25078</id>
		<title>Fail2ban - A tool against brute force</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=Fail2ban_-_A_tool_against_brute_force&amp;diff=25078"/>
		<updated>2010-09-20T00:15:27Z</updated>

		<summary type="html">&lt;p&gt;Pw44: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: Tutorials]]&lt;br /&gt;
&lt;br /&gt;
Having asterik installed is almost an invitation for others wishing to place calls at your expense.&lt;br /&gt;
&lt;br /&gt;
After configuring my sip trunk, i did not take 2 days and someone was trying to register to take advantage of it.&lt;br /&gt;
&lt;br /&gt;
Fail2ban prevented it, blocking the attacker.&lt;br /&gt;
&lt;br /&gt;
Installing fail2ban is not complicated.&lt;br /&gt;
&lt;br /&gt;
I will describe the steps to have it properly installed and configured, so you can protect your asterisk and other services from brute force attack.&lt;br /&gt;
&lt;br /&gt;
Install with: &lt;br /&gt;
 sudo apt-get install fail2ban&lt;br /&gt;
&lt;br /&gt;
After is installed, you need to change /etc/asterisk/logger.conf and add the following line under [general] section (You may have to create this before the [logfiles] section). &lt;br /&gt;
&lt;br /&gt;
 [general]&lt;br /&gt;
 dateformat=%F %T&lt;br /&gt;
&lt;br /&gt;
In /etc/asterisk/logger.conf add the following line under the [logfiles] section for Asterisk to log NOTICE level events to the syslog (/var/log/messages) as well as its normal log file. These entries in syslog will have a Date/Time stamp that is usable by Fail2Ban.&lt;br /&gt;
&lt;br /&gt;
 syslog.local0 =&amp;gt; notice &lt;br /&gt;
&lt;br /&gt;
Reload asterisk with:&lt;br /&gt;
&lt;br /&gt;
 asterisk -rx &amp;quot;logger reload&amp;quot; &lt;br /&gt;
&lt;br /&gt;
Configuring fail2ban:&lt;br /&gt;
&lt;br /&gt;
 cd /etc/fail2ban/filter.d&lt;br /&gt;
&lt;br /&gt;
 touch asterisk.conf &lt;br /&gt;
&lt;br /&gt;
 vi asterisk.conf&lt;br /&gt;
&lt;br /&gt;
insert the following (copy &amp;amp; paste)&lt;br /&gt;
&lt;br /&gt;
 # Fail2Ban configuration file&lt;br /&gt;
 #&lt;br /&gt;
 #&lt;br /&gt;
 # $Revision: 250 $&lt;br /&gt;
 #&lt;br /&gt;
 [INCLUDES]&lt;br /&gt;
 # Read common prefixes. If any customizations available -- read them from&lt;br /&gt;
 # common.local&lt;br /&gt;
 #before = common.conf&lt;br /&gt;
 [Definition]&lt;br /&gt;
 #_daemon = asterisk&lt;br /&gt;
 # Option:  failregex&lt;br /&gt;
 # Notes.:  regex to match the password failures messages in the logfile. The&lt;br /&gt;
 #          host must be matched by a group named &amp;quot;host&amp;quot;. The tag &amp;quot;&amp;lt;HOST&amp;gt;&amp;quot; can&lt;br /&gt;
 #          be used for standard IP/hostname matching and is only an alias for&lt;br /&gt;
 #          (?:::f{4,6}:)?(?P&amp;lt;host&amp;gt;\S+)&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 failregex = NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Wrong password&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - No matching peer found&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Username/auth name mismatch&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Device does not match ACL&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&amp;quot; .* failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Peer is not supposed to register&lt;br /&gt;
             NOTICE.* &amp;lt;HOST&amp;gt; failed to authenticate as &#039;.*&#039;$&lt;br /&gt;
             NOTICE.* .*: No registration for peer &#039;.*&#039; \(from &amp;lt;HOST&amp;gt;\)&lt;br /&gt;
             NOTICE.* .*: Host &amp;lt;HOST&amp;gt; failed MD5 authentication for &#039;.*&#039; (.*)&lt;br /&gt;
             NOTICE.* .*: Failed to authenticate user .*@&amp;lt;HOST&amp;gt;.*&lt;br /&gt;
 # Option:  ignoreregex&lt;br /&gt;
 # Notes.:  regex to ignore. If this regex matches, the line is ignored.&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 ignoreregex =&lt;br /&gt;
&lt;br /&gt;
Next edit /etc/fail2ban/jail.conf to include the following section so that it uses the new filter. &lt;br /&gt;
&lt;br /&gt;
 [asterisk-iptables]&lt;br /&gt;
 enabled  = true&lt;br /&gt;
 filter   = asterisk&lt;br /&gt;
 action   = iptables-allports[name=ASTERISK, protocol=all]&lt;br /&gt;
            sendmail-whois[name=ASTERISK, dest=root, sender=fail2ban@example.org]&lt;br /&gt;
 logpath  = /var/log/asterisk/full&lt;br /&gt;
 maxretry = 5&lt;br /&gt;
 bantime = 259200&lt;br /&gt;
&lt;br /&gt;
Locate the line ignoreip in /etc/fail2ban/jail.conf (beginning of the file) and insert the ip&#039;s and / or blocks you want fail2ban to ignore, so you don&#039;t risk banning yourserf or any host in your network.&lt;br /&gt;
&lt;br /&gt;
Mine is defined as follows:&lt;br /&gt;
&lt;br /&gt;
 [DEFAULT]&lt;br /&gt;
 # &amp;quot;ignoreip&amp;quot; can be an IP address, a CIDR mask or a DNS host. Fail2ban will not&lt;br /&gt;
 # ban a host which matches an address in this list. Several addresses can be   &lt;br /&gt;
 # defined using space separator.                                               &lt;br /&gt;
 ignoreip = 127.0.0.1 192.168.80.1 192.168.80.0 192.168.0.0&lt;br /&gt;
&lt;br /&gt;
To start Fail2Ban type the following as root:&lt;br /&gt;
&lt;br /&gt;
/etc/init.d/fail2ban start&lt;br /&gt;
&lt;br /&gt;
Check It&lt;br /&gt;
&lt;br /&gt;
If started properly issue the following command to view your iptables rules:&lt;br /&gt;
&lt;br /&gt;
 iptables -L -v&lt;br /&gt;
&lt;br /&gt;
You should see something like the following for the INPUT chain &lt;br /&gt;
&lt;br /&gt;
 Chain INPUT (policy ACCEPT 0 packets, 0 bytes)&lt;br /&gt;
 pkts bytes target     prot opt in     out     source               destination         &lt;br /&gt;
 2104K  414M fail2ban-ASTERISK  all  —  any    any     anywhere             anywhere&lt;br /&gt;
&lt;br /&gt;
If you do not seem something similar to that then you have some troubleshooting to, check out /var/log/fail2ban.log.&lt;br /&gt;
&lt;br /&gt;
I hope this helps.&lt;br /&gt;
&lt;br /&gt;
source: http://www.voip-info.org/wiki/view/Fail2Ban+(with+iptables)+And+Asterisk&lt;/div&gt;</summary>
		<author><name>Pw44</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=Fail2ban_-_A_tool_against_brute_force&amp;diff=25077</id>
		<title>Fail2ban - A tool against brute force</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=Fail2ban_-_A_tool_against_brute_force&amp;diff=25077"/>
		<updated>2010-09-20T00:13:26Z</updated>

		<summary type="html">&lt;p&gt;Pw44: New page: Category: Tutorials  Having asterik installed is almost an invitation for others wishing to place calls at your expense.  After configuring my sip trunk, i did not take 2 days and some...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: Tutorials]]&lt;br /&gt;
&lt;br /&gt;
Having asterik installed is almost an invitation for others wishing to place calls at your expense.&lt;br /&gt;
&lt;br /&gt;
After configuring my sip trunk, i did not take 2 days and someone was trying to register to take advantage of it.&lt;br /&gt;
&lt;br /&gt;
Fail2ban prevented it, blocking the attacker.&lt;br /&gt;
&lt;br /&gt;
Installing fail2ban is not complicated.&lt;br /&gt;
&lt;br /&gt;
I will describe the steps to have it properly installed and configured, so you can protect your asterisk and other services from brute force attack.&lt;br /&gt;
&lt;br /&gt;
Install with: &lt;br /&gt;
 sudo apt-get install fail2ban&lt;br /&gt;
&lt;br /&gt;
After is installed, you need to change /etc/asterisk/logger.conf and add the following line under [general] section (You may have to create this before the [logfiles] section). &lt;br /&gt;
&lt;br /&gt;
 [general]&lt;br /&gt;
 dateformat=%F %T&lt;br /&gt;
&lt;br /&gt;
In /etc/asterisk/logger.conf add the following line under the [logfiles] section for Asterisk to log NOTICE level events to the syslog (/var/log/messages) as well as its normal log file. These entries in syslog will have a Date/Time stamp that is usable by Fail2Ban.&lt;br /&gt;
&lt;br /&gt;
 syslog.local0 =&amp;gt; notice &lt;br /&gt;
&lt;br /&gt;
Reload asterisk with:&lt;br /&gt;
&lt;br /&gt;
 asterisk -rx &amp;quot;logger reload&amp;quot; &lt;br /&gt;
&lt;br /&gt;
Configuring fail2ban:&lt;br /&gt;
&lt;br /&gt;
 cd /etc/fail2ban/filter.d&lt;br /&gt;
&lt;br /&gt;
 touch asterisk.conf &lt;br /&gt;
&lt;br /&gt;
 vi asterisk.conf&lt;br /&gt;
&lt;br /&gt;
insert the following (copy &amp;amp; paste)&lt;br /&gt;
&lt;br /&gt;
 # Fail2Ban configuration file&lt;br /&gt;
 #&lt;br /&gt;
 #&lt;br /&gt;
 # $Revision: 250 $&lt;br /&gt;
 #&lt;br /&gt;
 [INCLUDES]&lt;br /&gt;
 # Read common prefixes. If any customizations available -- read them from&lt;br /&gt;
 # common.local&lt;br /&gt;
 #before = common.conf&lt;br /&gt;
 [Definition]&lt;br /&gt;
 #_daemon = asterisk&lt;br /&gt;
 # Option:  failregex&lt;br /&gt;
 # Notes.:  regex to match the password failures messages in the logfile. The&lt;br /&gt;
 #          host must be matched by a group named &amp;quot;host&amp;quot;. The tag &amp;quot;&amp;lt;HOST&amp;gt;&amp;quot; can&lt;br /&gt;
 #          be used for standard IP/hostname matching and is only an alias for&lt;br /&gt;
 #          (?:::f{4,6}:)?(?P&amp;lt;host&amp;gt;\S+)&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 failregex = NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Wrong password&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - No matching peer found&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Username/auth name mismatch&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&#039; failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Device does not match ACL&lt;br /&gt;
             NOTICE.* .*: Registration from &#039;.*&amp;quot; .* failed for &#039;&amp;lt;HOST&amp;gt;&#039; - Peer is not supposed to register&lt;br /&gt;
             NOTICE.* &amp;lt;HOST&amp;gt; failed to authenticate as &#039;.*&#039;$&lt;br /&gt;
             NOTICE.* .*: No registration for peer &#039;.*&#039; \(from &amp;lt;HOST&amp;gt;\)&lt;br /&gt;
             NOTICE.* .*: Host &amp;lt;HOST&amp;gt; failed MD5 authentication for &#039;.*&#039; (.*)&lt;br /&gt;
             NOTICE.* .*: Failed to authenticate user .*@&amp;lt;HOST&amp;gt;.*&lt;br /&gt;
 # Option:  ignoreregex&lt;br /&gt;
 # Notes.:  regex to ignore. If this regex matches, the line is ignored.&lt;br /&gt;
 # Values:  TEXT&lt;br /&gt;
 #&lt;br /&gt;
 ignoreregex =&lt;br /&gt;
&lt;br /&gt;
Next edit /etc/fail2ban/jail.conf to include the following section so that it uses the new filter. &lt;br /&gt;
&lt;br /&gt;
 [asterisk-iptables]&lt;br /&gt;
 enabled  = true&lt;br /&gt;
 filter   = asterisk&lt;br /&gt;
 action   = iptables-allports[name=ASTERISK, protocol=all]&lt;br /&gt;
            sendmail-whois[name=ASTERISK, dest=root, sender=fail2ban@example.org]&lt;br /&gt;
 logpath  = /var/log/asterisk/full&lt;br /&gt;
 maxretry = 5&lt;br /&gt;
 bantime = 259200&lt;br /&gt;
&lt;br /&gt;
Locate the line ignoreip in /etc/fail2ban/jail.conf (beginning of the file) and insert the ip&#039;s and / or blocks you want fail2ban to ignore, so you don&#039;t risk banning yourserf or any host in your network.&lt;br /&gt;
&lt;br /&gt;
Mine is defined as follows:&lt;br /&gt;
&lt;br /&gt;
 [DEFAULT]&lt;br /&gt;
 # &amp;quot;ignoreip&amp;quot; can be an IP address, a CIDR mask or a DNS host. Fail2ban will not&lt;br /&gt;
 # ban a host which matches an address in this list. Several addresses can be   &lt;br /&gt;
 # defined using space separator.                                               &lt;br /&gt;
 ignoreip = 127.0.0.1 192.168.80.1 192.168.80.0 192.168.0.0&lt;br /&gt;
&lt;br /&gt;
To start Fail2Ban type the following as root:&lt;br /&gt;
&lt;br /&gt;
/etc/init.d/fail2ban start&lt;br /&gt;
&lt;br /&gt;
Check It&lt;br /&gt;
&lt;br /&gt;
If started properly issue the following command to view your iptables rules:&lt;br /&gt;
&lt;br /&gt;
 iptables -L -v&lt;br /&gt;
&lt;br /&gt;
You should see something like the following for the INPUT chain &lt;br /&gt;
&lt;br /&gt;
 Chain INPUT (policy ACCEPT 0 packets, 0 bytes)&lt;br /&gt;
 pkts bytes target     prot opt in     out     source               destination         &lt;br /&gt;
 2104K  414M fail2ban-ASTERISK  all  —  any    any     anywhere             anywhere&lt;br /&gt;
&lt;br /&gt;
If you do not seem something similar to that then you have some troubleshooting to, check out /var/log/fail2ban.log.&lt;br /&gt;
&lt;br /&gt;
I hope this helps.&lt;/div&gt;</summary>
		<author><name>Pw44</name></author>
	</entry>
	<entry>
		<id>http://wiki.linuxmce.org/index.php?title=Sipgate.co.uk&amp;diff=24891</id>
		<title>Sipgate.co.uk</title>
		<link rel="alternate" type="text/html" href="http://wiki.linuxmce.org/index.php?title=Sipgate.co.uk&amp;diff=24891"/>
		<updated>2010-08-13T20:39:16Z</updated>

		<summary type="html">&lt;p&gt;Pw44: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=SIPGATE.CO.UK=&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;CAVEAT&#039;&#039;&#039;==&lt;br /&gt;
:1)this guide is what worked for me, It is intentionally &amp;quot;dumbed down&amp;quot; because.&lt;br /&gt;
::a) I have no indepth knowledge and,&lt;br /&gt;
::b)it&#039;s intended for the totally virgin Windows&#039; refugee with negligible cli experience and limited typing skills&lt;br /&gt;
&lt;br /&gt;
:2)If it insults your intelligence, and you get nothing from it &#039;&#039;&#039;GOOD&#039;&#039;&#039;...it means you&#039;ve been lucky enough to have gained a fair amount of knowledge....&#039;&#039;&#039;USE&#039;&#039;&#039; it &amp;amp; when you&#039;ve found the answer to your problem, &#039;&#039;&#039;PLEASE&#039;&#039;&#039; come back &amp;amp; share it with us lesser mortals&lt;br /&gt;
&lt;br /&gt;
:3)All credit for any accuracy goes to Zaerc and Colinjones &lt;br /&gt;
:4)I&#039;ve cut and pasted most of the material,and hopefully credited the sources, :if not, my apologies for plaugiarising your work.&lt;br /&gt;
:5) ALL errors are mine, please do not repeat them without giving me credit   : )&lt;br /&gt;
* ASSUMPTIONS      uk user, ISP= British TelecoN, router/modem= BT.HomeHub,   dynamic IP address (section on static should work but I can&#039;t test)  ......you may have to modify for any other combination&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;&#039;&#039;&#039;PREPARE&#039;&#039;&#039;&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
::READ, READ , READ....check out  the links at the end for good starting points&lt;br /&gt;
*get fixed in your mind that &amp;quot;external ip&amp;quot;in all(?) mon-LMCE   docs means the internet isp provided ip.NOT the ip of your Hybrid&#039;s &amp;quot;external&amp;quot; nic, ie the one that connects to the router&lt;br /&gt;
*get a pen &amp;amp;paper....make a clear note of settings as you go along ...DON&#039;T trust to memory....&lt;br /&gt;
*bookmark usefull sites...open atleast four tabs in firefox for: google, pluto web admin,forums, homeHub  adminpage, and put their bookmarks on the toolbar,don&#039;t close tabs/firefox  on shutdown/reloads ....restore last session when  you restart firefox.&lt;br /&gt;
* beware of hidden html code when cutting/pasting&lt;br /&gt;
&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;GET INFO&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;voip provider&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
*google &amp;quot;free voip&amp;quot;   to find a provider, preferably free, pay as you go, free phone No. .. in your preffered region, according to your anticipated usage ..  #check out the forums at VOXILLA for uptodate good/bad guys ...&lt;br /&gt;
::I chose SIPGATE&amp;gt;CO&amp;gt;UK &#039;cos it ticked all the boxes and there is some barebones wiki material/and a ready made trunk  allready.&lt;br /&gt;
:::Register ,print off your details,.. your loginP/wd/user name for the website are NEVER used in any of this setup ...you&#039;ll need the 7 digit numeric sipID  (usernam trunk id ), 7 digit sip password, the only place the actual localDID is used is for caller  ID  ?????CHECK????&lt;br /&gt;
&lt;br /&gt;
*IF YOU CAN..-.beg, borrow, or  steal, a windows  laptop and install Xlite from  spgate/settigs/help centre--it comes pre configured, - test the connection out. ::TEST   IN and OUT  using landline/mobile ....bear in mind the Sipgate online status page is &#039;&#039;&#039;only valid at login&#039;&#039;&#039; time.so you may have to log out and back in to check your installation&#039;s registration.&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;Dynamic DNS&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
Choose a Dynamic  domain name sever provider , loads on google, get a free one,&lt;br /&gt;
*READ help/howtos&lt;br /&gt;
::(I chose DynDNS ,free , well known and it makes life a bit easier later) READ the instructions -&lt;br /&gt;
::* register -- wait for login e-mail (2 mins)&lt;br /&gt;
::* choose any (host)name for your hybrid,choose an extension  eg. homeip.net-- take the wild card option,&lt;br /&gt;
::*--set IP type either static/dynamic..set ttl according to IP type.....&lt;br /&gt;
::*find the providers test apps and follow instructions,&lt;br /&gt;
:::TEST  name resolution , &lt;br /&gt;
:::CHECK for any blocked ports, make a note of current dynamic IP address.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;BT HomeHub&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
* Does your internet connection have a static or a dynamic ip address ?&lt;br /&gt;
::If it&#039;s dynamic (most domestic BT BROADBAND)  and you don&#039;t  begrudge them the extra £5 pcm you pay for the privelige,get them to change it to static.wait for notificatin/check  in HOMEHUB  that it&#039;s in effect. It will make installation simpler, and allegedly is more reliable than alternatives.&lt;br /&gt;
::........at the same time get them to disable their own voip service, &#039;&#039;&#039;and&#039;&#039;&#039; do it yourself as well ,-if you are using their supplied HomeHub........&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
::::login =&amp;gt; advanced =&amp;gt; telephony=&amp;gt; uncheck the &amp;quot;enable telephony &amp;quot; box (no idea if the textphone option has an impact.) &lt;br /&gt;
&#039;&#039;&#039;YOU MUST disable BT BROADBAND TALK&#039;&#039;&#039;&lt;br /&gt;
:::: while youre in Hub admin, go into IP Adresses and  note the range of DHCP pool  (mine is LAN_private	192.168.1.64 - 192.168.1.237	  &amp;amp; Gateway   (your HOMEHUB ) 192.168.1.254&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;NAT&#039;&#039;&#039;===&lt;br /&gt;
::*admin/advanced/application sharing / create new game/Manual Entry of Port Maps /&lt;br /&gt;
:::&#039;&#039;&#039;name&#039;&#039;&#039;(I used &amp;quot;sipserver&amp;quot;)...   click &#039;&#039;&#039;next&#039;&#039;&#039;&lt;br /&gt;
:::: check the  new name is correct&lt;br /&gt;
&lt;br /&gt;
::::::click &#039;&#039;&#039;ENTER&#039;&#039;&#039;&lt;br /&gt;
:::fill in the boxes, as follows&lt;br /&gt;
:::::protocl UDP  from5060   to 5080   translate to  5060      Trigger protocol  ANY   Trigger  Port leave blank    ADD&lt;br /&gt;
:::::protocl UDP  from10000  to 20000  translate to  10001     Trigger protocol  ANY   Trigger  Port leave blank    ADD&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&lt;br /&gt;
CHECK SETTINGS&#039;&#039;&#039;  its a &#039;&#039;&#039;PITA&#039;&#039;&#039;to do it later&lt;br /&gt;
&lt;br /&gt;
Click &#039;&#039;&#039;APPLY&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;MISC&#039;&#039;&#039;===  &lt;br /&gt;
 &lt;br /&gt;
:GOTO  FIREWALL .. set at standard&lt;br /&gt;
:GOTO  DEVICES .. establish which entry is the HYBRID ,it SHOULD be the one at the IP youset for it earlier (if it shows a mac address, check in Pluto admin/network/network settings for a match)&lt;br /&gt;
&lt;br /&gt;
CLICK &#039;&#039;&#039;EDIT&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:::CHANGE name to the hostname you picked at DynDNS earlier,just the name not the  (for e.g.  .is-a-geek.net)&lt;br /&gt;
:::GAME or SERVICE &#039;&#039;&#039; dropdown&#039;&#039;&#039; ...... pick the application  ( &amp;quot;sipserver&amp;quot;)   you created earlier..&lt;br /&gt;
CLICK &#039;&#039;&#039;ADD&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE&#039;&#039;&#039;  if you need to edit the &amp;quot;application&amp;quot; in anyway, you must first unassign it from your Hybrid, make the  alterations, then remember to reassign it to the hybrid&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=&#039;&#039;&#039;LMCE&#039;&#039;&#039;=&lt;br /&gt;
&lt;br /&gt;
:::: go into Web (pluto) admin on your core/Hybrid,login (your password is whatever you  entered as first user  during initial AV wizard)&lt;br /&gt;
&lt;br /&gt;
*-wizard/ basic/keyboard setup.. and select relevant country (if you haven&#039;t &lt;br /&gt;
allready) ../   update button&lt;br /&gt;
==Network settings==:&lt;br /&gt;
*-wizard/advanced/network/network settings .... change  radio button to use a static IP address &lt;br /&gt;
**fill in cores/Hybrids ip address as 192.165.2.X  where X is outside  the private lan dhcp pool for e.g 250 &lt;br /&gt;
:::subnetmask 255.255.255.0 &lt;br /&gt;
:::gateway/dns1/dns2  all same  as your HomeHubs address   (probably) 192.168.1.254&lt;br /&gt;
:::::::&#039;&#039;&#039;press green UPDATE button&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;Firewall&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
*- advanced/network/firewall rules... and use the boxes untill the rules look exactly like this,&lt;br /&gt;
:::::&#039;&#039;&#039;BE PATIENT &amp;amp; ACCURATE&#039;&#039;&#039; ....sometimes the progress bar seems to&lt;br /&gt;
:::::::freeze...leave it alone untill it&#039;s done it&#039;s  thing&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:udp....4569 to 0.......0...............core_input..............Delete&lt;br /&gt;
:udp....5060 to 0.......0...............core_input..............Delete&lt;br /&gt;
:udp....2000 to 0.......0...............core_input..............Delete&lt;br /&gt;
:tcp....2000 to 0.......0...............core_input..............Delete&lt;br /&gt;
:tcp....3877 to 3877....3877...192.168.80.1...port_forward......Delete&lt;br /&gt;
:udp....10001 to 20000 	0...............core_input..............Delete&lt;br /&gt;
(port 4569 is iax protocol  5060 is sip   10001to 20000 carries the audio   NB some docs say use 10000 rather than 10001&#039;&#039;&#039; don&#039;t&#039;&#039;&#039; FreePBX uses that for it&#039;s web panel&lt;br /&gt;
&lt;br /&gt;
*-wizard/restart/reload router  (not strictly necessary in this case but it is in others ,-get into the habit,- it doesn&#039;t cost you anything, besides, its time for tea/smoke /sex whatever takes your fancy.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;Phone Lines&#039;&#039;&#039;==&lt;br /&gt;
:GOTO ... pluto admin/wizard /devices/phone lines&lt;br /&gt;
*1)&#039;&#039;&#039;Check&#039;&#039;&#039; When dialing a local number, automatically prepend the area code and specify the areacode you would like to have prepended when dialing a local number, for instance  mine is 0114  (sheffield)&lt;br /&gt;
*2. &#039;&#039;&#039;Uncheck&#039;&#039;&#039; Also prepend a digit (1 for US/Canada, 0 for Europe) (also optional).&lt;br /&gt;
*3. Local Number Length 7 (the default). &lt;br /&gt;
&lt;br /&gt;
::::::Hit the &#039;&#039;&#039;Update&#039;&#039;&#039; button.&lt;br /&gt;
:Choose provider sipgate (try for free, pay as you go)&lt;br /&gt;
&lt;br /&gt;
*1. Username &amp;lt;&#039;&#039;&#039;SipID&#039;&#039;&#039; from provider....&amp;gt;&lt;br /&gt;
*2. Password &#039;&#039;&#039;SipPassword&#039;&#039;&#039;from provider&amp;gt;&lt;br /&gt;
*3. Phone number &amp;lt;&#039;&#039;&#039;SipID&#039;&#039;&#039; from provider...  AGAIN......NOT the DID ie local number.&amp;gt;&lt;br /&gt;
*4. Host  &amp;lt;sipgate.co.uk&amp;gt;&lt;br /&gt;
*5.  Hit the &#039;&#039;&#039;Submit&#039;&#039;&#039; button.&lt;br /&gt;
*6. Hit the &#039;&#039;&#039;Deactivate Automatic Configuration button&#039;&#039;&#039; and the following Yes button.&lt;br /&gt;
*7. Click the &#039;&#039;&#039;click here&#039;&#039;&#039; link (next to &amp;quot;Manual configuration activated. To configure AMP, click&amp;quot;)&lt;br /&gt;
*8. Click Trunks, and Trunk SIP/sipgate&lt;br /&gt;
*9. Under &amp;quot;Outgoing Dial Rules&amp;quot; change Dial Rules to  &lt;br /&gt;
&lt;br /&gt;
::::112&lt;br /&gt;
::::999&lt;br /&gt;
::::0114+XXXXXXX&lt;br /&gt;
::::9|.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:::::1. This will recognize 112,999, the emergency numbers&lt;br /&gt;
:::::2. Seven digit local numbers will get 0114 prepended.&lt;br /&gt;
:::::3  A nine will dial out no matter how many digits. &lt;br /&gt;
:::::4You now can (optionally) modify other settings to your liking as well, however do NOT change the Trunk Name (leave it at the default sipgate). When done hit &#039;&#039;&#039;Submit Changes&#039;&#039;&#039;.&lt;br /&gt;
:::::5Click &#039;&#039;&#039;Reload Required Apply Configuration Changes&#039;&#039;&#039;&lt;br /&gt;
::::::: and &#039;&#039;&#039;Continue with reload.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
GOTO  Go back to pluto admin/Wizard &amp;gt; Devices &amp;gt; Phone Lines and hit the &#039;&#039;&#039;Activate Automatic Configuration button&#039;&#039;&#039;, followed by the &#039;&#039;&#039;Yes and keep my advanced settings&#039;&#039;&#039; button.&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;FreePBX&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
:GOTO ... pluto admin/wizard /advanced/config./phone setup , which puts you into FreePBX webadmin&lt;br /&gt;
&lt;br /&gt;
*CLICK  &#039;&#039;&#039;&amp;quot;TRUNKS&amp;quot;&#039;&#039;&#039; on left hand side&lt;br /&gt;
*CLICK  &#039;&#039;&#039;&amp;quot;sipgate&amp;quot;&#039;&#039;&#039; on right hand side&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;CHECK&#039;&#039;&#039; settings are as below&lt;br /&gt;
&lt;br /&gt;
PEER DETAILS&lt;br /&gt;
allow=alaw&amp;amp;alaw&amp;amp;ulaw&amp;amp;g729&amp;amp;gsm&amp;amp;slinear&lt;br /&gt;
auth=md5&lt;br /&gt;
authuser=&#039;&#039;&#039;SIP ID&#039;&#039;&#039;&lt;br /&gt;
callerid=&#039;&#039;&#039;SIP ID&#039;&#039;&#039;&lt;br /&gt;
canreinvite=no&lt;br /&gt;
context=from-trunk&lt;br /&gt;
dtmfmode=inband&lt;br /&gt;
fromdomain=&#039;&#039;&#039;sipgate.co.uk&#039;&#039;&#039;&lt;br /&gt;
fromuser=&#039;&#039;&#039;SIP ID&#039;&#039;&#039;&lt;br /&gt;
host=&#039;&#039;&#039;sipgate.co.uk&#039;&#039;&#039;&lt;br /&gt;
insecure=very&lt;br /&gt;
nat=&#039;&#039;&#039;yes&#039;&#039;&#039;&lt;br /&gt;
qualify=no&lt;br /&gt;
secret=&#039;&#039;&#039;SIP Pwd&#039;&#039;&#039;&lt;br /&gt;
type=peer&lt;br /&gt;
user=&#039;&#039;&#039;SIP ID&#039;&#039;&#039;&lt;br /&gt;
username=&#039;&#039;&#039;SIP ID&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
USER CONTEXT&lt;br /&gt;
&#039;&#039;&#039;SIP ID&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
USER DETAILS&lt;br /&gt;
&lt;br /&gt;
allow=alaw&amp;amp;alaw&amp;amp;ulaw&amp;amp;g729&amp;amp;gsm&amp;amp;slinear&lt;br /&gt;
auth=md5&lt;br /&gt;
authuser=&#039;&#039;&#039;SIP ID&#039;&#039;&#039;&lt;br /&gt;
callerid=&#039;&#039;&#039;SIP ID&#039;&#039;&#039;&lt;br /&gt;
canreinvite=no&lt;br /&gt;
context=from-trunk&lt;br /&gt;
dtmfmode=inband&lt;br /&gt;
fromdomain=&#039;&#039;&#039;sipgate.co.uk&#039;&#039;&#039;&lt;br /&gt;
fromuser=&#039;&#039;&#039;SIP ID&#039;&#039;&#039;&lt;br /&gt;
host=&#039;&#039;&#039;sipgate.co.uk&#039;&#039;&#039;&lt;br /&gt;
insecure=very&lt;br /&gt;
nat=&#039;&#039;&#039;yes&#039;&#039;&#039;&lt;br /&gt;
qualify=no&lt;br /&gt;
secret=&#039;&#039;&#039;SIP Pwd&#039;&#039;&#039;&lt;br /&gt;
type=user&lt;br /&gt;
user=&#039;&#039;&#039;SIP ID&#039;&#039;&#039;&lt;br /&gt;
username=&#039;&#039;&#039;SIP ID&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
REGISTER STRING&lt;br /&gt;
&#039;&#039;&#039;SIP ID:SIP password@sipgate.co.uk/SIP ID&lt;br /&gt;
&#039;&#039;&#039;&lt;br /&gt;
:::click &#039;&#039;&#039;submit button&#039;&#039;&#039;&lt;br /&gt;
::::then..&lt;br /&gt;
:::click&#039;&#039;&#039;orange config bar&#039;&#039;&#039; at top of page&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;make sure&#039;&#039;&#039; pluto admin/advanced/configuration/phones setup.....&lt;br /&gt;
FreePBX...../outbound route / 0sipgate           settings    are as below&lt;br /&gt;
&lt;br /&gt;
...trunk sequence    0  (drop down =) &#039;&#039;&#039;SIP/sipgate&#039;&#039;&#039;&lt;br /&gt;
:::click &#039;&#039;&#039;submit button&#039;&#039;&#039;&lt;br /&gt;
::::then..&lt;br /&gt;
:::click&#039;&#039;&#039;orange config bar&#039;&#039;&#039; at top of page&lt;br /&gt;
&lt;br /&gt;
=&#039;&#039;&#039;Asterisk&#039;&#039;&#039;=&lt;br /&gt;
&lt;br /&gt;
[(RIP-OFF FROM)    &amp;lt;nowiki&amp;gt;freepbx.org/support/documentation/howtos/howto-resolving-audio-problems]&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;DYNAMIC ADDRESS&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
####NEED TO CHECK/change  file  PERMISSIONS     ????HOW&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Once you get a DynDNS or other address that identifies your system on the Internet, put it in your etc/hosts file. For example, if you are assigned foo.dyndns.net, then open etc/hosts in your favorite text editor &lt;br /&gt;
(I use joe...it&#039;s very simple....konsole/...........sudoapt-get install joe)&lt;br /&gt;
::::* joe /etc/hosts&lt;br /&gt;
&lt;br /&gt;
:::::::(use  UP, DOWN, LEFT RIGHT arrows to navigate,  Ctrl k x to save  Ctrl h for help)&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;127.0.0.1 localhost&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DO NOT REMOVE OR CHANGE THAT LINE.&#039;&#039;&#039; On a NEW line directly underneath it, place this line:&lt;br /&gt;
&#039;&#039;&#039;&lt;br /&gt;
127.0.0.1 foo.dyndns.net&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
But substitute &#039;&#039;&#039;YOUR address&#039;&#039;&#039;, of course......&lt;br /&gt;
&lt;br /&gt;
:::::&#039;&#039;&#039;save &amp;amp; exit&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Add some information to your /etc/asterisk/sip_nat.conf file&lt;br /&gt;
&lt;br /&gt;
####NEED TO CHECK PERMISSIONS     ????HOW&lt;br /&gt;
&lt;br /&gt;
 sudo joe /etc/asterisk/sip_nat.conf..................(your password is linuxmce)&lt;br /&gt;
nat=yes&lt;br /&gt;
externhost=YOUR FULL DynDNS  address e.g  dummy.is-a-geek.net&lt;br /&gt;
externrefresh=10&lt;br /&gt;
localnet=192.168.80.0/255.255.255.0&lt;br /&gt;
&lt;br /&gt;
:::::&#039;&#039;&#039;save and exit&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;STATIC ADDRESS&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Make use that your system knows its own name.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
####NEED TO CHECK/change  file  PERMISSIONS     ????HOW&lt;br /&gt;
&lt;br /&gt;
Once you get a DynDNS or other address that identifies your system on the Internet, put it in your etc/hosts file. For example, if you are assigned foo.dyndns.net, then open etc/hosts in your favorite text editor &lt;br /&gt;
I use joe...it&#039;s very simple....konsole/...........sudoapt-get install joe&lt;br /&gt;
                                 joe /etc/hosts&lt;br /&gt;
&lt;br /&gt;
(use  UP, DOWN, LEFT RIGHT arrows to navigate,  Ctrl k x to save  Ctrl h for help)&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;127.0.0.1 localhost&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DO NOT REMOVE OR CHANGE THAT LINE.&#039;&#039;&#039; On a NEW line directly underneath it, place this line:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;127.0.0.1 foo.dyndns.net&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
But substitute &#039;&#039;&#039;YOUR address&#039;&#039;&#039;, of course......save &amp;amp; exit&lt;br /&gt;
&lt;br /&gt;
Add some information to your /etc/asterisk/sip_nat.conf file&lt;br /&gt;
&lt;br /&gt;
####NEED TO CHECK PERMISSIONS     ????HOW&lt;br /&gt;
&lt;br /&gt;
 sudo joe /etc/asterisk/sip_nat.conf..................(your password is linuxmce)&lt;br /&gt;
nat=yes&lt;br /&gt;
externip=your.external.dotted.IPaddess&lt;br /&gt;
&lt;br /&gt;
fromdomain=YOUR DynDNS name in full&lt;br /&gt;
localnet=192.168.80.0/255.255.255.0&lt;br /&gt;
&lt;br /&gt;
::::&#039;&#039;&#039;save and exit&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;ALL&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
Check your  /etc/asterisk/rtp.conf file&lt;br /&gt;
&lt;br /&gt;
sudo joe /etc/asterisk/rtp.conf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It should contain these two lines:&lt;br /&gt;
&lt;br /&gt;
rtpstart=10001&lt;br /&gt;
&lt;br /&gt;
rtpend=20000&lt;br /&gt;
&lt;br /&gt;
&amp;quot;If the port values are any different, change them. N.B. These MUST match what you opened in your firewall, and DO NOT start with port 10000, because it conflicts with usage in FreePBX  Webmin &lt;br /&gt;
Some people feel the need to open fewer than 10,000 ports. I don&#039;t recommend this because six months from now when you start having audio problems you may not remember that you opened fewer than the recommended number of ports, and may spend hours troubleshooting the issue. But if you are simply obsessive about open ports, remember that each open SIP connection may require as many as FOUR concurrent ports, so don&#039;t cut it down to some ridiculously small number. For the non-paranoid, I suggest sticking with the recommendations above (and remember, if a hacker is looking at ports on your system, he&#039;s going to scan ALL of them, so having fewer UDP ports open really doesn&#039;t make you any more secure).&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
::::&#039;&#039;&#039;save &amp;amp; exit&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=&#039;&#039;&#039;Keeping Asterisk current&#039;&#039;&#039;=&lt;br /&gt;
You can use this sh script. run it from the crontab, maybe every 4 hours and on boot..&lt;br /&gt;
&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# get current ip of the router&lt;br /&gt;
&lt;br /&gt;
CURRENT_IP=`/usr/bin/lynx -dump http://www.netins.net/dialup/tools/my_ip.shtml | grep -A2 &amp;quot;Your current IP Address is:&amp;quot; | tail -n2 | tr -d &#039; &#039;`&lt;br /&gt;
&lt;br /&gt;
# update the sip_nat.conf and re-read configs&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;externip=$CURRENT_IP&amp;quot; &amp;gt; /tmp/sip_nat.conf&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;localnet=192.168.80.0/255.255.255.0&amp;quot; &amp;gt;&amp;gt; /tmp/sip_nat.conf&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;externrefresh=5&amp;quot; &amp;gt;&amp;gt; /tmp/sip_nat.conf&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;localnet=192.168.80.0/255.255.255.0&amp;quot;  &amp;gt;&amp;gt; /tmp/sip_nat.conf&lt;br /&gt;
&lt;br /&gt;
cat /tmp/sip_nat.conf &amp;gt; /etc/asterisk/sip_nat.conf&lt;br /&gt;
&lt;br /&gt;
chown asterisk.asterisk /etc/asterisk/sip_nat.conf&lt;br /&gt;
&lt;br /&gt;
asterisk -rx reload&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
PERL SCRIPT from/www.freepbx.org/support/documentation/howtos/howto-resolving-audio-problems&lt;br /&gt;
&lt;br /&gt;
when i tried this it threw errors.....needs a linux man for this section}}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;YOU&#039;RE ALMOST DONE !&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
exit Konsole&lt;br /&gt;
 GOTO ... pluto admin/wizard /advanced/config./phone setup&lt;br /&gt;
&lt;br /&gt;
if the orange bar is showing in FreePBX &#039;&#039;&#039;click it&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
GOTO        pluto admin/wizard/restart/ &#039;&#039;&#039;click reboot&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
GET TEA...(smoke/ have sex etc)&lt;br /&gt;
&lt;br /&gt;
pickup cell/landline&lt;br /&gt;
dial the local number sipgate gave you.....the rest , if it works should be obvious&lt;br /&gt;
&lt;br /&gt;
==TROUBLESHOOTING==&lt;br /&gt;
&lt;br /&gt;
if it does&#039;nt work&lt;br /&gt;
{A   run perl checkip.pl}&lt;br /&gt;
&lt;br /&gt;
1  check your ISP hasn&#039;t changed your IP address&lt;br /&gt;
2  check everything, form square one   for typos&lt;br /&gt;
3  goto Dyndns and run their name resolver&lt;br /&gt;
4  consider posting in user forum-- AFTER you&#039;ve had a break, freshened up, and RECHECKED EVERYTHING CAREFULLY&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;ONCE YOU&#039;RE RUNNING&#039;&#039;&#039;==&lt;br /&gt;
TEST TEST TEST&lt;br /&gt;
*read up on dial plans and tweak to your own desires&lt;br /&gt;
*read up on extensions/mds/voicemail/IVRs and  configure to your own desires&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;PLEASE&#039;&#039;&#039; &lt;br /&gt;
*.....keep it simple and test each step as you go -it makes troubleshooting so much easier&lt;br /&gt;
*--- take notes, post/wiki any new knowledge&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;LINKS&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
BT HomeHub.........................http://www.frequencycast.co.uk/homehub.html&lt;br /&gt;
WIKI...............................http://wiki.linuxmce.org/index.php/Category:Phone_Lines&lt;br /&gt;
:::::::::::::::::::::::::::::::::::http://wiki.linuxmce.org/index.php/LinuxMCE_telecom_features&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreePBX.............................http://www.freepbx.org/support/documentation&lt;br /&gt;
other voip providers/setups.........http://www.freepbx.org/support/documentation/howtos/howto-setting-up-voip-provider-trunks&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
THE O&#039;reiley book..................http://www.digium.com/elqNow/elqRedir.htm?ref=http://downloads.oreilly.com/books/9780596510480.pdf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Telecom]]&lt;br /&gt;
[[Category: Phone Lines]]&lt;br /&gt;
[[Category: Tutorials]]&lt;br /&gt;
[[Category: VOIP Setups]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A&lt;br /&gt;
&amp;lt;nowiki&amp;gt;Insert non-formatted text here&amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Pw44</name></author>
	</entry>
</feed>