I'm building a REST application to store credentials -- GitHub keys and other sensitive data (which may be uploaded by web app user). I'm looking for an optimal way to secure the data but I'm lost at how to lower the security risk in case the database/web application server is compromised.
Currently I'm looking at the following solution:
Encrypted credentials are stored in the application database.
Encryption keys for the credentials are stored in a separate database behind a firewall.
This, as I look at it, should reduce the risk if the application database is compromised.
Database is PostgreSQL and the server is likely to be Apache2+wsgi.
Does this architecture make sense? Is it redundant? What can be improved as to the storage of the encryption keys? What tools would you recommend for this use case? Thanks in advance!