Skip to content

Commit e32c871

Browse files
author
Marius Burkard
committed
Merge branch 'stable-3.1'
2 parents 4382fdc + 02fde68 commit e32c871

File tree

402 files changed

+1567
-427
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

402 files changed

+1567
-427
lines changed

install/dist/lib/fedora.lib.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -722,6 +722,12 @@ public function configure_apache()
722722
$tpl = new tpl('apache_ispconfig.conf.master');
723723
$tpl->setVar('apache_version',getapacheversion());
724724

725+
if($this->is_update == true) {
726+
$tpl->setVar('logging',get_logging_state());
727+
} else {
728+
$tpl->setVar('logging','yes');
729+
}
730+
725731
$records = $this->db->queryAllRecords("SELECT * FROM ?? WHERE server_id = ? AND virtualhost = 'y'", $conf['mysql']['master_database'] . '.server_ip', $conf['server_id']);
726732
$ip_addresses = array();
727733

@@ -806,6 +812,17 @@ public function configure_nginx(){
806812
//* add a sshusers group
807813
$command = 'groupadd sshusers';
808814
if(!is_group('sshusers')) caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
815+
816+
// add anonymized log option to nginxx.conf file
817+
$nginx_conf_file = $conf['nginx']['config_dir'].'/nginx.conf';
818+
if(is_file($nginx_conf_file)) {
819+
$tmp = file_get_contents($nginx_conf_file);
820+
if(!stristr($tmp, 'log_format anonymized')) {
821+
copy($nginx_conf_file,$nginx_conf_file.'~');
822+
replaceLine($nginx_conf_file, 'http {', "http {\n\n".file_get_contents('tpl/nginx_anonlog.master'), 0, 0);
823+
}
824+
}
825+
809826
}
810827

811828
public function configure_bastille_firewall()

install/dist/lib/gentoo.lib.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,12 @@ public function configure_apache()
603603
$tpl = new tpl('apache_ispconfig.conf.master');
604604
$tpl->setVar('apache_version',getapacheversion());
605605

606+
if($this->is_update == true) {
607+
$tpl->setVar('logging',get_logging_state());
608+
} else {
609+
$tpl->setVar('logging','yes');
610+
}
611+
606612
$records = $this->db->queryAllRecords("SELECT * FROM ?? WHERE server_id = ? AND virtualhost = 'y'", $conf['mysql']['master_database'] . '.server_ip', $conf['server_id']);
607613
$ip_addresses = array();
608614

install/dist/lib/opensuse.lib.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,12 @@ public function configure_apache()
691691
$tpl = new tpl('apache_ispconfig.conf.master');
692692
$tpl->setVar('apache_version',getapacheversion());
693693

694+
if($this->is_update == true) {
695+
$tpl->setVar('logging',get_logging_state());
696+
} else {
697+
$tpl->setVar('logging','yes');
698+
}
699+
694700
$records = $this->db->queryAllRecords("SELECT * FROM ?? WHERE server_id = ? AND virtualhost = 'y'", $conf['mysql']['master_database'] . '.server_ip', $conf['server_id']);
695701
$ip_addresses = array();
696702

@@ -817,6 +823,16 @@ public function configure_nginx(){
817823
//* add a sshusers group
818824
$command = 'groupadd sshusers';
819825
if(!is_group('sshusers')) caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
826+
827+
// add anonymized log option to nginxx.conf file
828+
$nginx_conf_file = $conf['nginx']['config_dir'].'/nginx.conf';
829+
if(is_file($nginx_conf_file)) {
830+
$tmp = file_get_contents($nginx_conf_file);
831+
if(!stristr($tmp, 'log_format anonymized')) {
832+
copy($nginx_conf_file,$nginx_conf_file.'~');
833+
replaceLine($nginx_conf_file, 'http {', "http {\n\n".file_get_contents('tpl/nginx_anonlog.master'), 0, 0);
834+
}
835+
}
820836
}
821837

822838
public function configure_bastille_firewall()

