The next iteration of our shared web hosting service

Perhaps we don’t need to provide CGI on shared hosting anymore?

Looking at the .cgi and .pl scripts on our latest servers I have found:

  1. A Bash script being used to run wget to download a file that needs authentication, this could be re-written as PHP.
  2. Lots of copies of a Perl script that comes with the WordPress Updraft Plus plugin, get-cpanel-quota-usage.pl, since we are not running CPanel and the script has a #!/usr/local/bin/perl shebang and we don’t have a copy of Perl in /usr/local/bin, this is not an issue.
  3. Quite a few left over scripts from hosting on past servers, especially on static archives sites (and on these the scripts are not allowed to be run via HTTP in any case).
  4. The MediaWiki Perl script, mediawiki_mysql2postgres.pl, this would be run on the command line to migrate to Postgres but since we use MySQL / MariaDB and this would never be run from the web, it isn’t an issue.
  5. A 12 year old copy of FCKeditor (I added a .htaccess file with Deny from All in it to this directory).
  6. A libsass Perl script test-leaks.pl which appears to be installed by Yarn, it is deigned to be run on the command line and not via a web browser.
  7. A couple of installs of AWStats for clients who prefer these stats over the Matomo generated ones.

I’m of the view that we don’t need to support CGI on our shared hosting servers any more, static HTML, SSI and PHP covers almost everything.

If we allowed exec via SSI then this would be a security issue but since we don’t and includes can’t escape the DocumentRoot I believe it would be secure having Apache run as www-data for all users.

If necessary we could setup separate FastCGI shared hosting servers, but it appears to me that we only have a demand for static and PHP shared hosting at the moment, so it would be safe to drop support for CGI scripts on new shared hosting servers.

We could potentially chroot Apache but I don’t think there is any point as it would make phpMyAdmin setup more complicated with little security advantage.

Chrooting PHP-FPM and SFTP / SSH however is essential (together with the way we are using multiple mounts) as without this users could access each others files.