Dimagi

Staff Blog

Our partners, field work, technology, and everything else.

CommCare featured in CNN/Fortune article

by Jonathan Jackson on 29 December 2008

We had a nice article written up on CNN/Fortune on our CommCare initiative. We’d like to add to the context with some things we emphasized with the author but that did not make it into the article.  In particular, we’d like to credit the amazing JavaROSA community for enabling applications like CommCare to be built on the platform.  Without the funding support of groups like IDRC, University of Bergen (EpiHandy), Rockefeller, WHO and others, CommCare would not exist because JavaROSA would not be as strong.  In addition, all of the great programmers working in developing and developed countries from organizations like Cell-Life, D-Tree, DataDyne, Makerere University, and MRC of SA make all of our collective work much easier and more rewarding.  Neal Lesh, our strategic director and leader of the CommCare initiative, has done an amazing job of building a collaborative group of programmers, researchers, and implementers to make CommCare a reality.


The NYHE

by Vikram S. Kumar on 23 December 2008

“Welcome to the New York Health Exchange! At the closing bell on Dec 31, 2008, you saved 40% of your allocated money for the year, received dividends amounting to 10% of your starting balance, benefited from a 15% appreciation in your health indices, and a corresponding drop in your mortality markers. The NYHE reminds you to ease on the holiday gorging and wishes you a healthy Q109.”

I had an interesting conversation yesterday with Jessica Shambora from Fortune. Whether patients will own and control their health information through personal mobile technologies was one of the topics we discussed. It became clear to me that while we will have the ability to browse our medication histories on our phones, we need to look beyond technology if we want to get our health system back in shape.

Thanks to Mikhail Elias who recently joined our team at Dimagi, I have been learning lots about Health Information Exchanges. They form a cloud of health information between institutions and stakeholders that make it easier (at least conceptually) to share data. So in theory we can have a central way to access all of our data. But we can do more than that.

We need some innovations in health financing (eg HSA 2.0) that’ll make spending or saving on healthcare fashionable. Put control of the purse with the patient and their family/network since the patient is where all pieces of the puzzle converge. Run the dollars and data through a centralized exchange; so a patient is able check the status of a lab (with simple interpretation) and also the balance in a health dollar account. The data is all there, but focusing only on fixing the data exchange misses the bigger picture. That is, of making all the hard data work relevant to a patient.

Back in the day we made a video game for children with diabetes. People criticized us, saying that patients would compromise their health for the sake of the game. The good news (or bad news for those who work on behavioral change) is that patients are more sensible than that. If given the means, they will do what they think helps their health. An exchange where they also can make some cash by saving the health system some dollars (eg. prevent hospitalizations by taking those asthma meds) can change the game. Or as John Hammergren of McKesson says in his aptly titled book, we will change the game when we give patients some Skin in the game.


Backup Bliss

by Dan Myung on 12 December 2008

This entry was originally published in our developer’s wiki,  we’ve pasted it here to conserve mouse clicks.

 

Back it up here

So, internally we’ve found a need to do a lot of file transfer and encryption with off site backups. It took most of the day, but we’ve got a cool solution that works well, and we thought we’d share it with you.

Background and problem

  • I need to accept tons of transfers from a variety of clients in a secure way
  • I want to have these files backed up in a large device on my network
  • I want to make sure that these backups are stored encrypted
  • I also need to make sure that these backups are encrypted remotely (via Amazon S3)

Our Solution

  • Secure transfer via sftp + rssh
  • Use Ubuntu’s encfs as the encryption method
  • Use Jungledisk and rsync to backup the stored files to S3

Hey, you think you’re so cool, using standard tools why the need to write a wiki on this?

Not everything works out of the box…what to do?

sftp+rssh+chroot == wtf?!?”’

For something that purports to be secure, we found one glaring nuisance (not an outright security flaw), but something that would raise eyebrows. When you use chroot to make your jail for your sequestered / directory, you still need to grant your users for the limited scp and sftp execution access to the entire (limited) filesystem. That includes the /home directory. So if your user testuser logs in, and does a chdir .. – it will be able to scan through and see if there are other clients that this server is feeding to. Definetaly a big no-no in our book. Some forums we ran across raised this issue, but we found that they went unanswered. Since disk space is cheap, we ultimately made a new chroot jail for each customer, so to speak.

We largely followed the directions found at this ubuntu forum entry, but with the modification that you’ll need to make run chroot.sh <jail location> for each jail you want to setup.

