<?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>Random Tech Articles &#187; linux</title>
	<atom:link href="http://www.analogrithems.com/rant/category/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.analogrithems.com/rant</link>
	<description>If I have seen a little further it is by standing on the shoulders of Giants. - Newton</description>
	<lastBuildDate>Thu, 02 Feb 2012 20:07:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Convert avi/mkv/mp4 to dvd in OSX or Someother *nix derivative</title>
		<link>http://www.analogrithems.com/rant/2011/02/11/convert-avimkvmp4-to-dvd-in-osx-or-someother-nix-derivative/</link>
		<comments>http://www.analogrithems.com/rant/2011/02/11/convert-avimkvmp4-to-dvd-in-osx-or-someother-nix-derivative/#comments</comments>
		<pubDate>Sat, 12 Feb 2011 00:22:58 +0000</pubDate>
		<dc:creator>analogrithems</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[OSX]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[Video]]></category>

		<guid isPermaLink="false">http://www.analogrithems.com/rant/?p=202</guid>
		<description><![CDATA[I often need to convert avi, mkv, mp4 or some other video format to generic DVD.  Using a Mac, I&#8217;ve found that this processes is a pain in the ass.  It surprises me that there are very few tools for &#8230; <a href="http://www.analogrithems.com/rant/2011/02/11/convert-avimkvmp4-to-dvd-in-osx-or-someother-nix-derivative/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<a href='http://twitter.com/share?url=http%3A%2F%2Fwww.analogrithems.com%2Frant%2F%3Fp%3D202&count=horizontal&related=&text=Convert%20avi%2Fmkv%2Fmp4%20to%20dvd%20in%20OSX%20or%20Someother%20%2Anix%20derivative' class='twitter-share-button' data-text='Convert avi/mkv/mp4 to dvd in OSX or Someother *nix derivative' data-url='http://www.analogrithems.com/rant/?p=202' data-counturl='http://www.analogrithems.com/rant/2011/02/11/convert-avimkvmp4-to-dvd-in-osx-or-someother-nix-derivative/' data-count='horizontal' data-via='analogrithems'></a><p>I often need to convert avi, mkv, mp4 or some other video format to generic DVD.  Using a Mac, I&#8217;ve found that this processes is a pain in the ass.  It surprises me that there are very few tools for pulling this together.  I spent a few days searching and see that there was a few tools, but they were either dead projects, or not stable.  Don&#8217;t get me wrong, FFMpegX is pretty good at converting video formats, but trying to use it to actually make a dvd with subtitles just doesn&#8217;t work for me.  I did notice that it was based of the opensource ffmpeg, dvdauthor and cdrtools projects, so I decided to use my Darwin Ports system to install the packages (With all prerequisites)  and use the command line tools to do all the conversion.</p>
<p>sudo port install ffmpeg</p>
<p>sudo port install dvdauthor</p>
<p>sudo port install cdrtools</p>
<p>I had no clue how easy the command line tools would be to use and decided to document for my own use later.  Most of my info came from <a href="http://atomized.org/2005/03/converting-divxxvid-avi-to-dvd-with-ffmpeg/">http://atomized.org/2005/03/converting-divxxvid-avi-to-dvd-with-ffmpeg/</a></p>
<p><span style="text-decoration: underline;"><strong>Step 1)  Convert Source file to DVD video format</strong></span></p>
<p>The first thing you need to do is convert the video file to a mpeg2 file with the proper video dimensions 720&#215;480.  Luckily the FFMpeg package has a predefined template for it &#8216;-target ntsc-dvd, or -target pal-dvd for europe&#8217;.  Since I have a widescreen plasma screen, I use the 16:9 aspect ratio, if you have a more square tv, or if you just want your file more square use the &#8216;-aspect 4:3&#8242;  The ffmpeg <a href="http://www.ffmpeg.org/faq.html">faq</a> has some great info on additional options like converting videos to play on game consoles or smart phones or even to just a different format.  FFMPEG can be downloaded from <a href="http://www.ffmpeg.org">http://www.ffmpeg.org</a> for non-osx systems</p>
<p>ffmpeg -i MyMovie.avi -target ntsc-dvd -aspect 16:9 -sameq MyMovie.mpg</p>
<p><strong><span style="text-decoration: underline;">Step 2) Add Subtitles (If Needed)</span></strong></p>
<p>The easiest way to add subtitles to your newly created mpeg2 file is with DVDAuthor&#8217;s spumux tool.  This tool is a bit confusing to use, so I&#8217;ll try to make this as simple as possible.  First you need to make a xml config file for each subtitle you want to add.  Here is the one I make, and tend to use over and over by copying the file and changing the subfile name inside. Get the DVDauthor tools here <a href="http://dvdauthor.sourceforge.net">http://dvdauthor.sourceforge.net</a></p>
<p>&lt;subpictures&gt;<br />
&lt;stream&gt;<br />
&lt;textsub filename=&#8221;ongbak.3.english.srt&#8221; characterset=&#8221;ISO8859-1&#8243;<br />
fontsize=&#8221;28.0&#8243; font=&#8221;Geneva.ttf&#8221;<br />
horizontal-alignment=&#8221;center&#8221;<br />
vertical-alignment=&#8221;bottom&#8221; left-margin=&#8221;40&#8243;<br />
right-margin=&#8221;40&#8243;<br />
top-margin=&#8221;20&#8243; bottom-margin=&#8221;30&#8243;<br />
subtitle-fps=&#8221;25&#8243;<br />
movie-fps=&#8221;25&#8243; movie-width=&#8221;720&#8243; movie-height=&#8221;480&#8243;<br />
force=&#8221;yes&#8221;<br />
/&gt;<br />
&lt;/stream&gt;<br />
&lt;/subpictures&gt;</p>
<p>Here is a simple breakdown of what is going on in this config. Better definition found here <a href="http://dvdauthor.sourceforge.net/doc/spumux.html">http://dvdauthor.sourceforge.net/doc/spumux.html</a></p>
<ul>
<li><strong>filename</strong> &#8211; This is the subtitle file you will be attaching.</li>
<li><strong>characterset</strong> &#8211; This is the characterset for your subtitle text to use in the film.  For english you can use ISO8859-1, for other languages reference http://en.wikipedia.org/wiki/Character_encoding</li>
<li><strong>fontsize</strong> &#8211; This is the size of the font to display in the movie</li>
<li><strong>font</strong> &#8211; Which font to show as.  The fonts used by spumux are locate in ~/.spumux/</li>
<li><strong>horizontal-alignment</strong> &#8211; Where to place the subtitles in the film, {left, right, center}</li>
<li><strong>vertical-alignment </strong>- Where to place the subtitles on the film {top, center, bottom}</li>
<li><strong>right-margin</strong> &#8211; Don&#8217;t really understand these</li>
<li><strong>left-margin</strong> &#8211; Don&#8217;t really understand these</li>
<li><strong>top-margin</strong> &#8211; Don&#8217;t really understand these</li>
<li><strong>bottom-margin</strong> &#8211; Don&#8217;t really understand these</li>
<li><strong>subtitle-fps</strong> &#8211; Just set this to 25, for DVD</li>
<li><strong>movie-fps</strong> &#8211; Just set this to 25, for DVD</li>
<li><strong>movie-width</strong> &#8211; for DVD set to 720 for wide or 640 4:3</li>
<li><strong>movie-height</strong> &#8211; for dvd set to 480</li>
<li><strong>force</strong> &#8211; turns the subtitle without being selected</li>
</ul>
<p>spumux -s 0 -P MyMovie.xml &lt; MyMovie.mpg &gt; MyMovie.sub.eng.mpg</p>
<p><strong><span style="text-decoration: underline;">Step 3) Convert mpg to Video_TS format, this is called DVD authoring</span></strong></p>
<p>Now that we have our file encoded to the mpeg2 (AKA DVD) format and perhaps even the subtitles, it&#8217;s time to get the mpeg file turned into the more recognizable video_ts structure.   You can get the full lowdown on all the dvdauthor arguments from <a href="http://dvdauthor.sourceforge.net/doc/r1741.html">http://dvdauthor.sourceforge.net/doc/r1741.html</a></p>
<p>dvdauthor &#8211;title -f MyMovie.sub.eng.mpg -o MyMovie</p>
<p>the -o MyMovie means create a output directory with the VIDEO_TS subdirectory &amp; files inside</p>
<p><span style="text-decoration: underline;"><strong>Step 4) Create the DVD menu system</strong></span></p>
<p>Now that the mpeg file is in the video_ts directory structure (and is broken into vob files). You need to make the dvd menu.  Personally I don&#8217;t care for advanced menus.  I just want my movies to start, so I use the following command to just make an empty menu that just auto starts the movie.</p>
<p>dvdauthor -T -o MyMovie</p>
<p><strong><span style="text-decoration: underline;">Step 5) Create ISO image from finished VIDEO_TS directory</span></strong></p>
<p>Now that we have our functioning dvd video, lets convert it to an ISO that we can burn.  I do this with the mkisofs command from the cdrtools package.  It&#8217;s pretty simple, just use the following.  You can get cdrtools from  <a href="http://cdrecord.berlios.de/">http://cdrecord.berlios.de/</a></p>
<p>mkisofs -dvd-video -o MyMovie.iso MyMovie/</p>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://www.analogrithems.com/rant/2011/02/11/convert-avimkvmp4-to-dvd-in-osx-or-someother-nix-derivative/" target="_blank" title="Share on Facebook">Share on Facebook</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.analogrithems.com/rant/2011/02/11/convert-avimkvmp4-to-dvd-in-osx-or-someother-nix-derivative/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Snort + Mysql on RHEL 5.4</title>
		<link>http://www.analogrithems.com/rant/2010/01/14/132/</link>
		<comments>http://www.analogrithems.com/rant/2010/01/14/132/#comments</comments>
		<pubDate>Fri, 15 Jan 2010 00:29:08 +0000</pubDate>
		<dc:creator>analogrithems</dc:creator>
				<category><![CDATA[IDS]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[Snort]]></category>
		<category><![CDATA[Redhat EL5]]></category>

		<guid isPermaLink="false">http://www.analogrithems.com/rant/?p=132</guid>
		<description><![CDATA[This document describes the steps for install and setting up Snort the opensource intrustion detection system. It also describes the process for updating the signature definitions. Snort is an opensource IDS (Intrusion Detection System) written and maintained by a company &#8230; <a href="http://www.analogrithems.com/rant/2010/01/14/132/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<a href='http://twitter.com/share?url=http%3A%2F%2Fwww.analogrithems.com%2Frant%2F%3Fp%3D132&count=horizontal&related=&text=Snort%20%2B%20Mysql%20on%20RHEL%205.4' class='twitter-share-button' data-text='Snort + Mysql on RHEL 5.4' data-url='http://www.analogrithems.com/rant/?p=132' data-counturl='http://www.analogrithems.com/rant/2010/01/14/132/' data-count='horizontal' data-via='analogrithems'></a><p>This document describes the steps for install and setting up Snort the opensource intrustion detection system. It also describes the process for updating the signature definitions.</p>
<p><a title="http://www.snort.org/" rel="nofollow" href="http://www.snort.org/">Snort</a> is an opensource IDS (Intrusion Detection System)  written and maintained by a company called <a title="http://www.sourcefire.com/" rel="nofollow" href="http://www.sourcefire.com/">sourcefire</a>.  It is one of the best IDS available and is free (Kinda).</p>
<h3>Downloading Snort</h3>
<p>Since we us Redhat Enterprise Linux 5 here go to the snort <a title="http://www.snort.org/downloads/" rel="nofollow" href="http://www.snort.org/downloads/">download</a> page and select <strong>snort-2.8.5.2-1.RH5.i386.rpm</strong>.  Since we will also be using the BASE web interface to view the alerts also download the <strong>snort-mysql-2.8.5.2-1.RH5.i386.rpm</strong> add-on that allows snort to log its alerts to a MySQL database.</p>
<h3>Installing Snort</h3>
<p>Installing Snort via the rpms is very easy.  Just use the rpm command like the following.</p>
<pre>[root@mytest src]# rpm -Uvh snort-2.8.5.2-1.RH5.i386.rpm snort-mysql-2.8.5.2-1.RH5.i386.rpm
Preparing...                ########################################### [100%]
  1:snort                    ########################################### [ 50%]
  2:snort-mysql          ########################################### [100%]
</pre>
<p>That&#8217;s it, Snort is installed and the rpm install script already configures Snort to start at boot.</p>
<pre>[root@mytest src]# chkconfig --list |grep snort
snortd          0:off   1:off   2:on    3:on    4:on    5:on    6:off
</pre>
<h3>Configuring Snort</h3>
<p>Here is where the real magic happens. He now need to configure Snort for use. Typicaly your server will have two NICs. One will be for remote administration and one will be dedicated to Snort. In our case I will use eth0 for remote administration and logging into the computer and I&#8217;ll use eth1 for Snort. We want to dedicate the whole interface to snort because we will be placing it in promiscus mode which will cause the network interface to take sniff all the traffic coming across its segment.</p>
<h4>Configure Dedicated Network Interface</h4>
<p>You don&#8217;t actually need to use a real IP for the Snort interface so when you configure the if-cfg file just leave out the actual IP info In redhat the network config files are located under <strong>/ettc/sysconfig/network-scripts/</strong> so I&#8217;ll place the following in <strong>/etc/sysconfig/network-scripts/ifcfg-eth1</strong></p>
<pre>DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
TYPE=Ethernet
</pre>
<p>Then recycle the network service with the <strong>service network restart</strong> command.</p>
<pre>[root@mytest network-scripts]# service network restart
Shutting down interface eth0:                              [  OK  ]
Shutting down interface eth1:                              [  OK  ]
Shutting down loopback interface:                        [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth0:                                  [  OK  ]
Bringing up interface eth1:                                 [  OK  ]
</pre>
<p>This will then turn on your network interface. You can verify that the interface is up and on with the ifconfig command.</p>
<pre>[root@mytest network-scripts]# ifconfig eth1
eth1      Link encap:Ethernet  HWaddr 00:C0:F2:01:16:73
         UP BROADCAST MULTICAST  MTU:1500  Metric:1
         RX packets:0 errors:0 dropped:0 overruns:0 frame:0
         TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:1000
         RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
         Interrupt:193 Base address:0xdde0
</pre>
<h4>Snort Sysconfig file</h4>
<p>So now that we have our network up it&#8217;s time to configure Snort to use the new network interface we just created. You can tell snorrt to either usee a certain NIC or ALL. In our case we only want it to use eth1 so edit <strong>/etc/sysconfig/snort</strong> find the line that has <strong>INTERFACE=eth0</strong> and change it to <strong>INTERFACE=eth1</strong></p>
<pre># What interface should snort listen on?  [Pick only 1 of the next 3!]
# This is -i {interface} on the command line
# This is the snort.conf config interface: {interface} directive
INTERFACE=eth1
</pre>
<p>Next since we will be logging to MySQL we need to shut off the standard flat file out by commenting out the <strong>ALERTMODE</strong> option. This step is actually really important. Without it no matter what you tell the snort config file, it will not send any logs to the MySQL database.</p>
<pre># How should Snort alert? Valid alert modes include fast, full, none, and
# unsock.  Fast writes alerts to the default "alert" file in a single-line,
# syslog style alert message.  Full writes the alert to the "alert" file
# with the full decoded header as well as the alert message.  None turns off
# alerting. Unsock is an experimental mode that sends the alert information
# out over a UNIX socket to another process that attaches to that socket.
# -A {alert-mode}
# output alert_{type}: {options}
#ALERTMODE=fast
</pre>
<h4>Create and Configure the Database</h4>
<p>We now need to create and configure our mysql database and tables where Snort&#8217;s events will be logged. The snort rpm you installed earlier placed a MySQL database scheme at <strong>/usr/share/snort-2.8.5.2/schemas/create_mysql</strong> Sso first we will need to manually create the MySQL database.</p>
<pre>[root@mytest ~]# mysql
mysql&gt; create database snort;
Query OK, 1 row affected (0.09 sec)
mysql&gt; exit
Bye
</pre>
<p>Next we will import the database scheme to the snorrt database we just created with the following command.</p>
<pre>[root@mytest ~]# mysql snort &lt; /usr/share/snort-2.8.5.2/schemas/create_mysql
</pre>
<p>Last we need to create a snort user in mysql with full access to the database and tables we just created. In the following example replace secret password with an actual password.</p>
<pre>[root@mytest ~]# mysql snort
mysql&gt; grant all on snort.* to 'snort'@'%' identified by 'secret password';
Query OK, 0 rows affected (0.04 sec)
mysql&gt; exit
Bye
</pre>
<h4>Snort Configuration File</h4>
<p>The actual Snort config file is located in <strong>/etc/snort</strong> and is called <strong>snort.conf&#8217;</strong> Really the only things we should edit in this file are the VAR options that are specific to our network and the log line that defines our snort connection.</p>
<pre>#This should reflect all the subnets we have on our network.
var HOME_NET [10.0.0.0/24,10.0.10.0/24,10.0.23.0/24]
var EXTERNAL_NET any
# Configure your server lists.  This allows snort to only look for attacks to
# systems that have a service up.  Why look for HTTP attacks if you are not
# running a web server?  This allows quick filtering based on IP addresses
# These configurations MUST follow the same configuration scheme as defined
# above for $HOME_NET.
var DNS_SERVERS [10.0.0.42,10.0.23.42]
var SMTP_SERVERS $HOME_NET
#Any computer that was a webserver running should be in this list
var HTTP_SERVERS [10.0.0.23,10.0.23.42]
#Any Machine that is running any type of SQL server should be listed here
var SQL_SERVERS [10.0.0.60,10.0.0.61]
var TELNET_SERVERS $HOME_NET
var FTP_SERVERS $HOME_NET
var SNMP_SERVERS $HOME_NET
#Now we should define our database config
output database: log, mysql, user=snort password=secretpassword dbname=snort host=localhost
</pre>
<p>That&#8217;s it after that you can start snort with a simple <strong>service snortd start</strong></p>
<h3>Configuring Switches for Snort</h3>
<p>In the old days of hubs every packet was always sent out every port. This was inefficient and a huge security risk. So Switches came along to make sure only the port that needed the data got the packet. It did this my keeping an internal list of which mac was on which port. Then it only sends out packets destine for the mac associated with each port. This is much more efficient and secure but for snort this actually causes a problem. In order to see every packet to inspect it, it needs the switch to treat it&#8217;s port like a hub. Luckily in managed Cisco switches you have the ability to mirror ports or vlans to another port or vlan.</p>
<p>On our vlan we will assume that we have two vlans. In reality we probably have many more but for our example it doesn&#8217;t matter we will also assume that our dedicated network interface is plugged in to port GigabitEtherrnet0/5.</p>
<pre>Switch&gt; conf t
Switch&gt; monitor session 1 source vlan 1 - 2 rx
Switch&gt; monitor session 1 destination interface gigabitEthernet0/5
</pre>
<p>This will tell your switch to take all traffic on vlan 1 &amp; 2 and mirror them to gigabitEthernet port 0/5</p>
<p>after that write and save your config. Now snort should be getting all the traffic from your vlans. As stated above if you have multiple Vlans then add more monitor session 1 source statements. You can combine all sorts of interfaces and vlans.</p>
<h3>Updating Scanning Signatures</h3>
<p>Unfortunately updating snort rules requires an account on the snort.org website. Their are free and paid subscriptions based accounts. The free account gets new signatures 30 days after the paid account. For our purposes we will be using the free version for now. So create your free account via the <a title="https://www.snort.org/signup" rel="nofollow" href="https://www.snort.org/signup">Signup Page</a> and after you do the whole email confirm thing login to the website at the <a title="https://www.snort.org/login" rel="nofollow" href="https://www.snort.org/login">Login Page</a> When you login Click on the <strong>Get Rules</strong> button this will take you to a download page and show you two sections one for VRT Subscription users and one for Registered users (Free 30days late). Select the <strong>snortrules-snapshot-CURRENT.tar.gz</strong> from the registered users section, this file is usually about 25-30MB so be patient. Once you download this tar archive to your snort machine create a tmp dir and unarchive all the files with the tar command again.</p>
<pre>[root@mytest src]# mkdir snort-rules-temp
[root@mytest src]# cd snort-rules-temp
[root@mytest snort-rules-temp]# tar -zxf ../snortrules-snapshot-CURRENT.tar.gz
</pre>
<p>Once you uncompressed the rules you need to copy only the normal rules. Copy the normal rules to the <strong>/etc/snort/rules</strong> directory.</p>
<pre>[root@mytest snort-rules-temp]# cp rules/* /etc/snort/rules/
</pre>
<p>Test the so rules with</p>
<pre>[root@mytest src]# snort -c /etc/snort/snort.conf -T
</pre>
<p>If everything looks good recycle snort with <strong>service snortd restart</strong> For best results you should update your snort rules every week.</p>
<h2>References</h2>
<ul>
<li> <a title="https://forums.snort.org/forums" rel="nofollow" href="https://forums.snort.org/forums">https://forums.snort.org/forums</a></li>
<li> <a title="http://snort.org/" rel="nofollow" href="http://snort.org/">http://snort.org/</a></li>
</ul>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://www.analogrithems.com/rant/2010/01/14/132/" target="_blank" title="Share on Facebook">Share on Facebook</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.analogrithems.com/rant/2010/01/14/132/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Debugging Unix</title>
		<link>http://www.analogrithems.com/rant/2009/06/14/debugging-unix/</link>
		<comments>http://www.analogrithems.com/rant/2009/06/14/debugging-unix/#comments</comments>
		<pubDate>Sun, 14 Jun 2009 23:15:44 +0000</pubDate>
		<dc:creator>analogrithems</dc:creator>
				<category><![CDATA[Irix]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[Solaris]]></category>
		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://www.analogrithems.com/rant/?p=56</guid>
		<description><![CDATA[When ever I come across a command or service in Unix that crashes or fails to run properly I quickly go to the trace tools to trace the system commands.  I often find that If I just follow the system &#8230; <a href="http://www.analogrithems.com/rant/2009/06/14/debugging-unix/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<a href='http://twitter.com/share?url=http%3A%2F%2Fwww.analogrithems.com%2Frant%2F%3Fp%3D56&count=horizontal&related=&text=Debugging%20Unix' class='twitter-share-button' data-text='Debugging Unix' data-url='http://www.analogrithems.com/rant/?p=56' data-counturl='http://www.analogrithems.com/rant/2009/06/14/debugging-unix/' data-count='horizontal' data-via='analogrithems'></a><p>When ever I come across a command or service in Unix that crashes or fails to run properly I quickly go to the trace tools to trace the system commands.  I often find that If I just follow the system trace i can usually see what was supposed to happen and didn&#8217;t.  Unfortunatley not every unix flavor uses the same tracing commands.</p>
<p>In linux it is very simple prefix any command with <strong>strace</strong> and it will give you lots of system trace info.</p>
<p>In Solaris use the <strong>truss</strong> command.</p>
<p>In Irix use the <strong>par</strong> command.</p>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://www.analogrithems.com/rant/2009/06/14/debugging-unix/" target="_blank" title="Share on Facebook">Share on Facebook</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.analogrithems.com/rant/2009/06/14/debugging-unix/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why nscd sucks&#8230;.</title>
		<link>http://www.analogrithems.com/rant/2008/09/16/why-nscd-sucks/</link>
		<comments>http://www.analogrithems.com/rant/2008/09/16/why-nscd-sucks/#comments</comments>
		<pubDate>Wed, 17 Sep 2008 01:27:53 +0000</pubDate>
		<dc:creator>analogrithems</dc:creator>
				<category><![CDATA[ldap]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[nscd]]></category>

		<guid isPermaLink="false">http://www.analogrithems.com/rant/?p=5</guid>
		<description><![CDATA[The name service cache daemon has some serious flaws. One that I notice pretty often in Linux arises when you are using LDAP. It seems that nscd will crash and burn when/if ldap is unavailable. Unfortunately when nscd bombs, it &#8230; <a href="http://www.analogrithems.com/rant/2008/09/16/why-nscd-sucks/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<a href='http://twitter.com/share?url=http%3A%2F%2Fwww.analogrithems.com%2Frant%2F%3Fp%3D5&count=horizontal&related=&text=Why%20nscd%20sucks....' class='twitter-share-button' data-text='Why nscd sucks....' data-url='http://www.analogrithems.com/rant/?p=5' data-counturl='http://www.analogrithems.com/rant/2008/09/16/why-nscd-sucks/' data-count='horizontal' data-via='analogrithems'></a><p>The name service cache daemon has some serious flaws. One that I notice pretty often in Linux arises when you are using LDAP. It seems that nscd will crash and burn when/if ldap is unavailable. Unfortunately when nscd bombs, it usually takes the entire system with it. Actually what will happen is nscd sockets will start getting broken pipe&#8217;s and becoming stale until you have several nscd. Eventually your system will slow to a halt. Mind you the box hasn&#8217;t crashed, but the box is in a dos state. If you do an &#8216;<em>$# netstat -an</em>&#8216; you&#8217;ll notice several entries in reference to &#8216;/var/run/nscd/socket&#8217;. This bug has been listed by several distros, I&#8217;ve yet to see any of them address it properly.</p>
<p>From what I&#8217;ve discovered about nscd this issue is a design flaw in nscd. Several people have just recommended disabling nscd. While this is a solution, it isn&#8217;t an acceptable solution in an enterprise environment. Especially if you are using oracle. Several oracle tools and apps will freeze or crash if they can&#8217;t talk to the nscd socket. Lame I know, but I&#8217;ve observed this in at least Oracle 10i.</p>
<p><strong>Solutions</strong></p>
<p>Now there are tow ways to get around this. One is to make your LDAP service load balanced and highly available. You can do replication in OpenLDAP with slurpd and then use something like balance to make the service highly available. Another option though is to fix nscd so it doesn&#8217;t bomb your machine when it dies.</p>
<p>In this article we are going to go over the fix nscd solution.  nscd comes with a config file located in &#8216;<em>/etc/nscd.conf&#8217;</em> This file tells the nscd daemon how long to cache which name service.  See the man page to understand what each option means. The quick way to fix nscd is to tell the service here not to cache passwd and group info.  This will make nscd not go to LDAP and freak out if LDAP is not available.  Randomly I also came across a drop in replacement for nscd that dosen&#8217;t suffer from this issue. <a href="http://www.analogrithems.com/rant/wp-content/uploads/2008/09/nscd-033.c">unscd-033.c</a> The compile instructions are in the file. I can&#8217;t guarantee this safe, but I&#8217;ve used it for a while in an enterprise environment and seem haven&#8217;t had any nscd issues since<a href="http://www.analogrithems.com/rant/wp-content/uploads/2008/09/nscd-033.c"><br />
</a></p>
<p><strong>Refferences:</strong></p>
<ul>
<li>http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=248271</li>
</ul>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://www.analogrithems.com/rant/2008/09/16/why-nscd-sucks/" target="_blank" title="Share on Facebook">Share on Facebook</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.analogrithems.com/rant/2008/09/16/why-nscd-sucks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ldap with linux a basic primmer</title>
		<link>http://www.analogrithems.com/rant/2008/09/16/ldap-with-linux-a-basic-primmer/</link>
		<comments>http://www.analogrithems.com/rant/2008/09/16/ldap-with-linux-a-basic-primmer/#comments</comments>
		<pubDate>Tue, 16 Sep 2008 22:59:37 +0000</pubDate>
		<dc:creator>analogrithems</dc:creator>
				<category><![CDATA[ldap]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[centralized authentication]]></category>
		<category><![CDATA[pam]]></category>

		<guid isPermaLink="false">http://www.analogrithems.com/rant/?p=3</guid>
		<description><![CDATA[LDAP has been around for over a decade, and yet it is still considered a newer technology.  Many modern vendors have added LDAP authentication.  This document is a brief generic howto for configuring linux to use LDAP.  This will be &#8230; <a href="http://www.analogrithems.com/rant/2008/09/16/ldap-with-linux-a-basic-primmer/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<a href='http://twitter.com/share?url=http%3A%2F%2Fwww.analogrithems.com%2Frant%2F%3Fp%3D3&count=horizontal&related=&text=ldap%20with%20linux%20a%20basic%20primmer' class='twitter-share-button' data-text='ldap with linux a basic primmer' data-url='http://www.analogrithems.com/rant/?p=3' data-counturl='http://www.analogrithems.com/rant/2008/09/16/ldap-with-linux-a-basic-primmer/' data-count='horizontal' data-via='analogrithems'></a><p>LDAP has been around for over a decade, and yet it is still considered a newer technology.  Many modern vendors have added LDAP authentication.  This document is a brief generic howto for configuring linux to use LDAP.  This will be a fairly detailed recipe as most of my docs are.</p>
<p><strong>Linux Name Services</strong><br />
Name Server Switch is the engine that really enables Linux to harness LDAP. In linux you have two different ldap.conf files that the modules and services use to configure their ldap communications &#8216;/etc/ldap.conf&#8217; and &#8216;/etc/openldap/ldap.com&#8217;. The first gives the dn&#8217;s for passwd, group and sudoers. You can also specify the server and communication protocol. One really cool bonus is that you get to enable the host_acl based of users with this config file</p>
<p>host    ldap.analogrithems.com<br />
base    dc=analogrithems,dc=com,dc=us<br />
ldap_version    3<br />
#Validate cert<br />
tls_checkpeer no<br />
ssl     start_tls<br />
#ssl on<br />
nss_map_attribute       uniqueMember member<br />
pam_password_prohibit_message Please visit http://enterprise.company.com/password_policy.html.<br />
pam_groupdn cn=ldap.analogrithems.com,ou=Computers,dc=analogrithems,dc=com,dc=us<br />
pam_member_attribute uniquemember<br />
pam_filter accountStatus=active<br />
nss_base_passwd         ou=People,dc=analogrithems,dc=com,dc=us?one<br />
nss_base_shadow         ou=People,dc=analogrithems,dc=com,dc=us?one<br />
nss_base_group          ou=Groups,dc=analogrithems,dc=com,dc=us?one<br />
sudoers_base    ou=SUDOers,dc=analogrithems,dc=com,dc=us<br />
#This options is VERY helpful for debugging sudo ldap extension<br />
#sudoers_debug 2</p>
<p><strong>PAM</strong><br />
PAM is an authentication and accounting module that allows Linux services to use different methods for authenticating users (MySQL, LDAP, NIS, etc..). Their are two different pam config versions. You should look up the version your gnu/linux vedor uses for exact details on ldap setup, for SuSE you modify &#8220;/etc/security/pam_unix2.conf&#8221; to include the following. This system makes it so you don&#8217;t have to modify every pam service to use ldap, you just let them all use the standard unix2 module which then handles the ldap lookup.</p>
<p>auth:   use_ldap<br />
account:        use_ldap<br />
password:       use_ldap<br />
session:        none</p>
<p><strong>NSS</strong><br />
Edit your &#8216;/etc/nsswitch.conf&#8217; place the word ldap before files for the passwd and group name service. You can also add it to sudoers if you want to store your sudo configs in ldap also</p>
<p>passwd: compat<br />
shadow: compat<br />
group: compat<br />
sudoers: files ldap</p>
<p>passwd_compat: files ldap<br />
shadow_compat: files ldap<br />
group_compat: files ldap</p>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://www.analogrithems.com/rant/2008/09/16/ldap-with-linux-a-basic-primmer/" target="_blank" title="Share on Facebook">Share on Facebook</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.analogrithems.com/rant/2008/09/16/ldap-with-linux-a-basic-primmer/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic

Served from: www.analogrithems.com @ 2012-02-05 02:07:06 -->
