Commit 3af0b9c3 authored by Marius Burkard's avatar Marius Burkard
Browse files

- wrong jail config used

parent 65504102
......@@ -10,7 +10,7 @@ class ISPConfigDebian10OS extends ISPConfigDebianOS {
$this->replaceContents('/etc/mysql/debian.cnf', array('/^password\s*=.*$/m' => 'password = ' . $mysql_root_pw));
$this->replaceContents('/etc/mysql/mariadb.conf.d/50-server.cnf', array('/^bind-address/m' => '#bind-address'), true, 'mysqld');
}
public function getRestartServiceCommand($service, $command = 'restart') {
if($command != 'start' && $command != 'stop' && $command != 'status') {
$command = 'restart';
......@@ -25,7 +25,7 @@ class ISPConfigDebian10OS extends ISPConfigDebianOS {
$service = 'pure-ftpd-mysql';
break;
}
return 'systemctl ' . $command . ' ' . escapeshellarg($service) . ' 2>&1';
}
......@@ -37,7 +37,7 @@ class ISPConfigDebian10OS extends ISPConfigDebianOS {
$packages[] = 'unrar';
$packages[] = 'lrzip';
}
return $packages;
}
......@@ -50,11 +50,34 @@ class ISPConfigDebian10OS extends ISPConfigDebianOS {
}
}
protected function getFail2BanJail() {
$jk_jail = '[pure-ftpd]
enabled = true
port = ftp
filter = pure-ftpd
logpath = /var/log/syslog
maxretry = 3
[dovecot]
enabled = true
filter = dovecot
logpath = /var/log/mail.log
maxretry = 5
[postfix-sasl]
enabled = true
port = smtp
filter = postfix[mode=auth]
logpath = /var/log/mail.log
maxretry = 3';
return $jk_jail;
}
protected function installPHPMyAdmin($mysql_root_pw) {
if(!ISPConfig::shallInstall('web') || !ISPConfig::shallInstall('pma')) {
return;
}
ISPConfigLog::info('Installing package phpmyadmin', true);
if(!is_dir('/usr/share/phpmyadmin')) {
......@@ -67,7 +90,7 @@ class ISPConfigDebian10OS extends ISPConfigDebianOS {
mkdir('/var/lib/phpmyadmin/tmp', 0777, true);
}
touch('/etc/phpmyadmin/htpasswd.setup');
$cmd = 'chown -R www-data:www-data ' . escapeshellarg('/var/lib/phpmyadmin') . ' ; cd /tmp ; rm -f phpMyAdmin-4.9.0.1-all-languages.tar.gz ; wget "https://files.phpmyadmin.net/phpMyAdmin/4.9.0.1/phpMyAdmin-4.9.0.1-all-languages.tar.gz" 2>/dev/null && tar xfz phpMyAdmin-4.9.0.1-all-languages.tar.gz && cp -a phpMyAdmin-4.9.0.1-all-languages/* /usr/share/phpmyadmin/ && rm -f phpMyAdmin-4.9.0.1-all-languages.tar.gz && rm -rf phpMyAdmin-4.9.0.1-all-languages';
$result = $this->exec($cmd);
if($result === false) {
......@@ -75,13 +98,13 @@ class ISPConfigDebian10OS extends ISPConfigDebianOS {
}
copy('/usr/share/phpmyadmin/config.sample.inc.php', '/usr/share/phpmyadmin/config.inc.php');
$replacements = array(
'/^(?:\s*\/\/)?\s*\$cfg\[\'blowfish_secret\'\]\s*=.*$/m' => '$cfg[\'blowfish_secret\'] = \'' . substr(sha1(uniqid('pre', true)), 0, 32) . '\';',
'/^(?:\s*\/\/)?\s*\$cfg\[\'TempDir\'\]\s*=.*$/m' => '$cfg[\'TempDir\'] = \'/var/lib/phpmyadmin/tmp\';'
);
$this->replaceContents('/usr/share/phpmyadmin/config.inc.php', $replacements, true);
$contents = '# phpMyAdmin default Apache configuration
Alias /phpmyadmin /usr/share/phpmyadmin
......@@ -131,17 +154,17 @@ Alias /phpmyadmin /usr/share/phpmyadmin
$this->restartService('apache2');
}
$pma_pass = ISPConfigFunctions::generatePassword(15);
$pma_pass_enc = preg_replace('/[\'\\\\]/', '\\$1', $pma_pass);
$queries = array(
'CREATE DATABASE phpmyadmin;',
'CREATE USER \'pma\'@\'localhost\' IDENTIFIED BY \'' . $pma_pass_enc . '\';',
'GRANT ALL PRIVILEGES ON phpmyadmin.* TO \'pma\'@\'localhost\' IDENTIFIED BY \'' . $pma_pass_enc . '\' WITH GRANT OPTION;',
'FLUSH PRIVILEGES;'
);
foreach($queries as $query) {
$cmd = 'mysql --defaults-file=/etc/mysql/debian.cnf -e ' . escapeshellarg($query) . ' 2>&1';
$result = $this->exec($cmd);
......@@ -149,13 +172,13 @@ Alias /phpmyadmin /usr/share/phpmyadmin
ISPConfigLog::warn('Query ' . $query . ' failed.', true);
}
}
$cmd = 'mysql --defaults-file=/etc/mysql/debian.cnf -D phpmyadmin < /usr/share/phpmyadmin/sql/create_tables.sql';
$result = $this->exec($cmd);
if($result === false) {
ISPConfigLog::warn('Command ' . $cmd . ' failed.', true);
}
$uncomment = array(
array(
'first_line' => '/^(?:\s*\/\/)?\s*\$cfg\[\'Servers\'\]\[\$i\]/',
......@@ -164,7 +187,7 @@ Alias /phpmyadmin /usr/share/phpmyadmin
)
);
$this->uncommentLines('/usr/share/phpmyadmin/config.inc.php', $uncomment, '//');
$replacements = array(
'/^(?:\s*\/\/)?\s*(\$cfg\[\'Servers\'\]\[\$i\]\[\'controlhost\'\])\s*=.*$/m' => '$1 = \'localhost\';',
'/^(?:\s*\/\/)?\s*(\$cfg\[\'Servers\'\]\[\$i\]\[\'controlport\'\])\s*=.*$/m' => '$1 = \'\';',
......@@ -173,7 +196,7 @@ Alias /phpmyadmin /usr/share/phpmyadmin
);
$this->replaceContents('/usr/share/phpmyadmin/config.inc.php', $replacements, false);
}
protected function getSystemPHPVersion() {
return '7.3';
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment