diff --git a/core/Updates/3.0.1.php b/core/Updates/3.0.1-b1.php similarity index 76% rename from core/Updates/3.0.1.php rename to core/Updates/3.0.1-b1.php index 8820be0526faa6d6d2d01d12721dd96ea5481cd8..6222e27b2cca0dff580137c708bda57fe1547fa1 100644 --- a/core/Updates/3.0.1.php +++ b/core/Updates/3.0.1-b1.php @@ -13,11 +13,12 @@ use Piwik\Plugins\Installation\ServerFilesGenerator; use Piwik\Updater; use Piwik\Updates as PiwikUpdates; -class Updates_3_0_1 extends PiwikUpdates +class Updates_3_0_1_b1 extends PiwikUpdates { public function doUpdate(Updater $updater) { // Allow IIS to serve .woff files (https://github.com/piwik/piwik/pull/11091). + // Re-generate .htaccess without 'Options -Indexes' because it does not always work on some servers ServerFilesGenerator::createFilesForSecurity(); } } diff --git a/plugins/Installation/ServerFilesGenerator.php b/plugins/Installation/ServerFilesGenerator.php index a10b1471dc568a53858d4d756bb3cb03d83c453c..1207024bfda06baa7521bbf0621feadb3d0a99a2 100644 --- a/plugins/Installation/ServerFilesGenerator.php +++ b/plugins/Installation/ServerFilesGenerator.php @@ -33,13 +33,10 @@ class ServerFilesGenerator $denyAll = self::getDenyAllHtaccessContent(); $allow = self::getAllowHtaccessContent(); - // more selective allow/deny filters - $noDirectoryListing = "Options -Indexes\n"; - $allowAny = "# Allow any file in this directory\n" . "<Files \"*\">\n" . - $allow . "\n" . + "\t" . $allow . "\n" . "</Files>\n"; $allowStaticAssets = @@ -55,11 +52,11 @@ class ServerFilesGenerator "</Files>\n"; $directoriesToProtect = array( - '/js' => $allowAny . $noDirectoryListing, - '/libs' => $denyAll . $allowStaticAssets . $noDirectoryListing, - '/vendor' => $denyAll . $allowStaticAssets . $noDirectoryListing, - '/plugins' => $denyAll . $allowStaticAssets . $noDirectoryListing, - '/misc/user' => $denyAll . $allowStaticAssets . $noDirectoryListing, + '/js' => $allowAny, + '/libs' => $denyAll . $allowStaticAssets, + '/vendor' => $denyAll . $allowStaticAssets, + '/plugins' => $denyAll . $allowStaticAssets, + '/misc/user' => $denyAll . $allowStaticAssets, ); foreach ($directoriesToProtect as $directoryToProtect => $content) { self::createHtAccess(PIWIK_INCLUDE_PATH . $directoryToProtect, $overwrite = true, $content); @@ -67,10 +64,10 @@ class ServerFilesGenerator // deny access to these folders $directoriesToProtect = array( - '/config' => $denyAll . $noDirectoryListing, - '/core' => $denyAll . $noDirectoryListing, - '/lang' => $denyAll . $noDirectoryListing, - '/tmp' => $denyAll . $noDirectoryListing, + '/config' => $denyAll, + '/core' => $denyAll, + '/lang' => $denyAll, + '/tmp' => $denyAll, ); foreach ($directoriesToProtect as $directoryToProtect => $content) { self::createHtAccess(PIWIK_INCLUDE_PATH . $directoryToProtect, $overwrite = true, $content);