<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.10.0">Jekyll</generator><link href="https://www.canet.me.uk/feed.xml" rel="self" type="application/atom+xml" /><link href="https://www.canet.me.uk/" rel="alternate" type="text/html" /><updated>2024-11-13T11:04:03+00:00</updated><id>https://www.canet.me.uk/feed.xml</id><title type="html">Transmuting Reality</title><subtitle>Cooking in the DevOps kitchen (sometimes literally!)</subtitle><author><name>Christakis Angeli</name><email>christakis@canet.me.uk</email><uri>https://www.canet.me.uk</uri></author><entry><title type="html">Rclone and large Google Docs export support</title><link href="https://www.canet.me.uk/rclone-large-docs-export/" rel="alternate" type="text/html" title="Rclone and large Google Docs export support" /><published>2018-09-01T09:17:00+01:00</published><updated>2018-09-01T09:17:00+01:00</updated><id>https://www.canet.me.uk/rclone-large-docs-export</id><content type="html" xml:base="https://www.canet.me.uk/rclone-large-docs-export/"><![CDATA[<p>Large Google docs above 5-10MB have issues exporting to via rclone for backup purposes. With the release of <strong>rclone v1.42</strong>, there’s a new option <code class="language-plaintext highlighter-rouge">--drive-alternate-export</code> which used a different method to export Google Docs stored in Drive, which allows this to exceed the size limits. Documentation is <a href="https://rclone.org/drive/">here</a>.</p>]]></content><author><name>Christakis Angeli</name><email>christakis@canet.me.uk</email><uri>https://www.canet.me.uk</uri></author><category term="google" /><category term="gsuite" /><category term="rclone" /><summary type="html"><![CDATA[Large Google docs above 5-10MB have issues exporting to via rclone for backup purposes. With the release of rclone v1.42, there’s a new option --drive-alternate-export which used a different method to export Google Docs stored in Drive, which allows this to exceed the size limits. Documentation is here.]]></summary></entry><entry><title type="html">Personal Google vs G Suite - Differences when using Google Services</title><link href="https://www.canet.me.uk/google-vs-g-suite/" rel="alternate" type="text/html" title="Personal Google vs G Suite - Differences when using Google Services" /><published>2018-06-05T20:16:00+01:00</published><updated>2018-06-05T20:16:00+01:00</updated><id>https://www.canet.me.uk/google-vs-g-suite</id><content type="html" xml:base="https://www.canet.me.uk/google-vs-g-suite/"><![CDATA[<h2 id="g-suite-migration">G Suite Migration</h2>

<p>So a little while back, I switched all my email over to G Suite instead of hosting my own solution (I was paying for a VPS to do this as well, which was more costly). Eventually, you do get to a point where you realise that someone else can do something better than you and your time is more valuably spent doing other things. I was also routing a large amount of my email via Gmail for public usage anyway as it was easier to explain over the phone than my domain email address (possibly just a bad choice on my part for this one xD).</p>

<p>G Suite has a few advantages that replicating myself would be quite costly and/or time consuming:</p>

<ul>
  <li><strong>More Highly available:</strong> Getting a multi-master setup to be reliable with Dovecot over the internet was a bit of a time investment and I was never convinced it worked properly. I would also have to replicate the various frontends.</li>
  <li><strong>Tagging &amp; Search:</strong> This was quite a big one. It’s so much easier to tag and search in Gmail than set up the infrastructure required to do it myself and make it highly available and performant.</li>
  <li><strong>Unmanaged:</strong> I would no longer have to debug and look after the infrastructure myself. Email can be fussy at times just trying to avoid spam filters.
= <strong>Calendar &amp; Contacts Support:</strong> Whilst I had this working with CalDAV and CardDAV via Davical, integrating this every time with various plugins was a bit tedious and didn’t work greatly when it came to tying it into an interface. The HA side of things comes into play here as I never set it up to be HA.</li>
</ul>

<p>Some of the other nice features that made it easy to use were the following:</p>

<ul>
  <li><strong>Unlimited Domains:</strong> This was quite nice as I could add as many domains as I wanted and redirect emails to one user with many aliases, much as I had been doing with the Open Source stack I was using. I retained delimiter support in emails, so migrating across was pretty much seamless.</li>
  <li><strong>Storage:</strong> With G Suite Business (see my previous article for more details), I have pretty much unlimited storage on Drive now.</li>
</ul>

<p>To be honest, it’s just pretty easy to use, which also makes it quite appealing.</p>

<p>In the end, the main reason I chose it would be the <strong>custom domain support</strong> and ability to retain <strong>+</strong> delimiter support in emails.</p>]]></content><author><name>Christakis Angeli</name><email>christakis@canet.me.uk</email><uri>https://www.canet.me.uk</uri></author><category term="google" /><category term="gsuite" /><summary type="html"><![CDATA[G Suite Migration]]></summary></entry><entry><title type="html">Cloud Mirrors &amp;amp; Backup Storage</title><link href="https://www.canet.me.uk/backup-storage/" rel="alternate" type="text/html" title="Cloud Mirrors &amp;amp; Backup Storage" /><published>2018-06-03T12:06:00+01:00</published><updated>2018-06-03T12:06:00+01:00</updated><id>https://www.canet.me.uk/backup-storage</id><content type="html" xml:base="https://www.canet.me.uk/backup-storage/"><![CDATA[<p><strong>This is going to end up more of a personal reference page for myself than anything else most likely as I sometimes find it hard to remember why I did what I did lol</strong></p>

<h2 id="background">Background</h2>

<p>The gist of this is that over time, I’ve used various backup/mirroring tools to take copies of my data and store them in the Cloud. Over time, I’ve used a few storage providers such as:</p>

