<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>www.gavinwill.me.uk</title>
	<atom:link href="http://www.gavinwill.me.uk/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.gavinwill.me.uk</link>
	<description>Photography, IT, Bikes and more.</description>
	<lastBuildDate>Sat, 07 Apr 2012 12:36:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>ESXi : Windows session credentials cannot be used to log into this server</title>
		<link>http://www.gavinwill.me.uk/2012/04/esxi-windows-session-credentials-cannot-be-used-to-log-into-this-server/</link>
		<comments>http://www.gavinwill.me.uk/2012/04/esxi-windows-session-credentials-cannot-be-used-to-log-into-this-server/#comments</comments>
		<pubDate>Sat, 07 Apr 2012 12:35:01 +0000</pubDate>
		<dc:creator>Gavin</dc:creator>
				<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[Virtualisation]]></category>

		<guid isPermaLink="false">http://www.gavinwill.me.uk/?p=348</guid>
		<description><![CDATA[For a remote (very remote &#8211; the other side of the world to where I was) ESXi host I recently had issues using the option to &#8220;Use Windows Session Credentials&#8221; in vSphere and it would complain that &#8216;Windows session credentials cannot be used to log into this server&#8217;. The strange thing was this was working [...]]]></description>
			<content:encoded><![CDATA[<p>For a remote (very remote &#8211; the other side of the world to where I was) ESXi host I recently had issues using the option to &#8220;Use Windows Session Credentials&#8221; in vSphere and it would complain that &#8216;Windows session credentials cannot be used to log into this server&#8217;. The strange thing was this was working correctly before I shipped the Esxi server and it would accept the credentials if I manually entered domain/username and then password. First thing to check was there was a valid PTR record in DNS since vSphere checks the host by doing a ptr lookup. This was all correct so I had to do a bit more digging to find the problem. Logging in via SSH with a local account I discovered that Esxi uses Likewise Open to enable the host to join a windows domain. Looking at the config files and especially <em>/etc/likewise/krb5-affinity.conf</em> it had listed a stale Domain Controller entry. I therefore simply edited out the stale entry and ensured the local DC was first in the list:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">vi <span style="color: #339933;">/</span>etc<span style="color: #339933;">/</span>likewise<span style="color: #339933;">/</span>krb5<span style="color: #339933;">-</span>affinity<span style="color: #339933;">.</span>conf</pre></div></div>

<p>After editing and saving the file the likewise server needs restarted by the command</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">/</span>etc<span style="color: #339933;">/</span>init<span style="color: #339933;">.</span>d<span style="color: #339933;">/</span>lsassd restart</pre></div></div>

<p>After this I was able to use Windows Session Credentials again to connect to this remote ESXi host. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.gavinwill.me.uk/2012/04/esxi-windows-session-credentials-cannot-be-used-to-log-into-this-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>List Mailbox Sizes in Exchange 2010</title>
		<link>http://www.gavinwill.me.uk/2012/03/list-mailbox-sizes-in-exchange-2010/</link>
		<comments>http://www.gavinwill.me.uk/2012/03/list-mailbox-sizes-in-exchange-2010/#comments</comments>
		<pubDate>Fri, 30 Mar 2012 09:22:21 +0000</pubDate>
		<dc:creator>Gavin</dc:creator>
				<category><![CDATA[Exchange]]></category>

		<guid isPermaLink="false">http://www.gavinwill.me.uk/?p=342</guid>
		<description><![CDATA[Using the Exchange Management Shell it is possible to export a list of Mailbox sizes to a csv file using a very simple command Get-Mailbox &#124;Get-MailboxStatistics &#124; Sort-Object TotalItemSize -Descending &#124; select-object DisplayName, &#123;$_.TotalItemSize.Value.ToMB&#40;&#41;&#125; &#124; export-csv -path C:\Temp\MailboxSizes.csv Once opened up in Excel or any other spreadsheet the data is clearly presented.]]></description>
			<content:encoded><![CDATA[<p>Using the Exchange Management Shell it is possible to export a list of Mailbox sizes to a csv file using a very simple command</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">Get<span style="color: #339933;">-</span>Mailbox <span style="color: #339933;">|</span>Get<span style="color: #339933;">-</span>MailboxStatistics <span style="color: #339933;">|</span> Sort<span style="color: #339933;">-</span>Object TotalItemSize <span style="color: #339933;">-</span>Descending <span style="color: #339933;">|</span>  select<span style="color: #339933;">-</span>object DisplayName<span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span><span style="color: #000088;">$_</span><span style="color: #339933;">.</span>TotalItemSize<span style="color: #339933;">.</span>Value<span style="color: #339933;">.</span>ToMB<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#125;</span>  <span style="color: #339933;">|</span> export<span style="color: #339933;">-</span>csv <span style="color: #339933;">-</span>path C<span style="color: #339933;">:</span>\Temp\MailboxSizes<span style="color: #339933;">.</span>csv</pre></div></div>

<p>Once opened up in Excel or any other spreadsheet the data is clearly presented. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.gavinwill.me.uk/2012/03/list-mailbox-sizes-in-exchange-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Active Directory Authentication with Racktables</title>
		<link>http://www.gavinwill.me.uk/2012/03/active-directory-authentication-with-racktables/</link>
		<comments>http://www.gavinwill.me.uk/2012/03/active-directory-authentication-with-racktables/#comments</comments>
		<pubDate>Fri, 02 Mar 2012 16:58:28 +0000</pubDate>
		<dc:creator>Gavin</dc:creator>
				<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Random]]></category>

		<guid isPermaLink="false">http://www.gavinwill.me.uk/?p=331</guid>
		<description><![CDATA[Racktables is a mature and robust solution for datacenter and server room asset management. It helps document hardware assets, network addresses, space in racks, networks configuration and more. To enable Active Directory authentication you need to edit secret.php and add the LDAP option along with the Base DN to search for. &#160; &#60;?php /* This [...]]]></description>
			<content:encoded><![CDATA[<p>Racktables is a mature and robust solution for datacenter and server room asset management. It helps document hardware assets, network addresses, space in racks, networks configuration and  more. </p>
<p>To enable Active Directory authentication you need to edit secret.php and add the LDAP option along with the Base DN to search for.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">/* This file has been generated automatically by RackTables installer.
 * you shouldn't normally edit it unless your database setup has changed.
 */</span>
<span style="color: #000088;">$pdo_dsn</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'mysql:host=localhost;dbname=racktables'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$db_username</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'DBusername'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$db_password</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'DBpassword'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Default setting is to authenticate users locally, but it is possible to</span>
<span style="color: #666666; font-style: italic;">// employ existing LDAP or Apache userbase. Uncommenting below two lines MAY</span>
<span style="color: #666666; font-style: italic;">// help in switching authentication to LDAP completely.</span>
<span style="color: #666666; font-style: italic;">// More info: http://sourceforge.net/apps/mediawiki/racktables/index.php?title=RackTablesAdminGuide</span>
&nbsp;
<span style="color: #000088;">$user_auth_src</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'ldap'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$require_local_account</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// This is only necessary for 'ldap' authentication soure</span>
&nbsp;
<span style="color: #000088;">$LDAP_options</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span>
<span style="color: #009900;">&#40;</span>
  <span style="color: #0000ff;">'server'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'domaincontroller1.domain.com domain.controller2.domain.com'</span><span style="color: #339933;">,</span>
  <span style="color: #0000ff;">'domain'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'domain.com'</span><span style="color: #339933;">,</span>
  <span style="color: #0000ff;">'search_attr'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'sAMAccountName'</span><span style="color: #339933;">,</span>
  <span style="color: #0000ff;">'search_dn'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'OU=Users,OU=MyBusiness,DC=domain,DC=com'</span><span style="color: #339933;">,</span>
  <span style="color: #0000ff;">'displayname_attrs'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'givenname sn'</span><span style="color: #339933;">,</span>
  <span style="color: #0000ff;">'options'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span>LDAP_OPT_PROTOCOL_VERSION <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">3</span><span style="color: #339933;">,</span> LDAP_OPT_REFERRALS <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>The important lines to notice are <strong>$user_auth_src = &#8216;ldap&#8217;;</strong> which states to use ldap as the authentication source and the line &#8211; <strong>$require_local_account = FALSE; </strong> that states that there does not need to be a local user in the database. Our preference was to have this as false and instead let the person access racktables if authenticated. Permissions in racktables then handle what the person can or cant see. </p>
<p>You will also want to run racktables over https if you are using LDAP authentication since the passwords could possibly be sniffed.<br />
Now that you have setup the LDAP authentication you need to go into Configuration then permissions in Racktables and set what you want to access.</p>
<p>If you were to simply want any authenticated user admin access you would simply add the line:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">allow <span style="color: #009900; font-weight: bold;">true</span></pre></div></div>

<p>If you were to want a specific user admin access you would add the line:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">allow <span style="color: #009900;">&#123;</span><span style="color: #000088;">$username_auser</span><span style="color: #009900;">&#125;</span></pre></div></div>

<p>and finally for a member of a specific group you would use:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">allow <span style="color: #009900;">&#123;</span><span style="color: #000088;">$lgcn_IT</span> Dept<span style="color: #009900;">&#125;</span></pre></div></div>

<p>You will want to restrict access depending on what group membership a person uses but by having AD authentication means it is simple and quick to grant a user access. Simply put them in the relevant group and they can login straight away.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gavinwill.me.uk/2012/03/active-directory-authentication-with-racktables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Before and After cabling</title>
		<link>http://www.gavinwill.me.uk/2012/02/before-and-after-cabling/</link>
		<comments>http://www.gavinwill.me.uk/2012/02/before-and-after-cabling/#comments</comments>
		<pubDate>Sat, 25 Feb 2012 17:53:51 +0000</pubDate>
		<dc:creator>Gavin</dc:creator>
				<category><![CDATA[Random]]></category>

		<guid isPermaLink="false">http://www.gavinwill.me.uk/?p=318</guid>
		<description><![CDATA[I wish I had better pictures when doing this work. One of my first jobs I needed to do when I arrived at my new work.]]></description>
			<content:encoded><![CDATA[<p>I wish I had better pictures when doing this work. One of my first jobs I <em>needed</em> to do when I arrived at my new work.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gavinwill.me.uk/2012/02/before-and-after-cabling/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Blackberry Contacts not Syncing With BES Server / Exchange</title>
		<link>http://www.gavinwill.me.uk/2012/02/blackberry-contacts-not-syncing-with-bes-server-exchange/</link>
		<comments>http://www.gavinwill.me.uk/2012/02/blackberry-contacts-not-syncing-with-bes-server-exchange/#comments</comments>
		<pubDate>Fri, 10 Feb 2012 15:23:41 +0000</pubDate>
		<dc:creator>Gavin</dc:creator>
				<category><![CDATA[Exchange]]></category>
		<category><![CDATA[Random]]></category>

		<guid isPermaLink="false">http://www.gavinwill.me.uk/?p=311</guid>
		<description><![CDATA[If you see that contacts in Outlook are not being synced with your Blackberry you can first ensure that wireless sync is enabled. If it is you may need to reset and reload your contacts. To do this go into contacts and press the Blackberry button and select options. Type RSET (nothing appears as you [...]]]></description>
			<content:encoded><![CDATA[<p>If you see that contacts in Outlook are not being synced with your Blackberry you can first ensure that wireless sync is enabled. If it is you may need to reset and reload your contacts.</p>
<p>To do this go into contacts and press the Blackberry button and select options. Type RSET (nothing appears as you type) from the options menu and when you have typed RSET in it will prompt if you want to erase contacts and reload from server. Select yes and wait a short while for the contacts to be populated. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.gavinwill.me.uk/2012/02/blackberry-contacts-not-syncing-with-bes-server-exchange/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Uptime Reports</title>
		<link>http://www.gavinwill.me.uk/2012/02/uptime-reports/</link>
		<comments>http://www.gavinwill.me.uk/2012/02/uptime-reports/#comments</comments>
		<pubDate>Fri, 10 Feb 2012 09:55:28 +0000</pubDate>
		<dc:creator>Gavin</dc:creator>
				<category><![CDATA[Random]]></category>

		<guid isPermaLink="false">http://www.gavinwill.me.uk/?p=300</guid>
		<description><![CDATA[I like seeing graphs like this.]]></description>
			<content:encoded><![CDATA[<p>I like seeing graphs like this.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gavinwill.me.uk/2012/02/uptime-reports/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enable Windows Server 2008 Mode Greyed out In DFS</title>
		<link>http://www.gavinwill.me.uk/2012/02/enable-windows-server-2008-mode-greyed-out-in-dfs/</link>
		<comments>http://www.gavinwill.me.uk/2012/02/enable-windows-server-2008-mode-greyed-out-in-dfs/#comments</comments>
		<pubDate>Wed, 08 Feb 2012 12:58:19 +0000</pubDate>
		<dc:creator>Gavin</dc:creator>
				<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.gavinwill.me.uk/?p=291</guid>
		<description><![CDATA[If you have a Domain and Forest functional level of 2008 you should be able to create DFS Namespaces that are enabled for Windows 2008 mode. However when creating a DFS I noticed that this option was greyed out. I checked again in Active Directory to confirm the Forest and Domain was running at a [...]]]></description>
			<content:encoded><![CDATA[<p>If you have a Domain and Forest functional level of 2008 you should be able to create DFS Namespaces that are enabled for Windows 2008 mode. However when creating a DFS I noticed that this option was greyed out. I checked again in Active Directory to confirm the Forest and Domain was running at a 2008 Functional Level and it was. It turns out that this option to enable Windows Server 2008 Mode does not appear until the DFS Namesspace service and the DFS Replication Service have been restarted on the Namespace server and the Domain Controller that holds the Operations Master FSMO role. </p>
<p>After restarting these services try and create a new namespace and the option to Enable Windows Server 2008 Mode should be availible.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gavinwill.me.uk/2012/02/enable-windows-server-2008-mode-greyed-out-in-dfs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Change the OS Name in Windows Boot Manager</title>
		<link>http://www.gavinwill.me.uk/2012/01/change-the-os-name-in-windows-boot-manager/</link>
		<comments>http://www.gavinwill.me.uk/2012/01/change-the-os-name-in-windows-boot-manager/#comments</comments>
		<pubDate>Sat, 28 Jan 2012 17:27:23 +0000</pubDate>
		<dc:creator>Gavin</dc:creator>
				<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.gavinwill.me.uk/?p=288</guid>
		<description><![CDATA[Being able to test against multiple OS&#8217;s is great if you are developing an application. Virtual machines are perfect for this with the nature of the flexibility they offer. However I needed to setup a physical computer that would multiboot for testing that would run Windows XP, XP 64 bit, Vista Business, Vista Business 64 [...]]]></description>
			<content:encoded><![CDATA[<p>Being able to test against multiple OS&#8217;s is great if you are developing an application. Virtual machines are perfect for this with the nature of the flexibility they offer. However I needed to setup a physical computer that would multiboot for testing that would run Windows XP, XP 64 bit, Vista Business, Vista Business 64 bit and finally Windows 7 along with Windows 7 64 bit. </p>
<p>So it was simply a case of installing XP first then Vista and then 7 onto different partitions on the hard drive. After I installed Vista 64bit there was a problem since both versions of Vista were simply listed as <strong>Microsoft Windows Vista</strong> at the multiboot prompt to select an OS. There was no way to distinguish what was the 32bit version and what was the 64bit version when given the boot options to choose the OS. </p>
<p>In XP you can modify the display name by modifying the hidden file boot.ini however this feature is abscent in Vista and 7. In Windows Vista and 7 you need to use an elevated command prompt and run the command <strong>bcdeit</strong>. This displays the boot manager along with the boot loader. In the Windows boot loader you can see an entry called description. This is the entry you see at boot when selecting what OS you want to go into. </p>
<p>Say we were in the 64bit version of Windows 7 and wanted to label the boot loader accordingly simply run the command:</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"> bcdedit <span style="color: pink;">/</span><span style="color: #008080; font-weight: bold;">set</span> <span style="color: #000000;">&#123;</span>current<span style="color: #000000;">&#125;</span> Description <span style="color: #800000;">&quot;Microsoft Windows 7 64bit&quot;</span></pre></div></div>

<p>You should be returned with <em>The operation completed successfully</em>. Now when the computer reboots you will be presented with an unambiguous list of operating systems that you can choose from. A simple touch but it makes it a lot easier. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.gavinwill.me.uk/2012/01/change-the-os-name-in-windows-boot-manager/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Configuring Fail2Ban with Asterisk</title>
		<link>http://www.gavinwill.me.uk/2012/01/configuring-fail2ban-with-asterisk/</link>
		<comments>http://www.gavinwill.me.uk/2012/01/configuring-fail2ban-with-asterisk/#comments</comments>
		<pubDate>Sat, 28 Jan 2012 15:36:11 +0000</pubDate>
		<dc:creator>Gavin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[VOIP]]></category>

		<guid isPermaLink="false">http://www.gavinwill.me.uk/?p=249</guid>
		<description><![CDATA[Fail2Ban can compliment your Asterisk security by automatically blocking failed authentication attempts against your asterisk server. However a little configuration is needed to let Fail2Ban be aware of the structure of the asterisk log files so it can &#8220;read&#8221; the log files and block the failed attempts. First we need to install fail2ban and jwhois [...]]]></description>
			<content:encoded><![CDATA[<p>Fail2Ban can compliment your Asterisk security by automatically blocking failed authentication attempts against your asterisk server. However a little configuration is needed to let Fail2Ban be aware of the structure of the asterisk log files so it can &#8220;read&#8221; the log files and block the failed attempts.</p>
<p>First we need to install fail2ban and jwhois from the rpmforge repository</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">yum <span style="color: #c20cb9; font-weight: bold;">install</span> <span style="color: #660033;">-y</span> fail2ban jwhois</pre></div></div>

<p>We then need to create the file <strong>/etc/fail2ban/asterisk.conf</strong>. This is telling fail2ban how to read the log files for failed authentication attempts.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Fail2Ban configuration.</span>
<span style="color: #666666; font-style: italic;">#</span>
&nbsp;
&nbsp;
<span style="color: #7a0874; font-weight: bold;">&#91;</span>INCLUDES<span style="color: #7a0874; font-weight: bold;">&#93;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Read common prefixes. If any customizations available -- read them from</span>
<span style="color: #666666; font-style: italic;"># common.local</span>
<span style="color: #666666; font-style: italic;">#before = common.conf</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">&#91;</span>Definition<span style="color: #7a0874; font-weight: bold;">&#93;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#_daemon = asterisk</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Option:  failregex</span>
<span style="color: #666666; font-style: italic;"># Notes.:  regex to match the password failures messages in the logfile. The</span>
<span style="color: #666666; font-style: italic;">#          host must be matched by a group named &quot;host&quot;. The tag &quot;&lt;HOST&gt;&quot; can</span>
<span style="color: #666666; font-style: italic;">#          be used for standard IP/hostname matching and is only an alias for</span>
<span style="color: #666666; font-style: italic;">#          (?:::f{4,6}:)?(?P&lt;host&gt;\S+)</span>
<span style="color: #666666; font-style: italic;"># Values:  TEXT</span>
<span style="color: #666666; font-style: italic;">#</span>
&nbsp;
failregex = NOTICE.<span style="color: #000000; font-weight: bold;">*</span> .<span style="color: #000000; font-weight: bold;">*</span>: Registration from <span style="color: #ff0000;">'.*'</span> failed <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #ff0000;">'&lt;HOST&gt;'</span> - Wrong password
            NOTICE.<span style="color: #000000; font-weight: bold;">*</span> .<span style="color: #000000; font-weight: bold;">*</span>: Registration from <span style="color: #ff0000;">'.*'</span> failed <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #ff0000;">'&lt;HOST&gt;'</span> - No matching peer found
            NOTICE.<span style="color: #000000; font-weight: bold;">*</span> .<span style="color: #000000; font-weight: bold;">*</span>: Registration from <span style="color: #ff0000;">'.*'</span> failed <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #ff0000;">'&lt;HOST&gt;'</span> - Username<span style="color: #000000; font-weight: bold;">/</span>auth name mismatch
            NOTICE.<span style="color: #000000; font-weight: bold;">*</span> .<span style="color: #000000; font-weight: bold;">*</span>: Registration from <span style="color: #ff0000;">'.*'</span> failed <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #ff0000;">'&lt;HOST&gt;'</span> - Device does not match ACL
            NOTICE.<span style="color: #000000; font-weight: bold;">*</span> .<span style="color: #000000; font-weight: bold;">*</span>: Registration from <span style="color: #ff0000;">'.*'</span> failed <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #ff0000;">'&lt;HOST&gt;'</span> - Peer is not supposed to register
            NOTICE.<span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">&lt;</span>HOST<span style="color: #000000; font-weight: bold;">&gt;</span> failed to authenticate <span style="color: #c20cb9; font-weight: bold;">as</span> <span style="color: #ff0000;">'.*'</span>$
            NOTICE.<span style="color: #000000; font-weight: bold;">*</span> .<span style="color: #000000; font-weight: bold;">*</span>: No registration <span style="color: #000000; font-weight: bold;">for</span> peer <span style="color: #ff0000;">'.*'</span> \<span style="color: #7a0874; font-weight: bold;">&#40;</span>from <span style="color: #000000; font-weight: bold;">&lt;</span>HOST<span style="color: #000000; font-weight: bold;">&gt;</span>\<span style="color: #7a0874; font-weight: bold;">&#41;</span>
            NOTICE.<span style="color: #000000; font-weight: bold;">*</span> .<span style="color: #000000; font-weight: bold;">*</span>: Host <span style="color: #000000; font-weight: bold;">&lt;</span>HOST<span style="color: #000000; font-weight: bold;">&gt;</span> failed MD5 authentication <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #ff0000;">'.*'</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>.<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
            NOTICE.<span style="color: #000000; font-weight: bold;">*</span> .<span style="color: #000000; font-weight: bold;">*</span>: Failed to authenticate user .<span style="color: #000000; font-weight: bold;">*@&lt;</span>HOST<span style="color: #000000; font-weight: bold;">&gt;</span>.<span style="color: #000000; font-weight: bold;">*</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Option:  ignoreregex</span>
<span style="color: #666666; font-style: italic;"># Notes.:  regex to ignore. If this regex matches, the line is ignored.</span>
<span style="color: #666666; font-style: italic;"># Values:  TEXT</span>
<span style="color: #666666; font-style: italic;">#</span>
ignoreregex =</pre></div></div>

<p>We now need to add some information to <strong>/etc/fail2ban/jail.conf</strong> that tells fail2ban where the log files are and what to do when it sees failed authentication attempts.<br />
This includes sending an email to alert you of the action.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>asterisk-iptables<span style="color: #7a0874; font-weight: bold;">&#93;</span>
&nbsp;
enabled  = <span style="color: #c20cb9; font-weight: bold;">true</span>
filter   = asterisk
action   = iptables-allports<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #007800;">name</span>=ASTERISK, <span style="color: #007800;">protocol</span>=all<span style="color: #7a0874; font-weight: bold;">&#93;</span>
           sendmail-whois<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #007800;">name</span>=ASTERISK, <span style="color: #007800;">dest</span>=alerts<span style="color: #000000; font-weight: bold;">@</span>domain.com, <span style="color: #007800;">sender</span>=fail2ban<span style="color: #000000; font-weight: bold;">@</span>domain.com<span style="color: #7a0874; font-weight: bold;">&#93;</span>
logpath  = <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>asterisk<span style="color: #000000; font-weight: bold;">/</span>full
maxretry = <span style="color: #000000;">5</span>
bantime = <span style="color: #000000;">432000</span></pre></div></div>

<p>Also in the jail.conf you would want to configure the <strong>ignoreip</strong> or whitelist to tell fail2ban to ignore certain ip addresses or subnets.</p>
<pre lang=bash>
ignoreip = 172.16.0.0/12</pre>
<p>This is almost working now but we need to tell asterisk to log the date in a specific format which is compatible with fail2ban. </p>
<p>Modify <strong>/etc/asterisk/logger.conf</strong> and add the following</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>general<span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #007800;">dateformat</span>=<span style="color: #000000; font-weight: bold;">%</span>F <span style="color: #000000; font-weight: bold;">%</span>T</pre></div></div>

<p>The asterisk logger needs restarted after this change</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"> asterisk <span style="color: #660033;">-rx</span> <span style="color: #ff0000;">&quot;logger reload&quot;</span></pre></div></div>

<p>Now we can start up fail2ban (or restart if it is already running) and set it to start as a service at boot.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">service fail2ban start
chkconfig fail2ban on</pre></div></div>

<p>Naturally we now need to test this and ensure it works as expected. When you start the fail2ban service you should get an email notifying you that the jail has started. This is naturally a good sign. Now from a phone / softphone simply try and register the phone with invalid extension or password (ensuring it address is outwith the specified ignoreip) and repeat this 5 times. It should be banned automatically and you should receive an email notifying you of this ban. When trying to authenticate the first few time you will see a 403 forbidden message. When fail2ban has banned this IP you should notice on the phone / softphone that instead of a 403 error message it should simply state no service. This is a good sign since it appears that the phone / softphone cannot connect at all to the server &#8211; the reason is because it has been blocked by fail2ban. </p>
<p>You can see a list of the banned ips / addresses by running the command</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">iptables <span style="color: #660033;">-L</span> <span style="color: #660033;">-n</span></pre></div></div>

<p>Now reboot the server and ensure the fail2ban service starts at startup. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.gavinwill.me.uk/2012/01/configuring-fail2ban-with-asterisk/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Step By Step</title>
		<link>http://www.gavinwill.me.uk/2012/01/step-by-step/</link>
		<comments>http://www.gavinwill.me.uk/2012/01/step-by-step/#comments</comments>
		<pubDate>Tue, 24 Jan 2012 15:33:37 +0000</pubDate>
		<dc:creator>Gavin</dc:creator>
				<category><![CDATA[Video]]></category>

		<guid isPermaLink="false">http://www.gavinwill.me.uk/?p=245</guid>
		<description><![CDATA[Chris Akrigg&#8217;s Road to recovery.]]></description>
			<content:encoded><![CDATA[<p>Chris Akrigg&#8217;s Road to recovery.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gavinwill.me.uk/2012/01/step-by-step/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

