<?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>Chainring Circus</title>
	<atom:link href="http://www.chainringcircus.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.chainringcircus.org</link>
	<description>My thoughts on Linux, Routing and Cycling.</description>
	<lastBuildDate>Tue, 07 Feb 2012 00:00:07 +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>Long Time No Post</title>
		<link>http://www.chainringcircus.org/long-time-no-post/</link>
		<comments>http://www.chainringcircus.org/long-time-no-post/#comments</comments>
		<pubDate>Tue, 27 Dec 2011 00:15:41 +0000</pubDate>
		<dc:creator>jud</dc:creator>
				<category><![CDATA[Musings]]></category>

		<guid isPermaLink="false">http://www.chainringcircus.org/?p=2689</guid>
		<description><![CDATA[I have been putting off this post because I didn&#8217;t really know what to say. So much has changed in the last six months I didn&#8217;t know how best to communicate what was going on in my life. Please understand that I am leaving out quite a bit of this story but I believe it [...]]]></description>
			<content:encoded><![CDATA[<p>I have been putting off this post because I didn&#8217;t really know what to say.  So much has changed in the last six months I didn&#8217;t know how best to communicate what was going on in my life.  Please understand that I am leaving out quite a bit of this story but I believe it needs to be told so that others will understand when they stumble across my blog.</p>
<p>Let&#8217;s start with some background.  I have been working for the same employer for the last 8 years.  It is a regional medical center and a great place to work.  Before Fortune magazine stopped allowing non-profits to be on the &#8220;100 Best Places to Work&#8221; my employer made the list twice.  </p>
<p>I started working at the hospital as a Programmer Analyst in early 2003 writing code that allowed hospital systems to communicate and was also the UNIX/Linux administrator.  During this time I managed DNS/DHCP, most of the printing and portions of our email infrastructure on *NIX while also writing mostly TCL and Perl code.</p>
<p>When a Senior Network Engineer slot opened I applied and was promoted in early 2006.  I earned my CCNA and began to learn quite a bit about networking.  Shortly thereafter I decided I was ready to leave the hospital in order to learn more, but my wife loves working here, knows and trusts many of the doctors and made me promise that we would have our children at this hospital.  </p>
<p>As a result of that promise to my wife I decided to work on my CCNP and started this blog, figuring both would help me get my next job.  During that time I was selected for &#8220;50 for the Future&#8221; a two year management training program at the hospital and I finished my CCNP. I also became dedicated to my craft.  As I learned more and more about networking, I began to understand how much I did not know and it became a joy to learn something new everyday.  Not all of the lessons were fun at the time but I was learning so much I loved coming to work.  </p>
<p>The next logical step was starting on my CCIE.  It sounded like a great challenge and with a family now depending upon me, it was the next logical step for job security.  It surely would allow me to get my next job and my promise to my wife was still not fulfilled.  We had suffered through two miscarriages to get our first child, and our second child was born in April 2011.  </p>
<p>With the birth of our second child my promise to my wife had been fulfilled and I was ready to leave.  Literally the day after my second child was born I started applying for jobs.  I was offered an interesting position in South Carolina working with a team that fit my goals.  Some had their CCIEs and others were working toward their digits.  I would fit right in and I knew it was the place for me, so I turned in my resignation.  The wrinkle being that the hospital requests a 30 day notice for professional employees.</p>
<p>I had already spoken with my Director about leaving and he was gracious.  I had spent $5,000 on my CCIE lab and the hospital had spent another $5,000, but my boss gave me the whole rack.  Everything.  I cannot describe how much that meant to me, I am truly grateful.</p>
<p>That day my Vice President asked me what it would take for me to stay and I told him I was chasing a dream.  While I appreciated the offer and I knew the hospital was a great place to work, it was a goal I had set for myself and I felt I should leave in order to get the experience I needed.</p>
<p>Two weeks later I had both my AVP and VP stop by my desk within ten minutes of each other.  My last day was drawing near and they wanted to discuss what it would take for me to stay.  I declined a second time.  I had made the decision to try to earn my CCIE and I did not want to let my family down.  I believed that South Carolina offered me the best chance to achieve my goal. </p>
<p>My last day at the hospital came and went, but it was a tumultuous day.  My AVP literally gave me a hug as I walked out the door for the last time and I cried in her arms.  </p>
<p>I had a week off between jobs and I had lunch with friends to say goodbye, finished setting up the lab at home and packed.  I made arrangements for long term housing in South Carolina and prepared to leave my family while we tried to sell our home.</p>
<p>Thursday evening of my week off I got a call on my cell phone.  It was my VP and AVP calling to chat.  The first question they asked was whether I was still in town or had I already left for South Carolina.  Then they asked me to stay one last time.  They had met with our CEO and Executive Vice President and wanted me to stay.  I was floored.  I had worked for nearly three years getting ready to leave.  I had started down a road and I didn&#8217;t want to change direction.</p>
<p>But I did.  My wife told me that I will never again be offered the chance to work at a company which knows neither what my job title will be nor what I will be doing, just that they want me to work for them.  She was probably right.</p>
<p>I was offered the chance to make a difference working for a company that has been good to me and my family.  It is a different challenge than what I had been working toward but an interesting one all the same.  I am slowly settling into my new job as Technical Services Manager.  Some of the changes I have made are for the better, some of the changes have not lasted and others have yet to be implemented, but I am still learning every day.</p>
<p>And so my goals are slowly evolving.  It is hard to give up a goal that I have sacrificed so much to earn, without completing it.  In the short term I will begin working toward my CCIP in the new year.  Currently I do not have the time to complete the CCIE but I believe working toward my CCIP will keep my mind in networking and it will cover topics that I believe are needed if I decide to again try for my CCIE.</p>
<p>Thank you for reading.  I plan to post more regularly in the coming year.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chainringcircus.org/long-time-no-post/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TestLab Script in AppleScript</title>
		<link>http://www.chainringcircus.org/testlab-script-in-applescript/</link>
		<comments>http://www.chainringcircus.org/testlab-script-in-applescript/#comments</comments>
		<pubDate>Sun, 14 Aug 2011 18:26:34 +0000</pubDate>
		<dc:creator>jud</dc:creator>
				<category><![CDATA[CCIE]]></category>
		<category><![CDATA[CCIE Labs]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Routing]]></category>

		<guid isPermaLink="false">http://www.chainringcircus.org/?p=2498</guid>
		<description><![CDATA[I got a new Mac Pro workstation at work and re-wrote some scripts to work on it. This morning I couldn&#8217;t find the script under the new file lay out, it was in /Applications so I decided I had better document the script so I don&#8217;t have to rewrite it if I can&#8217;t find it. [...]]]></description>
			<content:encoded><![CDATA[<p>I got a new Mac Pro workstation at work and re-wrote some scripts to work on it.  This morning I couldn&#8217;t find the script under the new file lay out, it was in /Applications so I decided I had better document the script so I don&#8217;t have to rewrite it if I can&#8217;t find it.</p>
<p>It uses the same script, tle, that I wrote a while ago, it just fires up iTerm instead of Gnome Terminal.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">-- 2011-03-24 <br />
-- Jud Bishop <br />
<br />
<br />
tell application &quot;iTerm&quot;<br />
&nbsp; &nbsp; activate<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; -- If you don't have this you end up with two terminals<br />
&nbsp; &nbsp; terminate the first session of the first terminal<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; set iterm to (make new terminal)<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; repeat with X from 1 to 6<br />
&nbsp; &nbsp; &nbsp; &nbsp; set Y to &quot;R&quot; &amp; X as string<br />
&nbsp; &nbsp; &nbsp; &nbsp; tell iterm<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; make new session at the end of sessions<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tell the last session<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; exec command &quot;/usr/local/bin/tle &quot; &amp; Y &amp; &quot; testlab.chainringcircus.org&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; set name to Y<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end tell<br />
&nbsp; &nbsp; &nbsp; &nbsp; end tell<br />
&nbsp; &nbsp; end repeat<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; repeat with X from 1 to 4<br />
&nbsp; &nbsp; &nbsp; &nbsp; set Y to &quot;SW&quot; &amp; X as string<br />
&nbsp; &nbsp; &nbsp; &nbsp; tell iterm<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; make new session at the end of sessions<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tell the last session<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; exec command &quot;/usr/local/bin/tle &quot; &amp; Y &amp; &quot; testlab.chainringcircus.org&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; set name to Y<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end tell<br />
&nbsp; &nbsp; &nbsp; &nbsp; end tell<br />
&nbsp; &nbsp; end repeat<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; repeat with X from 1 to 3<br />
&nbsp; &nbsp; &nbsp; &nbsp; set Y to &quot;BB&quot; &amp; X as string<br />
&nbsp; &nbsp; &nbsp; &nbsp; tell iterm<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; make new session at the end of sessions<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tell the last session<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; exec command &quot;/usr/local/bin/tle &quot; &amp; Y &amp; &quot; testlab.chainringcircus.org&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; set name to Y<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end tell<br />
&nbsp; &nbsp; &nbsp; &nbsp; end tell<br />
&nbsp; &nbsp; end repeat<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; set the bounds of the first window to {0, 0, 1200, 900}<br />
&nbsp; &nbsp; <br />
end tell</div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.chainringcircus.org/testlab-script-in-applescript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Does Google Hurt Efficiency?</title>
		<link>http://www.chainringcircus.org/does-google-hurt-efficiency/</link>
		<comments>http://www.chainringcircus.org/does-google-hurt-efficiency/#comments</comments>
		<pubDate>Sun, 31 Jul 2011 23:38:06 +0000</pubDate>
		<dc:creator>jud</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Routing]]></category>

		<guid isPermaLink="false">http://www.chainringcircus.org/?p=2055</guid>
		<description><![CDATA[The other night we were doing a hardware upgrade on a cluster and testing. We were working with the command clusvcadm to relocate a service from one host in the cluster to another but the originating server kept getting power fenced. We assumed it was the command switches we were running so I went straight [...]]]></description>
			<content:encoded><![CDATA[<p>The other night we were doing a hardware upgrade on a cluster and testing.  We were working with the command clusvcadm to relocate a service from one host in the cluster to another but the originating server kept getting power fenced.  We assumed it was the command switches we were running so I went straight to the man page, my coworker went straight to google.  Just for reference there is a 10 year difference in our ages, I grew up with man pages and it is a pet peeve of mine when either no man page exists or it is a terrible placeholder.  I digress, through his search he came upon a webified man page while I was reading the man page.  When I needled him about it his answer was, &#8220;But mine is nicely formatted and I can search the web page.&#8221;  I was surprised, I can search the man page too, right in the pager and can even change man page viewers by changing the PAGER variable.</p>
<p>Three weeks ago I needed to bring up an https server on Ubuntu and spent 45 minutes googling around reading old, outdated or completely wrong howtos before finally going to <a href="https://help.ubuntu.com">help.ubuntu.com</a> and 20 minutes later it was done.</p>
<p>The same thing happened over the past couple of weeks working with Xen and VirtualBox.  I&#8217;ve toiled away looking at poorly written documentation and even mentioned it in my last Red Hat class.  The instructor worked for Red Hat and took umbrage with my statement.  He was amazed that I did not think Red Hat had great documentation, I was even more shocked that he considered their documentation more than rudimentary.  Have a look for your self at the <a href="http://www.redhat.com/docs/manuals/enterprise/">Red Hat documentation</a>.</p>
<p>Just this week I was helping a friend who is the server and network administrator for a small school system configure the proper etherchannel load balancing for a server and he was frustrated at the Cisco documentation.  I was astonished.  It seemed that he was overwhelmed.  He was stuck googling around trying find the &#8220;right&#8221; documentation rather than learning the layout of the Cisco documentation website.</p>
<p>The point of this post is that lately it seems I waste more time trying to find good information through searching on the web than trying to find the best source of information.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chainringcircus.org/does-google-hurt-efficiency/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Service Provider Labs</title>
		<link>http://www.chainringcircus.org/service-provider-labs/</link>
		<comments>http://www.chainringcircus.org/service-provider-labs/#comments</comments>
		<pubDate>Thu, 09 Jun 2011 21:08:07 +0000</pubDate>
		<dc:creator>jud</dc:creator>
				<category><![CDATA[CCIE]]></category>
		<category><![CDATA[CCIE Labs]]></category>
		<category><![CDATA[Routing]]></category>

		<guid isPermaLink="false">http://www.chainringcircus.org/?p=2609</guid>
		<description><![CDATA[Running across the Hacking Cisco blog made me remember a similar site, CCIE18473.net. I actually spent about 30 minutes looking for that site and it was Tyson Scott from IPE that me helped find it. I have added this site to my blogroll even though it is not a blog.]]></description>
			<content:encoded><![CDATA[<p>Running across the Hacking Cisco blog made me remember a similar site, <a href="http://www.ccie18473.net/">CCIE18473.net</a>.  I actually spent about 30 minutes looking for that site and it was Tyson Scott from IPE that me helped find it.</p>
<p>I have added this site to my blogroll even though it is not a blog.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chainringcircus.org/service-provider-labs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Routing Mnemonics</title>
		<link>http://www.chainringcircus.org/routing-mnemonics/</link>
		<comments>http://www.chainringcircus.org/routing-mnemonics/#comments</comments>
		<pubDate>Fri, 03 Jun 2011 13:28:50 +0000</pubDate>
		<dc:creator>jud</dc:creator>
				<category><![CDATA[CCIE]]></category>
		<category><![CDATA[Routing]]></category>

		<guid isPermaLink="false">http://www.chainringcircus.org/?p=2161</guid>
		<description><![CDATA[I&#8217;ve been keeping track of some the mnemonics that I have come across or have figured out for myself. For instance in general, in layer 2 elections the lower priority usually wins, however, in layer 3 elections the higher priority usually wins. Layer 2 LACP System Priority 2-bytes priority values followed by a 6-byte MAC [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been keeping track of some the mnemonics that I have come across or have figured out for myself.  For instance in general, in layer 2 elections the lower priority usually wins, however, in layer 3 elections the higher priority usually wins.  </p>
<p><strong>Layer 2</strong></p>
<p><strong>LACP System Priority</strong><br />
2-bytes priority values followed by a 6-byte MAC address.  Lowest system priority makes decisions about the etherchannel setup.</p>
<p><strong>LACP Port Priority</strong><br />
LACP port priority is a 2-byte priority followed by a 2-byte port number.  Lowest port priority is used to decide which ports are put in standby mode when not all ports can be put in etherchannel.</p>
<p><strong>STP</strong><br />
Root bridge election, lowest bridge ID wins.  Bridge ID consists of:<br />
&#8211;2-byte bridge priority from 0-65,535 with a default of 32,768.<br />
&#8211;6-byte MAC address<br />
If the bridge priorities are equal, lowest MAC wins. </p>
<p>Root port, lowest root path cost.</p>
<p>Designated port &#8212; lowest root path cost or if equal use tie breakers:<br />
1.  Lowest root bridge ID<br />
2.  Lowest root path cost to root bridge<br />
3.  Lowest sender bridge ID<br />
4.  Lowest sender port ID</p>
<p><strong>Frame Relay</strong><br />
DCE requires the clock rate, D<strong>C</strong>E, D<strong>T</strong>E, <strong>c</strong>lock rate starts with a <strong>c</strong> and D<strong>C</strong>E is the one with a <strong>c</strong> in it.</p>
<p><strong>Layer 3</strong></p>
<p><strong>HSRP</strong><br />
Active router election is based upon priority, highest priority wins.  Default priority of 100 and a range of 0-255.  Highest IP address on HSRP interface breaks ties.<br />
Standby router is the second highest priority.</p>
<p><strong>VRRP</strong><br />
Election of master is the router with the gateway IP address or if not a &#8220;real&#8221; IP address, the router with the highest priority.  Priority ranges from 1 to 254 with 254 being highest, 100 is the default.</p>
<p><strong>GLBP</strong><br />
Active virtual gateway (AVG) is elected by the highest priority value, tie breaker is the highest IP address in the group.  Router priority is 1-255 with 255 being highest, 100 is the default.</p>
<p><strong>OSPF DR/BDR Election</strong><br />
1.  Highest priority wins.<br />
2.  Highest router ID breaks ties.<br />
Priority range is 0-255 with 255 being highest, 1 is the default and 0 means the router will not participate in the election.</p>
<p><strong>OSPF RID</strong><br />
1.  router-id command wins.<br />
2.  If no router-id is set, the highest loopback address wins, even if it is not advertised and it is not advertised by default.<br />
3.  Highest physical address wins.</p>
<p><strong>OSPF summary-address command or the range command.</strong><br />
The summary-address command is used on an ASBR and has an &#8220;S&#8221; in it, whereas the area range command is used on an ABR and does not have an &#8220;S&#8221; in it.  Both commands are used to summarize routes.</p>
<p><strong>OSPF ExStart</strong><br />
During ExStart of the OSPF packet exchange the neighbor with the highest RID will become the master and sets the DD sequence number. </p>
<p><strong>DVMRP</strong><br />
An exception to the rule of Layer 2 lower takes priority and Layer 3 higher takes the priority.  If two routers are the same distance from the source, the router with the numerically lower IP address becomes the designated forwarder for the network.</p>
<p><strong>BGP best path mnemonic</strong><br />
We love oranges as oranges mean pure refreshment.</p>
<p>We &#8212; Weight (highest)<br />
Love &#8212; LOCAL_PREF (highest)<br />
Oranges &#8212; Originate (local)<br />
AS &#8212; AS_PATH (shortest)<br />
Oranges &#8212; Origin Code (IGP > EGP > Incomplete)<br />
Mean &#8212; Med (lowest)<br />
Pure &#8212; Paths (External > Internal)<br />
Refreshment &#8212; RID (lowest)</p>
<p><strong>Redistribution</strong><br />
RIP and any other protocol that has the letters R-I-P in it requires a seed metric, RIP, IGRP, EIGRP.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chainringcircus.org/routing-mnemonics/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>EIGRP MPLS VPN PE-CE SOO</title>
		<link>http://www.chainringcircus.org/eigrp-mpls-vpn-pe-ce-soo/</link>
		<comments>http://www.chainringcircus.org/eigrp-mpls-vpn-pe-ce-soo/#comments</comments>
		<pubDate>Tue, 31 May 2011 23:47:05 +0000</pubDate>
		<dc:creator>jud</dc:creator>
				<category><![CDATA[CCIE]]></category>
		<category><![CDATA[CCIE Labs]]></category>
		<category><![CDATA[Routing]]></category>

		<guid isPermaLink="false">http://www.chainringcircus.org/?p=2639</guid>
		<description><![CDATA[I couldn&#8217;t resist using all of those acronyms. EIGRP &#8211; Enhanced Interior Gateway Routing Protocol MPLS &#8211; Multiprotocol Label Switching VPN &#8211; Virtual Private Networking PE-CE &#8211; Provider Equipment &#8211; Customer Equipment SOO &#8211; Site Of Origin MPLS SOO MPLS Fundamentals pp. 220-226 BGP->EIGRP and EIGRP->BGP Advertisement of the SOO BGP extended community attribute is [...]]]></description>
			<content:encoded><![CDATA[<p>I couldn&#8217;t resist using all of those acronyms.<br />
EIGRP &#8211; Enhanced Interior Gateway Routing Protocol<br />
MPLS &#8211; Multiprotocol Label Switching<br />
VPN &#8211; Virtual Private Networking<br />
PE-CE &#8211; Provider Equipment &#8211; Customer Equipment<br />
SOO &#8211; Site Of Origin</p>
<p><a href="http://www.cisco.com/en/US/docs/ios/12_0s/feature/guide/s_mvesoo.html">MPLS SOO</a><br />
MPLS Fundamentals pp. 220-226 </p>
<p>BGP->EIGRP and EIGRP->BGP </p>
<p>Advertisement of the SOO BGP extended community attribute is used to identify routes that have originated from a site so that they are not re-advertised back into the same site.  Each SOO uniquely identifies the site and allows for the routes to be filtered.  SOO filtering is configured at the interface level.  It is commonly used when a site contains both VPN and back door links. </p>
<p>From the Cisco document:<br />
The configuration of the SOO extended community allows MPLS VPN traffic to be filtered on a per-site basis. The SoO extended community is configured in an inbound BGP route map on the PE router and is applied to the interface with the ip vrf sitemap command. The SOO extended community can be applied to all exit points at the customer site for more specific filtering but must be configured on all interfaces of PE routers that provide VPN services to CE routers.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chainringcircus.org/eigrp-mpls-vpn-pe-ce-soo/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Hacking Cisco</title>
		<link>http://www.chainringcircus.org/hacking-cisco/</link>
		<comments>http://www.chainringcircus.org/hacking-cisco/#comments</comments>
		<pubDate>Tue, 24 May 2011 13:26:25 +0000</pubDate>
		<dc:creator>jud</dc:creator>
				<category><![CDATA[CCIE Labs]]></category>

		<guid isPermaLink="false">http://www.chainringcircus.org/?p=2604</guid>
		<description><![CDATA[Someone on one of the lists posted about the blog Hacking Cisco so I went over to check it out. Wow. Jarek Rek is the author and he must be putting a ton of time into his studies. Inspiring. I have added his blog to the blogroll on the side.]]></description>
			<content:encoded><![CDATA[<p>Someone on one of the lists posted about the blog <a href="http://hackingcisco.blogspot.com">Hacking Cisco</a> so I went over to check it out. Wow.  Jarek Rek is the author and he must be putting a ton of time into his studies. </p>
<p>Inspiring.</p>
<p>I have added his blog to the blogroll on the side.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chainringcircus.org/hacking-cisco/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DRBD and Heartbeat</title>
		<link>http://www.chainringcircus.org/drbd-and-heartbeat/</link>
		<comments>http://www.chainringcircus.org/drbd-and-heartbeat/#comments</comments>
		<pubDate>Tue, 10 May 2011 12:59:29 +0000</pubDate>
		<dc:creator>jud</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.chainringcircus.org/?p=2490</guid>
		<description><![CDATA[I spent a considerable amount of time over the last couple of days working with DRBD and Heartbeat. Below are the links I used to get things running: http://wiki.centos.org/HowTos/Ha-Drbd http://www.howtoforge.com/vm_replication_failover_vmware_debian_etch_p3 http://www.clusterlabs.org/doc/en-US/Pacemaker/1.1/html/Clusters_from_Scratch/s-intro-pacemaker.html http://www.drbd.org/users-guide/s-heartbeat-r1.html http://www.drbd.org/users-guide/s-heartbeat-config.html http://www.drbd.org/users-guide/s-heartbeat-crm.html Part of my problem was not understanding the difference between R1 and DRM style clusters and their accompanying daemons; heartbeat, pacemaker [...]]]></description>
			<content:encoded><![CDATA[<p>I spent a considerable amount of time over the last couple of days working with DRBD and Heartbeat.  </p>
<p>Below are the links I used to get things running:<br />
<a href="http://wiki.centos.org/HowTos/Ha-Drbd">http://wiki.centos.org/HowTos/Ha-Drbd</a><br />
<a href="http://www.howtoforge.com/vm_replication_failover_vmware_debian_etch_p3">http://www.howtoforge.com/vm_replication_failover_vmware_debian_etch_p3</a><br />
<a href="http://www.clusterlabs.org/doc/en-US/Pacemaker/1.1/html/Clusters_from_Scratch/s-intro-pacemaker.html">http://www.clusterlabs.org/doc/en-US/Pacemaker/1.1/html/Clusters_from_Scratch/s-intro-pacemaker.html</a><br />
<a href="http://www.drbd.org/users-guide/s-heartbeat-r1.html">http://www.drbd.org/users-guide/s-heartbeat-r1.html</a><br />
<a href="http://www.drbd.org/users-guide/s-heartbeat-config.html">http://www.drbd.org/users-guide/s-heartbeat-config.html</a><br />
<a href="http://www.drbd.org/users-guide/s-heartbeat-crm.html">http://www.drbd.org/users-guide/s-heartbeat-crm.html</a></p>
<p>Part of my problem was not understanding the difference between R1 and DRM style clusters and their accompanying daemons; heartbeat, pacemaker and the different protocol versions.  Pacemaker is a more advanced cluster resource manager that can work with both Corosync and Heartbeat.  Heartbeat uses an older protocol whereas pacemaker uses OpenAIS to be compatible with RedHat cluster services.</p>
<p>Regardless here are my notes for configuration, and just for completeness my notes are a mix of doing this first on VMWare and then on a Xen cluster so any inconsistencies are a result of doing this multiple times in different environments.  Regardless the errors are mine and I would recommend reading the documentation linked above.</p>
<p>The basics behind the setup is that DRBD replicates data between two servers.  DRBD is the network block device that mirrors the data.  The heartbeat daemon keeps track of the shared IP, the daemons that are in HA and runs the init scripts appropriately.</p>
<p><strong>DRBD Initialization</strong></p>
<p>Format the disk:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">fdisk /dev/xvdb <br />
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel<br />
Building a new DOS disklabel. Changes will remain in memory only,<br />
until you decide to write them. After that, of course, the previous<br />
content won't be recoverable.<br />
<br />
<br />
The number of cylinders for this disk is set to 10443.<br />
There is nothing wrong with that, but this is larger than 1024,<br />
and could in certain setups cause problems with:<br />
1) software that runs at boot time (e.g., old versions of LILO)<br />
2) booting and partitioning software from other OSs<br />
&nbsp; &nbsp;(e.g., DOS FDISK, OS/2 FDISK)<br />
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)<br />
<br />
Command (m for help): p<br />
Disk /dev/xvdb: 85.8 GB, 85899345920 bytes<br />
255 heads, 63 sectors/track, 10443 cylinders<br />
Units = cylinders of 16065 * 512 = 8225280 bytes<br />
<br />
&nbsp; &nbsp; Device Boot &nbsp; &nbsp; &nbsp;Start &nbsp; &nbsp; &nbsp; &nbsp; End &nbsp; &nbsp; &nbsp;Blocks &nbsp; Id &nbsp;System<br />
<br />
Command (m for help): n<br />
Command action<br />
&nbsp; &nbsp;e &nbsp; extended<br />
&nbsp; &nbsp;p &nbsp; primary partition (1-4)<br />
p<br />
Partition number (1-4): 1<br />
First cylinder (1-10443, default 1): <br />
Using default value 1<br />
Last cylinder or +size or +sizeM or +sizeK (1-10443, default 10443): <br />
Using default value 10443<br />
<br />
Command (m for help): t<br />
Selected partition 1<br />
Hex code (type L to list codes): 83<br />
<br />
Command (m for help): p<br />
Disk /dev/xvdb: 85.8 GB, 85899345920 bytes<br />
255 heads, 63 sectors/track, 10443 cylinders<br />
Units = cylinders of 16065 * 512 = 8225280 bytes<br />
<br />
&nbsp; &nbsp; Device Boot &nbsp; &nbsp; &nbsp;Start &nbsp; &nbsp; &nbsp; &nbsp; End &nbsp; &nbsp; &nbsp;Blocks &nbsp; Id &nbsp;System<br />
/dev/xvdb1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1 &nbsp; &nbsp; &nbsp; 10443 &nbsp; &nbsp;83883366 &nbsp; 83 &nbsp;Linux<br />
<br />
Command (m for help): w<br />
The partition table has been altered!<br />
<br />
Calling ioctl() to re-read partition table.<br />
Syncing disks.</div></div>
<p>Make sure that the names names are consistent throughout all of these configuration files.  This may mean ensuring they are correct in DNS and /etc/hosts.</p>
<p>Locally configure name for this server:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">uname -n<br />
drbd01.chainringcircus.org<br />
<br />
uname -n<br />
drbd02.chainringcircus.org</div></div>
<p>DNS name for this server:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">dig +short drbd01.chainringcircus.org<br />
192.168.1.191<br />
dig +short drbd02.chainringcircus.org<br />
192.168.1.192</div></div>
<p>The /etc/drbd.conf file was designed to allow a verbatim copy on both nodes of the cluster.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">cat /etc/drbd.conf<br />
#<br />
# please have a a look at the example configuration file in<br />
# /usr/share/doc/drbd83/drbd.conf<br />
#<br />
<br />
global { <br />
&nbsp; &nbsp; &nbsp; &nbsp; usage-count no; <br />
}<br />
<br />
common {<br />
&nbsp; &nbsp; &nbsp; &nbsp; protocol C;<br />
&nbsp; &nbsp; &nbsp; &nbsp; handlers {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pri-on-incon-degr &quot;echo '!DRBD! pri on incon-degr' | wall ; sleep 60 ; halt -f&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #pri-on-incon-degr &quot;echo o &gt; /proc/sysrq-trigger ; halt -f&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #pri-on-incon-degr This handler is called if the node is primary, degraded and the local<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #copy of the data is inconsistent. &nbsp;It broadcasts an error, sleeps for 60 seconds and then halts.<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; startup { <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; wfc-timeout 10; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Wait for connection timeout. &nbsp;The init script blocks the boot process <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # until the DRBD resources are connected. &nbsp;We wait for 10 seconds.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; degr-wfc-timeout 30; &nbsp; &nbsp; &nbsp; &nbsp;# Wait for connection timeout if this node was a degraded cluster.<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; disk { <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; on-io-error detach; <br />
&nbsp; &nbsp; &nbsp; &nbsp; } # or panic, ...<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; net { &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cram-hmac-alg &quot;sha1&quot;; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shared-secret &quot;CHANGEME&quot;; &nbsp; &nbsp; &nbsp; &nbsp;# Don't forget to choose a secret for auth<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; max-buffers &nbsp; 20000; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# Play with this setting to achieve highest possible performance<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unplug-watermark &nbsp; 12000; &nbsp; &nbsp; &nbsp; &nbsp; # Play with this setting to achieve highest possible performance<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; max-epoch-size 20000; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Should be the same as max-buffers<br />
&nbsp; &nbsp; &nbsp; &nbsp; } <br />
&nbsp; &nbsp; &nbsp; &nbsp; syncer { <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rate 100M; <br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
}<br />
<br />
resource sites {<br />
&nbsp; &nbsp; &nbsp; &nbsp; device /dev/drbd0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; disk /dev/sdb;<br />
&nbsp; &nbsp; &nbsp; &nbsp; meta-disk internal; &nbsp; &nbsp; # Internal means that the last part of the backing device is used to store the metadata.<br />
&nbsp; &nbsp; &nbsp; &nbsp; on drbd01.chainringcircus.org { &nbsp; &nbsp; &nbsp; #on hostname as seen in uname -n and the DNS lookup.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; address 192.168.1.191:7788;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; on drbd02.chainringcircus.org {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; address 192.168.1.192:7788;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
}</div></div>
<p>Copy the configuration file:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">scp /etc/drbd.conf root@drbd02.chainringcircus.org:/etc/</div></div>
<p>Tried to start DRBD but got an error:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">service drbd start<br />
Starting DRBD resources: [ <br />
sites<br />
no suitable meta data found :(<br />
Command '/sbin/drbdmeta 0 v08 /dev/sdb internal check-resize' terminated with exit code 255<br />
drbdadm check-resize sites: exited with code 255<br />
d(sites) 0: Failure: (119) No valid meta-data signature found.<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; ==&gt; Use 'drbdadm create-md res' to initialize meta-data area. &lt;==<br />
<br />
<br />
[sites] cmd /sbin/drbdsetup 0 disk /dev/sdb /dev/sdb internal --set-defaults --create-device --on-io-error=detach &nbsp;failed - continuing!<br />
&nbsp;<br />
s(sites) n(sites) ]..........<br />
/etc/init.d/drbd status<br />
drbd driver loaded OK; device status:<br />
version: 8.3.8 (api:88/proto:86-94)<br />
GIT-hash: d78846e52224fd00562f7c225bcc25b2d422321d build by mockbuild@builder10.centos.org, 2010-06-04 08:04:16<br />
m:res &nbsp; &nbsp;cs &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ro &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ds &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p &nbsp;mounted &nbsp;fstype<br />
0:sites &nbsp;WFConnection &nbsp;Secondary/Unknown &nbsp;Diskless/DUnknown &nbsp;C<br />
<br />
<br />
/etc/init.d/drbd stop<br />
Stopping all DRBD resources: .</div></div>
<p>I did not initialize the meta data storage and this needs to be done before a DRBD resource can be brought online.  The DRBD resource needs to be down or detached from its backing storage.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">drbdadm create-md sites<br />
md_offset 1073737728<br />
al_offset 1073704960<br />
bm_offset 1073672192<br />
<br />
Found some data<br />
<br />
&nbsp;==&gt; This might destroy existing data! &lt;==<br />
<br />
Do you want to proceed?<br />
[need to type 'yes' to confirm] yes<br />
<br />
Writing meta data...<br />
initializing activity log<br />
NOT initialized bitmap<br />
New drbd meta data block successfully created.<br />
<br />
service drbd start<br />
Starting DRBD resources: [ <br />
sites<br />
Found valid meta data in the expected location, 1073737728 bytes into /dev/sdb.<br />
d(sites) s(sites) n(sites) ]..........</div></div>
<p>Check the status:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">cat /proc/drbd <br />
version: 8.3.8 (api:88/proto:86-94)<br />
GIT-hash: d78846e52224fd00562f7c225bcc25b2d422321d build by mockbuild@builder10.centos.org, 2010-06-04 08:04:16<br />
&nbsp;0: cs:WFConnection ro:Secondary/Unknown ds:Inconsistent/DUnknown C r----<br />
&nbsp; &nbsp; ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:1048508</div></div>
<p>Make it primary:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">drbdadm -- --overwrite-data-of-peer primary sites<br />
cat /proc/drbd <br />
version: 8.3.8 (api:88/proto:86-94)<br />
GIT-hash: d78846e52224fd00562f7c225bcc25b2d422321d build by mockbuild@builder10.centos.org, 2010-06-04 08:04:16<br />
&nbsp;0: cs:SyncSource ro:Primary/Secondary ds:UpToDate/Inconsistent C r----<br />
&nbsp; &nbsp; ns:67584 nr:0 dw:0 dr:67584 al:0 bm:4 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:980924<br />
&nbsp; &nbsp; &nbsp; &nbsp; [&gt;...................] sync'ed: &nbsp;6.7% (980924/1048508)K delay_probe: 10<br />
&nbsp; &nbsp; &nbsp; &nbsp; finish: 0:01:27 speed: 11,264 (11,264) K/sec<br />
[root@localhost etc]# cat /proc/drbd <br />
version: 8.3.8 (api:88/proto:86-94)<br />
GIT-hash: d78846e52224fd00562f7c225bcc25b2d422321d build by mockbuild@builder10.centos.org, 2010-06-04 08:04:16<br />
&nbsp;0: cs:SyncSource ro:Primary/Secondary ds:UpToDate/Inconsistent C r----<br />
&nbsp; &nbsp; ns:1019904 nr:0 dw:0 dr:1019904 al:0 bm:62 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:28604<br />
&nbsp; &nbsp; &nbsp; &nbsp; [==================&gt;.] sync'ed: 97.7% (28604/1048508)K delay_probe: 195<br />
&nbsp; &nbsp; &nbsp; &nbsp; finish: 0:00:02 speed: 11,132 (10,404) K/sec<br />
[root@localhost etc]# cat /proc/drbd <br />
version: 8.3.8 (api:88/proto:86-94)<br />
GIT-hash: d78846e52224fd00562f7c225bcc25b2d422321d build by mockbuild@builder10.centos.org, 2010-06-04 08:04:16<br />
&nbsp;0: cs:Connected ro:Primary/Secondary ds:UpToDate/UpToDate C r----<br />
&nbsp; &nbsp; ns:1048508 nr:0 dw:0 dr:1048508 al:0 bm:64 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:0<br />
You have new mail in /var/spool/mail/root</div></div>
<p>Make a file system:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">mkfs.ext3 /dev/drbd0<br />
mke2fs 1.39 (29-May-2006)<br />
Filesystem label=<br />
OS type: Linux<br />
Block size=4096 (log=2)<br />
Fragment size=4096 (log=2)<br />
131072 inodes, 262127 blocks<br />
13106 blocks (5.00%) reserved for the super user<br />
First data block=0<br />
Maximum filesystem blocks=268435456<br />
8 block groups<br />
32768 blocks per group, 32768 fragments per group<br />
16384 inodes per group<br />
Superblock backups stored on blocks: <br />
&nbsp; &nbsp; &nbsp; &nbsp; 32768, 98304, 163840, 229376<br />
<br />
Writing inode tables: done &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
Creating journal (4096 blocks): done<br />
Writing superblocks and filesystem accounting information: done<br />
<br />
This filesystem will be automatically checked every 24 mounts or<br />
180 days, whichever comes first. &nbsp;Use tune2fs -c or -i to override.</div></div>
<p>Testing the filesystem:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">mount /dev/drbd0 /sites<br />
<br />
mount<br />
/dev/sda2 on / type ext3 (rw)<br />
proc on /proc type proc (rw)<br />
sysfs on /sys type sysfs (rw)<br />
devpts on /dev/pts type devpts (rw,gid=5,mode=620)<br />
/dev/sda5 on /home type ext3 (rw)<br />
/dev/sda1 on /boot type ext3 (rw)<br />
tmpfs on /dev/shm type tmpfs (rw)<br />
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)<br />
.host:/ on /mnt/hgfs type vmhgfs (rw,ttl=1)<br />
none on /proc/fs/vmblock/mountPoint type vmblock (rw)<br />
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)<br />
/dev/drbd0 on /sites type ext3 (rw)<br />
<br />
touch /sites/test.txt<br />
<br />
ls /sites<br />
lost+found &nbsp;test.txt<br />
<br />
umount /sites<br />
<br />
drbdadm secondary sites</div></div>
<p>On the second server:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">drbdadm primary sites<br />
<br />
mount /dev/drbd0 /sites/<br />
<br />
mount<br />
/dev/sda2 on / type ext3 (rw)<br />
proc on /proc type proc (rw)<br />
sysfs on /sys type sysfs (rw)<br />
devpts on /dev/pts type devpts (rw,gid=5,mode=620)<br />
/dev/sda5 on /home type ext3 (rw)<br />
/dev/sda1 on /boot type ext3 (rw)<br />
tmpfs on /dev/shm type tmpfs (rw)<br />
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)<br />
.host:/ on /mnt/hgfs type vmhgfs (rw,ttl=1)<br />
none on /proc/fs/vmblock/mountPoint type vmblock (rw)<br />
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)<br />
/dev/drbd0 on /sites type ext3 (rw)<br />
<br />
ls /sites<br />
lost+found &nbsp;test.txt</div></div>
<p><strong>Heartbeat R1-style</strong></p>
<p>Heartbeat in R1 configuration uses 3 files that must be configured if you are using the heartbeat protocol.<br />
/etc/ha.d/ha.cf<br />
/etc/ha.d/haresources<br />
/etc/ha.d/authkeys</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">cat /etc/ha.d/authkeys <br />
auth 1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# A numerical identifier between 1 and 15 inclusive<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # must be unique within the file.<br />
1 sha1 CHANGEME &nbsp; # Methods can be md5 sha1 or crc.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # The password is just a string.</div></div>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">chmod 600 /etc/ha.d/authkeys</div></div>
<p>Before we take care of the ha.cf file we need to set up the ha_logd configuration file.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">cp /usr/share/doc/heartbeat-2.1.3/logd.cf /etc/</div></div>
<p>And make changes to the logd.cf file accordingly.  Be sure to copy /etc/logd.cf to both servers.  Also note that I had to completely stop and then restart the heartbeat daemon for my logging changes to take affect.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">cat /etc/logd.cf <br />
# &nbsp; &nbsp; &nbsp; File to write debug messages to<br />
# &nbsp; &nbsp; &nbsp; Default: /var/log/ha-debug<br />
debugfile /var/log/ha-debug.log<br />
<br />
#<br />
#<br />
# &nbsp; &nbsp; &nbsp; File to write other messages to<br />
# &nbsp; &nbsp; &nbsp; Default: /var/log/ha-log<br />
logfile /var/log/ha.log<br />
<br />
#<br />
#<br />
# &nbsp; &nbsp; &nbsp; Facility to use for syslog()/logger <br />
# &nbsp; &nbsp; &nbsp; Default: daemon<br />
#logfacility &nbsp; &nbsp;daemon<br />
<br />
# &nbsp; &nbsp; &nbsp; Entity to be shown at beginning of a message<br />
# &nbsp; &nbsp; &nbsp; for logging daemon<br />
# &nbsp; &nbsp; &nbsp; Default: &quot;logd&quot;<br />
entity logd<br />
<br />
# &nbsp; &nbsp; &nbsp; Do we register to apphbd<br />
# &nbsp; &nbsp; &nbsp; Default: no<br />
#useapphbd no<br />
<br />
# &nbsp; &nbsp; &nbsp; There are two processes running for logging daemon<br />
# &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1. parent process which reads messages from all client channels <br />
# &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; and writes them to the child process <br />
# &nbsp;<br />
# &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2. the child process which reads messages from the parent process through IPC<br />
# &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; and writes them to syslog/disk<br />
<br />
# &nbsp; &nbsp; &nbsp; set the send queue length from the parent process to the child process<br />
#<br />
#sendqlen 256 <br />
<br />
# &nbsp; &nbsp; &nbsp; set the recv queue length in child process<br />
#<br />
#recvqlen 256</div></div>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">cat /etc/ha.d/ha.cf <br />
# The recommendation is to use logd.<br />
use_logd yes<br />
# Default option is 0, values are 0-255 with 1-3 being the most useful.<br />
debug 0<br />
# Timing according to the FAQ at www.linux-ha.org/wiki/FAQ<br />
# warntime should be at least 2 * keepalive <br />
# warntime should be 1/2 to 1/4 deadtime<br />
# The interval between heartbeat packets.<br />
keepalive 1<br />
# How quickly Heartbeat should issue a &quot;late heartbeat&quot; warning. &nbsp;Warntime is <br />
# important for tuning deadtime.<br />
warntime 5<br />
# How long to decide a cluster node is dead. &nbsp;Too low will flasely declare<br />
# a death and too high will hinder takeover during a failure.<br />
# Can be specified as a floating point number followed by a untis-specifier.<br />
# If units are omitted it defaults to seconds.<br />
# deadtime 1<br />
# deadtime 100ms 100 milliseconds<br />
# deadtime 1000us 1000 microseconds<br />
deadtime 10<br />
# 694 is the default but can be changed if multiple clusters are in use.<br />
udpport 694<br />
# Which interfaces send UDP broadcast traffic, more than one can be specified.<br />
bcast &nbsp; eth0<br />
# auto_failback can be &quot;on&quot; &quot;off&quot; or &quot;legacy&quot;<br />
auto_failback off<br />
# Set the nodes in the cluster.<br />
node &nbsp; &nbsp;in1.eamc.org &nbsp; &nbsp; &nbsp; &nbsp; <br />
node &nbsp; &nbsp;in2.eamc.org<br />
# Make sure this IP address is pingable from the bcast network above.<br />
ping 192.168.1.1 &nbsp; &nbsp;<br />
respawn hacluster /usr/lib/heartbeat/ipfail</div></div>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">cat /etc/ha.d/haresources <br />
drbd01 192.168.1.190 drbddisk::sites Filesystem::/dev/drbd0::/sites::ext3 httpd<br />
# Explanation:<br />
# Primary Server name --&gt; virtual IP address to be used --&gt; DRBD resource as configurd in /etc/drbd.conf<br />
# --&gt; where to mount the DRBD resource and the filesystem type --&gt; resource to start/stop in case of failover</div></div>
<p><strong>Cluster Management</strong><br />
To take over cluster management from  a primary server:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/usr/lib/heartbeat/hb_takeover</div></div>
<p>Relinquishing cluster management to a secondary server:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/usr/lib/hearbeat/hb_standby<br />
/etc/init.d/heartbeat stop</div></div>
<p>The order of operations as set by the init scripts:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">ls -al /etc/rc3.d/ | egrep &quot;hear|drb&quot;<br />
lrwxrwxrwx &nbsp;1 root root &nbsp; 14 Apr &nbsp;1 11:40 S70drbd -&gt; ../init.d/drbd<br />
lrwxrwxrwx &nbsp;1 root root &nbsp; 19 Jun &nbsp;1 08:58 S75heartbeat -&gt; ../init.d/heartbeat</div></div>
<p><a href="http://www.drbd.org/users-guide/s-xen-drbd-mod-params.html">Notes for Xen users:</a></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"># cat /etc/modprobe.d/drbd.conf <br />
options debd disable_sendpage=1</div></div>
<p><a href="http://www.drbd.org/users-guide/s-xen-create-resource.html">To allow live migration on Xen:</a></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; &nbsp; &nbsp; net {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; allow-two-primaries;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }</div></div>
<p><strong>Split-brain</strong><br />
Playing around this morning I got the cluster into split-brain.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Jun &nbsp;1 10:46:53 in1 kernel: block drbd0: Split-Brain detected but unresolved, dropping connection!<br />
Jun &nbsp;1 10:46:53 in1 kernel: block drbd0: helper command: /sbin/drbdadm split-brain minor-0</div></div>
<p>Here is how to fix it.<br />
Run this first on the secondary node.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">drbadm -- --discard-my-data connect sites</div></div>
<p>Run this on the primary node.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">drbadm connect sites</div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.chainringcircus.org/drbd-and-heartbeat/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CCIE R&amp;S Written Blueprint</title>
		<link>http://www.chainringcircus.org/rs-written-blueprint/</link>
		<comments>http://www.chainringcircus.org/rs-written-blueprint/#comments</comments>
		<pubDate>Tue, 12 Apr 2011 18:49:35 +0000</pubDate>
		<dc:creator>jud</dc:creator>
				<category><![CDATA[CCIE]]></category>
		<category><![CDATA[Routing]]></category>

		<guid isPermaLink="false">http://www.chainringcircus.org/?p=2499</guid>
		<description><![CDATA[Below is the CCIE written blueprint. My plan is to slowly fill in my notes with the corresponding sections. The problem arises when Cisco is vague as to what is actually required. For instance I have been studying MPLS and LDP recently. While MPLS is listed on the blueprint, you need to understand LDP as [...]]]></description>
			<content:encoded><![CDATA[<p>Below is the CCIE written blueprint.  My plan is to slowly fill in my notes with the corresponding sections.  The problem arises when Cisco is vague as to what is actually required.  For instance I have been studying MPLS and LDP recently.  While MPLS is listed on the blueprint, you need to understand LDP as well, however, it is not on the blueprint.  </p>
<p><em>I have decided go ahead and add sections I feel are necessary but my added sections will be in italics to set them apart from the official outline.  They will also break from the Cisco numbering convention.  For instance below, section 4.11 Implement LDP does not follow the Cisco numbering theme of 4.10, 4.20, 4.30 but instead uses 4.11.  Italics combined with the odd numbering signal my personal changes to the outline.</em></p>
<p>Source:<br />
<a href="https://learningnetwork.cisco.com/docs/DOC-4374">Cisco Learning Network</a> </p>
<p><strong>1.00	Implement Layer 2 Technologies</strong><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1.10	Implement Spanning   Tree Protocol (STP)                   <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(a) 802.1d                   <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(b) 802.1w                   <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(c) 801.1s                   <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(d) Loop guard                   <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(e) Root guard                   <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(f) Bridge protocol   data unit (BPDU) guard<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(g) Storm control                   <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(h) Unicast flooding                   <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(i) Port roles,   failure propagation, and loop guard operation<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1.20	Implement VLAN and VLAN Trunking Protocol (VTP)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1.30	Implement trunk and trunk protocols, EtherChannel, and load-balance<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1.40	Implement Ethernet technologies<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(a) Speed and duplex<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(b) Ethernet, Fast Ethernet, and Gigabit Ethernet<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(c) PPP over Ethernet  (PPPoE)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1.50	Implement Switched Port Analyzer (SPAN), Remote Switched Port Analyzer (RSPAN),<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; and flow control<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1.60	Implement Frame Relay<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(a) Local Management Interface (LMI)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(b) Traffic shaping<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(c) Full mesh<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(d) Hub and spoke<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(e) Discard eligible (DE)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1.70	Implement High-Level   Data Link Control (HDLC) and PPP </p>
<p><strong>2.00	Implement IPv4</strong><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;2.10	Implement IP version 4 (IPv4) addressing, subnetting,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; and variable-length subnet masking (VLSM)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;2.20	Implement IPv4 tunneling and Generic Routing Encapsulation (GRE)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;2.30	Implement IPv4 RIP version 2 (RIPv2)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;2.40	Implement IPv4 Open Shortest Path First (OSPF)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(a) Standard OSPF areas<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(b) Stub area<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(c) Totally stubby area<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(d) Not-so-stubby-area (NSSA)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(e) Totally NSSA<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(f) Link-state  advertisement (LSA) types<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(g) Adjacency on a  point-to-point and on a multi-access network<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(h) OSPF graceful restart<br />
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;2.50	Implement IPv4 Enhanced Interior Gateway Routing Protocol (EIGRP)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(a) Best path<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(b) Loop-free paths<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(c) EIGRP operations when alternate loop-free paths are available,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;and when they are not available<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(d) EIGRP queries<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(e) Manual   summarization and autosummarization<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(f) EIGRP stubs<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;2.60	Implement IPv4 Border Gateway Protocol (BGP)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(a) Next hop<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(b) Peering<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(c) Internal BorderGateway Protocol (IBGP) and<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;External Border Gateway Protocol (EBGP)<br />
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;2.70	Implement policy routing<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;2.80	Implement Performance Routing (PfR) and Cisco Optimized Edge Routing (OER)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;2.90	Implement filtering, route redistribution, summarization,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;synchronization, attributes, and other advanced features </p>
<p><strong>3.00	Implement IPv6</strong><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;3.10	Implement IP version 6 (IPv6) addressing and different addressing types<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;3.20	Implement IPv6 neighbor discovery<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;3.30	Implement basic IPv6 functionality protocols<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;3.40	Implement tunneling techniques<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;3.50	Implement OSPF version 3 (OSPFv3)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;3.60	Implement EIGRP version 6 (EIGRPv6)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;3.70	Implement filtering and route redistribution </p>
<p><strong>4.00	Implement MPLS Layer 3 VPNs</strong><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;4.10	Implement   Multiprotocol Label Switching (MPLS)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<em>4.11     Implement LDP</em><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;4.20	Implement Layer 3 virtual private networks (VPNs) on provider edge (PE),<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;provider (P), and customer edge (CE) routers<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;4.30	Implement virtual   routing and forwarding (VRF) and Multi-VRF Customer Edge (VRF-Lite) </p>
<p><strong>5.00	Implement IP Multicast</strong><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;5.10	Implement Protocol Independent Multicast (PIM) sparse mode<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;5.20	Implement Multicast Source Discovery Protocol (MSDP)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;5.30	Implement interdomain multicast routing<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;5.40	Implement PIM Auto-Rendezvous Point (Auto-RP),<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;unicast rendezvous point (RP), and   bootstrap router (BSR)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;5.50	Implementmulticast tools, features, and source-specific multicast<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;5.60	Implement IPv6 multicast, PIM, and related multicast protocols,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;such as Multicast Listener Discovery (MLD) </p>
<p><strong>6.00	Implement Network   Security</strong><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;6.01	Implement access lists<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;6.02	Implement Zone Based Firewall<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;6.03	Implement Unicast Reverse Path Forwarding (uRPF)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;6.04	Implement IP Source Guard<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;6.05	Implement authentication, authorization, and accounting (AAA)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(configuring the AAA server is not required, only the client-side (IOS) is configured)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;6.06	Implement Control Plane Policing (CoPP)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;6.07	Implement Cisco IOS Firewall<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;6.08	Implement Cisco IOS Intrusion Prevention System (IPS)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;6.09	Implement Secure Shell (SSH)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;6.10	Implement 802.1x<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;6.11	Implement NAT<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;6.12	Implement routing protocol authentication<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;6.13	Implement device access control<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;6.14	Implement security features </p>
<p><strong>7.00	Implement Network   Services</strong><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;7.10	Implement Hot Standby Router Protocol (HSRP)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;7.20	Implement Gateway Load Balancing Protocol (GLBP)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;7.30	Implement Virtual Router Redundancy Protocol (VRRP)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;7.40	Implement Network Time Protocol (NTP)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;7.50	Implement DHCP<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;7.60	Implement Web Cache Communication Protocol (WCCP) </p>
<p><strong>8.00	Implement Quality of   Service (QoS)</strong><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;8.10	Implement Modular QoS CLI (MQC)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(a) Network-Based Application Recognition (NBAR)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(b) Class-based weighted fair queuing (CBWFQ),  modified deficit round robin (MDRR),<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;and low latency queuing (LLQ)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(c) Classification<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(d) Policing<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(e) Shaping<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(f) Marking<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(g) Weighted random early detection (WRED) and random early detection (RED)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(h) Compression<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;8.20	Implement Layer 2 QoS: weighted round robin (WRR), shaped round robin (SRR),<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;and policies<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;8.30	Implement link fragmentation and interleaving (LFI) for Frame Relay<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;8.40	Implement generic traffic shaping<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;8.50	Implement Resource Reservation Protocol (RSVP)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;8.60	Implement Cisco AutoQoS </p>
<p><strong>9.00	Troubleshoot a  Network</strong><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;9.10	Troubleshoot complex Layer 2 network issues<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;9.20	Troubleshoot complex Layer 3 network issues<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;9.30	Troubleshoot a network in response to application problems<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;9.40	Troubleshoot network services<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;9.50	Troubleshoot network security </p>
<p><strong>10.00	Optimize the Network</strong><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;10.01	Implement syslog and local logging<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;10.02	Implement IP Service Level Agreement SLA<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;10.03	Implement NetFlow<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;10.04	Implement SPAN, RSPAN, and router IP traffic export (RITE)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;10.05	Implement Simple Network Management Protocol (SNMP)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;10.06	Implement Cisco IOS Embedded Event Manager (EEM)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;10.07	Implement Remote Monitoring (RMON)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;10.08	Implement FTP<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;10.09	Implement TFTP<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;10.10	Implement TFTP server   on router<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;10.11	Implement  Secure Copy Protocol (SCP)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;10.12	Implement HTTP and   HTTPS<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;10.13	Implement Telnet </p>
<p><strong>11.00	Evaluate proposed changes to a Network </strong><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;11.01	Evaluate interoperability of proposed technologies against deployed technologies<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(a) Changes to routing protocol parameters<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(b) Migrate parts of a network to IPv6<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(c) Routing Protocol migration<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(d) Adding multicast support<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(e) Migrate spanning tree protocol<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(f) Evaluate impact of new traffic on existing QoS design<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;11.02	Determine operational impact of proposed changes to an existing network<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(a) Downtime of network or portions of network<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(b) Performance degradation<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(c) Introducing security breaches<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;11.03	Suggest Alternative solutions when incompatible changes<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;are proposed to an existing network<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(a) Hardware/Software upgrades<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(b) Topology shifts<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(c) Reconfigurations</p>
<p>  </p>
]]></content:encoded>
			<wfw:commentRss>http://www.chainringcircus.org/rs-written-blueprint/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Data Loss Prevention</title>
		<link>http://www.chainringcircus.org/data-loss-prevention/</link>
		<comments>http://www.chainringcircus.org/data-loss-prevention/#comments</comments>
		<pubDate>Mon, 07 Mar 2011 13:48:45 +0000</pubDate>
		<dc:creator>jud</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.chainringcircus.org/?p=2456</guid>
		<description><![CDATA[Every once in a while I get to write a neat piece of code that I can share. This is one of those times. I realize it is not large and by PerlMonk standards not very elegant. The problem therein lies with maintainability over the next few years. Regardless I like what I wrote and [...]]]></description>
			<content:encoded><![CDATA[<p>Every once in a while I get to write a neat piece of code that I can share.  This is one of those times.  I realize it is not large and by PerlMonk standards not very elegant.  The problem therein lies with maintainability over the next few years.   Regardless I like what I wrote and would like to share.</p>
<p>At the Circus we had a pretty good idea that we had some data leakage.  Nothing like people taking off with everything needed to get home loans and rip off customers, just people not thinking about what they send through email.  We didn&#8217;t know the extent of the problem or even if we had one.  We just weren&#8217;t sure.  Our C-level executives didn&#8217;t believe that employees would be so careless with customer data.  We decided to find out.  </p>
<p>I must say that the results were actually quite positive.  We had a couple of people email work related data home so they could work at home over the weekend and a few emails regarding employment, but they were  originated by the prospective employee.</p>
<p>Regardless, in order for us to find out I wrote a few scripts that hook into our email system.  One that I am particularly proud of recurses through a directory of email messages and attachments scanning each file for relevant data.</p>
<p>Please note that by the time these scripts touch the data it has been scrubbed by the antivirus and other checks we have in place.  I am only looking for keywords or regular expressions that would indicate customer related data loss.</p>
<p>Let me explain the directory structure.  Under the email system is the directory /var/spool/filter that contains every email message that has been sent in the last 30 minutes.  There is a cleanup process that erases all the files in that directory and that is actually where I wrote the hook, in the cleanup process.  Here is a sample listing of the directory.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">#ls -1 /var/spool/filter/<br />
msg-1299451572-29517-0<br />
msg-1299451626-29523-0<br />
msg-1299451695-29528-0<br />
msg-1299452467-29565-0<br />
msg-1299452491-29570-0<br />
msg-1299453007-29593-0<br />
msg-1299453086-29599-0</div></div>
<p>As you can see, each email header ends with a .hed extension and the message is in .txt format.  The ETP.doc file is an attachment.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">#ls -1 /var/spool/filter/msg-1299451626-29523-0/<br />
ETP.doc<br />
msg-29523-1.txt<br />
msg-29523-2.dat.hed</div></div>
<p>The subroutine I am most pleased with is the one that recurses through the directory structure.  The slurp command returns a hash and if it is a subdirectory then it is a hash as well.  I look for it with the following line of code.</p>
<div class="codecolorer-container perl default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="perl codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://perldoc.perl.org/functions/ref.html"><span style="color: #000066;">ref</span></a> <span style="color: #0000ff;">$structure</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#123;</span><span style="color: #0000ff;">$key</span><span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">eq</span> <span style="color: #ff0000;">'HASH'</span><span style="color: #009900;">&#41;</span></div></div>
<p>That is how I find subdirectories to push onto the stack of recursive calls.  As it traverses each directory it just looks at each file extension and makes a determination as to what to do with it.  </p>
<p>I realize most system administrators are asking why I didn&#8217;t use the file command to make sure the script was acting appropriately for each file type but that does not work with the new Microsoft document types.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;"># file Test-Excel.xlsx</span><br />
Test-Excel.xlsx: Zip archive data, at least v2.0 to extract</div></div>
<p>I thought it was a fun project and I enjoyed writing what I felt was an interesting piece of code.</p>
<div class="codecolorer-container perl default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="perl codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">#!/usr/bin/perl</span><br />
<span style="color: #666666; font-style: italic;"># 2011-01-12 Jud Bishop</span><br />
<span style="color: #666666; font-style: italic;"># This script goes looking for customer data being sent out through email and </span><br />
<span style="color: #666666; font-style: italic;"># flags it for further review.</span><br />
<span style="color: #000000; font-weight: bold;">use</span> strict<span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">use</span> warnings<span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">use</span> File<span style="color: #339933;">::</span><span style="color: #006600;">Find</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">use</span> File<span style="color: #339933;">::</span><span style="color: #006600;">Basename</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">use</span> File<span style="color: #339933;">::</span><span style="color: #006600;">Copy</span><span style="color: #339933;">::</span><span style="color: #006600;">Recursive</span> <a href="http://perldoc.perl.org/functions/qw.html"><span style="color: #000066;">qw</span></a><span style="color: #009900;">&#40;</span>fcopy dircopy rcopy<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">use</span> File<span style="color: #339933;">::</span><span style="color: #006600;">Slurp</span><span style="color: #339933;">::</span><span style="color: #006600;">Tree</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #666666; font-style: italic;">#my $dir = &quot;/home/jud/TestMessages&quot;;</span><br />
<span style="color: #666666; font-style: italic;">#my $log = &quot;/home/jud/TestMessages/violation&quot;;</span><br />
<span style="color: #666666; font-style: italic;">#my $auditdir = &quot;/home/jud/TestMessages/Trash/&quot;;</span><br />
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$dir</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;/var/spool/filter&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$log</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;/var/log/hipaa/violation&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$auditdir</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;/opt/smtpaudit/&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$debug</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span><br />
<br />
<br />
<span style="color: #666666; font-style: italic;">###################</span><br />
<span style="color: #666666; font-style: italic;"># MAIN</span><br />
<span style="color: #666666; font-style: italic;">###################</span><br />
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">%tree</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$tree</span> <span style="color: #339933;">=</span> slurp_tree<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$dir</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<a href="http://perldoc.perl.org/functions/open.html"><span style="color: #000066;">open</span></a> <span style="color: #009900;">&#40;</span>LOG<span style="color: #339933;">,</span> <span style="color: #ff0000;">'&gt;&gt;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$log</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">or</span> <a href="http://perldoc.perl.org/functions/die.html"><span style="color: #000066;">die</span></a> <span style="color: #0000ff;">$!</span><span style="color: #339933;">;</span><br />
<br />
traverse_structure<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$dir</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$tree</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<a href="http://perldoc.perl.org/functions/close.html"><span style="color: #000066;">close</span></a> LOG <span style="color: #b1b100;">or</span> <a href="http://perldoc.perl.org/functions/die.html"><span style="color: #000066;">die</span></a> <span style="color: #0000ff;">$!</span><span style="color: #339933;">;</span><br />
<br />
<br />
<span style="color: #666666; font-style: italic;">##########</span><br />
<span style="color: #666666; font-style: italic;"># This does the heavy lifting of the whole program. &nbsp;It recursively </span><br />
<span style="color: #666666; font-style: italic;"># iterates through the directory structure and works on a file accordingly.</span><br />
<span style="color: #666666; font-style: italic;"># Each directory is a hash key.</span><br />
<span style="color: #666666; font-style: italic;">##########</span><br />
<span style="color: #000000; font-weight: bold;">sub</span> traverse_structure <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$debug</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&quot;##traverse_structure<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$base</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$structure</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">@_</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$path</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">@violation</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$secure</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">foreach</span> <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$key</span> <span style="color: #009900;">&#40;</span> <a href="http://perldoc.perl.org/functions/keys.html"><span style="color: #000066;">keys</span></a> <span style="color: #0000ff;">%$structure</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$path</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$base</span> <span style="color: #339933;">.</span> <span style="color: #ff0000;">&quot;/&quot;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">$key</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$secure</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">## If it's a HASH then it's a directory.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://perldoc.perl.org/functions/ref.html"><span style="color: #000066;">ref</span></a> <span style="color: #0000ff;">$structure</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#123;</span><span style="color: #0000ff;">$key</span><span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">eq</span> <span style="color: #ff0000;">'HASH'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$debug</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&quot;key: $key<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; traverse_structure<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">$path</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$structure</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#123;</span><span style="color: #0000ff;">$key</span><span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$debug</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&quot;file &nbsp;: $key<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$debug</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&quot;base &nbsp;: $base<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$debug</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&quot;path &nbsp;: $path<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$debug</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&quot;secure: $secure<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$debug</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&quot;violation: $#violation<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">## If the file is not being used...</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$path</span> <span style="color: #339933;">=~</span> <span style="color: #009966; font-style: italic;">m/doc$/</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; parse_doc<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$path</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">\@violation</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elsif</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$path</span> <span style="color: #339933;">=~</span> <span style="color: #009966; font-style: italic;">m/xlsx$|xls$/</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; parse_excel<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$path</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">\@violation</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elsif</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$path</span> <span style="color: #339933;">=~</span> <span style="color: #009966; font-style: italic;">m/txt$/</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; parse_message<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$path</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">\@violation</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elsif</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$path</span> <span style="color: #339933;">=~</span> <span style="color: #009966; font-style: italic;">m/pdf$/</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; parse_pdf<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$path</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">\@violation</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elsif</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$path</span> <span style="color: #339933;">=~</span> <span style="color: #009966; font-style: italic;">m/hed$/</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; parse_head<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$path</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">\@violation</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">\$secure</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #666666; font-style: italic;"># If it is a secure email than it is encrypted on </span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #666666; font-style: italic;"># the fly and not a violation.</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$secure</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$#violation</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://perldoc.perl.org/functions/push.html"><span style="color: #000066;">push</span></a> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">@violation</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;EMAIL: &quot;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">$base</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; log_it<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">@violation</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; copy_dir<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$base</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #666666; font-style: italic;"># For later review.</span><br />
<span style="color: #000000; font-weight: bold;">sub</span> copy_dir <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$path</span> <span style="color: #339933;">=</span> <a href="http://perldoc.perl.org/functions/shift.html"><span style="color: #000066;">shift</span></a><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$debug</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&quot;##copy_dir $path<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$file</span> <span style="color: #339933;">=</span> fileparse<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$path</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$file</span> <span style="color: #339933;">=~</span> <span style="color: #009966; font-style: italic;">m/^msg/</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$basename</span> <span style="color: #339933;">=</span> basename<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$path</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$newpath</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$auditdir</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">$basename</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$debug</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&quot;dircopy $path $newpath<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; dircopy<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$path</span><span style="color: #339933;">,</span><span style="color: #0000ff;">$newpath</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #666666; font-style: italic;"># Log file that is easy to ready because an employee goes through</span><br />
<span style="color: #666666; font-style: italic;"># this file and decides if it is a REAL violation.</span><br />
<span style="color: #000000; font-weight: bold;">sub</span> log_it <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">@text</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">@_</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$line</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$debug</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&quot;##log_it<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> LOG <span style="color: #ff0000;">&quot;---------------------------------------------<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">foreach</span> <span style="color: #0000ff;">$line</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">@text</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> LOG <span style="color: #ff0000;">&quot;$line<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> LOG <span style="color: #ff0000;">&quot;---------------------------------------------<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">sub</span> parse_head <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$file</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$violation_ref</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$secure_ref</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">@_</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">@body</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$line</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$debug</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&quot;##parse_head $file<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <a href="http://perldoc.perl.org/functions/open.html"><span style="color: #000066;">open</span></a><span style="color: #009900;">&#40;</span>FILE<span style="color: #339933;">,</span><span style="color: #0000ff;">$file</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <a href="http://perldoc.perl.org/functions/return.html"><span style="color: #000066;">return</span></a> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">@body</span> <span style="color: #339933;">=</span> <span style="color: #009999;">&lt;FILE&gt;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <a href="http://perldoc.perl.org/functions/close.html"><span style="color: #000066;">close</span></a><span style="color: #009900;">&#40;</span>FILE<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #b1b100;">foreach</span> <span style="color: #0000ff;">$line</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">@body</span><span style="color: #009900;">&#41;</span> &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$line</span> <span style="color: #339933;">=~</span> <span style="color: #009966; font-style: italic;">m/^From/</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://perldoc.perl.org/functions/push.html"><span style="color: #000066;">push</span></a> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">@$violation_ref</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$line</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elsif</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$line</span> <span style="color: #339933;">=~</span> <span style="color: #009966; font-style: italic;">m/^To/</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://perldoc.perl.org/functions/push.html"><span style="color: #000066;">push</span></a> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">@$violation_ref</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$line</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elsif</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$line</span> <span style="color: #339933;">=~</span> <span style="color: #009966; font-style: italic;">m/^Subject/</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://perldoc.perl.org/functions/push.html"><span style="color: #000066;">push</span></a> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">@$violation_ref</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$line</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$line</span> <span style="color: #339933;">=~</span> <span style="color: #009966; font-style: italic;">m/^secure/i</span> <span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$$secure_ref</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">sub</span> parse_pdf <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$file</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$violation_ref</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">@_</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">@body</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$new_file</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$file</span> <span style="color: #339933;">.</span> <span style="color: #ff0000;">&quot;.txt&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$CMD</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$debug</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&quot;##parse_doc $dir $file<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">$CMD</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;/usr/bin/pdftotext <span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">$file</span> <span style="color: #339933;">.</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span> &gt; <span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">$new_file</span> <span style="color: #339933;">.</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$debug</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&quot;CMD: $CMD<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://perldoc.perl.org/functions/system.html"><span style="color: #000066;">system</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$CMD</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; parse_text <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$new_file</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$violation_ref</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">sub</span> parse_doc <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$file</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$violation_ref</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">@_</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">@body</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$new_file</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$file</span> <span style="color: #339933;">.</span> <span style="color: #ff0000;">&quot;.txt&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$CMD</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$debug</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&quot;##parse_doc $dir $file<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">$CMD</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;/usr/bin/antiword -st <span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">$file</span> <span style="color: #339933;">.</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span> &gt; <span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">$new_file</span> <span style="color: #339933;">.</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$debug</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&quot;CMD: $CMD<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://perldoc.perl.org/functions/system.html"><span style="color: #000066;">system</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$CMD</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; parse_text <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$new_file</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$violation_ref</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">sub</span> parse_excel <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$file</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$violation_ref</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">@_</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">@body</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$new_file</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$file</span> <span style="color: #339933;">.</span> <span style="color: #ff0000;">&quot;.txt&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$CMD</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$debug</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&quot;##parse_excel $file<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">$CMD</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;/usr/local/bin/antiexcel <span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">$file</span> <span style="color: #339933;">.</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span> &gt; <span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">$new_file</span> <span style="color: #339933;">.</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$debug</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&quot;CMD: $CMD<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://perldoc.perl.org/functions/system.html"><span style="color: #000066;">system</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$CMD</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; parse_text <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$new_file</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$violation_ref</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">sub</span> parse_text <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$file</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$violation_ref</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">@_</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">@body</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$debug</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&quot;##parse_text $file<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <a href="http://perldoc.perl.org/functions/open.html"><span style="color: #000066;">open</span></a><span style="color: #009900;">&#40;</span>FILE<span style="color: #339933;">,</span><span style="color: #0000ff;">$file</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <a href="http://perldoc.perl.org/functions/return.html"><span style="color: #000066;">return</span></a> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">@body</span> <span style="color: #339933;">=</span> <span style="color: #009999;">&lt;FILE&gt;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <a href="http://perldoc.perl.org/functions/close.html"><span style="color: #000066;">close</span></a><span style="color: #009900;">&#40;</span>FILE<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; compare_text<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">\@body</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$violation_ref</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">sub</span> parse_message <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$file</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$violation_ref</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">@_</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">@body</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$debug</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&quot;##parse_text $file<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <a href="http://perldoc.perl.org/functions/open.html"><span style="color: #000066;">open</span></a><span style="color: #009900;">&#40;</span>FILE<span style="color: #339933;">,</span><span style="color: #0000ff;">$file</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <a href="http://perldoc.perl.org/functions/return.html"><span style="color: #000066;">return</span></a> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">@body</span> <span style="color: #339933;">=</span> <span style="color: #009999;">&lt;FILE&gt;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <a href="http://perldoc.perl.org/functions/close.html"><span style="color: #000066;">close</span></a><span style="color: #009900;">&#40;</span>FILE<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; compare_text<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">\@body</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$violation_ref</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #666666; font-style: italic;"># All of the earlier subroutines call this one. &nbsp;</span><br />
<span style="color: #666666; font-style: italic;"># It takes the text and looks for keywords.</span><br />
<span style="color: #000000; font-weight: bold;">sub</span> compare_text <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$text_ref</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$violation_ref</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">@_</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">@difference</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">@text_array</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">@elements</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">%count</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">%rules</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$element</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$debug</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&quot;##compare_text<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #b1b100;">foreach</span> <span style="color: #0000ff;">$element</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">@$text_ref</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">@elements</span> <span style="color: #339933;">=</span> <a href="http://perldoc.perl.org/functions/split.html"><span style="color: #000066;">split</span></a><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">' '</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$element</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://perldoc.perl.org/functions/push.html"><span style="color: #000066;">push</span></a> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">@text_array</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">@elements</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># The parser was already created above. </span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">@rule</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;DOB&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;D.O.B.&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;d.o.b.&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;dob&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;death:&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;release&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;admit&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;admission&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Age:&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;SSN&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Social&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Security&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Account&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Acct&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;claimant&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;MRI&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;myelogram&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;credit&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;card&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># Me being lazy.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">foreach</span> <span style="color: #0000ff;">$element</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">@rule</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$rules</span><span style="color: #009900;">&#123;</span><span style="color: #0000ff;">$element</span><span style="color: #009900;">&#125;</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">foreach</span> <span style="color: #0000ff;">$element</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">@text_array</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://perldoc.perl.org/functions/exists.html"><span style="color: #000066;">exists</span></a> <span style="color: #0000ff;">$rules</span><span style="color: #009900;">&#123;</span><span style="color: #0000ff;">$element</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$debug</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&quot;$element<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$element</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;VIOLATION: &quot;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">$element</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://perldoc.perl.org/functions/push.html"><span style="color: #000066;">push</span></a> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">@$violation_ref</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$element</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># Social Security Number</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">elsif</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$element</span> <span style="color: #339933;">=~</span> <span style="color: #009966; font-style: italic;">/\d{3}-?\d{2}-?\d{4}/</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$debug</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&quot;$element<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$element</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;VIOLATION: &quot;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">$element</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://perldoc.perl.org/functions/push.html"><span style="color: #000066;">push</span></a> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">@$violation_ref</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$element</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># Credit Card Number or MRN</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">elsif</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$element</span> <span style="color: #339933;">=~</span> <span style="color: #009966; font-style: italic;">/\d{4}-?\d{4}-?\d{4}-?\d{4}/</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$debug</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&quot;$element<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$element</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;VIOLATION: &quot;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">$element</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://perldoc.perl.org/functions/push.html"><span style="color: #000066;">push</span></a> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">@$violation_ref</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$element</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.chainringcircus.org/data-loss-prevention/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