<ul>
  <li>Google Drive</li>
  <li>OVH Dedicated Servers</li>
  <li>VPS solutions</li>
  <li>OneDrive</li>
  <li>Amazon Cloud Drive</li>
</ul>

<p>As I’m an avid photographer, this data is actually growing at a pretty decent rate due to shooting in RAW. When an image can be 50MB+, the storage tends to add up pretty quickly!</p>

<h3 id="amazon-cloud-drive-and-the-rclone-fiasco">Amazon Cloud Drive and the rclone fiasco</h3>

<p>For a while, I decided that making use of the unlimited photo storage that Amazon Cloud Drive offers as part of its’ Amazon Prime membership seemed like a good idea and I started to make use of this with the <code class="language-plaintext highlighter-rouge">rclone</code> tool which I’ve been using with good success for a while now. All <em>was</em> well and good.</p>

<p>At some point in 2017 (I can’t remember when), Amazon decided to revoke the keys that <code class="language-plaintext highlighter-rouge">rclone</code> was using for access. This became a major problem for me as I back up from a NAS box running Gentoo Linux (with the data stored in RAID1). A workaround was soon developed using an OAUTH proxy run on Google’s App Engine and things worked briefly. Eventually I ran into rate-limiting issues which I haven’t been able to resolve and thus, ended up stuck.</p>

<p>I even tried running a backup tool (SyncBack SE Pro) from my desktop, to copy the files on the NAS to ACD. It decided however that on every single run, files had <em>changed</em>. I didn’t really fancy syncing 700GB~ of photo data every single time I wanted to take a copy and this started to seem like more and more effort for something that should really be a painless process.</p>

<h2 id="finding-something-better">Finding something better</h2>

<p>At this point, I’d pretty much had enough and decided that if I wanted something painless and that would tick along, I’d have to find another solution to the problem and this might involve some form of monthly spending fee. I won’t go into huge amounts of detail but here are the thoughts on solutions I came across.</p>

<h3 id="microsoft-onedrive-as-part-of-an-office-365-subscription">Microsoft Onedrive (as part of an Office 365 subscription)</h3>

<p><strong>Disclaimer:</strong> I already use this for a lot of things such as: music storage, encrypted backups of smaller data, document storage and sharing etc.</p>

<p>I’m actually a big fan and it works pretty well for me. I’ve even got a weird setup where it syncs my Lightroom Catalog files so that I can edit the previews on the move (it’s got a few quirks but works pretty much seamlessly!).</p>

<h4 id="pros">Pros</h4>

<ul>
  <li>£46.50 for the year for an Office 365 sub from Amazon (£3.90~ per month).</li>
  <li>1TB storage per user.</li>
  <li>Desktop synchronization client.</li>
  <li>API support (works with <code class="language-plaintext highlighter-rouge">rclone</code>, <code class="language-plaintext highlighter-rouge">duplicity</code> etc).</li>
  <li>Office Desktop &amp; mobile license is included and use of all the web applications as well.</li>
  <li>£68 per year (£5.70~ per month) for the 5 user subscription from Amazon. Apparently, each user can have 1TB of OneDrive storage.</li>
</ul>

<h4 id="cons">Cons</h4>

<ul>
  <li>You can’t really have more than 1TB of storage per user as a consumer, which rules it out for using as photo storage as well at this point.</li>
  <li>Additional setup required to use multiple accounts. I also don’t know how easy it is to move from the 1 to 5 user subscription and and pre-requisites that might have.</li>
</ul>

<h3 id="google-drive-consumer-edition">Google Drive (Consumer Edition)</h3>

<p>So, I’ve used this before and it was pretty good but as listed below, cost was a bit much. A second Office 365 subscription for backups would be half the cost (at the expense of being a bit of a pain to scale).</p>

<h4 id="pros-1">Pros</h4>

<ul>
  <li>API Support (same as OneDrive)</li>
  <li>Transfer speeds are good</li>
  <li>Variable storage limits depending on how much you need</li>
</ul>

<h4 id="cons-1">Cons</h4>

<ul>
  <li>The desktop applications are undergoing a bit of a transition which I haven’t quite got to grips with yet. They removed the original sync app and replaced it with two others. As I haven’t used that in a while, it might be fine, but something to be aware of.</li>
  <li>£7.99 a month per TB (over twice the cost of an Office 365 subscription. The limit is going up to 2TB soon though, so it will be more competitive if you’re just looking for storage.)</li>
</ul>

<h3 id="dropbox-plus">Dropbox Plus</h3>

<p>I won’t go into too much detail on this one but basically the 1TB is the same price as Google Drive. This pretty much has the same pros/cons as Google Drive (Consumer Edition) apart from the fact that when I have used it in the past, the Desktop Application was pretty slick compared to other providers I’ve used. If you are swayed by the previous but want better desktop support, Dropbox is definitely a contender!</p>

<h3 id="aws-s3glacier">AWS S3/Glacier</h3>

<p>Given that this is run by an entirely different Amazon division and is Production grade storage, it’s worth including to see how this pans out. That said, retrieval cost pretty much rules out this option for consumer usage.</p>

<h4 id="pros-2">Pros</h4>

<ul>
  <li>Production grade, various policies for availability and durability, all of them being 99% or higher.</li>
  <li>Glacier costs for primarily storage are reasonable per GB ($0.004-$0.0045 per GB).</li>
  <li>S3 API support is an industry standard for a lot of tools, so lots of support.</li>
</ul>

<h4 id="cons-2">Cons</h4>

<ul>
  <li>Costs vary per region per GB stored.</li>
  <li>API calls and bandwidth are calculated as separate costs.</li>
  <li>Retrieval from Glacier (which is the only price-competitive option), can be very costly.</li>
