How to secure Apache for shared hosting environment? (chrooting, avoid symlinking...)

Posted by Alessio Periloso on Server Fault See other posts from Server Fault or by Alessio Periloso
Published on 2012-06-26T21:19:07Z Indexed on 2012/06/27 9:17 UTC
Read the original article Hit count: 228

I'm having problems dealing with Apache configuration: the problem is that I want to limit each user to his own docroot (so, a chroot() would be what I'm looking for), but:

  • Mod_chroot works only globally and not for each virtualhost: i have the users in a path like the following one /home/vhosts/xxxxx/domains/domain.tld/public_html (xxxxx is the user), and can't solve the problem chrooting /home/vhosts, because the users would still be allowed to see each other.
  • Using apache-mod-itk would slow down the websites too much, and I'm not sure if it would solve anything
  • Without using any of the previous two, I think the only thing left is avoiding symlinking, not allowing the users to link to something that doesn't belong to them.

So, I think I'm going to follow the third point but... how to efficiently avoid symlinking while still keeping mod_rewrite working?!
The php has already been chrooted with php-fpm, so my only concern is about Apache itself.

© Server Fault or respective owner

Related posts about apache2

Related posts about security