Take the 2-minute tour ×
Information Security Stack Exchange is a question and answer site for Information security professionals. It's 100% free, no registration required.

I have read the following question: Storing password in Java application but I don't find the answers useful for my case.

So here is my question somehow related to that. I have a Java Web application with a back end DataBase secured access with username and password.

Right now the username/password sits in a .properties file on the web server. The server is secure, but having it like that in plain text kinda bothers me.

Tried at some point to use secure stores to encrypt/decrypt the username and password but the stores are themselves protected by a password so where do I store that? I'm back to square one.

So? What is the best way to store username/passwords for connecting to other systems (database, web service etc)

share|improve this question
    
Have you looked at the answers here: security.stackexchange.com/questions/22817/… ? –  iivel Nov 2 '12 at 15:09
add comment

1 Answer

up vote 3 down vote accepted

The server needs to be able to access some resource R. If an attacker has full control of the server then that attacker can by definition now access any resource the server can access. There is absolutely nothing you can do about this except secure the server.

If the attacker doesn't have full control of the server but has access to the server's file system then the question is if the server needs to boot autonomously (without any external help). If the server needs to boot autonomously then all the data required to access resource R must reside somewhere in the server's file system and are thus available to the attacker. The best you could do is to try and obfuscate the password - good luck with that.

If the server can use external help to boot then the best option would be to require an administrator to enter the password during boot (and keeping the password stored in RAM). If that's not a practical option (it usually isn't) then you could secure the password using a USB token (e.g. store an encrypted password and use the USB token to decrypt it).

TL;DR: Assuming you can't manually enter the password every time you boot the server there's not much you can do except protect the server itself.

share|improve this answer
    
I was afraid of an answer like this :( –  johnD Nov 2 '12 at 16:55
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.