</ul>

<h3 id="backblaze-b2">Backblaze B2</h3>

<p>I very much almost went for this, as it was quite an appealing option. Note, this is the professional, not the consumer option which just backs up everything on your PC.</p>

<h4 id="pros-3">Pros</h4>

<ul>
  <li>Good API support, with a multitude of clients available (including <code class="language-plaintext highlighter-rouge">rclone</code>).</li>
  <li>Price per GB ($0.005) is good. Not as good as Glacier but you don’t have a myriad of costs. You pay a small amount for putting data in and then just pay for the data at rest. Deletes are mostly free unless you do a huge amount of transactions (and even the transaction cost is reasonable).</li>
  <li>Dedicated subreddit with responses from the people who run Backblaze</li>
  <li>If you need to restore a lot, you can pay to get a drive with all your data shipped to you, rather than trying to download it all.</li>
</ul>

<h4 id="cons-3">Cons</h4>

<ul>
  <li>Limited amount of data centers (I think 2 at time of writing?)</li>
  <li>Daytime outage when attempting to provision support for more clients. With the amount of data they hold, I was expecting somewhat better management when I read about the recent incident, with regards to scaling.</li>
  <li>There’s a restore cost for getting data out, varying by method.</li>
</ul>

<h3 id="google-drive-for-business-as-part-of-g-suite">Google Drive for Business (as part of G Suite)</h3>

<p>So, this is an interesting consideration, depending on number of users (&lt; 5 or 5+), you get slightly different packages. Also, there’s a difference between G Suite Basic (£3.30 pcm/user) vs G Suite Business (£6.60 pcm/user).</p>

<p>Here, we’ll evaluate the Business edition, as the Basic doesn’t give you more than 30GB of storage.</p>

<h4 id="pros-4">Pros</h4>

<ul>
  <li>1TB per user (&lt;5 users) or <strong>unlimited</strong> (5+ users). The big pro here is that, according to reddit users, the 1TB limit <strong>isn’t enforced actively</strong>. This means you effectively can have unlimited storage with less than 5 users on the account.</li>
  <li>Plenty of API support for Google Drive (see above)</li>
</ul>

<h4 id="cons-4">Cons</h4>

<ul>
  <li>If you can consider this a con, there’s a 750GB upload limit daily and there’s a multi terabyte download limit daily.</li>
  <li>At any point, if you’re using with less than 5 users, in theory the 1TB limit of storage could be enforced.</li>
  <li>Same issue as Google Drive for consumers with desktop applications</li>
</ul>

<h2 id="overall-solution">Overall Solution</h2>

<p><strong>Winner:</strong> Google Drive for Business (G Suite Business)</p>

<p>To start with, I already use OneDrive as part of the Office 365 subscription due to the price and storage space and the fact I get Office licenses and web apps all together. As much as Google pushes its’ own productivity suite, the Microsoft suite is a major preference for me.</p>

<p>I was also a G Suite Basic subscriber, therefore I have all my email etc hosted with Google already and paying £3.30 per month for the privilege of high availability and all the other integration features. This made my choice a no-brainer really.</p>

<ul>
  <li>For the £3.30 per month upgrade to G Suite Business, I could use the Google Drive storage. It gives me 1TB (although in practice, it’s unlimited, so it could scale forever).</li>
  <li>The speeds are good.</li>
  <li>I don’t need to create yet <em>another</em> user account to manage.</li>
</ul>

<p>If in future I hit the storage limit and it becomes enforced, I might look back into the Office 365 5 User Family subscription and start looking at spreading my data across multiple accounts for cost efficiency. Until then though, this was a fairly easy solution to put in place (a few button clicks to upgrade my subscription and an OAUTH signin with <code class="language-plaintext highlighter-rouge">rclone</code> and I was good to go and start syncing!).</p>]]></content><author><name>Christakis Angeli</name><email>christakis@canet.me.uk</email><uri>https://www.canet.me.uk</uri></author><category term="linux" /><category term="backups" /><category term="google" /><category term="gsuite" /><category term="onedrive" /><category term="microsoft" /><summary type="html"><![CDATA[This is going to end up more of a personal reference page for myself than anything else most likely as I sometimes find it hard to remember why I did what I did lol]]></summary></entry><entry><title type="html">Implementing Samba with LDAP Backend on Gentoo</title><link href="https://www.canet.me.uk/samba-ldap/" rel="alternate" type="text/html" title="Implementing Samba with LDAP Backend on Gentoo" /><published>2016-07-09T20:16:00+01:00</published><updated>2016-07-09T20:16:00+01:00</updated><id>https://www.canet.me.uk/samba-ldap</id><content type="html" xml:base="https://www.canet.me.uk/samba-ldap/"><![CDATA[<h2 id="integrating-ldap-into-samba">Integrating LDAP into Samba</h2>
<hr />

<h3 id="installation">Installation</h3>
<hr />
<h4 id="gentoo">Gentoo</h4>
<ul>
  <li>Enable <code class="language-plaintext highlighter-rouge">sambakr5passwd</code> and <code class="language-plaintext highlighter-rouge">samba</code> USE flags for OpenLDAP</li>
  <li>
    <p>Enable <code class="language-plaintext highlighter-rouge">ldap</code> USE flag for Samba</p>

    <ol>
      <li><code class="language-plaintext highlighter-rouge">USE="smbkrb5passwd samba" emerge openldap</code></li>
      <li><code class="language-plaintext highlighter-rouge">USE="ldap" emerge samba</code></li>
      <li><code class="language-plaintext highlighter-rouge">emerge net-nds/smbldap-tools</code></li>
    </ol>
  </li>
