<?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>ITSA Blog &#187; Tip of the day!</title>
	<atom:link href="http://itsecureadmin.com/category/totd/feed/" rel="self" type="application/rss+xml" />
	<link>http://itsecureadmin.com</link>
	<description>Life as an Open Source Solutions Architect</description>
	<lastBuildDate>Wed, 09 May 2012 16:50:05 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Proxy HTTP Requests through Nginx to Jetty6 with X-Forwarded-For</title>
		<link>http://itsecureadmin.com/2012/03/proxy-http-requests-through-nginx-to-jetty6-with-x-forwarded-for/</link>
		<comments>http://itsecureadmin.com/2012/03/proxy-http-requests-through-nginx-to-jetty6-with-x-forwarded-for/#comments</comments>
		<pubDate>Wed, 14 Mar 2012 23:37:16 +0000</pubDate>
		<dc:creator>Josh Miller, Red Hat Certified Engineer</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Open Source Software]]></category>
		<category><![CDATA[Tip of the day!]]></category>

		<guid isPermaLink="false">http://itsecureadmin.com/?p=284</guid>
		<description><![CDATA[One important part of any proxy configuration is logging the correct originating IP address on the final application log to ensure proper analytics and problem determination.  Note that at times, it&#8217;s very useful to log the proxy or load balancer IP at the application server to determine where an issue may be occurring but [...]]]></description>
			<content:encoded><![CDATA[<p>One important part of any proxy configuration is logging the correct originating IP address on the final application log to ensure proper analytics and problem determination.  Note that at times, it&#8217;s very useful to log the proxy or load balancer IP at the application server to determine where an issue may be occurring but for the most part, the original IP address is desired in the application log.</p>
<p>This example is using;</p>
<ul>
<li>Amazon Linux (as of 2012-03)</li>
<li>nginx-0.8.54-1.4.amzn1.x86_64</li>
<li>jetty6-6.1.14-1.jpp5.noarch from jpackage.org</ul>
</li>
</ul>
<p>Perform the following steps:</p>
<ol>
<li>Install and configure nginx to proxy all requests to localhost port 8080.</li>
<pre>
       location / {
                proxy_pass   http://127.0.0.1:8080;
        }
</pre>
<li>Install and configure jetty6, using all default options.</li>
<li>Configure nginx to set the proxy header values for X-Forwarded-For</li>
<pre>
       location / {
                proxy_set_header X-Real-IP       $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header Host            $host;
                proxy_pass   http://127.0.0.1:8080;
        }
</pre>
<li>Configure Jetty to log the X-Forwarded-For IP in /etc/jetty6/jetty.xml under the RequestLog section</li>
<p><code><br />
        ...<br />
          &lt;Set name="LogTimeZone"&gt;GMT&lt;/Set&gt;<br />
          &lt;Set name="PreferProxiedForAddress"&gt;true&lt;/Set&gt;<br />
        &lt;/New&gt;<br />
        ...<br />
</code></p>
<li>Once that is complete, restart both nginx and jetty to test.</li>
<pre>
sudo /etc/init.d/nginx restart
sudo /etc/init.d/jetty6 restart
</pre>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://itsecureadmin.com/2012/03/proxy-http-requests-through-nginx-to-jetty6-with-x-forwarded-for/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>List MySQL Table Space Consumption</title>
		<link>http://itsecureadmin.com/2011/12/list-mysql-table-space-consumption/</link>
		<comments>http://itsecureadmin.com/2011/12/list-mysql-table-space-consumption/#comments</comments>
		<pubDate>Thu, 15 Dec 2011 18:44:12 +0000</pubDate>
		<dc:creator>Josh Miller, Red Hat Certified Engineer</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Open Source Software]]></category>
		<category><![CDATA[Tip of the day!]]></category>

		<guid isPermaLink="false">http://itsecureadmin.com/2011/12/list-mysql-table-space-consumption/</guid>
		<description><![CDATA[Have you ever needed to print out a list of each table within MySQL and how much space was consumed?
Try this to list the top 20 space offenders:

SELECT engine, concat( table_schema, '.', table_name ) table_name,
concat( round( data_length / ( 1024 *1024 ) , 2 ) , 'M' ) data_length,
concat( round( index_length / ( 1024 *1024 [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever needed to print out a list of each table within MySQL and how much space was consumed?</p>
<p>Try this to list the top 20 space offenders:</p>
<pre>
SELECT engine, concat( table_schema, '.', table_name ) table_name,
concat( round( data_length / ( 1024 *1024 ) , 2 ) , 'M' ) data_length,
concat( round( index_length / ( 1024 *1024 ) , 2 ) , 'M' ) index_length,
concat( round( round( data_length + index_length ) / ( 1024 *1024 ) , 2 ) , 'M' ) total_size
FROM information_schema.TABLES
ORDER BY ( data_length + index_length ) DESC LIMIT 20
</pre>
<p>Taken from a comment on the mysql developer docs site:  http://dev.mysql.com/doc/refman/5.1/en/tables-table.html</p>
]]></content:encoded>
			<wfw:commentRss>http://itsecureadmin.com/2011/12/list-mysql-table-space-consumption/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bash Tip!  for loop on directory listing</title>
		<link>http://itsecureadmin.com/2010/08/bash-tip-for-loop-on-directory-listing/</link>
		<comments>http://itsecureadmin.com/2010/08/bash-tip-for-loop-on-directory-listing/#comments</comments>
		<pubDate>Tue, 24 Aug 2010 17:52:43 +0000</pubDate>
		<dc:creator>Josh Miller, Red Hat Certified Engineer</dc:creator>
				<category><![CDATA[Open Source Software]]></category>
		<category><![CDATA[Tip of the day!]]></category>

		<guid isPermaLink="false">http://itsecureadmin.com/?p=105</guid>
		<description><![CDATA[One very common task when scripting with bash is to use a for loop to iterate over the contents of a directory or directory tree.  There are two primary methods of accomplishing this task; using ls and using find.  We&#8217;ll not consider the manual method as that would be completely unworthy of our [...]]]></description>
			<content:encoded><![CDATA[<p>One very common task when scripting with bash is to use a for loop to iterate over the contents of a directory or directory tree.  There are two primary methods of accomplishing this task; using <code>ls</code> and using <code>find</code>.  We&#8217;ll not consider the manual method as that would be completely unworthy of our attention.</p>
<p>I find it easy to start with <code>ls</code> when I don&#8217;t need to recurse into a directory tree as that is a command that I use often.  This often turns into a process such as this:</p>
<pre>
for dir in $(ls)
do
  echo ${dir}
done
</pre>
<p>Now the above method typically does not work for me.  I have an alias setup to print out pretty colors when I issue the <code>ls</code> command and that will cause each command which operates on the variable <code>$dir</code> to fail with a &#8220;No such file or directory&#8221; error.  I always have to remember this and re-write the command with the flag to disable color formatting:</p>
<pre>
for dir in $(ls --color=never)
do
  echo ${dir}
done
</pre>
<p>The above script will work every time.</p>
<p>The next option is using <code>find</code>.  <code>find</code> is awesome and all powerful.  Learn and use <code>find</code>.  The most common issue when using find is that you may have to filter out the current and/or parent directories when processing the results.  Take this example:</p>
<pre>
for dir in $(find . -maxdepth 1 -type d)
do
  echo ${dir}
done
</pre>
<p>This loop will print out the current directory, as well as all other directories in the current working directory.  If you are running some sort of processing within this loop, you may end up re-processing everything unless you discard the current working directory (noted by the dot).</p>
<p>This example will not process the current working directory:</p>
<pre>
for dir in $(find . -maxdepth 1 -type d)
do
  if [ ${dir} == "." ]
  then
    continue
  fi
  echo ${dir}
  while pushd ${dir}
  do
    echo ${dir}
  done
  popd
done
</pre>
<p>Bash for loops are incredibly useful and easy to work with.  Use the above tips and make bash work for you.</p>
]]></content:encoded>
			<wfw:commentRss>http://itsecureadmin.com/2010/08/bash-tip-for-loop-on-directory-listing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>System Administrator Technical Interviews</title>
		<link>http://itsecureadmin.com/2010/07/system-administrator-technical-interviews/</link>
		<comments>http://itsecureadmin.com/2010/07/system-administrator-technical-interviews/#comments</comments>
		<pubDate>Thu, 08 Jul 2010 16:26:46 +0000</pubDate>
		<dc:creator>Josh Miller, Red Hat Certified Engineer</dc:creator>
				<category><![CDATA[Open Source Software]]></category>
		<category><![CDATA[Tip of the day!]]></category>
		<category><![CDATA[interviews]]></category>
		<category><![CDATA[jobs]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://itsecureadmin.com/2010/07/system-administrator-technical-interviews/</guid>
		<description><![CDATA[I have had the opportunity to interview many candidates over the past few months and have a few tips:

When indicating that you have VMware experience, clearly indicate which features you have experience with.  I have interviewed many candidates who claim to be experts on VI3/vSphere and yet have never used clustering or shared storage.
When [...]]]></description>
			<content:encoded><![CDATA[<p>I have had the opportunity to interview many candidates over the past few months and have a few tips:</p>
<ul>
<li>When indicating that you have VMware experience, clearly indicate which features you have experience with.  I have interviewed many candidates who claim to be experts on VI3/vSphere and yet have never used clustering or shared storage.</li>
<li>When asked about rating yourself from 1-5 or 1-10, make sure you understand which side is the proficient side and give an example of what you think is proficient in a particular area.</li>
</ul>
<p>My methodology is to ask the interviewee to rate themselves and then ask them what that rating means to them.  If they rate themselves a 4 out of 5 with general Linux system administration, I then ask them to give me a few examples of what somebody who has a 4/5 rating would be able to do.  I then ask them questions based on that assessment.  If you can&#8217;t win on those terms, you typically can&#8217;t win.</p>
<p>It is not my desire to stump somebody in an interview, I would prefer to ask them questions about what they have done in the past and get into a good dialogue about things they are familiar with.  Do your interviewer a favor and be very clear on the resume and during the interview process.</p>
]]></content:encoded>
			<wfw:commentRss>http://itsecureadmin.com/2010/07/system-administrator-technical-interviews/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bash Tip!  Renaming files using Bash string operations</title>
		<link>http://itsecureadmin.com/2010/01/bash-tip-renaming-files-using-bash-string-operations/</link>
		<comments>http://itsecureadmin.com/2010/01/bash-tip-renaming-files-using-bash-string-operations/#comments</comments>
		<pubDate>Thu, 07 Jan 2010 05:47:47 +0000</pubDate>
		<dc:creator>Josh Miller, Red Hat Certified Engineer</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Open Source Software]]></category>
		<category><![CDATA[Tip of the day!]]></category>

		<guid isPermaLink="false">http://itsecureadmin.com/blog/?p=44</guid>
		<description><![CDATA[To rename all html files in a particular directory to shtml files, use the following loop:
for file in *.html
do
  mv ${file} ${file%%.html}.shtml
done
This uses the ${variable%%match} format which strips the longest match from the end of the variable.
]]></description>
			<content:encoded><![CDATA[<p>To rename all html files in a particular directory to shtml files, use the following loop:</p>
<pre>for file in *.html
do
  mv ${file} ${file%%.html}.shtml
done</pre>
<p>This uses the ${variable%%match} format which strips the longest match from the end of the variable.</p>
]]></content:encoded>
			<wfw:commentRss>http://itsecureadmin.com/2010/01/bash-tip-renaming-files-using-bash-string-operations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

