Dez Udezue
Dez Udezue

Reputation: 757

Is there an encrypted version control system?

I am looking for an encrypted version control system . Basically I would like to

Can anyone recommend something like this? I did a lot of searches but I cant find anything.

Upvotes: 45

Views: 12530

Answers (13)

Commodore Jaeger
Commodore Jaeger

Reputation: 33390

You could use a Tahoe-LAFS grid to store your files. Since Tahoe is designed as a distributed file system, not a versioning system, you'd probably need to use another versioning scheme on top of the file system.

Edit: Here's a prototype extension to use Tahoe-LAFS as the backend storage for Mercurial.

Upvotes: 5

1ng0
1ng0

Reputation: 21

Similar to some comments above, a useful workaround may be to encrypt&zip the whole repository locally and synchronize it with the remote box. E.g. when using git, the whole repository is stored in directory '.git' within the project dir.

  • zip/encrypt the whole project dir
  • upload it to a server (unsure if handling .git alone is sufficient)
  • before you continue working on the project download this archive
  • decrypt/unpack and sync with git (locally)

This can be done with a simple shell line script more comfortable.

pro: You can use whatever encryption is appropriate as well as every VCS which supports local repositories.

cons: lacks obviously some VCS features when several people want to upload their code base (the merge situation) - although, perhaps, this could be fixed by avoiding overwrite remotely and merging locally (which introduces locking, this is where the nightmare starts)

Nevertheless, this solution is a hack, not a proper solution.

Upvotes: 1

Bhasker Pandya
Bhasker Pandya

Reputation: 193

Have you thought of using Duplicity? It's like rdiff-backup (delta backups) but encrypted? Not really version control - but maybe you want all the cool diff stuff but don't want to work with anyone else. Or, just push/pull from a local Truecrypt archive and rsync it to a remote location. rsync.net has a nice description of both - http://www.rsync.net/resources/howto/duplicity.html http://www.rsync.net/products/encrypted.html - apparently Truecrypt containers still rsync well.

Upvotes: 2

Rudi
Rudi

Reputation: 19940

Variant A

Use a distributed VCS and transport changes direct between different clients over encrypted links. In this scenario is no attackable central server.

For example with mercurial you can use the internal web server, and connect the clients via VPN. Or you can bundle the change sets and distribute them with encrypted mails.

Variant B

You can export an encrypted hard drive partition over the network and mount it on the client side, and run the VCS on the client side. But this approach has lot's of problems, like:

  • possible data loss when two different clients try to access the VCS at the same time
  • the link itself must be secured against fraudulent write access (when the partition is shared via NFS it is very likely to end with a configuration where anyone can write to the shared partition, so even when there is no way for others to read the content, there is easily a hole to destroy the content)

There might be also other problems with variant B, so forget variant B.

Variant C

Like @Commodore Jaeger wrote, use a VCS on top of an encryption-aware network file system like AFS.

Upvotes: 1

rook
rook

Reputation: 67019

It is possible to create a version control system of cipher text. It would be ideal to use a stream cipher such as RC4-drop1024 or AES-OFB mode. As long as the same key+iv is used for each revision. This will mean that the same PRNG stream will be generated each time and then XOR'ed with the code. If any individual byte is different, then you have a mismatch and the cipher text its self will be merged normally.

A block cipher in ECB mode could also be used, where the smallest mismatch would be 1 block in size, so it would be ideal to use small blocks. CBC mode on the other hand can produce widely different cipher text for each revision and thus is undesirable.

I recognize that this isn't very secure, OFB and ECB modes shouldn't normally be used as they are weaker than CBC mode. The sacrifice of the IV is also undesirable. Further more it isn't clear what attack is being defended against. Where as using something like SVN+HTTPS is very common and also secure. My post is merely stating that it is possible to do this efficiently.

Upvotes: 17

David Cary
David Cary

Reputation: 5490

Use rsyncrypto to encrypt files from your plaintext directory to your encrypted directory, and decrypt files from your encrypted directory and your plaintext directory, using keys that you keep locally.

Use your favorite version control system (or any other version control system -- svn, git, mercurial, whatever) to synchronize between your encrypted directory and the remote host.

The rsyncrypto implementation you can download now from Sourceforge not only handles changes in bytes, but also insertions and deletions. It implements an approach very similar to the approach that that "The Rook" mentions.

Single-byte insertions, deletions, and changes in a plaintext file typically cause rsyncrypto to make a few K of completely different encrypted text around the corresponding point in the encrypted version of that file.

Chris Thornton points out that ssh is one good solution; rsyncrypto is a very different solution. The tradeoff is:

  • using rsyncrypto requires transferring a few K for each "trivial" change rather than the half-a-K it would take using ssh (or on a unencrypted system). So ssh is slightly faster and requires slightly less "diff" storage than rsyncrypto.
  • using ssh and a standard VCS requires the server to (at least temporarily) have the keys and decrypt the files. With rsyncrypto, all encryption keys never leave the local computer. So rsyncrypto is slightly more secure.

Upvotes: 10

Chris Thornton
Chris Thornton

Reputation: 15817

You should encrypt the data pipe (ssl/ssh) instead, and secure the access to the server. Encrypting the data would force SVN to essentially treat everything as a binary file. It can't do any diff, so it can't store deltas. This defeats the purpose of a delta-based approach.
Your repository would get huge, very quickly. If you upload a file that's 100kb and then change 1 byte and checkin again, do that 8 more times (10 revs total), the repository would be storing 10 * 100kb, instead of 100kb + 9 little deltas (let's call it 101kb).

Update: @TheRook explains that it is possible to do deltas with encrypted repository. So it may be possible to do this. However, my initial advice stands: it's not worth the hassle, and you're better off with encrypting the ssl/ssh pipe and securing the server. i.e. "best practices".

Upvotes: 48

Jus12
Jus12

Reputation: 18024

Based on my understanding this cannot be done, because in SVN and other versioning systems, the server needs access to the plaintext in order to perform versioning.

Upvotes: 0

FastAl
FastAl

Reputation: 6280

Source safe stores data in Encrypted files. Wait, I take that back. They're obfuscated. And there's no other security other than a front door to the obfuscation.

C'mon, it's monday.

Upvotes: -1

Claus Broch
Claus Broch

Reputation: 9212

SVN have built-in support for transferring data securely. If you use svnserve, then you can access it securely using ssh. Alternatively you can access it through the apache server using https. This is detailed in the svn documentation.

Upvotes: 5

myron-semack
myron-semack

Reputation: 6425

What specifically are you trying to guard against?

Use Subversion ssh or https for the repo access. Use an encrypted filesystem on the clients.

Upvotes: 4

Maksym Bykovskyy
Maksym Bykovskyy

Reputation: 832

Have a look at GIT. It supports various hooks that might do the job. See, git encrypt/decrypt remote repository files while push/pull.

Upvotes: 2

John Weldon
John Weldon

Reputation: 40759

Why not set up your repo (subversion, mercurial, whatever) on an encrypted filesystem, and use ssh only to connect?

Upvotes: 12

Related Questions