</ul>

<h3 id="configuration">Configuration</h3>
<hr />
<ol>
  <li>
    <p>Edit <code class="language-plaintext highlighter-rouge">/etc/openldap/slapd.conf</code> to include the following:</p>

    <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code> include /etc/openldap/schema/samba.schema

 access to attrs=userPassword,sambaLMPassword,sambaNTPassword,shadowLastChange,sambaPwdLastSet,sambaPwdMustChange
 	by dn="cn=Samba Admin,ou=SystemAccounts,dc=canet,dc=me,dc=uk" write

 access to *
 	by dn="cn=Samba Admin,ou=SystemAccounts,dc=canet,dc=me,dc=uk" write  This grants the `Samba Admin` account full access to LDAP once authenticated. 
</code></pre></div>    </div>
  </li>
  <li>
    <p>We need to add an OU for the Samba required entries as well as the <code class="language-plaintext highlighter-rouge">Samba Admin</code> account. To do this, add to the LDIF data the following (use <code class="language-plaintext highlighter-rouge">slapcat &gt; myldif.ldif</code> to generate an LDIF file including all the current data):</p>

    <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code> dn: ou=SystemAccounts,dc=canet,dc=me,dc=uk
 objectClass: organizationalUnit
 objectClass: top
 objectClass: domainRelatedObject
 associatedDomain: canet.co.uk
 ou: SystemAccounts

 dn: cn=Samba Admin,ou=SystemAccounts,dc=canet,dc=me,dc=uk
 givenName: Samba
 sn: Admin
 uid: smbadmin
 cn: Samba Admin
 userPassword: {SSHA}eXKqB5iVZnu+sValdI3Omqbyvt1el6c5
 objectClass: inetOrgPerson
 objectClass: top
</code></pre></div>    </div>
  </li>
  <li>
    <p>Load the LDIF changes into LDAP with the following (you are free to add the data into LDAP any other way you wish as long as it gets there!)</p>

    <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code> rm -rf /var/lib/openldap*
 slapadd -l myldif.ldif
 chown -R ldap:ldap /var/lib/openldap/
</code></pre></div>    </div>
  </li>
  <li>
    <p>Edit the Samba config to reflect the following so it knows how to connect to the LDAP server (<code class="language-plaintext highlighter-rouge">/etc/samba/smb.conf</code>):</p>

    <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code> # LDAP server location
 passdb backend = ldapsam:ldap://127.0.0.1:389/
	
 # The Base DN
 ldap suffix = dc=canet,dc=me,dc=uk
	
 # The LDAP path to computer, user and group account OUs
 ldap machine suffix = ou=Computers
 ldap user suffix = ou=People
 ldap group suffix = ou=Groups
	
 # Samba Admin account in LDAP to use for Administrative tasks
 ldap admin dn = cn=Samba Admin,ou=SystemAccounts,dc=canet,dc=me,dc=uk
	
 # Not sure what this is for
 ldap delete dn = no
   
 # This is for password synchronisation between the Unix and the Samba password in LDAP. 
 # So if you change your Samba password over smbpasswd or Windows this option changes your Unix/Linux password too.
 ldap password sync = yes
</code></pre></div>    </div>
  </li>
  <li>
    <p>Run <code class="language-plaintext highlighter-rouge">smbpasswd -W</code> to update local secret for accessing the <code class="language-plaintext highlighter-rouge">Samba Admin</code> account.</p>
  </li>
  <li>Run <code class="language-plaintext highlighter-rouge">smbldap-config</code>
    <ul>
      <li>Set <code class="language-plaintext highlighter-rouge">.</code> where required to generate blank fields.</li>
      <li>Set password validation time to 99999</li>
    </ul>
  </li>
  <li>Run <code class="language-plaintext highlighter-rouge">smbldap-populate -e server.ldif</code>. This generates an LDIF file with all the required LDAP users and groups.
    <ol>
      <li>Remove entries that already exist and remove the root and nobody accounts. Make sure your Groups OU is set correctly!</li>
      <li>Make sure it picks up the correct domain. It picked up my workgroup instead (as it was previously something else). If you run <code class="language-plaintext highlighter-rouge">net getlocalsid</code> it will give you the domain in capitals.</li>
    </ol>
  </li>
  <li>
    <p>Load the Samba accounts with <code class="language-plaintext highlighter-rouge">ldapadd -x -D "cn=Manager,dc=canet,dc=me,dc=uk" -f server.ldif -W</code> (this uses the LDAP Admin account to update from the LDIF file)</p>
  </li>
  <li>
    <p>Once done, we need to update existing ldap entries with SAM entries so need to run:</p>

    <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code> smbldap-usermod -a christakis  WARNING: If the ACLs in `slapd.conf` are too restrictive, this WON'T work
</code></pre></div>    </div>
  </li>
  <li><code class="language-plaintext highlighter-rouge">smbpasswd christakis</code> should then update both LDAP and Samba passwords as we’ve set Samba to sync them with <code class="language-plaintext highlighter-rouge">ldap password sync = yes</code> in the configuration file earlier.
    <ul>
      <li>At this point, if we update the LDAP password without <code class="language-plaintext highlighter-rouge">smbpasswd</code>, it won’t update the Samba password!!</li>
    </ul>
  </li>
</ol>

<h4 id="enable-smbk5pwd-overlay">Enable smbk5pwd Overlay</h4>
<hr />
<p>This overlay enables the updating of Kerberos and Samba passwords via an LDAP overlay whenever the LDAP password is changed via LDAP. Following the instructions for initial installation, the relevant library should be installed so it should only need configuration</p>

