<?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>sudo -s &#187; sys admin</title>
	<atom:link href="http://sudoers.org/category/sys-admin/feed/" rel="self" type="application/rss+xml" />
	<link>http://sudoers.org</link>
	<description>Got root?</description>
	<lastBuildDate>Mon, 08 Aug 2011 20:35:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Puppet apt module</title>
		<link>http://sudoers.org/2011/07/72/</link>
		<comments>http://sudoers.org/2011/07/72/#comments</comments>
		<pubDate>Sun, 31 Jul 2011 19:30:30 +0000</pubDate>
		<dc:creator>limed</dc:creator>
				<category><![CDATA[sys admin]]></category>

		<guid isPermaLink="false">http://sudoers.org/?p=72</guid>
		<description><![CDATA[Testing out the code plugin]]></description>
			<content:encoded><![CDATA[<p>Testing out the code plugin</p>
<pre class="brush: plain; title: ; notranslate">
class apt {

    file { '/etc/cron.daily/package.list':
        owner   =&gt; root,
        group   =&gt; root,
        mode    =&gt; 755,
        source  =&gt; &quot;puppet:///files/etc/cron.daily/package.list&quot;
    }

    file { &quot;/etc/apt/sources.list&quot;:
        owner   =&gt; root,
        group   =&gt; root,
        mode    =&gt; 644,
        source  =&gt; $lsbdistcodename ? {
            &quot;squeeze&quot;   =&gt; &quot;puppet:///files/etc/apt/sources.list.squeeze&quot;,
            default     =&gt; &quot;puppet:///files/etc/apt/sources.list.squeeze&quot;
        }
    }

    file { '/etc/apt/apt.conf.d/10puppet' :
        ensure  =&gt; present,
        owner   =&gt; root,
        group   =&gt; root,
        mode    =&gt; 644,
        source  =&gt; &quot;puppet:///files/etc/apt/apt.conf.d/10puppet&quot;
    }

    file { '/usr/local/sbin/check-updates':
        owner   =&gt; root,
        group   =&gt; root,
        mode    =&gt; 755,
        source  =&gt; &quot;puppet:///files/usr/local/bin/check-updates&quot;
    }

    exec { 'apt-update':
        command     =&gt; &quot;/usr/bin/apt-get -qq update&quot;,
        logoutput   =&gt; false,
        refreshonly =&gt; true,
        subscribe   =&gt; [File[&quot;/etc/apt/sources.list&quot;]]
    }

}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://sudoers.org/2011/07/72/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mail log fu</title>
		<link>http://sudoers.org/2009/07/mail-log-fu/</link>
		<comments>http://sudoers.org/2009/07/mail-log-fu/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 22:49:25 +0000</pubDate>
		<dc:creator>limed</dc:creator>
				<category><![CDATA[sys admin]]></category>

		<guid isPermaLink="false">http://sudoers.org/?p=27</guid>
		<description><![CDATA[Ever had someone go "I need you to look through the logs and get me every email address this From address sent to". Well heres how (or at least the easiest way I can think of doing it) grep "from=&#60;foo@example.com&#62;" /var/log/mail.log &#124; awk '{if ($6 != "NOQUEUE:"){print $6}}' &#124; sed 's/\://g' &#124; while read SEARCH; [...]]]></description>
			<content:encoded><![CDATA[<p>Ever had someone go "I need you to look through the logs and get me every email address this From address sent to". Well heres how (or at least the easiest way I can think of doing it)</p>
<pre>
<blockquote><code>grep "from=&lt;foo@example.com&gt;" /var/log/mail.log | awk '{if ($6 != "NOQUEUE:"){print $6}}' | sed 's/\://g' | while read SEARCH; do grep "${SEARCH}" /var/log/mail.log; done | grep "to=" | awk '{print $7}' | sed -r 's/^to=&lt;(.+)&gt;\,$/\1/g' | uniq</code></blockquote>
</pre>
<p>Here is a step by step walkthrough of whats going on</p>
<ol>
<li>We grep the from address out of the mail log</li>
<li>Pipe the output to awk and get the 6th column which is the mail id, if the 6th column doesn't start with NOQUEUE print the output</li>
<li>The output goes to sed which removes the ":" and</li>
<li>Read the output and put it into a variable and from that variable go through the mail log again</li>
<li>This time filter out the "to=" line from the mail log and print out the 7th column (which is the to address)</li>
<li>Use sed to filter out the to=&lt;&gt; line to print out the actual email addresses</li>
<li>Pass it through uniq to make sure there are no dupes</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://sudoers.org/2009/07/mail-log-fu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Checking expiration date for an SSL cert</title>
		<link>http://sudoers.org/2008/12/checking-expiration-date-for-an-ssl-cert/</link>
		<comments>http://sudoers.org/2008/12/checking-expiration-date-for-an-ssl-cert/#comments</comments>
		<pubDate>Tue, 30 Dec 2008 01:17:15 +0000</pubDate>
		<dc:creator>limed</dc:creator>
				<category><![CDATA[sys admin]]></category>

		<guid isPermaLink="false">http://sudoers.org/?p=16</guid>
		<description><![CDATA[Here is you how you check whether an SSL cert is valid and hasn't yet expired 1. Retrieve the certificate. 2. Check the expiration date of the certificate. Or you can use ssl-cert-check or check-expire]]></description>
			<content:encoded><![CDATA[<p>Here is you how you check whether an SSL cert is valid and hasn't yet expired</p>
<p>1. Retrieve the certificate.</p>
<pre class="brush: plain; title: ; notranslate">$ echo &quot;&quot; | openssl s_client -connect server:443 &gt; certificate</pre>
<p>2. Check the expiration date of the certificate.</p>
<pre class="brush: plain; title: ; notranslate">
$ openssl x509 -in certificate -noout -enddate
</pre>
<p>Or you can use <a href="http://freshmeat.net/projects/ssl-cert-check/">ssl-cert-check</a> or <a href="http://sial.org/howto/openssl/check-expire/">check-expire<br />
</a></p>
]]></content:encoded>
			<wfw:commentRss>http://sudoers.org/2008/12/checking-expiration-date-for-an-ssl-cert/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Changing permissions for all directories in folder</title>
		<link>http://sudoers.org/2008/12/changing-permissions-for-all-directories-in-folder/</link>
		<comments>http://sudoers.org/2008/12/changing-permissions-for-all-directories-in-folder/#comments</comments>
		<pubDate>Sun, 07 Dec 2008 06:57:22 +0000</pubDate>
		<dc:creator>limed</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[sys admin]]></category>

		<guid isPermaLink="false">http://sudoers.org/?p=13</guid>
		<description><![CDATA[Ever run into a situation where you have a mixture of both files and folders in a directory and you only need to change the permission of the folder? Naturally the first thing that comes to mind is to do something like this But what happens if your folders have spaces? Using find that way [...]]]></description>
			<content:encoded><![CDATA[<p>Ever run into a situation where you have a mixture of both files and folders in a directory and you only need to change the permission of the folder? Naturally the first thing that comes to mind is to do something like this</p>
<pre class="brush: plain; title: ; notranslate">find . -type d -print | xargs chmod 755</pre>
<p>But what happens if your folders have spaces? Using find that way will not escape the spaces instead the solution to this is to use find but in a slightly different manner</p>
<pre class="brush: plain; title: ; notranslate">find . -type d -print0 | xargs -0 chmod 755</pre>
<p>The -print0 tells find to terminate with zero so that whitespaces are recognized and the same goes for xargs as well.</p>
]]></content:encoded>
			<wfw:commentRss>http://sudoers.org/2008/12/changing-permissions-for-all-directories-in-folder/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Taken from Shell-fu</title>
		<link>http://sudoers.org/2008/12/taken-from-shell-fu/</link>
		<comments>http://sudoers.org/2008/12/taken-from-shell-fu/#comments</comments>
		<pubDate>Tue, 02 Dec 2008 22:20:59 +0000</pubDate>
		<dc:creator>limed</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[sys admin]]></category>

		<guid isPermaLink="false">http://sudoers.org/?p=9</guid>
		<description><![CDATA[This is taken from shell-fu.org still a pretty handy one liner though This will delete any packages that are not installed anymore which still has configuration files on the box]]></description>
			<content:encoded><![CDATA[<p>This is taken from shell-fu.org still a pretty handy one liner though</p>
<pre class="brush: plain; title: ; notranslate">aptitude search ~c | awk '{ print $2 }' | xargs aptitude -y purge</pre>
<p>This will delete any packages that are not installed anymore which still has configuration files on the box</p>
]]></content:encoded>
			<wfw:commentRss>http://sudoers.org/2008/12/taken-from-shell-fu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>deborphan and for loops</title>
		<link>http://sudoers.org/2008/12/deborphan-and-for-loops/</link>
		<comments>http://sudoers.org/2008/12/deborphan-and-for-loops/#comments</comments>
		<pubDate>Tue, 02 Dec 2008 18:29:59 +0000</pubDate>
		<dc:creator>limed</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[sys admin]]></category>

		<guid isPermaLink="false">http://sudoers.org/?p=7</guid>
		<description><![CDATA[deborphan is a package in debian that list orphaned libraries in debian. Handy for removing libraries that is no longer needed on a server. The problem with deborphan is that it only lists packages that are orphaned but doesnt remove them, so I do this: I love BASH]]></description>
			<content:encoded><![CDATA[<p>deborphan is a package in debian that list orphaned libraries in debian. Handy for removing libraries that is no longer needed on a server. The problem with deborphan is that it only lists packages that are orphaned but doesnt remove them, so I do this:</p>
<pre class="brush: plain; title: ; notranslate">
 for i in `deborphan`; do sudo aptitude remove $i; done
</pre>
<p>I love BASH <img src='http://sudoers.org/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://sudoers.org/2008/12/deborphan-and-for-loops/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

