Jungle Disk, Linux, and Mono

October 03, 2007 at 05:17 PM | categories: linux | View Comments

Jungle Disk is a really neat application that allows you to store/backup files online using the Amazon S3 storage service. Basically it is a really inexpensive, fast and efficient way to save important files and access them from anywhere. On top of all that, it runs on just about every platform I would ever use: Linux, Mac OS X, and Windows. (In no order of preference, oh wait... )

If you're not much into computer science, that's pretty much all you need to know. If you are though, keep reading. :)

Jungle Disk is not open source. This would normally raise a huge dilemma for me. Without it being open source, how can I be absolutely sure that I will be able to retrieve my data in the future? The software could have a lockout feature of some kind hidden inside the application that would prevent me from getting my data. I refuse to be held hostage by stupid software!

(By no means am I an open source zealot purist that only uses free software. I use a few high quality closed source, commercial applications (VMWare workstation comes to mind) I just think that open source software tends to be of much higher quality and is able to mature a lot faster than your typical closed source variety. I also detest software patents.)

Jungle Disk is a bit different, even though it's closed source, they have released a portion of their code under the GPL: the decoding/retrieval code. What this proves is that your data can be retrieved without any dependence on closed source, secretive, software.

But I still don't want to take their word for it. So I set out to compile the code and try it myself. The code is written for Visual Studio (which only runs on windows), but that's not so much of a problem because the Mono project has brought most of the .NET framework to Linux.

Here's how to compile the Jungle disk retrieval code on Linux using Mono:

Install the latest version of Mono (I used 1.2.4. 1.2.2.1 didn't have all of the functionality I needed).

Download and extract the source code:

mkdir jds
cd jds
wget http://downloads.jungledisk.com/jungledisk/JungleDiskSourceExample.zip
unzip JungleDiskSourceExample.zip

Compile the code:

gmcs *.cs -r:System.Web -out:jungle_example.exe

Cool! It compiled without warnings nor errors.

Now try running it:

mono jungle_example.exe Your_S3_ID Your_S3_Key listbuckets

Error executing command: Error getting response stream (Trust failure): TrustFailure
System.Net.WebException: Error getting response stream (Trust failure): TrustFailure ---> System.Net.WebException: Error getting response stream (Trust failure): TrustFailure ---> System.IO.IOException: The authentication or decryption has failed. ---> Mono.Security.Protocol.Tls.TlsException: Invalid certificate received from server.

Ouch, we're not accepting the certificate for whatever reason. I don't know much about CSharp at all, but I found a page on the Mono project site that explains the problem and possible solutions. I applied the dumbest of all the possible solutions, which is to ignore the certificate trust issue altogether -- caveat emptor. Here's my patch.

Apply the patch and recompile

wget http://tinyurl.com/2zutxz -O - | patch -p1
gmcs *.cs -r:System.Web -out:jungle_example.exe

Try running again:

mono jungle_example.exe Your_S3_ID Your_S3_Key listbuckets

If it lists your buckets, it worked!

You can also list files in the directory like so:

mono jungle_example.exe Your_S3_ID Your_S3_Key dir default /
mono jungle_example.exe Your_S3_ID Your_S3_Key dir default /pictures
mono jungle_example.exe Your_S3_ID Your_S3_Key dir default /music

You can retrieve your files like so:

mono jungle_example.exe ID Key getfile default "/Some File.zip" stuff.zip
blog comments powered by Disqus