<ol>
  <li>
    <p>Edit <code class="language-plaintext highlighter-rouge">/etc/openldap/slapd.conf</code>:</p>

    <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code> moduleload /usr/lib64/openldap/openldap/smbk5pwd.so
	
 #
 # More configuration…
 #
 # Database definition…
 #
	
 overlay smbk5pwd
 smbk5pwd-enable samba
 smbk5pwd-must-change 0
</code></pre></div>    </div>

    <p>This enables the overlay in LDAP to propegate the changes to LDAP</p>
  </li>
  <li>
    <p>Edit <code class="language-plaintext highlighter-rouge">/etc/samba/smb.conf</code>:</p>

    <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code> ldap password sync = only
</code></pre></div>    </div>

    <p>This tells Samba to only update the LDAP password and let the LDAP server do the rest (so use the new overlay!)</p>
  </li>
</ol>]]></content><author><name>Christakis Angeli</name><email>christakis@canet.me.uk</email><uri>https://www.canet.me.uk</uri></author><category term="samba" /><category term="gentoo" /><category term="linux" /><summary type="html"><![CDATA[Integrating LDAP into Samba]]></summary></entry><entry><title type="html">Backups and Google Drive</title><link href="https://www.canet.me.uk/backups-and-google-drive/" rel="alternate" type="text/html" title="Backups and Google Drive" /><published>2014-07-22T15:17:05+01:00</published><updated>2014-07-22T15:17:05+01:00</updated><id>https://www.canet.me.uk/backups-and-google-drive</id><content type="html" xml:base="https://www.canet.me.uk/backups-and-google-drive/"><![CDATA[<p>Having recently migrated from a dedicated server to VPS for hosting a mirrored solution of some of my home setup (Dovecot/Postfix), I had a bit of an issue in working out what to do about backups of large data sets such as my photos and music collection. One of the major issues I came across was that large amounts of online storage space tends to be quite expensive when attached to VPS or when provided by a decent dedicated server.</p>

<h2 id="google-drive">Google Drive</h2>
<p>It was at this point when Google Drive had recently announced 1TB of storage space for $9.99 a month making it a very cheap storage solution so I decided to do a bit more research into it to find out the benefits and drawbacks.</p>

<h3 id="benefits">Benefits</h3>
<ul>
  <li>Cheap at $9.99 per TB (with UK tax at 20% and the conversion rate, it is about £7 a month)</li>
  <li>Quick to access with apps for Windows, OSX, Android and iOS and a brilliant webapp</li>
  <li>Has a couple of music player addons to stream music from your browser as well as dedicated Android apps for music streaming with Drive as a storage backend</li>
  <li>Should be as redundant as Google’s storage for other services with nearly no downtime</li>
</ul>

<h3 id="drawbacks">Drawbacks</h3>
<ul>
  <li>Mainly API based access for 3rd parties</li>
  <li>No Linux server clients for syncing (which is a bit of a problem given my Gentoo-based storage server)</li>
  <li>Music playback apps leave something to be desired regarding interface and usability</li>
</ul>

<h2 id="gdrsync">gdrsync</h2>
<p>This looked like a good option for me except for the lack of Linux support so I did a bit of digging around and came across a tool called <strong>gdrsync</strong>. This attempts to emulate the <strong>rsync</strong> tool with the explicit intention of use against Google Drive. The only problem with the original version of this was that it didn’t support downloading the data back down. Luckily I found a fork <a href="https://github.com/quisar/gdrsync.py/tree/with-download-2">here</a> which does support it. Using the following with it preconfigured in the instructions in the README, I can sync any set of files to a given path in Google Drive from my Linux server.</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>gdrsync -rdvs /path/to/files/ gdrive:/path/to/files/
</code></pre></div></div>

<p>It’s worth noting you need to set up a development account and acquire a key and ID to go with this from Google but it’s a fairly straightforward process and doesn’t cost anything. It will work with the default configuration from the original developer but if more and more people are using, it will start running into issues with API calls so I suggest getting your own set up.</p>]]></content><author><name>Christakis Angeli</name><email>christakis@canet.me.uk</email><uri>https://www.canet.me.uk</uri></author><category term="linux" /><category term="backups" /><category term="google" /><summary type="html"><![CDATA[Having recently migrated from a dedicated server to VPS for hosting a mirrored solution of some of my home setup (Dovecot/Postfix), I had a bit of an issue in working out what to do about backups of large data sets such as my photos and music collection. One of the major issues I came across was that large amounts of online storage space tends to be quite expensive when attached to VPS or when provided by a decent dedicated server.]]></summary></entry><entry><title type="html">Dovecot ‘dsync’ Replication Over TCP</title><link href="https://www.canet.me.uk/dovecot-dsync-replication/" rel="alternate" type="text/html" title="Dovecot ‘dsync’ Replication Over TCP" /><published>2014-05-31T12:43:36+01:00</published><updated>2014-05-31T12:43:36+01:00</updated><id>https://www.canet.me.uk/dovecot-dsync-replication</id><content type="html" xml:base="https://www.canet.me.uk/dovecot-dsync-replication/"><![CDATA[<p>I’ve previously written about <strong>dsync</strong> as a tool provided by <strong>dovecot</strong> to migrate mailbox formats but it’s also a tool that works over SSH and TCP for synchronizing mailboxes across two instances of <strong>dovecot</strong>.</p>

<p><strong>dsync</strong> is primarily worth using because it uses <strong>dovecot</strong>’s log files to replicate as mail is received so filesystem corruption isn’t replicated and it also avoids having to script and control synchronization between the two instances. Because it uses the log files, it can also run master-master and whilst the official documentation recommends a user always goes to the same host, it also states that the worse case scenario is a user has to redownload mails again. <strong>dsync</strong> will also sync your <strong>sieve</strong> configurations if you have <strong>sieve</strong> set up!</p>

