<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>paluminum.net|blog</title>
	
	<link>http://paluminum.net/blog</link>
	<description>Projects, Code, My hobbies</description>
	<pubDate>Thu, 15 Jan 2009 17:14:33 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/paluminum" /><feedburner:info uri="paluminum" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Deny SCM directories with apache</title>
		<link>http://feedproxy.google.com/~r/paluminum/~3/KhK8gbDhyWE/deny-scm-directories-with-apache</link>
		<comments>http://paluminum.net/blog/deny-scm-directories-with-apache#comments</comments>
		<pubDate>Thu, 15 Jan 2009 17:14:33 +0000</pubDate>
		<dc:creator>ryan</dc:creator>
		
		<category><![CDATA[posts]]></category>

		<category><![CDATA[apache]]></category>

		<category><![CDATA[git]]></category>

		<category><![CDATA[hg]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[scm]]></category>

		<category><![CDATA[scripts]]></category>

		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://paluminum.net/blog/?p=31</guid>
		<description><![CDATA[
I use Mercurial (hg) and git to manage a few of my personal projects.  Some of those projects are exposed to the web (my site, for example).  I don&#8217;t want the .hg/ and .git/ directories to be available to people via apache, there is no reason (especially since i&#8217;m not hosting those repos [...]
]]></description>
			<content:encoded><![CDATA[<p>I use <a href="http://www.selenic.com/mercurial/wiki/">Mercurial</a> (hg) and <a href="http://git.or.cz">git</a> to manage a few of my personal projects.  Some of those projects are exposed to the web (my site, for example).  I don&#8217;t want the .hg/ and .git/ directories to be available to people via apache, there is no reason (especially since i&#8217;m not hosting those repos publicly).  I wanted a sitewide solution to deny access to those directories, and I figured blocking .svn would be worthwhile while I was at it.</p>
<p>I run debian on my VPS, so these instructions will be targeted towards how debian (and its derivatives, like ubuntu) structure the apache configuration.  It would be trivial to adapt my solution to another distro&#8217;s configuration.</p>
<p><span id="more-31"></span><br />
I created a file called <strong>/etc/apache2/conf.d/deny-scm.conf</strong><br />
The file&#8217;s contents:</p>

<div class="wp_syntax"><div class="code"><pre class="apache apache" style="font-family:monospace;"><span style="color: #adadad; font-style: italic;">## Deny access to various scm directories</span>
<span style="color: #adadad; font-style: italic;">## by Ryan (ryan@paluminum.net) 1-15-2009</span>
&nbsp;
<span style="color: #adadad; font-style: italic;"># Deny access to .hg/ directories</span>
&lt;<span style="color: #000000; font-weight:bold;">directory</span> ~ <span style="color: #7f007f;">&quot;<span style="color: #000099; font-weight: bold;">\.</span>hg&quot;</span>&gt;
        <span style="color: #00007f;">Order</span> <span style="color: #00007f;">allow</span>,<span style="color: #00007f;">deny</span>
        <span style="color: #00007f;">deny</span> <span style="color: #00007f;">from</span> <span style="color: #00007f;">all</span>
&lt;/<span style="color: #000000; font-weight:bold;">directory</span>&gt;
&nbsp;
<span style="color: #adadad; font-style: italic;"># .git</span>
&lt;<span style="color: #000000; font-weight:bold;">directory</span> ~ <span style="color: #7f007f;">&quot;<span style="color: #000099; font-weight: bold;">\.</span>git&quot;</span>&gt;
        <span style="color: #00007f;">Order</span> <span style="color: #00007f;">allow</span>,<span style="color: #00007f;">deny</span>
        <span style="color: #00007f;">deny</span> <span style="color: #00007f;">from</span> <span style="color: #00007f;">all</span>
&lt;/<span style="color: #000000; font-weight:bold;">directory</span>&gt;
&nbsp;
<span style="color: #adadad; font-style: italic;"># .svn</span>
&lt;<span style="color: #000000; font-weight:bold;">directory</span> ~ <span style="color: #7f007f;">&quot;<span style="color: #000099; font-weight: bold;">\.</span>svn&quot;</span>&gt;
        <span style="color: #00007f;">Order</span> <span style="color: #00007f;">allow</span>,<span style="color: #00007f;">deny</span>
        <span style="color: #00007f;">deny</span> <span style="color: #00007f;">from</span> <span style="color: #00007f;">all</span>
&lt;/<span style="color: #000000; font-weight:bold;">directory</span>&gt;</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://paluminum.net/blog/deny-scm-directories-with-apache/feed</wfw:commentRss>
		<feedburner:origLink>http://paluminum.net/blog/deny-scm-directories-with-apache</feedburner:origLink></item>
		<item>
		<title>Automated Backup Scripts</title>
		<link>http://feedproxy.google.com/~r/paluminum/~3/LgpIkcqkJkM/automated-backup-scripts</link>
		<comments>http://paluminum.net/blog/automated-backup-scripts#comments</comments>
		<pubDate>Fri, 09 Jan 2009 03:48:39 +0000</pubDate>
		<dc:creator>ryan</dc:creator>
		
		<category><![CDATA[posts]]></category>

		<category><![CDATA[code]]></category>

		<category><![CDATA[scripts]]></category>

		<guid isPermaLink="false">http://paluminum.net/blog/?p=10</guid>
		<description><![CDATA[
I wrote some scripts to run from cron to keep my stuff backed up properly.  I wrote one to backup my sql databases and another to use rsync to backup my home directory (which also contains sql backups, mail, etc).

This first script, dumps SQL databases and creates a tar.bz2 nightly of all dumped databases [...]
]]></description>
			<content:encoded><![CDATA[<p>I wrote some scripts to run from cron to keep my stuff backed up properly.  I wrote one to backup my sql databases and another to use rsync to backup my home directory (which also contains sql backups, mail, etc).</p>
<p><span id="more-10"></span></p>
<p>This first script, dumps SQL databases and creates a tar.bz2 nightly of all dumped databases - purges dumps older than 7 days.</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
<span style="color: #666666; font-style: italic;"># Backup sql databases</span>
&nbsp;
<span style="color: #007800;">DBUSER</span>=<span style="color: #ff0000;">&quot;&quot;</span>
<span style="color: #007800;">DBPASS</span>=<span style="color: #ff0000;">&quot;&quot;</span>
&nbsp;
<span style="color: #007800;">MYSQLDUMP</span>=<span style="color: #ff0000;">&quot;mysqldump -u $DBUSER -p$DBPASS --add-drop-database --add-drop-table&quot;</span>
<span style="color: #007800;">DATABASES</span>=<span style="color: #ff0000;">&quot;space separated list of databases&quot;</span>
<span style="color: #007800;">STAMP</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">date</span> +<span style="color: #000000; font-weight: bold;">%</span>Y<span style="color: #000000; font-weight: bold;">%</span>m<span style="color: #000000; font-weight: bold;">%</span>d<span style="color: #000000; font-weight: bold;">`</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Purge all database dumps more than 7 days old.</span>
<span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">dirname</span> $0<span style="color: #000000; font-weight: bold;">`/</span>sql<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #660033;">-type</span> f <span style="color: #660033;">-iname</span> <span style="color: #ff0000;">'*.tar.bz2'</span> <span style="color: #660033;">-mtime</span> +<span style="color: #000000;">7</span> | <span style="color: #c20cb9; font-weight: bold;">xargs</span> <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #000000; font-weight: bold;">&amp;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null
&nbsp;
<span style="color: #666666; font-style: italic;"># Dump each db to a $db-date.sql file</span>
<span style="color: #000000; font-weight: bold;">for</span> db <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #007800;">$DATABASES</span>;
<span style="color: #000000; font-weight: bold;">do</span>
        <span style="color: #007800;">FILENAME</span>=<span style="color: #ff0000;">&quot;$db-$STAMP.sql&quot;</span>
        <span style="color: #007800;">$MYSQLDUMP</span> <span style="color: #007800;">$db</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">dirname</span> $0<span style="color: #000000; font-weight: bold;">`/</span>sql<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$FILENAME</span>
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$?</span> <span style="color: #000000; font-weight: bold;">!</span>= 0 <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
                <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Error dumping database: $db&quot;</span>
                <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-f</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">dirname</span> $0<span style="color: #000000; font-weight: bold;">`/</span>sql<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$FILENAME</span>
        <span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #000000; font-weight: bold;">done</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Create a .tar.bz2 of all db dumps (save on file count, and improve compression)</span>
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">dirname</span> $0<span style="color: #000000; font-weight: bold;">`/</span>sql
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-rf</span> db-<span style="color: #007800;">$STAMP</span>.tar<span style="color: #000000; font-weight: bold;">*</span>
<span style="color: #c20cb9; font-weight: bold;">tar</span> cf db-<span style="color: #007800;">$STAMP</span>.tar <span style="color: #000000; font-weight: bold;">*</span>-<span style="color: #007800;">$STAMP</span>.sql
<span style="color: #c20cb9; font-weight: bold;">bzip2</span> <span style="color: #660033;">-9</span> db-<span style="color: #007800;">$STAMP</span>.tar
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-rf</span> <span style="color: #000000; font-weight: bold;">*</span>.sql
<span style="color: #7a0874; font-weight: bold;">cd</span> ..</pre></div></div>

<p>The second script is an rsync script to backup my home directory (and can do other stuff too) to my server at home.  This is currently not configured for automatic backups (need to set up an ssh priv/pub key for it yet).</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
<span style="color: #666666; font-style: italic;"># Automatically uses rsync to backup various directories</span>
<span style="color: #007800;">PATH</span>=<span style="color: #ff0000;">&quot;/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin&quot;</span>
<span style="color: #007800;">SCRIPT_PATH</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">dirname</span> $0<span style="color: #000000; font-weight: bold;">`</span>
&nbsp;
<span style="color: #007800;">REMOTE_ADDR</span>=<span style="color: #ff0000;">&quot;ryan@********:/home/ryan/backup/&quot;</span>
<span style="color: #007800;">BACKUP_DIRS</span>=<span style="color: #ff0000;">&quot;/home/ryan&quot;</span>
&nbsp;
<span style="color: #007800;">RSYNC_ARGS</span>=<span style="color: #ff0000;">&quot; -avz --progress --log-file=$SCRIPT_PATH/logs/rsync_$(date +%Y%m%d).log --exclude '$SCRIPT_PATH/logs/' --exclude '/home/ryan/.cpan/' &quot;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">for</span> <span style="color: #c20cb9; font-weight: bold;">dir</span> <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #007800;">$BACKUP_DIRS</span>
<span style="color: #000000; font-weight: bold;">do</span>
        rsync <span style="color: #007800;">$RSYNC_ARGS</span> <span style="color: #007800;">$dir</span> <span style="color: #007800;">$REMOTE_ADDR</span>
<span style="color: #000000; font-weight: bold;">done</span></pre></div></div>

<p>I just quickly pumped these scripts out, so they&#8217;re pretty rough and not well tested.  That said, hopefully they will help someone out&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://paluminum.net/blog/automated-backup-scripts/feed</wfw:commentRss>
		<feedburner:origLink>http://paluminum.net/blog/automated-backup-scripts</feedburner:origLink></item>
		<item>
		<title>Starting fresh</title>
		<link>http://feedproxy.google.com/~r/paluminum/~3/ONJb9EPmD5Y/starting-fresh</link>
		<comments>http://paluminum.net/blog/starting-fresh#comments</comments>
		<pubDate>Thu, 08 Jan 2009 19:40:43 +0000</pubDate>
		<dc:creator>ryan</dc:creator>
		
		<category><![CDATA[posts]]></category>

		<category><![CDATA[blog]]></category>

		<category><![CDATA[welcome]]></category>

		<guid isPermaLink="false">http://paluminum.net/blog/?p=3</guid>
		<description><![CDATA[
I was unhappy with my blog, and decided to take a new direction with it.  I would like to blog about personal projects and hobbies, code, etc.  I plan on updating regularly (at least 1-2 times weekly for now).  I figure I&#8217;ll keep anime related posts off of this blog.  I may start another blog [...]
]]></description>
			<content:encoded><![CDATA[<p>I was unhappy with my blog, and decided to take a new direction with it.  I would like to blog about personal projects and hobbies, code, etc.  I plan on updating regularly (at least 1-2 times weekly for now).  I figure I&#8217;ll keep anime related posts off of this blog.  I may start another blog elsewhere for that at some point.</p>
<p>Permalink structure:  /blog/post-title</p>
<p>Until I get stuff fully setup this blog will be &#8220;in testing&#8221; or something.</p>
<p><span id="more-3"></span><strong>preview of upcoming post(s):</strong> nerf maverick mods</p>
]]></content:encoded>
			<wfw:commentRss>http://paluminum.net/blog/starting-fresh/feed</wfw:commentRss>
		<feedburner:origLink>http://paluminum.net/blog/starting-fresh</feedburner:origLink></item>
	</channel>
</rss>
