Fix "deny from all" statements in .htaccess files

"Deny from all" statements do not work in Apache 2.4.
They are replaced by "Require all denied".

A check was added to make the .htaccess files work with both Apache 2.2 & 2.4.
pull/4885/head
TheTomcat14 2 years ago
parent bc432c19b4
commit 631b957b11
  1. 9
      app/cache/.htaccess
  2. 8
      app/home/.htaccess
  3. 9
      main/admin/archive_cleanup.php
  4. 9
      main/admin/user_import.php
  5. 9
      main/inc/lib/add_course.lib.inc.php

@ -1,5 +1,10 @@
order deny,allow
deny from all
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
# pChart generated files should be allowed
<FilesMatch "^[0-9a-f]+$">
order allow,deny

@ -1,3 +1,9 @@
<FilesMatch "(?i)\.(php5|php4|php|php3|php2|phtml|pl|py|jsp|asp|sh|cgi)$">
deny from all
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order allow,deny
Deny from all
</IfModule>
</FilesMatch>

@ -47,8 +47,13 @@ if ($form->validate()) {
$archive_path = api_get_path(SYS_ARCHIVE_PATH);
$htaccess = <<<TEXT
order deny,allow
deny from all
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
# pChart generated files should be allowed
<FilesMatch "^[0-9a-f]+$">
order allow,deny

@ -41,8 +41,13 @@ function createDirectory($path = null)
mkdir($data, api_get_permissions_for_new_directories());
$block =
'<FilesMatch "\.(csv|xml)$">
Order allow,deny
Deny from all
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order allow,deny
Deny from all
</IfModule>
</FilesMatch>
Options -Indexes';

@ -173,8 +173,13 @@ class AddCourse
"AuthName AllowLocalAccess
AuthType Basic
order deny,allow
deny from all
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
php_flag zlib.output_compression off"
);

Loading…
Cancel
Save