<p>It is worth noting that this is a bit of a pain to set up, so be prepared! This guide was also written based on the <strong>Gentoo</strong> installation configurations.</p>

<h4 id="dovecot-services-used">Dovecot Services Used</h4>
<ul>
  <li><strong>doveadm</strong> - Front facing TCP listening service providing access to <strong>aggregator</strong> and <strong>replicator</strong> I believe</li>
  <li><strong>aggregator</strong> - I believe this is used to provided notifications to the <strong>replicator</strong> process when there’s changes to synchronize</li>
  <li><strong>replicator</strong> - Triggers/handles synchronization</li>
</ul>

<h4 id="pre-requisites">Pre-requisites</h4>
<ul>
  <li><code class="language-plaintext highlighter-rouge">doveadm user '*'</code> should return a list of all the users <strong>dovecot</strong> hosts. I found this needed to be a complete list in email format for it to replicate properly (this is possibly in part due to me organizing my mail folders with folders for domain followed by folders for users underneath)</li>
  <li><strong>Optional</strong> - SSL Configured as per the <a href="http://wiki2.dovecot.org/SSL/DovecotConfiguration">Dovecot Documentation on SSL</a>. This is only required if you wish to use synchronization over SSL (and using <strong>Gentoo</strong>, you need to have <strong>dovecot</strong> compiled with <code class="language-plaintext highlighter-rouge">USE="ssl"</code>.</li>
  <li><strong>Optional (probably…)</strong> Mailbox format in <strong>mdbox</strong> or <strong>sdbox</strong>. I’m not sure where I read this but with a large amount of mail, the <strong>maildir</strong> format is expensive to sync in comparison and may have more issues. If I find the documentation on this, I’ll add it in.</li>
</ul>

<h4 id="configuration-on-both-hosts">Configuration (On both hosts)</h4>
<ol>
  <li>
    <p><code class="language-plaintext highlighter-rouge">/etc/dovecot/conf.d/10-mail.conf</code></p>

    <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code> # Enable globally the notify and replication plugins
 	# This will then apply to all protocols dovecot supports
 mail_plugins = notify replication
</code></pre></div>    </div>
  </li>
</ol>

<ul>
  <li>
    <p><code class="language-plaintext highlighter-rouge">/etc/dovecot/conf.d/30-dsync.conf</code> - You’ll need to create this manually</p>

    <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>  # This sets globally the port needed to connect
  # to the doveadm service
  doveadm_port = 1234
    
  # Set the password globally to use for connecting to 
  # and requiring for the doveadm service 
  doveadm_password = password
    
  # Set the directory for validating certificates
  # provided when running with SSL enabled
  # Should be the standard OpenSSL certificate directory by default
  ssl_client_ca_dir = /etc/ssl/certs
    
  # Configure the doveadm service to listen
  service doveadm {
  	inet_listener {
      	# port to listen on
      	port = 1234
          # enable SSL
          ssl = yes
      }
  }
    
  # Configure the aggregator service for notifications
  service aggregator {
  	fifo_listener replication-notify-fifo {
      	# Your mail user that's managing files generally is used here
      	user = mail
      }
      unix_listener replication-notify {
      	user = mail
      }
  }
    
  # Configure the replicator service
  service replicator {
  	process_min_avail = 1
      unix_listener replicator-doveadm {
      	mode = 0666
      }
  }
    
  # Configure target hosts for replication
  # tcps can be tcp if you don't want to connect with SSL
  # :port can be omitted if it's the default set globally for doveadm
  plugin {
  	mail_replica = tcps:fqdn:port
  }
</code></pre></div>    </div>
  </li>
  <li>
    <p>Restart <strong>dovecot</strong></p>
  </li>
</ul>

<h4 id="notes-on-ssl">Notes on SSL</h4>
<ul>
  <li>By default, <strong>doveadm</strong> will use the certificates set globally for <code class="language-plaintext highlighter-rouge">ssl_key</code> and <code class="language-plaintext highlighter-rouge">ssl_cert</code> if you tell it to listen on SSL. It does not support SNI like the <strong>imap</strong> and <strong>pop3</strong> listeners nor does <strong>dovecot</strong> when it attempts to connect to the other instance.</li>
  <li>Unlike the <strong>imap</strong> and <strong>pop3</strong> listeners, <strong>doveadm</strong> does not supply all certificates in the chain, even if they are in the certificate file. This means that verifying is left down to the certificates in <code class="language-plaintext highlighter-rouge">/etc/ssl/certs</code>. I found that the intermediate certificate for StartCom was missing from there and needed adding. After adding, you need to run <code class="language-plaintext highlighter-rouge">c_rehash</code> to update hashes in the directory that are used by OpenSSL for lookup.</li>
</ul>

<h4 id="useful-commands">Useful Commands</h4>
<ul>
  <li><code class="language-plaintext highlighter-rouge">doveadm replicator replicate &lt;email&gt;</code>  - Replicate a given email account manually</li>
  <li><code class="language-plaintext highlighter-rouge">doveadm replicator replicate -f &lt;email&gt;</code>  - Replicate a given email account manually <strong>IN FULL</strong></li>
  <li><code class="language-plaintext highlighter-rouge">doveadm replicator status &lt;email&gt;</code>  - Check replication status. Also works without the email parameter</li>
</ul>]]></content><author><name>Christakis Angeli</name><email>christakis@canet.me.uk</email><uri>https://www.canet.me.uk</uri></author><summary type="html"><![CDATA[I’ve previously written about dsync as a tool provided by dovecot to migrate mailbox formats but it’s also a tool that works over SSH and TCP for synchronizing mailboxes across two instances of dovecot.]]></summary></entry><entry><title type="html">nss_ldap Raspberry Pi Issues</title><link href="https://www.canet.me.uk/ldap-raspberry-pi/" rel="alternate" type="text/html" title="nss_ldap Raspberry Pi Issues" /><published>2014-05-30T17:59:51+01:00</published><updated>2014-05-30T17:59:51+01:00</updated><id>https://www.canet.me.uk/ldap-raspberry-pi</id><content type="html" xml:base="https://www.canet.me.uk/ldap-raspberry-pi/"><![CDATA[<p>This is more a note for myself than anything else. Whilst setting up OpenLDAP and integration with <code class="language-plaintext highlighter-rouge">PAM</code> and <code class="language-plaintext highlighter-rouge">nsswitch.conf</code>, I ran into a strange issue where <code class="language-plaintext highlighter-rouge">getent passwd</code> wouldn’t return any of the LDAP results, even using the same configuration that worked on another host. I tracked it down to the symlink <code class="language-plaintext highlighter-rouge">/lib/libnss_ldap.so.2</code> not existing and needing to point at <code class="language-plaintext highlighter-rouge">nss_ldap.so</code>. This was a bit of a strange situation as the symlink on my x86-64 based system links elsewhere so I am assuming it is a problem that only exists on arm architectures.</p>]]></content><author><name>Christakis Angeli</name><email>christakis@canet.me.uk</email><uri>https://www.canet.me.uk</uri></author><summary type="html"><![CDATA[This is more a note for myself than anything else. Whilst setting up OpenLDAP and integration with PAM and nsswitch.conf, I ran into a strange issue where getent passwd wouldn’t return any of the LDAP results, even using the same configuration that worked on another host. I tracked it down to the symlink /lib/libnss_ldap.so.2 not existing and needing to point at nss_ldap.so. This was a bit of a strange situation as the symlink on my x86-64 based system links elsewhere so I am assuming it is a problem that only exists on arm architectures.]]></summary></entry><entry><title type="html">Dovecot ‘mdbox’ Format Maintenance</title><link href="https://www.canet.me.uk/dovecot-mdbox-maintenance/" rel="alternate" type="text/html" title="Dovecot ‘mdbox’ Format Maintenance" /><published>2014-05-30T17:32:28+01:00</published><updated>2014-05-30T17:32:28+01:00</updated><id>https://www.canet.me.uk/dovecot-mdbox-maintenance</id><content type="html" xml:base="https://www.canet.me.uk/dovecot-mdbox-maintenance/"><![CDATA[<p>I ran into a wierd situation the other day when setting up Dovecot <code class="language-plaintext highlighter-rouge">dsync</code> replication over TCP where the new host I was syncing too, had finished syncing but the directory size differed between both hosts. After a bit of investigation, I found this was a quirk of sorts in how the <code class="language-plaintext highlighter-rouge">mdbox</code> format works.</p>

