c# - ship my software with a secure mongodb -
so have bundled software client can download , install (using msi on win machines).
part of software mongodb database, stores client info, configurations, etc..
when software first installed, creates empty folder mongodb, , whenever software starts, starts mongod
process (using c#'s process.start()
): mongod.exe --dbpath <path> --port <port> --quiet
.
my goal secure mongodb database username / password known application.
this prevent tampering client's data outside, make harder (but not impossible, see below) client tamper application's data.
general idea, guess, on installation (or on startup), create user read / write privileges software use communicate database.
so questions are:
1. how programmatically this? guess this right direction, couldn't find info on c# driver docs
2. how deal upgrades? i.e clients installed previous version of software, database not secure @ all; create user password in case well. 3. how store application user's credentials in application? in config file? can read client. best practices here?
versions info- (unfortunately, because of company's issues, we're not using latest product versions); mongodb 2.6, mongodb driver .net 1.5.0.
thanks!
p.s. have read through security section on mongodb website, wasn't able find simple example use case i'm trying implement.. maybe i'm missing simple here..
this kind of interesting, unusual use case.
first of all, want make sure you're aware of licensing/copyright implications of bundling mongodb software. should check out license section of mongo project github page , read on agpl.
second, easiest part of question:
how store application user's credentials in application? in config file? can read client. best practices here?
this goes beyond mongodb. if user owns system mongod process running on, copy data files , set no-auth mongod on top of application data. cannot reasonably stop them doing things that, not count on application's data secure client user. plus, if install application code locally, decently smart , committed person should able extract username , password compiled application code. can make hard, not impossible.
third,
how programmatically this?
based on said, i'm taking "this" mean
on installation (or on startup), create user read / write privileges software use communicate database.
not part having secure person owns computer it's installed on, because that's not possible. this, i'd either package mini datafile start mongod on top of, 1 included users set already, or include dump use mongorestore load mongod after start up. first option way simpler implement , should not require have take down , respawn mongod process, try - see if can set mongod auth how want , transplant user info copying data files. fwiw, i'm pretty sure passwords not stored in plain text in data files (they salted), won't have directly exposed data files.
finally,
how deal upgrades?
you'll have take down mongod, restart auth, use localhost exception create users need, turn off localhost exception (optional why not), , end connection , start new ones using auth. it's same process in security tutorials, have c# driver commands. note moving between mongodb versions tricky seurity model has improved on time, should consult upgrade guide things make sure user schema gets upgraded correctly if moving user secure 2.6 secure 3.0, say.
Comments
Post a Comment