install/install.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@
9999
die('We will stop here. There is already a ISPConfig installation, use the update script to update this installation.');
100100
}*/
101101

102+
// Patch is required to reapir latest amavis versions
103+
if(is_installed('amavisd-new') && !is_installed('patch')) die('The patch command is missing. Install patch command and start installation again.');
104+
102105
//** Get distribution identifier
103106
$dist = get_distname();
104107

install/lib/install.lib.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ function get_distname() {
9797
$mainver = current($mainver).'.'.next($mainver);
9898
}
9999
switch ($mainver){
100+
case "18.04":
101+
$relname = "(Bionic Beaver)";
102+
$distconfid = 'ubuntu1804';
103+
break;
100104
case "17.10":
101105
$relname = "(Artful Aardvark)";
102106
$distconfid = 'ubuntu1710';
@@ -874,6 +878,28 @@ function is_ispconfig_ssl_enabled() {
874878
}
875879
}
876880

881+
/*
882+
* Is anonymization enabled in ispconfig.conf file
883+
*/
884+
885+
function get_logging_state() {
886+
global $conf;
887+
$ispconfig_conf_file = $conf['apache']['vhost_conf_dir'].'/ispconfig.conf';
888+
889+
if(is_file($ispconfig_conf_file)) {
890+
$tmp = file_get_contents($ispconfig_conf_file);
891+
if(stristr($tmp, '/usr/local/ispconfig/server/scripts/vlogger -p -s access.log')) {
892+
return 'anon';
893+
} elseif(stristr($tmp, '/usr/local/ispconfig/server/scripts/vlogger -s access.log')) {
894+
return 'yes';
895+
} else {
896+
return 'no';
897+
}
898+
} else {
899+
return 'yes';
900+
}
901+
}
902+
877903
/**
878904
Function to find the hash file for timezone detection
879905
(c) 2012 Marius Cramer, pixcept KG, m.cramer@pixcept.de

install/lib/installer_base.lib.php

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,15 @@ public function reconfigure_app($service, $reconfigure_services_answer) {
226226
public function configure_database() {
227227
global $conf;
228228

229-
//* ensure no modes with errors for ENGINE=MyISAM
230-
$this->db->query("SET sql_mode = ''");
229+
//* check sql-mode
230+
/*$check_sql_mode = $this->db->queryOneRecord("SELECT @@sql_mode");
231+
232+
if ($check_sql_mode['@@sql_mode'] != '' && $check_sql_mode['@@sql_mode'] != 'NO_ENGINE_SUBSTITUTION') {
233+
echo "Wrong SQL-mode. You should use NO_ENGINE_SUBSTITUTION. Add\n\n";
234+
echo " sql-mode=\"NO_ENGINE_SUBSTITUTION\"\n\n";
235+
echo"to the mysqld-section in your mysql-config on this server and restart mysqld afterwards\n";
236+
die();
237+
}*/
231238