<p><code class="language-plaintext highlighter-rouge">mdbox</code> stores messages even after they are completely deleted and <code class="language-plaintext highlighter-rouge">expunged</code>. This is done by decremented a variable called <code class="language-plaintext highlighter-rouge">refcount</code> on the message and when there is finally no more references for it, the value should be set to <code class="language-plaintext highlighter-rouge">0</code>. Even after this though, the message is still stored in the file. When syncing however over <code class="language-plaintext highlighter-rouge">dsync</code>, these messages are not replicated as it is specific to the file format.</p>

<p>Apparently, during quiet periods of the day, it is recommended to schedule a maintenance command via <code class="language-plaintext highlighter-rouge">cron</code> for purging these messages completely. This can be done as follows:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code># To purge a single user's mails where refcount=0
doveadm purge -u &lt;user&gt;

# To purge all users' mails where refcount=0
doveadm purge -A
</code></pre></div></div>

<p>For the latter to succeed, <code class="language-plaintext highlighter-rouge">doveadm user '*'</code> must successfully return all the correct usernames for deletion. This of course is now running on both hosts as a nightly <code class="language-plaintext highlighter-rouge">cron</code> job to keep things tidy.</p>]]></content><author><name>Christakis Angeli</name><email>christakis@canet.me.uk</email><uri>https://www.canet.me.uk</uri></author><summary type="html"><![CDATA[I ran into a wierd situation the other day when setting up Dovecot dsync replication over TCP where the new host I was syncing too, had finished syncing but the directory size differed between both hosts. After a bit of investigation, I found this was a quirk of sorts in how the mdbox format works.]]></summary></entry><entry><title type="html">NIC Death</title><link href="https://www.canet.me.uk/network-interface-hell/" rel="alternate" type="text/html" title="NIC Death" /><published>2014-02-01T21:01:12+00:00</published><updated>2014-02-01T21:01:12+00:00</updated><id>https://www.canet.me.uk/network-interface-hell</id><content type="html" xml:base="https://www.canet.me.uk/network-interface-hell/"><![CDATA[<p>In the recent week, I’ve run across the annoying issue of trying to debug why my network, specifically my home server access was slow and sporadic. Given my router had been acting up since a power outage at Christmas, I believed that might be the cause but it just didn’t make sense. Having done some tests with my housemate’s hardware, I narrowed it down to my home server.</p>

<p>My initial issues manifested whilst trying to play videos on my PS3 via streaming, something that usually isn’t a problem. Having upgraded PS3 Media Server recently and using a video I wasn’t sure about, I gave up trying to fix it at the time. What worried me is that when I was trying to access files via a Samba share on the same server, it would start to play briefly then die, even on videos that used to work fine!</p>

<p>So, I take to the shell to try and diagnose the issues!</p>

