by hannob · 1w ago · 0 comments
They provide limited configurability of server functionality within a webroot. That's extremely convenient for PHP webapps. For many PHP apps, deploying them on anything that is not apache means touching the server config itself.
Modifying the web server config is a nonissue outside of shared hosting, which should have died out with the advent of VMs/containers.
Its use is optional: set "AllowOverride None" (the default) and it's disabled.
* https://httpd.apache.org/docs/2.4/mod/core.html#allowoverrid...
Disabling the feature does not remove it.
If I do not turn on my car's windshield wipers, do they get "removed"?
Caching is a thing. Only dump the cache when a changed is noticed.
Perfect security.
sigh
That can expose your files for such a trivial reason as different end of line sequence than what it expects. Instead of shutting down the access, it just happily ignores .htaccess and enables DirectoryIndex.
This is the software that's responsible for majority of data leaks in the world.
Stop using it.
Its model is fundamentally flawed precisely because it was based on the fundamentally flawed PHP model (website assets and code are stored and hosted from the same webroot). This allowed for shared hosting to exist but containers and reverse proxies are a far better way of organising such sites today.
The fact that in other webservers the server's configuration is configured through its configuration file and not the content of its webroot is a feature.
Really not sure how one could possibly read my comment as me saying htaccess is the only way of configuring Apache?
Nginx uses way less memory in most use-cases (1/4 to 1/10), but with dynamic content like php it is only slightly better (maybe 15% if lucky). Also, setting up websocket proxy in Nginx is still a bit of a bodge.
Each server type has its own trade offs, and a list of known mitigations the uninitiated must learn. If you have a single domain high-traffic site with static media files, than Nginx is probably going to matter more. =3
- php-fpm is easy, you can make the pool run as the domain's user/group directly
- nginx: you must add nginx's user (www-data) to the domain personal's group
The downside to this approach is that it's harder to reason about for someone unfamiliar with it and it's easy to misconfigure file permissions. There is also a limited number of extra groups a user can be part of before it becomes an issue (plus one fpm pool per user takes memory).
That being said the best massively-shared hosting system I've ever used was apache mpm_prefork with mod_php and mod_ruid2. It used as much(little) memory as a single user setup, it scaled to 10k users if you wanted, and file permissions were all naturally handled.
The way mod_ruid2 worked was to use linux capabilities to change the effective user/group of the apache process before serving the request, so it would run as the tenant's group and user, then switch back to nobody/nobody. It had very little overhead compared to things like mod_suphp and, more importantly, it also worked on static files and .htaccess!
The module has been abandoned and was never that popular so I always wondered if it was found to be exploitable or something... Thanks to Linux Capabilities an exploiter couldn't gain root, but as seen from the recent exploit apache's mod_php doesn't do a full cleanup so maybe there was leakage when the process was reused (but then that is solvable by limiting the requested to 1)