I am planning to offer a free multi-hosting for a rack-based ruby framework using nginx and passenger to serve these apps. I am working on several options and I would like to ask some advice on the best security practices for this type of setup in a multi hosting environment:

  • The first option I am working on is a web-based front-end which will allow users to upload their application. To make it fairly automated I could build a parser to check that the ruby/framework code doesn't contain any malicious command e.g. %x( and others too. I am not sure if it is really possible to cover all possibility but this should be mitigated by the fact that, upon upload, a unix user is created (together with a nginx sub domain) and the uploaded app will run inside the user directory and that user has no special server wide permissions outside his own directory;

  • The second option is to allow sftp access (or sftp/ssh access) with essentially no permissions outside their directory. In this case a screening of member will have to be implemented (subscription form) but would potentially give more flexibility.

From your experience what would be the most suitable option? Secondly for option 2 with sftp or even sftp and ssh access that would be an appropriate security setup? bear in mind that nginx would need read access in the whole /users/.... tree so it can't be too restrictive. Thanks in advance for your advice!

closed as not constructive by Wesley, Ward, Tom O'Connor, Zoredache, Skyhawk Apr 13 '12 at 23:30

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. If this question can be reworded to fit the rules in the help center, please edit the question.


You're not gonna like this.. Shared hosting is kinda dead. Nobody really does it anymore.

You'd be better off offering a VPS service where you control the images that they're using. Oh wait. Amazon beat you to that one, and so did all the other companies like Heroku and EngineYard.

The reason that VPSes are more in vogue this season and shared hosting is out?

Security's a big point. It's a lot easier to secure a virtual server than it is to secure a directory.

It's also easier to limit the user's allocated CPU, RAM and Disk usage, as well as their IO bandwidth.

If you really want to do it as a shared-server/multi-user thing, then the second option is possibly best, although, frankly, they both suck a bit.

Don't give them SSH access. Give them Git access, like PHPFog et al. That restricts them to just uploading files.

You can't effectively parse/filter the code that they do upload, because you'll only ever find exploits that you know how to look for. New exploits will pass you by, and then it'll be too late.

  • thank you for your reply Tom. Question: how do Engine Yard and Orchestra.io (that is the same thing now I think) deploy your application? I don't think they create a sub-micro-instance per each user. So for example if their users uploads to orchestra (via GIT orchestra clones the repo so it doesn't really upload I know ...) how do the practically deploy it ? thanks in advance – devnull Apr 6 '12 at 13:14
  • I think you'd have to ask them about that. – Tom O'Connor Apr 6 '12 at 22:17

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