<?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>Guy Rutenberg &#187; duplicity</title>
	<atom:link href="http://www.guyrutenberg.com/tag/duplicity/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.guyrutenberg.com</link>
	<description>Keeping track of what I do</description>
	<lastBuildDate>Sat, 14 Jan 2012 11:30:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Gmail backup: getmail vs. OfflineIMAP</title>
		<link>http://www.guyrutenberg.com/2012/01/14/gmail-backup-getmail-vs-offlineimap/</link>
		<comments>http://www.guyrutenberg.com/2012/01/14/gmail-backup-getmail-vs-offlineimap/#comments</comments>
		<pubDate>Sat, 14 Jan 2012 11:30:25 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[duplicity]]></category>
		<category><![CDATA[getmail]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[OfflineIMAP]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/?p=956</guid>
		<description><![CDATA[I&#8217;m currently reviewing my backup plans and decided it&#8217;s a good occasion to finally start backing up my Gmail account. Firstly, I didn&#8217;t seriously consider Desktop clients as the main backup tool, as they are hard to automate. The two main options are: OfflineIMAP and getamil. Both are available from Ubuntu&#8217;s repositories, so installation is [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m currently reviewing my backup plans and decided it&#8217;s a good occasion to finally start backing up my Gmail account. Firstly, I didn&#8217;t seriously consider Desktop clients as the main backup tool, as they are hard to automate. The two main options are: <a href="http://offlineimap.org/">OfflineIMAP</a> and <a href="http://pyropus.ca/software/getmail/">getamil</a>. Both are available from Ubuntu&#8217;s repositories, so installation is easy with both and both have good tutorials, <a href="http://www.mattcutts.com/blog/backup-gmail-in-linux-with-getmail/">Matt Cutts&#8217; getmail</a> and <a href="http://www.enigmacurry.com/2008/02/22/backing-up-my-online-brain/">EnigmaCurry&#8217;s OfflineIMAP</a>.</p>
<p>OfflineIMAP claims to be faster, but I haven&#8217;t really checked it (and I&#8217;m not sure how important that is giving that it runs in the background). From what I saw configuring them is mainly a task of cut-and-paste, but getmail requires to list every label you want to backup, which I consider is a major downside. As both are able to save the mails to maildir format, it should be easy to back it up using <a href="duplicity.nongnu.org">duplicity</a>.</p>
<p>Conclusion: This was a short comparison, mainly to guide me in choosing the right backup for me, you may have different opinions (which, of course, I would gladly hear). I finally chose OfflineIMAP, mainly due to the labels issue.</p>
<p>Note on desktop clients: It seems that every decent one can be configured to work with a local maildir, so you can use them to read the backups. As I prefer Gmail&#8217;s interface, I will only use desktop clients in case I&#8217;m offline, so read-only access from desktop client seems good enough for me.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2012/01/14/gmail-backup-getmail-vs-offlineimap/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automated Encrypted Backups to S3 Using Duplicity</title>
		<link>http://www.guyrutenberg.com/2011/09/03/automated-encrypted-backups-to-s3-using-duplicity/</link>
		<comments>http://www.guyrutenberg.com/2011/09/03/automated-encrypted-backups-to-s3-using-duplicity/#comments</comments>
		<pubDate>Sat, 03 Sep 2011 17:28:32 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[Amazon AWS]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[duplicity]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/?p=864</guid>
		<description><![CDATA[This tutorial will hopefully guide you in making automated encrypted backups to Amazon&#8217;s S3 using duplicity. It was written as a followup for Using Duplicity and Amazon S3 – Notes and Examples, in order to organize all the necessary information into a simple tutorial. Will start by creating a simple wrapper to duplicity: #! /usr/bin/python [...]]]></description>
			<content:encoded><![CDATA[<p>This tutorial will hopefully guide you in making automated encrypted backups to Amazon&#8217;s S3 using duplicity. It was written as a followup for <a href="/2009/12/12/using-duplicity-and-amazon-s3-notes-and-examples/">Using Duplicity and Amazon S3 – Notes and Examples</a>, in order to organize all the necessary information into a simple tutorial.</p>
<p>Will start by creating a simple wrapper to <code>duplicity</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#! /usr/bin/python</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">sys</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">os</span>
&nbsp;
duplicity_bin = <span style="color: #483d8b;">'/usr/bin/duplicity'</span>
&nbsp;
env = <span style="color: black;">&#123;</span>
    <span style="color: #483d8b;">'AWS_ACCESS_KEY_ID'</span>:     <span style="color: #483d8b;">'PUT YOUR KEY ID HERE'</span>,
    <span style="color: #483d8b;">'AWS_SECRET_ACCESS_KEY'</span>: <span style="color: #483d8b;">'PUT YOUR SECRET ACCESS KEY HERE'</span>,
    <span style="color: #483d8b;">'PASSPHRASE'</span>:            <span style="color: #483d8b;">'PUT ENCRYPTION PASSPHRASE'</span>,
<span style="color: black;">&#125;</span>
env.<span style="color: black;">update</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">os</span>.<span style="color: black;">environ</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #dc143c;">os</span>.<span style="color: black;">execve</span><span style="color: black;">&#40;</span>duplicity_bin, <span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span>, env<span style="color: black;">&#41;</span></pre></div></div>

<p>save this under <code>dupicity-wrapper.py</code> and <code>chmod 0500</code> it so only you will be able to read and execute it.</p>
<p><strong>Note:</strong> You&#8217;ll want to write down the passphrase and store it in a safe location (preferably in two separate locations). So in case you&#8217;ll need to restore the backups, you won&#8217;t have useless encrypted files.</p>
<p>Now edit your <code>crontab</code> and add a line like the following:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">10 1 * * 0 /path/to/duplicity-wrapper.py /path/to/folder/ s3+http://bucket-name/somefolder &amp;&gt;&gt; ~/log/backups.log</pre></div></div>

<p>This will create a weekly backup for <code>/path/to/folder</code>. The backup will be encrypted with what ever passphrase you&#8217;ve given in the <code>duplicity-wrapper.py</code>. The output of the backup process will be saved into <code>~/log/backups.log</code>.</p>
<p>You should also run</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">/path/to/duplicity-wrapper.py full /path/to/folder/ s3+http://bucket-name/somefolder</pre></div></div>

<p>in order to create full backups. You might want to periodically verify your backups:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">/path/to/duplicity-wrapper.py collection-status s3+http://bucket-name/somefolder
/path/to/duplicity-wrapper.py verify s3+http://bucket-name/somefolder /path/to/folder/</pre></div></div>

<p>To check the status of the backups and to verify them.</p>
<p>And last but not least, in case you ever need the backups, you can restore them using:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">/path/to/duplicity-wrapper.py restore s3+http://bucket-name/somefolder /path/to/folder/</pre></div></div>

<h3>Security Considerations</h3>
<p>As I know, some people will comment on the saving of the encryption passphrase plainly in a file, I will explain my reasoning. I use the above encryption in order to secure my files in case of data leakage from Amazon S3. In order to read my backups, or silently temper with them, some on will have to get the passphrase from my machine. While, this isn&#8217;t impossible, I will say it&#8217;s unlikely. Furthermore, if someone has access allowing him to read files from my computer, he doesn&#8217;t need the backups, he can access the files directly.</p>
<p>I&#8217;ve given some thought about making the backups more secure, but it seems you always have to compromise on either automation or incremental backups. But, as I wrote, the current solution seems to me strong enough given the circumstances. Nonetheless, if you&#8217;ve got a better solution it would be nice to hear.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2011/09/03/automated-encrypted-backups-to-s3-using-duplicity/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Using Duplicity and Amazon S3 &#8211; Notes and Examples</title>
		<link>http://www.guyrutenberg.com/2009/12/12/using-duplicity-and-amazon-s3-notes-and-examples/</link>
		<comments>http://www.guyrutenberg.com/2009/12/12/using-duplicity-and-amazon-s3-notes-and-examples/#comments</comments>
		<pubDate>Sat, 12 Dec 2009 10:00:14 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[Amazon AWS]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[duplicity]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/?p=603</guid>
		<description><![CDATA[Up until now I&#8217;ve been doing my backups to Amazon S3 using my s3backup script. While it&#8217;s simple and does what I needed at the time, I&#8217;ve decided to cut some of the costs by switching to incremental backups. I went on to define what I&#8217;m looking for, and after a short search I&#8217;ve came [...]]]></description>
			<content:encoded><![CDATA[<p>Up until now I&#8217;ve been doing my backups to Amazon S3 using my <a href="/2008/10/21/s3backup-easy-backups-of-folders-to-amazon-s3/"><code>s3backup</code></a> script. While it&#8217;s simple and does what I needed at the time, I&#8217;ve decided to cut some of the costs by switching to incremental backups.<br />
<span id="more-603"></span><br />
I went on to define what I&#8217;m looking for, and after a short search I&#8217;ve came up with <a href="http://duplicity.nongnu.org/">duplicity</a> which support efficient incremental backups to Amazon S3 (among many other backends). While duplicity has an simple CLI interface, I did come across two pitfalls when using S3.</p>
<p>The first one is that one must export the <code>AWS_ACCESS_KEY_ID</code> and <code>AWS_SECRET_ACCESS_KEY</code> or else you get a error message from the underlying <code>boto</code> library:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">  File &quot;//usr/lib64/python2.5/site-packages/boto/connection.py&quot;, line 148, in __init__
    self.hmac = hmac.new(self.aws_secret_access_key, digestmod=sha)
AttributeError: S3Connection instance has no attribute 'aws_secret_access_key'</pre></div></div>

<p>The second thing to note is that is the way to specify buckets for <code>duplicity</code>. Instead of</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">s3://&lt;bucket-name&gt;/&lt;prefix&gt;</pre></div></div>

<p>which is used by <a href="http://s3tools.logix.cz/s3cmd"><code>s3cmd</code></a> (which is a great tool), it asks to specify it using</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">s3+http://&lt;bucket-name&gt;/&lt;prefix&gt;</pre></div></div>

<p>Being aware of these points can save some time and frustration. In order to automate the backup process one can use <code>cron</code>. For example add the following to your <code>crontab</code></p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">AWS_ACCESS_KEY_ID=&quot;&lt;your-key-id&gt;&quot;
AWS_SECRET_ACCESS_KEY=&quot;&lt;your-secret-access-key&gt;&quot;
0 1 * * 0  duplicity --no-encryption &lt;folder-to-backup&gt; s3+http://&lt;bucket-name&gt;/&lt;prefix&gt; &amp;&gt;&gt; ~/backups.log
AWS_ACCESS_KEY_ID=&quot;&quot;
AWS_SECRET_ACCESS_KEY=&quot;&quot;</pre></div></div>

<p>I unset the environment variables, so it won&#8217;t leak to other cron jobs unnecessarily. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2009/12/12/using-duplicity-and-amazon-s3-notes-and-examples/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.314 seconds -->

