<?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>Kudithipudi.Org &#187; Linux</title>
	<atom:link href="http://kudithipudi.org/category/technology/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://kudithipudi.org</link>
	<description>Too much time on hand!!!</description>
	<lastBuildDate>Tue, 22 May 2012 13:11:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>HOW TO : grep options to display before and after lines of matching content</title>
		<link>http://kudithipudi.org/2012/04/29/how-to-grep-options-to-display-before-and-after-lines-of-matching-content/</link>
		<comments>http://kudithipudi.org/2012/04/29/how-to-grep-options-to-display-before-and-after-lines-of-matching-content/#comments</comments>
		<pubDate>Sun, 29 Apr 2012 13:59:51 +0000</pubDate>
		<dc:creator>Vinay</dc:creator>
				<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://kudithipudi.org/?p=1408</guid>
		<description><![CDATA[For my own notes.. if you are using grep to parse through the contents of a file and want to see the preceding or proceeding content than the line that matched your query, you can use the following options preceding content for example, if I was searching for kudithipudi in a file names access.log and [...]]]></description>
			<content:encoded><![CDATA[<p>For my own notes.. if you are using grep to parse through the contents of a file and want to see the preceding or proceeding content than the line that matched your query, you can use the following options</p>
<p><strong>preceding content</strong>
<pre class="brush: plain; title: ; notranslate">grep -B NUMBER_OF_LINES_TO_DISPLAY query filename</pre>
<p>for example, if I was searching for kudithipudi in a file names access.log and want to see 2 lines prior to the match, I would use
<pre class="brush: plain; title: ; notranslate">grep -B 2 kudithipudi access.log</pre>
<p><strong>proceeding content</strong>
<pre class="brush: plain; title: ; notranslate">grep -A NUMBER_OF_LINES_TO_DISPLAY query filename</pre>
<p>for example, if I was searching for kudithipudi in a file names access.log and want to see 2 lines after the match, I would use
<pre class="brush: plain; title: ; notranslate">grep -A 2 kudithipudi access.log</pre>
<p><strong>preceding and proceeding content</strong>
<pre class="brush: plain; title: ; notranslate">grep -C NUMBER_OF_LINES_TO_DISPLAY query filename</pre>
<p>for example, if I was searching for kudithipudi in a file names access.log and want to see 2 lines before and after the match, I would use
<pre class="brush: plain; title: ; notranslate">grep -C 2 kudithipudi access.log</pre>
]]></content:encoded>
			<wfw:commentRss>http://kudithipudi.org/2012/04/29/how-to-grep-options-to-display-before-and-after-lines-of-matching-content/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HOW TO : Use templates in puppet to pass hostnames</title>
		<link>http://kudithipudi.org/2012/04/26/how-to-use-templates-in-puppet-to-pass-hostnames/</link>
		<comments>http://kudithipudi.org/2012/04/26/how-to-use-templates-in-puppet-to-pass-hostnames/#comments</comments>
		<pubDate>Fri, 27 Apr 2012 03:00:46 +0000</pubDate>
		<dc:creator>Vinay</dc:creator>
				<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://kudithipudi.org/?p=1404</guid>
		<description><![CDATA[puppet, is a configuration management framework that can be used to perform several different things to validate/configure your infrastructure. We have been using puppet for sometime at my work and have just started moving into some of the advanced uses of the tool. One of the features offered by puppet is the capability to use [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://puppetlabs.com/">puppet</a>, is a configuration management framework that can be used to perform several different things to validate/configure your infrastructure. We have been using puppet for sometime at my work and have just started moving into some of the advanced uses of the tool.</p>
<p>One of the features offered by puppet is the capability to use templates to configure different servers.</p>
<p>For example, say you want to configure an application on server ABCD, XYZ and 123. And the configuration file for all these servers is the same, other than the hostname of the server. The configuration file has to reside in /opt/application/config.conf . The config.xml file looks like this</p>
<pre class="brush: plain; title: ; notranslate">

db.name=blah
db.user=blahblah
db.hostname=XYZ
log.level=ERROR
log.location=/var/log/application
</pre>
<p>Here is how you can do it in puppet.</p>
<p>Define a module which uses a template and then configure the template to put the host specific entry in the template. Let&#8217;s name our module test_config</p>
<ul>
<li>Create the module</li>
</ul>
<ul>
<ul>
<li>cd $PUPPET_HOME/modules</li>
<li>mkdir test_config/{files,manifests,templates}</li>
</ul>
<li>Create the template</li>
<ul>
<li>cd templates</li>
<li>vi config.conf.template and add the following to the file
<pre class="brush: plain; title: ; notranslate">db.name=blah
db.user=blahblah
db.hostname=&lt;%= fqdn %&gt;
log.level=ERROR
log.location=/var/log/application </pre>
</li>
<ul>
<li>note : see how I replaced the hostname XYZ, which was specific to one server with &lt;%= fqdn %&gt;. This is one of the &#8220;facts&#8221; provided by puppet. you can get a list of all the facts by running facter on any of the puppet clients.</li>
</ul>
</ul>
<li>Configure the module to use the template. In this case, we want the module to place the file config.conf in /opt/application</li>
<ul>
<li>cd manifests</li>
<li>vi init.pp and add the following to the file
<pre class="brush: plain; title: ; notranslate">class test_config {
file { &quot;/opt/application/config.conf&quot;:
ensure =&gt; present,
owner =&gt; appuser,
group =&gt; appuser,
mode =&gt; 755,
content =&gt; template(&quot;test_config/config.conf.template&quot;),
}
}</pre>
</li>
<ul>
<li>note : There are several other options you can use for the class file.. I just gave an example of some of the common ones. Like setting the owner, group and the rights.</li>
</ul>
</ul>
<li>Finally configure the clients to use the module. In the individual node config files, include the module you just created. Here is how the config for node ABCD would look like
<pre class="brush: plain; title: ; notranslate">node ABCD {
include test_config
}</pre>
</li>
</ul>
<p>The next time the puppet client runs on host ABCD, it would create the file /opt/application/config.conf with the right hostname in the config file.</p>
]]></content:encoded>
			<wfw:commentRss>http://kudithipudi.org/2012/04/26/how-to-use-templates-in-puppet-to-pass-hostnames/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>HOW TO : Configure Jboss to use hugepages in RHEL/CentOS</title>
		<link>http://kudithipudi.org/2012/04/17/how-to-configure-jboss-to-use-hugepages-in-rhelcentos/</link>
		<comments>http://kudithipudi.org/2012/04/17/how-to-configure-jboss-to-use-hugepages-in-rhelcentos/#comments</comments>
		<pubDate>Tue, 17 Apr 2012 22:23:42 +0000</pubDate>
		<dc:creator>Vinay</dc:creator>
				<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://kudithipudi.org/?p=1374</guid>
		<description><![CDATA[Most of us worry about paging to disk (swap), but if you are running a transaction intensive application the paging that happens in RAM also starts to impact the application performance. This happens due to the size of the &#8220;block&#8221; that is used to store data in memory. Hugepages allows you to store the data [...]]]></description>
			<content:encoded><![CDATA[<p>Most of us worry about paging to disk (swap), but if you are running a transaction intensive application the paging that happens in RAM also starts to impact the application performance. This happens due to the size of the &#8220;block&#8221; that is used to store data in memory. Hugepages allows you to store the data in bigger blocks, hence reducing the need to page while interacting with the data.</p>
<p>Here is how you can enable hugepages and configure jboss (actually any Java app) to use hugepages on a RHEL/CentoOS system.</p>
<p><strong>OS CONFIGURATION</strong></p>
<ol>
<li>Check if your system is capable of supporting hugepages by running
<pre class="brush: plain; title: ; notranslate">grep HUGETLB /boot/config-`uname -r`</pre>
<p>If you see the response as below, you should be good
<pre class="brush: plain; title: ; notranslate">CONFIG_HUGETLBFS=y
CONFIG_HUGETLB_PAGE=y
</pre>
</li>
</ol>
<ul>
<li>Next check if huge pages are already being used by running
<pre class="brush: plain; title: ; notranslate">cat /proc/sys/vm/nr_hugepages </pre>
</li>
</ul>
<ol>
<li>If the response is anything other than 0, that means hugepages have already been configured.</li>
</ol>
<ul>
<li>Find the block size for hugepages by running
<pre class="brush: plain; title: ; notranslate">cat /proc/meminfo | grep -i hugepagesize </pre>
</li>
<li>Calculate the amount of memory you want to dedicate to hugepages. (note: memory allocated to hugepages cannot be used by other processes in the system, unless they are configured to use it)</li>
</ul>
<ol>
<li>For example, I want to dedicate 3GB of RAM for hugepages. So the number of hugepages would be
<pre class="brush: plain; title: ; notranslate">(3*1024*1024)/2048</pre>
</li>
</ol>
<ul>
<li>Configure the number of hugepages on the system by editing the /etc/sysctl.conf and adding the option
<pre class="brush: plain; title: ; notranslate">vm.nr_hugepages = 1536</pre>
<p>(note: I put in 1536 since that was the value I got from the above example)</li>
<li>Restart the server and check if hugepages has been enabled by running
<pre class="brush: plain; title: ; notranslate">cat /proc/meminfo | grep -i huge </pre>
</li>
</ul>
<ol>
<li>You should see something like this
<pre class="brush: plain; title: ; notranslate">AnonHugePages:    839680 kB
HugePages_Total:    1500
HugePages_Free:     1500
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
</pre>
</li>
</ol>
<p><strong>JBOSS CONFIGURATION</strong></p>
<ol>
<li>At this point your system is configured with hugepages and any application that is configured to use them can leverage them.  In this example, we want to configure Jboss to utilize these hugepages</li>
<li>Add the groupid of the user that Jboss is running under to the /etc/sysctl.conf file. In my case, the jboss user group had a GID of 505, so I added this line to /etc/sysctl.conf
<pre class="brush: plain; title: ; notranslate">vm.hugetlb_shm_group = 505 </pre>
</li>
<li>Next allocate the memory to the user by editing /etc/security/limits.conf and allocating the memory. Again, in my case, I added the following to /etc/security/limits.conf
<pre class="brush: plain; title: ; notranslate"># Allocate memory for Jboss user to take advantage of hugepages
jboss   soft    memlock 1500
jboss   hard    memlock 1500
</pre>
</li>
<li>Finally add the following to the Jboss startup parameters. I edited the $JBOSS_HOME/bin/run.sh file. (note: the startup file can be different based on your config) with the option
<pre class="brush: plain; title: ; notranslate"> -XX:+UseLargePages</pre>
</li>
<li>Restart Jboss and you are good to go</li>
</ol>
<p>note : A lot articles that I read online say that hugepages are effective when you are allocating large amounts of RAM to the application. The use case of just using 3GB above was just that.. a use case.</p>
<p>While I cannot personally vouch for it, a lot of users have noted that they saw &gt;2 fold increase in performance.</p>
]]></content:encoded>
			<wfw:commentRss>http://kudithipudi.org/2012/04/17/how-to-configure-jboss-to-use-hugepages-in-rhelcentos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HOW TO : Install RPM packages without checking gpg key</title>
		<link>http://kudithipudi.org/2012/04/16/how-to-install-rpm-packages-without-checking-pgp-key/</link>
		<comments>http://kudithipudi.org/2012/04/16/how-to-install-rpm-packages-without-checking-pgp-key/#comments</comments>
		<pubDate>Mon, 16 Apr 2012 22:07:58 +0000</pubDate>
		<dc:creator>Vinay</dc:creator>
				<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://kudithipudi.org/?p=1364</guid>
		<description><![CDATA[This is on RHEL and CentOS distros. If you want to install packages without checking the GPG key (hope you know why you are doing this!!), here is the command line option]]></description>
			<content:encoded><![CDATA[<p>This is on RHEL and CentOS distros. If you want to install packages without checking the GPG key (hope you know why you are doing this!!), here is the command line option</p>
<pre class="brush: plain; title: ; notranslate">sudo yum install package_to_install --nogpgcheck </pre>
]]></content:encoded>
			<wfw:commentRss>http://kudithipudi.org/2012/04/16/how-to-install-rpm-packages-without-checking-pgp-key/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>HOW TO : Check number of processes (including threads) being run/executed by a user in Linux</title>
		<link>http://kudithipudi.org/2012/04/11/how-to-check-number-of-processes-including-threads-being-runexecuted-by-a-user-in-linux/</link>
		<comments>http://kudithipudi.org/2012/04/11/how-to-check-number-of-processes-including-threads-being-runexecuted-by-a-user-in-linux/#comments</comments>
		<pubDate>Wed, 11 Apr 2012 23:50:23 +0000</pubDate>
		<dc:creator>Vinay</dc:creator>
				<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://kudithipudi.org/?p=1358</guid>
		<description><![CDATA[Quick how to for finding out the list of processes, including threads spawned by these processes Explanation of the options e : Select all processes L : Show threads f : Extra full format]]></description>
			<content:encoded><![CDATA[<p>Quick how to for finding out the list of processes, including threads spawned by these processes</p>
<pre class="brush: plain; title: ; notranslate"> ps -eLf | grep USERNAME </pre>
<p>Explanation of the options</p>
<ul>
<li>e : Select all processes</li>
<li>L : Show threads</li>
<li>f : Extra full format</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://kudithipudi.org/2012/04/11/how-to-check-number-of-processes-including-threads-being-runexecuted-by-a-user-in-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HOW TO : Log all commands issued in shell to syslog</title>
		<link>http://kudithipudi.org/2012/04/05/how-to-log-all-commands-issued-in-shell-to-syslog/</link>
		<comments>http://kudithipudi.org/2012/04/05/how-to-log-all-commands-issued-in-shell-to-syslog/#comments</comments>
		<pubDate>Thu, 05 Apr 2012 23:41:07 +0000</pubDate>
		<dc:creator>Vinay</dc:creator>
				<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://kudithipudi.org/?p=1329</guid>
		<description><![CDATA[Inspired from this blog post by Vaidas Jablonskis.  This tip has been tested on Redhat and Centos distributions. If you ever wanted to log all the commands issued by users on a server, you can edit the default profile configuration to enable this Edit /etc/bashrc file and add the following at the end of the [...]]]></description>
			<content:encoded><![CDATA[<p>Inspired from <a href="http://jablonskis.org/2011/howto-log-bash-history-to-syslog/">this</a> blog post by <a href="https://plus.google.com/112500968398778336156">Vaidas Jablonskis</a>.  This tip has been tested on Redhat and Centos distributions.</p>
<p>If you ever wanted to log all the commands issued by users on a server, you can edit the default profile configuration to enable this</p>
<ul>
<li>Edit /etc/bashrc file and add the following at the end of the file
<pre class="brush: plain; title: ; notranslate">PROMPT_COMMAND='history -a &gt;(logger -t &quot;$USER[$$] $SSH_CONNECTION&quot;)' </pre>
</li>
<li>Log out and log back into your session</li>
<li>Now all your commands are logged in the default log file (/var/log/messages)</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://kudithipudi.org/2012/04/05/how-to-log-all-commands-issued-in-shell-to-syslog/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Project Uptime : Progress Report 5 : Getting ready for Reddit and Hacker News</title>
		<link>http://kudithipudi.org/2012/04/02/project-uptime-progress-report-5-getting-ready-for-reddit-and-hacker-news/</link>
		<comments>http://kudithipudi.org/2012/04/02/project-uptime-progress-report-5-getting-ready-for-reddit-and-hacker-news/#comments</comments>
		<pubDate>Tue, 03 Apr 2012 02:03:30 +0000</pubDate>
		<dc:creator>Vinay</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://kudithipudi.org/?p=1318</guid>
		<description><![CDATA[A very timely post on Hacker News by Ewan Leith about configuring a low end server to take ~11million hits/per month gave me some more ideas on optimizing the performance of this website. Ewan used a combination of nginx and varnish to get the server to respond to such traffic. From my earlier post, you [...]]]></description>
			<content:encoded><![CDATA[<p>A very <a href="http://news.ycombinator.com/item?id=3775715">timely post</a> on <a href="http://news.ycombinator.com">Hacker News</a> by <a href="http://www.ewanleith.com">Ewan Leith</a> about configuring a low end server to take ~11million hits/per month gave me some more ideas on optimizing the performance of this website. Ewan used a combination of <a href="htt://nginx.org">nginx</a> and <a href="https://www.varnish-cache.org/">varnish</a> to get the server to respond to such traffic.</p>
<p>From my <a href="http://kudithipudi.org/2012/03/05/project-uptime/">earlier post</a>, you might recall, that I planned on checking out nginx as the web server, but then ended up using <a href="http://kudithipudi.org/2012/03/28/project-uptime-progress-report-3/">Apache</a>. My earlier stack looked like this <img class="aligncenter" title="Stack - Old" src="http://farm8.staticflickr.com/7059/6894483670_4f80897e59_n_d.jpg" alt="" width="320" height="228" />Based on the recommendations from Ewan&#8217;s article, I decided to add Varnish to the picture. So here is how the stack looks currently<img class="aligncenter" title="Stack - New" src="http://farm8.staticflickr.com/7188/6894483686_dbd524fedb_n_d.jpg" alt="" width="320" height="228" /></p>
<p>And boy, did the performance improve or what. Here are some before and after performance charts based on a test run from <a href="http://blitz.io">blitz.io</a>. The test lasted for 60 seconds and was for 250 simultaneous connections.</p>
<p><strong>BEFORE</strong></p>
<ul>
<li>Screenshot of Response times and hit rates. Note that the server essentially stopped responding 25 minutes into the test. <img class="aligncenter" title="Pre Varnish" src="http://farm8.staticflickr.com/7085/7039058711_ec1ee1d2de_z_d.jpg" alt="" width="640" height="550" /></li>
<li>Screenshot of the analysis summary. 84% error rate!! <img class="aligncenter" title="Pre Varnish - 2" src="http://farm8.staticflickr.com/7241/7039058741_24785181aa_z_d.jpg" alt="" width="640" height="220" /></li>
</ul>
<p><strong>AFTER</strong></p>
<ul>
<li>Screenshot of response times and hit rates<img class="aligncenter" title="Post Varnish - 1" src="http://farm8.staticflickr.com/7126/7039058817_7a2bacb17a_z_d.jpg" alt="" width="640" height="552" /></li>
<li>Screenshot of summary of Analysis. 99.98% success rate!!<img class="aligncenter" title="Post Varnish - 2" src="http://farm8.staticflickr.com/7125/7039058847_26f9765f78_z_d.jpg" alt="" width="640" height="200" /></li>
</ul>
<p>&nbsp;</p>
<p>What a difference!!.. The server in fact stopped responding after the first test and had to be hard rebooted.  So how did I achieve it? By mostly copying the ideas from Ewan <img src='http://kudithipudi.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . The final configuration for serving the web pages looks like this on the server end</p>
<p>Varnish (listens on TCP 80) &#8211;&gt; Apache (listens on TCP 8080)</p>
<p><strong>NOTE :</strong> All the configuration guides (as with the previous entries of the posts in this series) are specific to Ubuntu.</p>
<ol>
<li>Configure Apache to listen on port 8080</li>
<ol>
<li>Stop Apache
<pre class="brush: plain; title: ; notranslate"> sudo service apache2 stop </pre>
</li>
<li>Edit the following files to change the default port from 80 to 8080</li>
<ol>
<li>/etc/apache2/ports.conf</li>
<ol>
<li>Change
<pre class="brush: plain; title: ; notranslate">NameVirtualHost *:80
Listen 80
</pre>
</li>
<li>to
<pre class="brush: plain; title: ; notranslate">NameVirtualHost *:8080
Listen 8080
</pre>
</li>
</ol>
<li>/etc/apache2/sites-available/default.conf (NOTE: This is the default sample site that comes with the package. You can create a new one for your site.  If you do so, you need to edit your site specific conf file)</li>
<ol>
<li>Change
<pre class="brush: plain; title: ; notranslate"> &lt;VirtualHost *:80&gt; </pre>
</li>
<li>To
<pre class="brush: plain; title: ; notranslate">&lt;VirtualHost *:8080&gt; </pre>
</li>
</ol>
</ol>
<li>Restart apache and ensure that it is listening on port 8080 by using this <a href="http://kudithipudi.org/2011/01/26/how-to-find-out-which-network-port-a-program-is-using-in-linux/">trick</a>.</li>
</ol>
<li>Install Varnish and configure it to listen on port 80</li>
<ol>
<li>Add the Varnish repository to the system and install the package
<pre class="brush: plain; title: ; notranslate">sudo curl http://repo.varnish-cache.org/debian/GPG-key.txt | apt-key add -
sudo echo &quot;deb http://repo.varnish-cache.org/ubuntu/ lucid varnish-3.0&quot; &gt;&gt; /etc/apt/sources.list
sudo apt-get update
sudo apt-get install varnish
</pre>
</li>
<li>Configure Varnish to listen on port 80 and use 64Mb of RAM for caching. (<strong>NOTE:</strong> Varnish uses port 8080 to get to the backend, in this case Apache, by default. So there is no need to configure it specifically).</li>
<ol>
<li>Edit the file /etc/default/varnish</li>
<ol>
<li>Change
<pre class="brush: plain; title: ; notranslate">DAEMON_OPTS=&quot;-a :6081 \
-T localhost:6082 \
-f /etc/varnish/default.vcl \
-S /etc/varnish/secret \
-s malloc,256m&quot;
</pre>
</li>
<li>To
<pre class="brush: plain; title: ; notranslate"> DAEMON_OPTS=&quot;-a :80 \
-T localhost:6082 \
-f /etc/varnish/default.vcl \
-S /etc/varnish/secret \
-s malloc,64m&quot;
</pre>
</li>
</ol>
</ol>
<li>Restart Varnish
<pre class="brush: plain; title: ; notranslate">sudo service varnish restart</pre>
<p>and you are ready to rock and roll.</li>
</ol>
</ol>
<p>There are some issues with this setup in terms of logging. Unlike your typical web server logs, where every request is logged, I noticed that not all the requests were being logged. I guess, that is because varnish is serving the content from cache. I have to figure out how to get that working. But that is for another post <img src='http://kudithipudi.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
]]></content:encoded>
			<wfw:commentRss>http://kudithipudi.org/2012/04/02/project-uptime-progress-report-5-getting-ready-for-reddit-and-hacker-news/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>HOW TO : List files that don&#8217;t contain a string using find and grep</title>
		<link>http://kudithipudi.org/2012/03/30/how-to-list-files-that-dont-contain-a-string-using-find-and-grep/</link>
		<comments>http://kudithipudi.org/2012/03/30/how-to-list-files-that-dont-contain-a-string-using-find-and-grep/#comments</comments>
		<pubDate>Fri, 30 Mar 2012 20:32:34 +0000</pubDate>
		<dc:creator>Vinay</dc:creator>
				<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://kudithipudi.org/?p=1308</guid>
		<description><![CDATA[If you run into a situation, where you need to search through a bunch of files and print the names of the files that don&#8217;t contain a particular string, here is how you do it in Linux The -L option for grep does this (according to the manual) Suppress normal output; instead print the name [...]]]></description>
			<content:encoded><![CDATA[<p>If you run into a situation, where you need to search through a bunch of files and print the names of the files that don&#8217;t contain a particular string, here is how you do it in Linux</p>
<pre class="brush: plain; title: ; notranslate">find -name PATTERN_FOR_FILE_NAMES | xargs grep -L STRING_YOU_ARE_SEARCHING_FOR </pre>
<p>The -L option for grep does this (according to the manual)</p>
<blockquote><p>Suppress normal output; instead print the name of each input file from which no output would normally have been printed.  The scanning will stop on the first match.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://kudithipudi.org/2012/03/30/how-to-list-files-that-dont-contain-a-string-using-find-and-grep/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HOW TO : Capture all traffic to and from a host using tcpdump</title>
		<link>http://kudithipudi.org/2012/03/30/how-to-capture-all-traffic-to-and-from-a-host-using-tcpdump/</link>
		<comments>http://kudithipudi.org/2012/03/30/how-to-capture-all-traffic-to-and-from-a-host-using-tcpdump/#comments</comments>
		<pubDate>Fri, 30 Mar 2012 15:59:02 +0000</pubDate>
		<dc:creator>Vinay</dc:creator>
				<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Networking]]></category>

		<guid isPermaLink="false">http://kudithipudi.org/?p=1303</guid>
		<description><![CDATA[Quick one liner for capturing traffic destined to and arriving from a host (IP address) using tcpdump and writing it to a file for analyzing later on]]></description>
			<content:encoded><![CDATA[<p>Quick one liner for capturing traffic destined to and arriving from a host (IP address) using tcpdump and writing it to a file for analyzing later on</p>
<pre class="brush: plain; title: ; notranslate">tcpdump -s0 host x.x.x.x -w destination.pcap </pre>
]]></content:encoded>
			<wfw:commentRss>http://kudithipudi.org/2012/03/30/how-to-capture-all-traffic-to-and-from-a-host-using-tcpdump/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Project Uptime : Progress Report &#8211; 4</title>
		<link>http://kudithipudi.org/2012/03/29/project-uptime-progress-report-4/</link>
		<comments>http://kudithipudi.org/2012/03/29/project-uptime-progress-report-4/#comments</comments>
		<pubDate>Thu, 29 Mar 2012 05:26:51 +0000</pubDate>
		<dc:creator>Vinay</dc:creator>
				<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://kudithipudi.org/?p=1295</guid>
		<description><![CDATA[Continuing to lock down the server as part of project uptime a bit more.. I highly recommend enabling and using iptables on every Linux server. I want to restrict inbound traffic to the server to only SSH (tcp port 22) and HTTP(S) (tcp port 80/443). Here&#8217;s the process Check the current rules on the server [...]]]></description>
			<content:encoded><![CDATA[<p>Continuing to lock down the server as part of <a href="http://kudithipudi.org/2012/03/05/project-uptime/">project uptime</a> a bit more.. I highly recommend enabling and using <a href="http://www.netfilter.org/">iptables</a> on every Linux server. I want to restrict inbound traffic to the server to only SSH (tcp port 22) and HTTP(S) (tcp port 80/443). Here&#8217;s the process</p>
<p>Check the current rules on the server</p>
<pre class="brush: plain; title: ; notranslate">sudo iptables -L </pre>
<p>Add rules to allow SSH, HTTP and HTTPS traffic and all traffic from the loopback interface</p>
<pre class="brush: plain; title: ; notranslate">sudo iptables -I INPUT -i lo -j ACCEPT
sudo iptables -A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A INPUT -p tcp --dport ssh -j ACCEPT
sudo iptables -A INPUT -p tcp --dport http -j ACCEPT
sudo iptables -A INPUT -p tcp --dport https -j ACCEPT
</pre>
<p>Drop any traffic that doesn&#8217;t match the above mentioned criteria</p>
<pre class="brush: plain; title: ; notranslate">sudo iptables -A INPUT -j DROP </pre>
<p>save the config and create script for the rules to survive reboots by running</p>
<pre class="brush: plain; title: ; notranslate">sudo su -
iptables-save &gt; /etc/firewall.rules</pre>
<p>now create a simple script that will load these rules during startup. Ubuntu provides a pretty neat way to do this. You can write a simple script and place it in /etc/network/if-pre-up.d and the system will execute this before bringing up the interfaces. You can get pretty fancy with this, but here is a simple scrip that I use</p>
<pre class="brush: plain; title: ; notranslate">
samurai@samurai:/etc/network/if-pre-up.d$ cat startfirewall
#!/bin/bash

# Import iptables rules if the rules file exists

if [ -f /etc/firewall.rules ]; then
iptables-restore &lt;/etc/firewall.rules
fi

exit 0
</pre>
<p>Now you can reboot the server and check if your firewall rules are still in effect by running</p>
<pre class="brush: plain; title: ; notranslate">sudo iptables -L </pre>
]]></content:encoded>
			<wfw:commentRss>http://kudithipudi.org/2012/03/29/project-uptime-progress-report-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

