<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

  <title><![CDATA[Junk Food for the Brain]]></title>
  <link href="http://rajaseelan.com/atom.xml" rel="self"/>
  <link href="http://rajaseelan.com/"/>
  <updated>2012-01-29T00:25:28+08:00</updated>
  <id>http://rajaseelan.com/</id>
  <author>
    <name><![CDATA[Rajaseelan]]></name>
    
  </author>
  <generator uri="http://octopress.org/">Octopress</generator>

  
  <entry>
    <title type="html"><![CDATA[Installing Python 2.7.2 on Centos 5.2]]></title>
    <link href="http://rajaseelan.com/2012/01/28/installing-python-2-dot-7-2-on-centos-5-dot-2/"/>
    <updated>2012-01-28T23:44:00+08:00</updated>
    <id>http://rajaseelan.com/2012/01/28/installing-python-2-dot-7-2-on-centos-5-dot-2</id>
    <content type="html"><![CDATA[<p>Centos / RHEL5 come with Python v2.4.3, which was relased in 2006 and is as ancient as you can get nowdays. Even other application build scripts require Python >= 2.5 for building, e.g node.js &amp; Spidermonkey 1.8.5. :|</p>

<p>This is my attempt at building a base Python distro that sits in <code>/opt/python-2.7.2</code>. My goal is to minimize depending on the installed system developement libraries; As in Enterprise-y environments, &#8216;polluting&#8217; the standard OS image will result in a visit from the <a href="http://xkcd.com/292">XKCD GOTO Raptor</a>.</p>

<!--more-->


<p><strong>tldr;</strong> This is the <a href="http://images.rajaseelan.com/build.sh">script</a> I created to install Python.</p>

<p>To start, I installed Centos 5.2 with only the groups @core, @base and @development tools. A few Text-Based Internet utilities were also installed for convinience&#8217;s sake.</p>

<p>I then downloaded Python 2.7.2 and ran the standard configure-make-make install routine, and got this:</p>

<pre><code>INFO: Can't locate Tcl/Tk libs and/or headers

…Snipped...
Python build finished, but the necessary bits to build these modules were not found:
_bsddb             _curses            _curses_panel   
_sqlite3           _ssl               _tkinter        
bsddb185           bz2                dbm             
dl                 gdbm               imageop         
readline           sunaudiodev        zlib            
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
….Snip…
</code></pre>

<p>FML, I knew this was the beginning of a journey into a rabbit hole.</p>

<p>This is the install sequence</p>

<pre><code>sqlite
bzip2
zlib
openssl
ncurses
readline
gdbm
bsddb
python
</code></pre>

<p>Some decisions I took:<br/>
Not installing the TCL/TK toolkit, as building tk requires X11 libraries which I didn&#8217;t install.</p>

<p>The end result was this:</p>

<pre><code>Building dbm using bdb
INFO: Can't locate Tcl/Tk libs and/or headers

Python build finished, but the necessary bits to build these modules were not found:
_tkinter           bsddb185           dl              
imageop            sunaudiodev                        
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
</code></pre>

<p><code>sunaudiodev</code> is is for Sun platforms,<code>dl</code> for 32bit platforms, <code>imageop</code> is deprecated and <code>bsddb185</code> is undocumented.</p>

<p>What the script does:<br/>
  *  created a directory called <code>src</code> and <code>build</code>.<br/>
  *  Downloads the required libraries and compiles them in <code>build</code>
  *  installs them all in <code>/opt/python-2.7.2</code>
  *  Removing this should be as easy as <code>rm -rf /opt/python-2.7.2</code></p>

<p>If you wish to modify the install path, edit the <code>PREFIX</code> option in the script.</p>

<p>References:
*  <a href="http://andrew.io/weblog/2010/02/installing-python-2-6-virtualenv-and-virtualenvwrapper-on-dreamhost/">andrew.io</a>
*  <a href="http://www.joywang.info/?p=112">Equatorian</a></p>

<p>Similar Projects that Address this issue (more elegantly)
 *  <a href="https://github.com/utahta/pythonbrew">pythonbrew</a>
 *  <a href="https://github.com/wavetossed/pybuild">pybuild</a></p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[How to Host an Octopress or Jekyll Site on Webfaction]]></title>
    <link href="http://rajaseelan.com/2012/01/04/how-to-host-an-octopress-or-jekyll-site-on-webfaction/"/>
    <updated>2012-01-04T23:10:00+08:00</updated>
    <id>http://rajaseelan.com/2012/01/04/how-to-host-an-octopress-or-jekyll-site-on-webfaction</id>
    <content type="html"><![CDATA[<p>Obviously, the kind of people who use <a href="http://octopress.org">Octopress</a> would already know this, but just in case.</p>

<!-- more -->


<p>In your <a href="http://www.webfaction.com?affiliate=rajaseelan">WebFaction</a> Control Panel:</p>

<ul>
<li>Click on <strong>Domains/websites</strong></li>
<li>Add your domain name (which has already been configured to point to your Webfaction server</li>
<li>In <strong>Applications</strong> Create a new application</li>
<li><strong>App Category</strong> -> <strong>Static</strong></li>
<li><strong>App type</strong> -> <strong>Static only (no .htaccess)</strong></li>
<li>Finally, in <strong>Websites</strong></li>
<li><strong>New</strong> -> Choose your <strong>subdomain</strong>, <strong>App</strong>, and fill in the <strong>URL</strong>, which most probably would be <strong>/</strong>.</li>
</ul>


<p>Enjoy the extremely fast load times provided by WebFaction&#8217;s nginx servers :).</p>

<p><em>Disclaimer: Webfaction link contains my affiliate ID</em></p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Amazon Starts Selling the Galaxy Nexus]]></title>
    <link href="http://rajaseelan.com/2012/01/04/amazon-starts-selling-the-galaxy-nexus/"/>
    <updated>2012-01-04T19:44:00+08:00</updated>
    <id>http://rajaseelan.com/2012/01/04/amazon-starts-selling-the-galaxy-nexus</id>
    <content type="html"><![CDATA[<p><a href="http://amzn.to/wANqRM" rel="nofollow">
<img class="right" src="http://images.rajaseelan.com/galaxy_nexus.jpg" />
</a></p>

<p>Finally, the <a href="http://amzn.to/wANqRM">Samsung Galaxy Nexus</a> reaches Amazon.</p>

<!-- more -->


<p>From what I see, there are a lot of dealers trying to cash in on this. The 3 legit links I see are from:</p>

<ul>
<li><a href="http://www.amazon.com/gp/product/B005ZEF01A/ref=as_li_ss_tl?ie=UTF8&amp;tag=rajaseelancom-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=B005ZEF01A">The OEM Shop</a></li>
<li><a href="http://www.amazon.com/gp/product/B005XYU45E/ref=as_li_ss_tl?ie=UTF8&amp;tag=rajaseelancom-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=B005XYU45E">Worldwide Distributors</a></li>
<li><a href="http://www.amazon.com/gp/product/B005ZEF01A/ref=as_li_ss_tl?ie=UTF8&amp;tag=rajaseelancom-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=B005ZEF01A">Addicted to Phones</a></li>
</ul>


<p>As for me, I&#8217;m still wondering if I should wait for my telco deals before I buy one, or get the unlocked version here.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[How to Program Better in Python]]></title>
    <link href="http://rajaseelan.com/2011/12/30/how-to-program-better-in-python/"/>
    <updated>2011-12-30T16:46:00+08:00</updated>
    <id>http://rajaseelan.com/2011/12/30/how-to-program-better-in-python</id>
    <content type="html"><![CDATA[<p>If you have learnt <a href="http://python.org">Python</a> to a certain degree, and can whip up quite a few scripts with it, you will be wondering where to go next.</p>

<p>You have this feeling that yeah, you can program, but you may be doing things the wrong way. Scouring through the Web for Python Tips &amp; Tricks might do, but after haphazardly learning the language, you&#8217;re finally ready for a more structured approach.</p>

<p><a href="http://amzn.to/yRfEZ3" rel="nofollow">
<img class="right" src="http://images.rajaseelan.com/pro_python_book.jpg" />
</a>
That&#8217;s how I am currently feeling, which is when I found this book: <a href="http://www.amazon.com/gp/product/1430227575/ref=as_li_tf_tlie=UTF8&amp;tag=rajaseelancom-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=1430227575">Pro Python</a></p>

<p>It starts off at <em>Advanced Basics</em> in Chapter 2 and progresses on. I just got this book, and am slowly progressing through Chapter 2.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[How to Enable Dropbox LAN Sync in Fedora 16]]></title>
    <link href="http://rajaseelan.com/2011/12/29/how-to-enable-dropbox-lan-sync-in-fedora-16/"/>
    <updated>2011-12-29T14:09:00+08:00</updated>
    <id>http://rajaseelan.com/2011/12/29/how-to-enable-dropbox-lan-sync-in-fedora-16</id>
    <content type="html"><![CDATA[<p>For extra fast syncing among machines and devices connected within your local LAN network, this a feature you may have to <em>enable</em>. What is LAN Sync you ask?</p>

<!-- more -->


<blockquote><p>LAN sync is a Dropbox feature that speeds syncing dramatically when the file exists on your Local Area Network (LAN).<br/>&#8230;<br/>With LAN syncing, Dropbox will look for the new file on your Local Area Network first, bypassing the need to download the file from Dropbox servers, thus speeding up the syncing process considerably.</p><footer><strong>DropBox Help</strong> <cite><a href='http://www.dropbox.com/help/137'>What Is LAN Sync?</a></cite></footer></blockquote>


<p>Determine what port the DropBox service is listening on:</p>

<pre><code># netstat -ntupl | grep dropbox
</code></pre>

<p>You should get something like this:</p>

<pre><code>[root@i7 ~]# netstat -ntupl | grep dropbox
tcp        0      0 0.0.0.0:17500               0.0.0.0:*                   LISTEN      2201/dropbox
udp        0      0 0.0.0.0:17500               0.0.0.0:*                               2201/dropbox
</code></pre>

<p>Dropbox LAN Sync listens on tcp/udp port 17500. We&#8217;ll need to open this port in <code>iptables</code>.</p>

<pre><code># iptables -I INPUT 3 --proto udp --dport 17500 -j ACCEPT
# iptables -I INPUT 3 --proto tcp --dport 17500 -j ACCEPT
</code></pre>

<p>This opens port 17500 for both the udp &amp; tcp protocols. Based on <code>/etc/services</code>, these two stand for:</p>

<pre><code>db-lsp          17500/tcp               # Dropbox LanSync Protocol
db-lsp-disc     17500/udp               # Dropbox LanSync Discovery
</code></pre>

<p>And at the end, don&#8217;t forget to save your rules by typing:</p>

<pre><code># iptables-save &gt; /etc/sysconfig/iptables
</code></pre>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[How to Prevent Mac OSX from writing .DS_Store files in Network Folders]]></title>
    <link href="http://rajaseelan.com/2011/12/29/how-to-prevent-mac-osx-from-writing-ds-store-files-in-network-folders/"/>
    <updated>2011-12-29T13:47:00+08:00</updated>
    <id>http://rajaseelan.com/2011/12/29/how-to-prevent-mac-osx-from-writing-ds-store-files-in-network-folders</id>
    <content type="html"><![CDATA[<p><strong>Mac Droppings</strong>, as they are unaffectionately known, are a source of pain for many cross platform users. Its particularly annoying when they appear in shared drives.</p>

<!-- more -->


<p>To disable these droppings, you&#8217;ll need to configure your user account to not create them on network drives.</p>

<p>Open your <strong>terminal</strong></p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>defaults write com.apple.desktopservices DSDontWriteNetworkStores true</span></code></pre></td></tr></table></div></figure>


<p>Restart your Mac.</p>

<p>That should do the trick.<br/>
Source: <a href="https://sysadm.equoria.com/index.php/Mac_Droppings:_Preventing_.DS_Store_file_creation">Mini System Administrator&#8217;s FAQ</a></p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[How to Connect to your Box.Net Folder In Mac OS X]]></title>
    <link href="http://rajaseelan.com/2011/12/28/how-to-connect-to-your-box-dot-net-folder-in-mac-os-x/"/>
    <updated>2011-12-28T19:41:00+08:00</updated>
    <id>http://rajaseelan.com/2011/12/28/how-to-connect-to-your-box-dot-net-folder-in-mac-os-x</id>
    <content type="html"><![CDATA[<p>If you happened to be lucky enough to have a <a href="http://www.box.com">Box</a> account, which can be considered an Enterprise Level DropBox, here&#8217;s how to connect to it in Finder.</p>

<!-- more -->


<p>Open Finder and press <code>&lt;command&gt;-k</code> to bring up the <strong>Connect to Server</strong> window.</p>

<p>Enter the URL <code>https://box.net/dav</code> and click on the <code>Connect</code> button.</p>

<p><img src="http://images.rajaseelan.com/box_net_01.png"></p>

<p>After a few seconds, you will be prompted to enter you username &amp; password. Use you existing Box userid and password.</p>

<p><img src="http://images.rajaseelan.com/box_net_02.png"></p>

<p>When successfully connected, you should see <code>box.net</code> entry in you <code>Shared</code> section of Finder, if depending on your settings, a little remote drive icon called <code>dav</code>.</p>

<p><img src="http://images.rajaseelan.com/box_net_03.png"></p>

<p>If you right click on it and choose <code>Get Info</code>, you should see something like the following image, with the format being <code>WebDAV (Secure)</code></p>

<p><img src="http://images.rajaseelan.com/box_net_04.png"></p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[How to Use a Different SSH Key for a Host]]></title>
    <link href="http://rajaseelan.com/2011/12/28/how-to-use-a-different-ssh-key-for-a-host/"/>
    <updated>2011-12-28T18:03:00+08:00</updated>
    <id>http://rajaseelan.com/2011/12/28/how-to-use-a-different-ssh-key-for-a-host</id>
    <content type="html"><![CDATA[<p>There are times when you need to use just one different SSH Key for a particular host. And you&#8217;re not allowed to add your own public key into the host&#8217;s <code>authorized_keys</code> file due to system limitations / policies etc.</p>

<p>This is where the ssh <code>config</code> file comes in handy.</p>

<!-- more -->


<p>For this example, I&#8217;ll assume you want to connect to a host called <code>db01</code> as the user admin. What you&#8217;ll need to do is:</p>

<p>Copy over the user@host&#8217;s private and public keys into your local <code>~/.ssh</code> directory.</p>

<pre><code>$ cd ~/.ssh
$ scp admin@db01:/home/admin/.ssh/id_rsa id_rsa_db01
$ scp admin@db01:/home/admin/.ssh/id_rsa.pub id_rsa_db01.pub
</code></pre>

<p><strong>Note</strong>: I copied the keys over as different filenames, <code>id_rsa_db01</code> and <code>id_rsa_db01.pub</code>. This is so you don&#8217;t overwrite your existing keys.</p>

<p>Create the ssh config file in your <code>.ssh</code> directory</p>

<pre><code>$ touch ~/.ssh/config
</code></pre>

<p>Specify the user and ssh private key file to use when connecting to the host <code>db01</code> in the <code>~/.ssh/config</code> file. Your config file should have the following contents:</p>

<pre><code>host db01
    user admin
    IdentityFile id_rsa_db01
</code></pre>

<p>Change the permissions of the ssh keys to read-only, and the ssh config file to be read-write only by you.</p>

<pre><code>$ chmod 400 ~/.ssh/id_rsa_db01*
$ chmod 600 !/.ssh/config
</code></pre>

<p>The ssh config file has some pretty powerful options, and more can be read by typing <code>man ssh_config</code>.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[How to Change Passwords in Linux Using a Shell Script]]></title>
    <link href="http://rajaseelan.com/2011/12/28/how-to-change-passwords-in-linux-using-a-shell-script/"/>
    <updated>2011-12-28T01:42:00+08:00</updated>
    <id>http://rajaseelan.com/2011/12/28/how-to-change-passwords-in-linux-using-a-shell-script</id>
    <content type="html"><![CDATA[<p>There are times when you would need to change the local user password for a whole bunch of Linux machines at one go. If they weren&#8217;t using the a directory service like NIS or LDAP, you&#8217;d be in for a lot of pain.</p>

<p>Fortunately, the <code>passwd</code> command comes with a handy option that allows this relatively insecure method.</p>

<!-- more -->


<p>Let&#8217;s assume you want to change the password for a system account called <code>webapp450</code> on 5 servers, named <code>web001, web002, web003, database001</code> and <code>database002</code>. The <code>passwd</code> command contains a switch that allows root to receive the password via <code>stdin</code>.</p>

<pre><code># passwd --stdin
</code></pre>

<p>What you could do is use the <code>echo</code> command to pipe the new password in. E.g.</p>

<pre><code># echo 'newpassword' | passwd --stdin webapp450
</code></pre>

<p>Now, we can add this into a script:</p>

<pre><code>#!/bin/bash
# chgpasswd.sh
export HISTIGNORE="*passwd*"
echo 'newpassword' | passwd --stdin webapp450
</code></pre>

<p>I created a bash script called <code>chgpasswd.sh</code> and changed its permissions to <code>700</code>, so only root could read &amp; execute it. For a little added security, I even added the bash <code>HISTIGNORE</code> command, that ignores any line containing the word <em>passwd</em>, so it doesn&#8217;t get added to the bash history file.</p>

<p>I then dumped it in a directory that was shared among those 5 hosts (<code>/shared</code>) and ran it via ssh.</p>

<p>As a final bit of automation, I ran in using the following bash for loop:</p>

<pre><code>$ for machine in web001 web002 web003 database001 database002; do ssh root@$machine '/shared/chgpasswd.sh'; done
</code></pre>

<p><em>Note</em>: This method is highly insecure, and should be only used if you know what you&#8217;re doing.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Mac OS X Lion Change Hostname]]></title>
    <link href="http://rajaseelan.com/2011/12/27/mac-os-x-lion-change-hostname/"/>
    <updated>2011-12-27T18:54:00+08:00</updated>
    <id>http://rajaseelan.com/2011/12/27/mac-os-x-lion-change-hostname</id>
    <content type="html"><![CDATA[<p>How to change your hostname in Mac OSX Lion</p>

<!-- more -->


<p>By default, you get the horribly user friendly Mac hostname in the terminal. To change that, do the following as root:</p>

<pre><code>scutil --set HostName hostname_you_like
</code></pre>

<p>Of course, replace <code>hostname_you_like</code> with something you want. Source: <a href="http://blog.psyrendust.com/2008/05/23/change-the-hostname-in-mac-os-x-osx/">Larry Gordon</a>.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Migrated to Webfaction]]></title>
    <link href="http://rajaseelan.com/2011/12/27/migrated-to-webfaction/"/>
    <updated>2011-12-27T10:59:00+08:00</updated>
    <id>http://rajaseelan.com/2011/12/27/migrated-to-webfaction</id>
    <content type="html"><![CDATA[<p>FInally migrated to <a href="http://www.webfaction.com?affiliate=rajaseelan">Webfaction</a>. Whoa, for a static HTML only blog, load times have finally decreased dramatically.</p>

<p><img class="left" src="http://images.rajaseelan.com/blog_load_times.png" title="Blog Load Times, Lower is Better" ></p>

<p>Check out the difference in load times, based on Google Analytics&#8217; site speed. I migrated to Octopress on the 19th of December, shaving load times from a peak of 16 seconds!! to 2 seconds. Moving to Webfaction made it 0.9 seconds :)</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Fedora 16 Virt Manager Stuck at Connecting]]></title>
    <link href="http://rajaseelan.com/2011/12/20/fedora-16-virt-manager-stuck-at-connecting/"/>
    <updated>2011-12-20T12:10:00+08:00</updated>
    <id>http://rajaseelan.com/2011/12/20/fedora-16-virt-manager-stuck-at-connecting</id>
    <content type="html"><![CDATA[<p>Sometimes you may see the Virt Manager for Fedora 16 stuck at the state connecting.</p>

<!-- more -->


<p>To fix this, first stop the <code>libvirtd</code> service.</p>

<pre><code># systemctld stop libvirtd.service
</code></pre>

<p>Then in a terminal, run</p>

<pre><code># ps -ef | grep libvirtd
</code></pre>

<p>You will see a few <code>libvirtd</code> processes running. Kill all the processes in one go using this:</p>

<pre><code># kill `pidof libvirtd`
</code></pre>

<p>Restart <code>libvirt</code></p>

<pre><code># systemctl start libvirtd.service
</code></pre>

<p>Close and reopen your Virt Manager. You should be able to connect now.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Rsync Over FTP]]></title>
    <link href="http://rajaseelan.com/2011/12/20/rsync-over-ftp/"/>
    <updated>2011-12-20T01:13:00+08:00</updated>
    <id>http://rajaseelan.com/2011/12/20/rsync-over-ftp</id>
    <content type="html"><![CDATA[<p>Mirroring a directory over ftp.</p>

<p>Unfortunately rsync doesn&#8217;t support mirroring over ftp, but thats where <a href="http://lftp.yar.ru/">lftp</a> comes in handy.</p>

<!-- more -->


<p>To recursively copy (mirror) a remote directory named <code>data</code> to a directory named <code>/ftp_mirror</code> in the current machine:</p>

<pre><code>lftp user@example.com:/pub&gt; mirror -v data /ftp_mirror
</code></pre>

<p>Where:<br/>
  * mirror: the mirror command<br/>
  * -v: the verbose flag, so you can see which file is being copied</p>

<p>To mirror a directory on your machine called <code>/data/remote_copy</code> to the remote ftp server:</p>

<pre><code>lftp user@example.com:/pub&gt; mirror -Rv /data/remote_copy .
</code></pre>

<p>Where:<br/>
  * -R: this is a <em>reverse</em> mirror, e.g Copy from local machine to remote machine<br/>
This will create a directory called <code>/pub/remote_copy</code> with the contents of the <code>/data/remote_copy</code>.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Migrated to Octopress]]></title>
    <link href="http://rajaseelan.com/2011/12/19/migrated-to-octopress/"/>
    <updated>2011-12-19T18:30:00+08:00</updated>
    <id>http://rajaseelan.com/2011/12/19/migrated-to-octopress</id>
    <content type="html"><![CDATA[<p>So I say goodbye to <a href="http://www.wordpress.org">Wordpress</a> and hello to <a href="http://octopress.org">Octopress</a>. Like it says, it does feel more <em>hackerish</em>, with the perfect amount hand-holding that <a href="https://github.com/mojombo/jekyll">jekyll</a> doesn&#8217;t give.</p>

<p>I&#8217;m lucky in the sense I didn&#8217;t actively blog that much, <em>(or a poor excuse for a blogger, depending on your POV)</em> so I had like &lt; 100 posts to migrate over. You could read more real life migration pains at <a href="http://blog.pixelingene.com/2011/09/switching-to-the-octopress-blogging-engine/">Pixel-in-Gene</a>.</p>

<p>For post conversion, I used Thomas Frössman&#8217;s <a href="https://github.com/thomasf/exitwp">exitwp</a> plugin, which is written in Python. I then removed all the cruft personal posts that served no purpose, leaving only the technical bits in.</p>

<p>The none active comments are removed, but I&#8217;ll be adding a disqus section soon.</p>

<p>For now I&#8217;ll be working on optimizing my workflow for blog publishing, possibly through rsync, or maybe git.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[lftp Fatal error: Certificate verification: Not trusted]]></title>
    <link href="http://rajaseelan.com/2011/12/18/lftp-fatal-error-certificate-verification-not-trusted/"/>
    <updated>2011-12-18T17:23:19+08:00</updated>
    <id>http://rajaseelan.com/2011/12/18/lftp-fatal-error-certificate-verification-not-trusted</id>
    <content type="html"><![CDATA[<p>If you use <a href="http://lftp.yar.ru/">lftp</a> alot, occasionally you will encounter
sites that just use ssl to secure transmission, but don&#8217;t actually purchase a
proper SSL cert for the domain.</p>

<p>You would get the following error message:</p>

<pre><code>Fatal error: Certificate verification: Not trusted
</code></pre>

<p>If you are <em>sure</em> its really the intended site (No Man in the Middle
Attacks!), you can temporaryly disable certificate verification by the
following command at the lftp prompt:</p>

<pre><code>lftp &gt; set ssl:verify-certificate no
</code></pre>

<p>To permanently set this for lftp, you could add this to your <code>/etc/lftp.conf</code>
or in your home directory <code>~/.lfptrc</code> file.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Fedora 16 Use Sun Java JDK]]></title>
    <link href="http://rajaseelan.com/2011/12/14/fedora-16-use-sun-java-jdk/"/>
    <updated>2011-12-14T23:27:20+08:00</updated>
    <id>http://rajaseelan.com/2011/12/14/fedora-16-use-sun-java-jdk</id>
    <content type="html"><![CDATA[<p>Fedora 16 comes with OpenJDK by default. For certain application, you are
required to use the SUN JDK. This post shows you how to download and install
the latest Oracle Java Development Kit (JDK) and set Fedora to use it by
default.</p>

<p>Download the latest Java JDK from
<a href="http://www.oracle.com/technetwork/java/javase/overview/index.html">here</a>.</p>

<pre><code>http://www.oracle.com/technetwork/java/javase/overview/index.html
</code></pre>

<p>I used the tar.gz version. I choose to install it in <code>/opt</code></p>

<pre><code>tar -zxf /path/to/your/jdk/download/jdk-7u2-linux-x64.tar.gz -C /opt
</code></pre>

<p>This extracts the Java JDK to <code>/opt/jdk1.7.0_02</code></p>

<p>Use the <code>alternatives</code> command to then set this as the default java.</p>

<pre><code># /usr/sbin/alternatives --install /usr/bin/java java /opt/jdk1.7.0_02/bin/java 200
</code></pre>

<p>Where:</p>

<ul>
<li>&#8211;install - Command to add an &#8216;alternative&#8217;</li>
<li>/usr/bin/java - where the java program should be linked to</li>
<li>java - The type of &#8216;alternative&#8217; we are installing</li>
<li>/opt/jdk1.7.0_02/bin/java - The full path to the java binary</li>
<li>200 - The priority of this version, the higher the number, the higher the chance of it being used first</li>
</ul>


<p>Test this in the command line by typing</p>

<pre><code>$ java -version
java version "1.7.0_02"
Java(TM) SE Runtime Environment (build 1.7.0_02-b13)
Java HotSpot(TM) 64-Bit Server VM (build 22.0-b10, mixed mode)
</code></pre>

<p>You will now see that it uses the Oracle Java.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Fedora 16 Lighttpd enable Directory Listing]]></title>
    <link href="http://rajaseelan.com/2011/12/12/fedora-16-lighttpd-enable-directory-listing/"/>
    <updated>2011-12-12T15:33:35+08:00</updated>
    <id>http://rajaseelan.com/2011/12/12/fedora-16-lighttpd-enable-directory-listing</id>
    <content type="html"><![CDATA[<p>Directory Listing is disabled in Lighttpd on Fedora 16 by default. Sometimes
you want quick and dirty file sharing over http. Lighttpd is perfect for that.</p>

<p>First install lighttpd:</p>

<pre><code>yum install lighttpd
</code></pre>

<p>Enable directory listing in <code>/etc/lighttpd/conf.d/dirlisting.conf</code></p>

<pre><code>dir-listing.activate      = "enable"
</code></pre>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[IPTables: How to Open a Firewall Port in Linux]]></title>
    <link href="http://rajaseelan.com/2011/12/08/iptables-how-to-open-a-firewall-port-in-linux/"/>
    <updated>2011-12-08T02:06:45+08:00</updated>
    <id>http://rajaseelan.com/2011/12/08/iptables-how-to-open-a-firewall-port-in-linux</id>
    <content type="html"><![CDATA[<p>Opening a specific port in Linux / Fedora 16. This should work on all ditros
that use use iptables.</p>

<p>For example. lets open the default DNS port to allow incoming queries for
addresses.</p>

<ol>
<li>List your exising firewall rules</li>
</ol>


<pre><code>iptables -L --line-numbers -n
</code></pre>

<p>This will list the current rules you have in your firewall configuration
Sample output:-</p>

<pre><code>[root@i7 ~]# iptables -L --line-numbers -n 
Chain INPUT (policy ACCEPT)
num  target     prot opt source               destination         
1    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0            state RELATED,ESTABLISHED
2    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:22
3    ACCEPT     icmp --  0.0.0.0/0            0.0.0.0/0           
4    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           
5    REJECT     all  --  0.0.0.0/0            0.0.0.0/0            reject-with icmp-host-prohibited  
Chain OUTPUT (policy ACCEPT)
num  target     prot opt source               destination
</code></pre>

<ol>
<li>DNS Queries require a UDP packet to port 53 (by default). Since iptables rules are done on a first match basis, we&#8217;ll insert it to line 3 in the INPUT chain.</li>
<li>The command to insert the rule:-</li>
</ol>


<pre><code>iptables -I INPUT 3 --proto udp --dport 53 -j ACCEPT
</code></pre>

<ol>
<li>Where:

<ul>
<li>-I INPUT 3: <strong>Insert</strong> rule into the <strong>INPUT</strong> chain at line number <strong>3</strong></li>
<li>&#8211;proto udp: Incoming Packets that are of the <strong>UDP Protocol</strong></li>
<li>&#8211;dport 53: Packets destined for <strong>port 53</strong></li>
<li>-j ACCEPT: <strong>Jump</strong> to the <strong>ACCEPT</strong> chain (let the packet through)</li>
</ul>
</li>
<li>When you list the iptables rules again, It should show the new rule in line number 3 of the input chain.</li>
</ol>


<pre><code>[root@i7 ~]# iptables -L --line-numbers -n 
Chain INPUT (policy ACCEPT)
num  target     prot opt source               destination         
1    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0            state RELATED,ESTABLISHED
2    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:22
3    ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0            udp dpt:53
4    ACCEPT     icmp --  0.0.0.0/0            0.0.0.0/0           
5    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           
6    REJECT     all  --  0.0.0.0/0            0.0.0.0/0            reject-with icmp-host-prohibited  
Chain OUTPUT (policy ACCEPT)
num  target     prot opt source               destination
</code></pre>

<ol>
<li>Remember to then save your rules, else the next time the service is rebooted, your changes will be lost.</li>
</ol>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Fedora 16 Configure Network Interface with Static IP Address]]></title>
    <link href="http://rajaseelan.com/2011/12/05/fedora-16-configure-network-interface-with-static-ip-address/"/>
    <updated>2011-12-05T21:04:06+08:00</updated>
    <id>http://rajaseelan.com/2011/12/05/fedora-16-configure-network-interface-with-static-ip-address</id>
    <content type="html"><![CDATA[<p>This post is just a reminder to myself. Due to the new Fedora <a href="http://fedoraproject.org/wiki/Features/ConsistentNetworkDeviceNaming">Consistent
Network Device
Naming</a>,
a quick guide to how to &#8216;release&#8217; it from the hassle of Network Manager.</p>

<ol>
<li>Determine the name of your device</li>
</ol>


<pre><code>[root@i7 ~]# ifconfig 
lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:424 errors:0 dropped:0 overruns:0 frame:0
          TX packets:424 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:31696 (30.9 KiB)  TX bytes:31696 (30.9 KiB)  
p34p1     Link encap:Ethernet  HWaddr 20:CF:30:0F:37:4A  
          inet addr:192.168.0.10  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::22cf:30ff:fe0f:374a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:297754 errors:0 dropped:0 overruns:0 frame:0
          TX packets:190679 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:426415608 (406.6 MiB)  TX bytes:15724959 (14.9 MiB)
          Interrupt:69 Base address:0x6000 
</code></pre>

<p>In my case, the device is called <em>p34p1</em>.</p>

<ol>
<li>Create a file in <code>/etc/sysconfig/network-scripts</code> called <code>ifcfg-p34p1</code></li>
<li>Contents of file:</li>
</ol>


<pre><code>DEVICE=p34p1
IPADDR=192.168.0.10
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
HWADDR=20:CF:30:0F:37:4A
DNS1=192.168.0.1
ONBOOT=yes
NAME=Wired_Connection
BOOTPROTO=none
NM_CONTROLLED=no
</code></pre>

<ol>
<li>Important points to note:

<ul>
<li><strong>NM_CONTROLLED=no</strong>: Tell NetworkManager not to control this device</li>
<li><strong>DNS1=192.168.0.1</strong>: The DNS Server to use</li>
<li><strong>HWADDR</strong>: The MAC address of the NIC</li>
</ul>
</li>
</ol>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Fedora 16 Save iptables rules]]></title>
    <link href="http://rajaseelan.com/2011/12/05/fedora-16-save-iptables-rules/"/>
    <updated>2011-12-05T20:47:39+08:00</updated>
    <id>http://rajaseelan.com/2011/12/05/fedora-16-save-iptables-rules</id>
    <content type="html"><![CDATA[<p>Not sure if this is a bug only I stumbled upon, or im doing it wrongly, but
when you try to save iptables rules in Fedora 16, you get this:- <code>
[root@fedora ~]# service iptables save Redirecting to /bin/systemctl save
iptables.service Unknown operation save</code></p>

<!-- more -->


<p><strong>Solution:</strong> <code>[root@fedora ~]# iptables-save &gt; /etc/sysconfig/iptables</code><br/>
Well, Fedora 16 has migrated more of its services to
<a href="http://fedoraproject.org/wiki/Systemd">Systemd</a>, so trying to do a save
redirects it to systemctl save iptables.service. :|</p>

<p>Looking at the <a href="http://docs.fedoraproject.org/en-%0AUS/Fedora/16/html/Security_Guide/sect-Security_Guide-IPTables-%0ASaving_IPTables_Rules.html">Fedora 16 Security Guide</a>, either they didn&#8217;t spot the error, or I&#8217;m doing
something completely wrong.</p>

<p>Anyway, it showed me another command: <code>/sbin/iptables-save</code> which did what I
wanted.</p>

<p>So what I did was pipe it back to <code>/etc/sysconfig/iptables</code> and then we all
lived happily ever after. :)</p>
]]></content>
  </entry>
  
</feed>

