couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Damien Katz <>
Subject new CouchDB feature: Admin accounts
Date Wed, 22 Oct 2008 17:13:22 GMT
I checked a new feature, Admin accounts.

Admin accounts are used for perform admin restricted actions like  
creating/deleting databases and altering the configuration settings.  
If there are no admin accounts for a server, then admin checking is  
turned off and anyone can perform admin actions.

The admin checking uses HTTP basic authentication, we'll need to  
eventually support SSL to make this secure or support a more secure  
authentication standard.

When the user attempts to perform an Admin action, the browser checks  
the user supplied credentials and sees it if matches any admin  
account. If not, a 401 Unauthorized error is returned and the HTTP  
client can resubmit with proper credentials. When the credentials  
match, the action is allowed to proceed.

To turning admin checking on,  in the local.ini file, you add an  
accounts section, with user name/password pairs, like this:

admin = password
damien katz = foo


When CouchDB starts it will find these new passwords and then hash them:

admin = -hashed- 
damien katz = - 


The hashed password line consists first of "-hashed-" then 2  
hexadecimal encoded numbers separated by a comma, the 160 bit sha  
hashed password + salt 160 bit sha hash, and then the 128 bit salt (a  

   user name = -hashed-%160bit hashed value%,%128 bit salt%

So the only restrictions on passwords is they shouldn't start with "- 
hashed-" and can't contain newlines.

Once a password is hashed, to change it, reset the password via the  
HTTP config api, CouchDB will then automatically hash the password  
without restarting. Or edit it by hand by deleting the old hashed  
value (everything after the "=") and enter in the new password. Then  
restart the server.


To run the test suite against a server with admin accounts enabled  
requires the user to have admin access.

There is a known problem in Futon with Safari, maybe other browsers,  
where it doesn't prompt the user for credentials, it just fails the  
HTTP request. In Firefox when the tests start to run and the HTTP  
client gets the first failure, the user is asked by the browser for  
his user name and password, the request automatically retried and all  
the tests pass without incident. But in Safari, the tests simply fail  
with 401 errors and the user is never prompted for credentials.

A workaround is to do something to force the browser to "log-in" by  
trying to view config values, or create a new database. Once logged in  
like that, the tests will pass just fine on Safari. We maybe need to  
force the log-ins at the beginning of the tests, or provide a Log-in  
button somewhere in Futon.

Feedback please.


View raw message