django - How to securely deploy environment settings via config file? -
i have removed api credentials , secret keys project's source code , repository , storing , applying them configuration file in local environment.
what best way deploy , apply settings production environment? first thought write script to:
- upload configuration file local machine production server
- read configuration file , apply settings on production server without logging settings or exposing them bash history
- delete configuration file production server
aside potential snooping on internet traffic during upload, or local machine being compromised, there wrong approach?
this django project. using django-environ read / manage settings , fabric upload configuration file , remotely run commands during deployment server located on aws (i'm not interested in using elastic beanstalk).
thank you!
how make secure
there million ways of doing deployment semi-"securely" extremely hard (if not impossible) make secure. reason simple. code needs access sensitive information in order run. can obfuscate information as want if system gets compromised, intruder can inspect running processes hence extract sensitive information.
that being said, dont see fundamentally wrong using config file start app long follow standard deploy practices using different non-root user run app, etc.
best way deploy
i think 12 factor refactored apps considered best practice in industry. 3rd rule states pretty how should configure applications:
store config in environment
storing config in env variables makes super easy deploy same application in many environments without changing code. doing arguably not 100% secure think if take normal precautions running server different user, etc should fine in cases.
obviously depends on type of application. if application deals super-sensitive data, suggest investigate other methods on how deploy applications in security-strict environments. outside of scope of question , outside of knowledge-area maybe other smart people here @ able help.
Comments
Post a Comment