Skip to content

Commit cd42638

Browse files
committed
Fixed: Forbid access to both /setup and /sql directories
CS fixes
1 parent 69014e5 commit cd42638

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/Handler.pm

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,8 @@ sub _buildConfigFiles
333333

334334
$cfgTpl = process( $data, $cfgTpl );
335335

336-
my $ug = $::imscpConfig{'SYSTEM_USER_PREFIX'} . $::imscpConfig{'SYSTEM_USER_MIN_UID'};
336+
my $ug = $::imscpConfig{'SYSTEM_USER_PREFIX'} .
337+
$::imscpConfig{'SYSTEM_USER_MIN_UID'};
337338
my $file = iMSCP::File->new(
338339
filename => './vendor/phpmyadmin/phpmyadmin/config.inc.php'
339340
);
@@ -349,9 +350,12 @@ sub _buildConfigFiles
349350
);
350351
return 1 unless defined( my $fileC = $file->getAsRef());
351352

352-
${ $fileC } =~ s%^define\('AUTOLOAD_FILE',\s+'./vendor/autoload.php'\);%define('AUTOLOAD_FILE', '$CWD/vendor/autoload.php');%m;
353-
${ $fileC } =~ s%^define\('TEMP_DIR',\s+'./tmp/'\);%define('TEMP_DIR', '$CWD/data/tmp/');%m;
354-
${ $fileC } =~ s%^define\('VERSION_CHECK_DEFAULT',\s+true\);%define\('VERSION_CHECK_DEFAULT', false);%m;
353+
${ $fileC } =~ s%^define\('AUTOLOAD_FILE',\s+'./vendor/autoload.php'\);
354+
%define('AUTOLOAD_FILE', '$CWD/vendor/autoload.php');%mx;
355+
${ $fileC } =~ s%^define\('TEMP_DIR',\s+'./tmp/'\);
356+
%define('TEMP_DIR', '$CWD/data/tmp/');%mx;
357+
${ $fileC } =~ s%^define\('VERSION_CHECK_DEFAULT',\s+true\);
358+
%define\('VERSION_CHECK_DEFAULT', false);%mx;
355359

356360
$file->save();
357361
}

src/nginx.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ location ^~ /phpmyadmin/ {
66
disable_symlinks off;
77
root {GUI_ROOT_DIR}/public/tools;
88

9+
location ~ /(setup|sql)/ {
10+
deny all;
11+
}
12+
913
location ~ \.php$ {
1014
include imscp_fastcgi.conf;
1115
}

0 commit comments

Comments
 (0)