<ul>
  <li>Nothing in the Samba logs to indicate what’s going on.</li>
  <li><code class="language-plaintext highlighter-rouge">ifconfig</code> decides to tell me that there’s no packet loss on the Gigabit interface at all</li>
</ul>

<p>All I get is this slightly obscure message in <code class="language-plaintext highlighter-rouge">syslog</code> from the kernel</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Jan 27 00:07:56 rinoa kernel: [  584.495023] r8169 0000:01:06.0 eth1: link down
Jan 27 00:07:59 rinoa kernel: [  586.852168] r8169 0000:01:06.0 eth1: link up
Jan	27 00:08:22 rinoa kernel: [  609.994358] r8169 0000:01:06.0 eth1: link down
Jan 27 00:08:24 rinoa kernel: [  612.328398] r8169 0000:01:06.0 eth1: link up
Jan 27 00:08:44 rinoa kernel: [  632.046656] r8169 0000:01:06.0 eth1: link down
Jan 27 00:08:46 rinoa kernel: [  634.587853] r8169 0000:01:06.0 eth1: link up
</code></pre></div></div>

<p>Why is the interface going up and down like this? Google didn’t really have a good answer for me. Investigation led me to replacing the ethernet cable, which just seemed to make the situation worse. In vain effort, I also tried updating my Linux kernel to the latest stable to see if that resolved the issue. I settled in the end for reverting to the 100mbit internal NIC to see if that fared any better. Despite the downgrade in speed, it’s been 100% reliable.</p>

<p>So, if you see this and you’ve tested your switch and ethernet cable, your NIC is pretty much FUBAR. Just wish this info was available more easily!</p>]]></content><author><name>Christakis Angeli</name><email>christakis@canet.me.uk</email><uri>https://www.canet.me.uk</uri></author><summary type="html"><![CDATA[In the recent week, I’ve run across the annoying issue of trying to debug why my network, specifically my home server access was slow and sporadic. Given my router had been acting up since a power outage at Christmas, I believed that might be the cause but it just didn’t make sense. Having done some tests with my housemate’s hardware, I narrowed it down to my home server.]]></summary></entry><entry><title type="html">Chicken Katsu Curry</title><link href="https://www.canet.me.uk/chicken-katsu-curry/" rel="alternate" type="text/html" title="Chicken Katsu Curry" /><published>2013-10-13T16:41:39+01:00</published><updated>2013-10-13T16:41:39+01:00</updated><id>https://www.canet.me.uk/chicken-katsu-curry</id><content type="html" xml:base="https://www.canet.me.uk/chicken-katsu-curry/"><![CDATA[<p>This is the Chicken Katsu Curry recipe lifted off of the BBC Good Food website before it was removed (if someone has the Author’s details, I’ll add here). It’s a brilliant recipe that always turns out well for me, hence I’m posting it here for reference.</p>

<h3 id="ingredients">Ingredients</h3>

<hr />
<h4 id="chicken">Chicken</h4>
<ul>
  <li>seasoned flour, for dusting</li>
  <li>1 egg, beaten</li>
  <li>100g natural dried breadcrumbs (if you can get the Japanese panko breadcrumbs then use those!)</li>
  <li>4 large skinless, boneless chicken thighs</li>
</ul>

<h4 id="curry-sauce">Curry Sauce</h4>
<ul>
  <li>1 onion, chopped</li>
  <li>2 garlic cloves, crushed</li>
  <li>a small chunk ginger, peeled and finely chopped</li>
  <li>a pinch chilli flakes (optional)</li>
  <li>oil, for frying</li>
  <li>1 tbsp plain flour, mixed with 1 tbsp mild curry powder</li>
  <li>350ml chicken stock</li>
  <li>1 tsp brown sugar (any kind will do)</li>
</ul>

<h4 id="rice">Rice</h4>
<ul>
  <li>100g basmati rice</li>
  <li>75g frozen peas</li>
  <li>sesame oil</li>
  <li>soy sauce</li>
</ul>

<h3 id="method">Method</h3>

<hr />
<ol>
  <li>
    <p>Put the flour, egg and breadcrumbs in separate dishes. Dust the chicken in flour, then the egg, then breadcrumbs. Chill for 20 minutes.</p>
  </li>
  <li>
    <p>To make the curry sauce cook the onion, garlic and ginger (and chilli flakes if using) in a little splash of oil until softened. Add the flour and curry powder mix, and cook for 2-3 minutes, stirring to stop it catching. Slowly add the chicken stock then stir in the sugar and simmer for 15 minutes. Blend the sauce to smooth using a stick blender or food processor.</p>
  </li>
  <li>
    <p>Heat the oven to 180C/fan 160C/gas 4. Heat 2 tbsp oil in a non-stick
frying pan. Fry the chicken until golden on both sides then transfer to a rack and finish cooking in the oven for 20 minutes.</p>
  </li>
  <li>
    <p>Boil the rice in lots of salted water, adding the peas for the last 2
minutes of cooking. Drain well then toss with a couple of drops of sesame oil and soy.</p>
  </li>
  <li>
    <p>Slice the chicken and arrange on top of the rice then serve with a drizzle of the reheated sauce.</p>
  </li>
</ol>]]></content><author><name>Christakis Angeli</name><email>christakis@canet.me.uk</email><uri>https://www.canet.me.uk</uri></author><category term="main-course" /><category term="chicken" /><category term="food" /><category term="cooking" /><summary type="html"><![CDATA[This is the Chicken Katsu Curry recipe lifted off of the BBC Good Food website before it was removed (if someone has the Author’s details, I’ll add here). It’s a brilliant recipe that always turns out well for me, hence I’m posting it here for reference.]]></summary></entry></feed>