232239
$unwanted_sql_plugins = array('validate_password');
233240
$sql_plugins = $this->db->queryAllRecords("SELECT plugin_name FROM information_schema.plugins WHERE plugin_status='ACTIVE' AND plugin_name IN ?", $unwanted_sql_plugins);
@@ -250,10 +257,10 @@ public function configure_database() {
250257
$this->error('Stopped: Database already contains some tables.');
251258
} else {
252259
if($conf['mysql']['admin_password'] == '') {
253-
caselog("mysql --default-character-set=".escapeshellarg($conf['mysql']['charset'])." -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." ".escapeshellarg($conf['mysql']['database'])." < '".ISPC_INSTALL_ROOT."/install/sql/ispconfig3.sql' &> /dev/null",
260+
caselog("mysql --default-character-set=".escapeshellarg($conf['mysql']['charset'])." -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." -P ".escapeshellarg($conf['mysql']['port'])." ".escapeshellarg($conf['mysql']['database'])." < '".ISPC_INSTALL_ROOT."/install/sql/ispconfig3.sql' &> /dev/null",
254261
__FILE__, __LINE__, 'read in ispconfig3.sql', 'could not read in ispconfig3.sql');
255262
} else {
256-
caselog("mysql --default-character-set=".escapeshellarg($conf['mysql']['charset'])." -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." -p".escapeshellarg($conf['mysql']['admin_password'])." ".escapeshellarg($conf['mysql']['database'])." < '".ISPC_INSTALL_ROOT."/install/sql/ispconfig3.sql' &> /dev/null",
263+
caselog("mysql --default-character-set=".escapeshellarg($conf['mysql']['charset'])." -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." -p".escapeshellarg($conf['mysql']['admin_password'])." -P ".escapeshellarg($conf['mysql']['port'])." ".escapeshellarg($conf['mysql']['database'])." < '".ISPC_INSTALL_ROOT."/install/sql/ispconfig3.sql' &> /dev/null",
257264
__FILE__, __LINE__, 'read in ispconfig3.sql', 'could not read in ispconfig3.sql');
258265
}
259266
$db_tables = $this->db->getTables();
@@ -1981,6 +1988,14 @@ public function configure_apache() {
19811988
$vhost_conf_enabled_dir = $conf['apache']['vhost_conf_enabled_dir'];
19821989

19831990
$tpl = new tpl('apache_ispconfig.conf.master');
1991+
$tpl->setVar('apache_version',getapacheversion());
1992+
1993+
if($this->is_update == true) {
1994+
$tpl->setVar('logging',get_logging_state());
1995+
} else {
1996+
$tpl->setVar('logging','yes');
1997+
}
1998+
19841999
$tpl->setVar('apache_version',getapacheversion(true));
19852000

19862001
$records = $this->db->queryAllRecords("SELECT * FROM ?? WHERE server_id = ? AND virtualhost = 'y'", $conf['mysql']['master_database'] . '.server_ip', $conf['server_id']);
@@ -2066,6 +2081,17 @@ public function configure_nginx(){
20662081
//* add a sshusers group
20672082
$command = 'groupadd sshusers';
20682083
if(!is_group('sshusers')) caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
2084+
2085+
// add anonymized log option to nginxx.conf file
2086+
$nginx_conf_file = $conf['nginx']['config_dir'].'/nginx.conf';
2087+
if(is_file($nginx_conf_file)) {
2088+
$tmp = file_get_contents($nginx_conf_file);
2089+
if(!stristr($tmp, 'log_format anonymized')) {
2090+
copy($nginx_conf_file,$nginx_conf_file.'~');
2091+
replaceLine($nginx_conf_file, 'http {', "http {\n\n".file_get_contents('tpl/nginx_anonlog.master'), 0, 0);
2092+
}
2093+
}
2094+
20692095
}
20702096

20712097
public function configure_fail2ban() {
@@ -2239,6 +2265,11 @@ public function configure_apps_vhost() {
22392265
$tpl->setVar('apps_vhost_basedir',$conf['web']['website_basedir']);
22402266
$tpl->setVar('apps_vhost_servername',$apps_vhost_servername);
22412267
$tpl->setVar('apache_version',getapacheversion());
2268+
if($this->is_update == true) {
2269+
$tpl->setVar('logging',get_logging_state());
2270+
} else {
2271+
$tpl->setVar('logging','yes');
2272+
}
22422273

22432274

22442275
// comment out the listen directive if port is 80 or 443
@@ -2322,7 +2353,12 @@ public function configure_apps_vhost() {
23222353
$content = str_replace('{fpm_socket}', $fpm_socket, $content);
23232354
$content = str_replace('{cgi_socket}', $cgi_socket, $content);
23242355

2325-
if(file_exists('/var/run/php5-fpm.sock') || file_exists('/var/run/php/php7.0-fpm.sock')){
2356+
if( file_exists('/var/run/php5-fpm.sock')
2357+
|| file_exists('/var/run/php/php7.0-fpm.sock')
2358+
|| file_exists('/var/run/php/php7.1-fpm.sock')
2359+
|| file_exists('/var/run/php/php7.2-fpm.sock')
2360+
|| file_exists('/var/run/php/php7.3-fpm.sock')
2361+
){
23262362
$use_tcp = '#';
23272363
$use_socket = '';
23282364
} else {

install/lib/update.lib.php

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ function prepareDBDump() {
8282
if ($conf['powerdns']['installed']) {
8383
//** export the current PowerDNS database data
8484
if( !empty($conf["mysql"]["admin_password"]) ) {
85-
system("mysqldump -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." -p".escapeshellarg($conf['mysql']['admin_password'])." -c -t --add-drop-table --create-options --quick --result-file=existing_powerdns_db.sql ".$conf['powerdns']['database']);
85+
system("mysqldump -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." -p".escapeshellarg($conf['mysql']['admin_password'])." -P ".escapeshellarg($conf['mysql']['port'])." -c -t --add-drop-table --create-options --quick --result-file=existing_powerdns_db.sql ".$conf['powerdns']['database']);
8686
} else {
87-
system("mysqldump -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." -c -t --add-drop-table --create-options --quick --result-file=existing_powerdns_db.sql ".$conf['powerdns']['database']);
87+
system("mysqldump -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." -P ".escapeshellarg($conf['mysql']['port'])." -c -t --add-drop-table --create-options --quick --result-file=existing_powerdns_db.sql ".$conf['powerdns']['database']);
8888
}
8989

9090
// create a backup copy of the PowerDNS database in the root folder
@@ -103,7 +103,7 @@ function checkDbHealth() {
103103
$notok = array();
104104

105105
echo "Checking ISPConfig database .. ";
106-
exec("mysqlcheck -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." -p".escapeshellarg($conf['mysql']['admin_password'])." -r ".escapeshellarg($conf["mysql"]["database"]), $result);
106+
exec("mysqlcheck -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." -p".escapeshellarg($conf['mysql']['admin_password'])." -P ".escapeshellarg($conf['mysql']['port'])." -r ".escapeshellarg($conf["mysql"]["database"]), $result);
107107
for( $i=0; $i<sizeof($result);$i++) {
108108
if ( substr($result[$i], -2) != "OK" ) {
109109
$notok[] = $result[$i];
@@ -125,8 +125,15 @@ function checkDbHealth() {
125125
function updateDbAndIni() {
126126
global $inst, $conf;
127127

128-
//* ensure no modes with errors for ENGINE=MyISAM
129-
$inst->db->query("SET sql_mode = ''");
128+
//* check sql-mode
129+
/*
130+
$check_sql_mode = $inst->db->queryOneRecord("SELECT @@sql_mode");
131+
if ($check_sql_mode['@@sql_mode'] != '' && $check_sql_mode['@@sql_mode'] != 'NO_ENGINE_SUBSTITUTION') {
132+
echo "Wrong SQL-mode. You should use NO_ENGINE_SUBSTITUTION. Add\n\n";
133+
echo " sql-mode=\"NO_ENGINE_SUBSTITUTION\"\n\n";
134+
echo"to the mysqld-section in your mysql-config on this server and restart mysqld afterwards\n";
135+
die();
136+
}*/
130137

131138
$unwanted_sql_plugins = array('validate_password');
132139
$sql_plugins = $inst->db->queryAllRecords("SELECT plugin_name FROM information_schema.plugins WHERE plugin_status='ACTIVE' AND plugin_name IN ?", $unwanted_sql_plugins);
@@ -203,9 +210,9 @@ function updateDbAndIni() {
203210

204211
//* Load patch file into database
205212
if( !empty($conf["mysql"]["admin_password"]) ) {
206-
$cmd = "mysql --default-character-set=".escapeshellarg($conf['mysql']['charset'])." --force -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." -p".escapeshellarg($conf['mysql']['admin_password'])." ".escapeshellarg($conf['mysql']['database'])." < ".$sql_patch_filename;
213+
$cmd = "mysql --default-character-set=".escapeshellarg($conf['mysql']['charset'])." --force -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." -p".escapeshellarg($conf['mysql']['admin_password'])." -P ".escapeshellarg($conf['mysql']['port'])." ".escapeshellarg($conf['mysql']['database'])." < ".$sql_patch_filename;
207214
} else {
208-
$cmd = "mysql --default-character-set=".escapeshellarg($conf['mysql']['charset'])." --force -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." ".escapeshellarg($conf['mysql']['database'])." < ".$sql_patch_filename;
215+
$cmd = "mysql --default-character-set=".escapeshellarg($conf['mysql']['charset'])." --force -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." -P ".escapeshellarg($conf['mysql']['port'])." ".escapeshellarg($conf['mysql']['database'])." < ".$sql_patch_filename;
209216
}
210217

211218
if(in_array($next_db_version,explode(',',$silent_update_versions))) {
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
ALTER TABLE `web_domain` ADD COLUMN `ssl_letsencrypt_exclude` enum('n','y') NOT NULL DEFAULT 'n' AFTER `ssl_letsencrypt`;
2+
ALTER TABLE `remote_user` ADD `remote_access` ENUM('y','n') NOT NULL DEFAULT 'y' AFTER `remote_password`;
3+
ALTER TABLE `remote_user` ADD `remote_ips` TEXT AFTER `remote_access`;
4+
ALTER TABLE `server_php` ADD `active` enum('y','n') NOT NULL DEFAULT 'y' AFTER `php_fpm_pool_dir`;
5+
ALTER TABLE `web_domain` CHANGE `log_retention` `log_retention` INT(11) NOT NULL DEFAULT '10';

install/sql/incremental/upd_dev_collection.sql

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
<<<<<<< HEAD
21
ALTER TABLE `mail_mailinglist` ADD `list_type` enum('open','closed') NOT NULL DEFAULT 'open';
32
ALTER TABLE `mail_mailinglist` ADD `subject_prefix` varchar(50) NOT NULL DEFAULT '';
43
ALTER TABLE `mail_mailinglist` ADD `admins` mediumtext;
@@ -94,8 +93,6 @@ ALTER TABLE `remote_user` ADD `remote_ips` TEXT AFTER `remote_access`;
9493
ALTER TABLE `web_domain` ADD `php_fpm_chroot` enum('n','y') NOT NULL DEFAULT 'n' AFTER `php_fpm_use_socket`;
9594

9695

97-
98-
9996
ALTER TABLE `client_template`
10097
ADD COLUMN `limit_xmpp_webpresence` ENUM( 'n', 'y' ) NOT NULL default 'y',
10198
ADD COLUMN `limit_xmpp_http_upload` ENUM( 'n', 'y' ) NOT NULL default 'n';

install/sql/ispconfig3.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1430,6 +1430,7 @@ CREATE TABLE `server_php` (
14301430
`php_fpm_init_script` varchar(255) DEFAULT NULL,
14311431
`php_fpm_ini_dir` varchar(255) DEFAULT NULL,
14321432
`php_fpm_pool_dir` varchar(255) DEFAULT NULL,
1433+
`active` enum('n','y') NOT NULL DEFAULT 'y',
14331434
PRIMARY KEY (`server_php_id`)
14341435
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
14351436

@@ -2076,7 +2077,7 @@ CREATE TABLE `web_domain` (
20762077
`http_port` int(11) unsigned NOT NULL DEFAULT '80',
20772078
`https_port` int(11) unsigned NOT NULL DEFAULT '443',
20782079
`folder_directive_snippets` text,
2079-
`log_retention` int(11) NOT NULL DEFAULT '30',
2080+
`log_retention` int(11) NOT NULL DEFAULT '10',
20802081
PRIMARY KEY (`domain_id`),
20812082
UNIQUE KEY `serverdomain` ( `server_id` , `ip_address`, `domain` )
20822083
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

0 commit comments

Comments
 (0)