1

I would like to create an application that use CouchDB as distributed database. Each user will work with the local CouchDB replica, and that way will be able to work offline. Each local replica will sync with a central replica, this is not a master replica it just easier for now to use central replica.

Given this design how can I secure both local and central databases?

By secure I mean that a user will have to authenticate with username and password before allow to either read or write to the database.

Off course the more important aspect is securing the central database because anything local can and will be hacked eventually but the central (or remote) database should be more secure. I've read that people suggest putting the CouchDB behind a proxy but how can the replication process authenticate on behalf of the user?

Thank you, Ido.

1 Answer 1

4

I don't think I can give some smart Couch-specific advice, as all the points fall in general security concerns, but here are them:

  • For starters, make sure that communication between nodes is encrypted. CouchDB supports SSL natively since 1.1, so for earlyer versions you will have to put it behind some proxy that will handle SSL (nginx, apache's mod_proxy, varnish), or limit access with VPN.

  • Check roles and user permissions. Disallow everything that need not to bee allowed. Require valid users, etc...

  • Make sure that if someone is authenticated it doesn't mean you can trust him. Make sure that you tightly validate all the data - use validate_doc_update functions liberally. Check that everyone is accessing data they really have access to. Again authentication does not mean authorization.

Sign up to request clarification or add additional context in comments.

1 Comment

FYI since version 1.1 CouchDB has native SSL support.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.