Then for each user you add, you will need to modify the /etc/password accordingly to set the home directory of the user to the correct jail root.

In the end, we ultimately put these entries directly at the end of the /etc/rssh.conf – the per-user options block.

user=user1:011:00011:"/home/jail1"
user=user2:011:00011:"/home/jail2"

Deciphering Encryption

Ubuntu’s latest releases come with two different flavors of folder encryption. encfs and ecryptfs. We chose to use encfs because it gives a bit more control over the location and more importantly the multiple ways in which one can mount the folder. According to this blog, performance between the two seems negligible.

encfs allows you store data in an encrypted folder, let’s call it /var/encrypteddata. In order to manipulate it, you need to mount it using

encfs /var/encrypteddata ~/letmesee

Now, if i look at ~/letmesee, i can see all the correct filenames and can read/write to it. If i look at /var/encrypteddata, the filenames are gibberish as are the contents.

Another cool part is that since the directories are locked with a passphrase, I can mount it across the network so long as I have encfs running on my machine. Of note, I had to make sure that the versions of encfs were at least the same version. I could not mount a volume encrypted on version 1.4.2 (Intrepid Ibex) on the default 1.3.2 (Hardy Heron).

Why not truecrypt?

This program intrigues us greatly, and we use it in other contexts, but for our needs, we found that it might have caused more issues, so ultimately we didn’t implement our solution with it.

The issues:

  • truecrypt needs to either allocate a big block of a file as the encrypted store
  • or it needs to mount an entire drive

The result of these two directives made it difficult to do a few things:

  • We wanted more flexibility with just dumping data to a directory and not have to allocate the storage ahead of time. N
  • We wanted also to send incremental backups of the data to S3. We saw that either we would have to decrypt the data out of the volume and deposit it to S3 and re-encrypt it (higher CPU cost, decrypt->recrypt, but that’s not necessarily a bad thing). Encfs let us just do a direct copy of the encrypted individual files to S3.

Implementing encfs So, ultimately for our solution, we attached our NAS to our machine running the sftp+rssh server. And what we set as the home directories of our jailed/chroot-ed users, the visible endpoint of an encfs mount. I had some trouble but found that the fusermount option for multiple users makes for the mounted directory being visible to the rssh’ed user on sftp. This page got me started on the road to using encfs.

To reiterate:

encfs -o allow_other /mnt/nasdrive/encrypted /home/user1/data-to-encrypt
rssh user1 home dir: /home/jail1/home/user1/data-to-encrypt

 

Note, the -o allow_other flag is the fuse option to allow your jailed user to have access the folder mounted by root

Jungledisk is awesome

There, I said it. Using the linux command line tool, we mounted our s3 filesystem with the fstab entry:

jungledisk  /mnt/s3  fuse  noauto,config=/etc/jungledisk-settings.xml 0 0

If you get any weird errors on trying to write files to the s3 mount, make sure that the tmp directory is actually viable. I copied over the xml settings verbatim from windows and it gave me two problems. One, the amazon secret key is not stored by default in the windows file, plus it has a temp directory setting to some win32 specific filepath.

After that, rsync is a breeze from getting the /mnt/nasdrive/encrypted directory to somewhere in s3. The advantage here is that we’re just uploading the already encrypted data in place. Because it’s encrypted on a per file basis, we can run rsync (or just cp for that matter) to just do a delta of files that do or do not exist (instead of say over a huge block of a truecrypt volume).


Our Developers' Site

by Cory Zue on 10 December 2008

Did you notice the “Developers” link in the menu bar?  It links to our public developers’ site, a resource that we use extensively internally as a mini-wiki for pretty much anything that one of our devs deems worth noting.  Ever find yourself googling the same question at least once every couple months?   E.g. “How do I change the sa password in Sql Server?”  Or ever find an application that was so cool you had to show all your programming buddies immediately?  That’s the type of stuff we like to put up there.

Anyway, it’s not very pretty and it’s not very polished or well maintained, but there is some useful information there for those that are interested.


Visualize this

by Dan Myung on 8 December 2008

Though it seems like the buzz around gapminder seems to have faded (though their cool tricks are now accessible via google charts and the snazzy gadgets), it seems like others are arriving on scene to bring cool visualization tools to the masses.  Of recent interest I’ve run across is Spatialkey.  Looks stunning and quite promising.