4 ms·
The correct way on Linux to run services is for each service to have it's own user. If you are just going to be running a single Django project I recommend crea
by overshard 15y ago
The correct way on Linux to run services is for each service to have it's own user. If you are just going to be running a single Django project I recommend creating a user simply called "django", putting all the projects files in "/srv/www/" because that's what "srv" is for. And then running your django project as the django user. If your django project gets hacked and you have permissions set properly then the most they can do is fiddle with all your django files. If they have root access they can get your SSL certs, SSH keys, redirect your Nginx server and all kinds of other bad things.
- latchkey 15y agoSure, trying to mitigate damage with sandboxes is a good goal, but the reality is that if your server is hacked at all you're screwed. There is enough local shell exploits that once you are on a box, chances are you can get past user and group permissions pretty easily. Plus, they've hacked your box! Time to wipe it and start over. Period. As for SSL certs, don't you store those on the load balancer? If you are running a single box and it goes down, pointing the LB at a new backend box is a lot easier than copying certs around. As for SSH keys, I'm not quite sure what damage could be done there. The only thing on there is public keys, right? As I said below, this is a big reason why I believe in PaaS if your application can deal with it (and most can). Sysadmin has become so commoditized that there is no point in wasting your own time/money dealing with this stuff.