From b15761fe58b1d68f71981b9a21703ecc9bd85e6c Mon Sep 17 00:00:00 2001 From: Till Date: Thu, 8 Feb 2024 13:59:16 +0100 Subject: [PATCH 1/7] Fixes #6643 --- .../plugins-available/rspamd_plugin.inc.php | 114 +++++++++--------- 1 file changed, 58 insertions(+), 56 deletions(-) diff --git a/server/plugins-available/rspamd_plugin.inc.php b/server/plugins-available/rspamd_plugin.inc.php index c3a60d0bb9..0e40d3b71f 100644 --- a/server/plugins-available/rspamd_plugin.inc.php +++ b/server/plugins-available/rspamd_plugin.inc.php @@ -282,74 +282,76 @@ class rspamd_plugin { $app->system->mkdirpath($this->users_config_dir); } - if((!$this->isValidEmail($app->functions->idn_encode($email_address))) || !isset($data['new']['policy_id']) || intval($data['new']['policy_id']) == 0 && $type == 'spamfilter_user') { - if(is_file($settings_file)) { - unlink($settings_file); - } - } else { - - $app->load('tpl'); - - $tpl = new tpl(); - if (file_exists($conf['rootpath']."/conf-custom/install/rspamd_users.inc.conf.master")) { - $tpl->newTemplate($conf['rootpath']."/conf-custom/install/rspamd_users.inc.conf.master"); + if ($type == 'spamfilter_user'){ + if((!$this->isValidEmail($app->functions->idn_encode($email_address))) || !isset($data['new']['policy_id']) || intval($data['new']['policy_id']) == 0) { + if(is_file($settings_file)) { + unlink($settings_file); + } } else { - $tpl->newTemplate("rspamd_users.inc.conf.master"); - } - $tpl->setVar('record_identifier', 'ispc_' . $type . '_' . $entry_id); - $tpl->setVar('priority', $settings_priority); + $app->load('tpl'); - if($type === 'spamfilter_user') { - if($data[$use_data]['local'] === 'Y') { - $tpl->setVar('to_email', $app->functions->idn_encode($email_address)); + $tpl = new tpl(); + if (file_exists($conf['rootpath']."/conf-custom/install/rspamd_users.inc.conf.master")) { + $tpl->newTemplate($conf['rootpath']."/conf-custom/install/rspamd_users.inc.conf.master"); } else { - $tpl->setVar('from_email', $app->functions->idn_encode($email_address)); + $tpl->newTemplate("rspamd_users.inc.conf.master"); } - // unneded? $spamfilter appears unused - $spamfilter = $data[$use_data]; - } else { - $tpl->setVar('to_email', $app->functions->idn_encode($email_address)); - // need to get matching spamfilter user if any - // unneded? $spamfilter appears unused - $spamfilter = $app->db->queryOneRecord('SELECT * FROM spamfilter_users WHERE `email` = ?', $email_address); - } + $tpl->setVar('record_identifier', 'ispc_' . $type . '_' . $entry_id); + $tpl->setVar('priority', $settings_priority); + + if($type === 'spamfilter_user') { + if($data[$use_data]['local'] === 'Y') { + $tpl->setVar('to_email', $app->functions->idn_encode($email_address)); + } else { + $tpl->setVar('from_email', $app->functions->idn_encode($email_address)); + } + // unneded? $spamfilter appears unused + $spamfilter = $data[$use_data]; + } else { + $tpl->setVar('to_email', $app->functions->idn_encode($email_address)); - if(!isset($policy['rspamd_spam_tag_level'])) { - $policy['rspamd_spam_tag_level'] = 6.0; - } - if(!isset($policy['rspamd_spam_tag_method'])) { - $policy['rspamd_spam_tag_method'] = 'add_header'; - } - if(!isset($policy['rspamd_spam_kill_level'])) { - $policy['rspamd_spam_kill_level'] = 15.0; - } - if(!isset($policy['rspamd_virus_kill_level'])) { - $policy['rspamd_virus_kill_level'] = floatval($policy['rspamd_spam_kill_level']) + 1000; - } + // need to get matching spamfilter user if any + // unneded? $spamfilter appears unused + $spamfilter = $app->db->queryOneRecord('SELECT * FROM spamfilter_users WHERE `email` = ?', $email_address); + } - $tpl->setVar('rspamd_spam_tag_level', floatval($policy['rspamd_spam_tag_level'])); - $tpl->setVar('rspamd_spam_tag_method', $policy['rspamd_spam_tag_method']); - $tpl->setVar('rspamd_spam_kill_level', floatval($policy['rspamd_spam_kill_level'])); - $tpl->setVar('rspamd_virus_kill_level', floatval($policy['rspamd_spam_kill_level']) + 1000); + if(!isset($policy['rspamd_spam_tag_level'])) { + $policy['rspamd_spam_tag_level'] = 6.0; + } + if(!isset($policy['rspamd_spam_tag_method'])) { + $policy['rspamd_spam_tag_method'] = 'add_header'; + } + if(!isset($policy['rspamd_spam_kill_level'])) { + $policy['rspamd_spam_kill_level'] = 15.0; + } + if(!isset($policy['rspamd_virus_kill_level'])) { + $policy['rspamd_virus_kill_level'] = floatval($policy['rspamd_spam_kill_level']) + 1000; + } - if(isset($policy['spam_lover']) && $policy['spam_lover'] == 'Y') { - $tpl->setVar('spam_lover', true); - } - if(isset($policy['virus_lover']) && $policy['virus_lover'] == 'Y') { - $tpl->setVar('virus_lover', true); - } + $tpl->setVar('rspamd_spam_tag_level', floatval($policy['rspamd_spam_tag_level'])); + $tpl->setVar('rspamd_spam_tag_method', $policy['rspamd_spam_tag_method']); + $tpl->setVar('rspamd_spam_kill_level', floatval($policy['rspamd_spam_kill_level'])); + $tpl->setVar('rspamd_virus_kill_level', floatval($policy['rspamd_spam_kill_level']) + 1000); - $tpl->setVar('greylisting', $greylisting); + if(isset($policy['spam_lover']) && $policy['spam_lover'] == 'Y') { + $tpl->setVar('spam_lover', true); + } + if(isset($policy['virus_lover']) && $policy['virus_lover'] == 'Y') { + $tpl->setVar('virus_lover', true); + } - if(isset($policy['rspamd_spam_greylisting_level'])) { - $tpl->setVar('greylisting_level', floatval($policy['rspamd_spam_greylisting_level'])); - } else { - $tpl->setVar('greylisting_level', 0.1); - } + $tpl->setVar('greylisting', $greylisting); - $app->system->file_put_contents($settings_file, $tpl->grab()); + if(isset($policy['rspamd_spam_greylisting_level'])) { + $tpl->setVar('greylisting_level', floatval($policy['rspamd_spam_greylisting_level'])); + } else { + $tpl->setVar('greylisting_level', 0.1); + } + + $app->system->file_put_contents($settings_file, $tpl->grab()); + } } } -- GitLab From bc0facd164a13232b9344a8d7f60e925a3434d26 Mon Sep 17 00:00:00 2001 From: Till Date: Thu, 8 Feb 2024 14:14:16 +0100 Subject: [PATCH 2/7] Fixes #6593 --- install/update.php | 53 ++++++++++++++++++++-------------------------- 1 file changed, 23 insertions(+), 30 deletions(-) diff --git a/install/update.php b/install/update.php index e03b5d9de1..55b711da73 100644 --- a/install/update.php +++ b/install/update.php @@ -279,11 +279,33 @@ $inst->check_mysql_version(); //* initialize the master DB, if we have a multiserver setup if($conf['mysql']['master_slave_setup'] == 'y') { + //** Get MySQL root credentials + $finished = false; + do { + $tmp_mysql_server_host = $inst->free_query('MySQL master server hostname', $conf['mysql']['master_host'],'mysql_master_hostname'); + $tmp_mysql_server_port = $inst->free_query('MySQL master server port', $conf['mysql']['master_port'],'mysql_master_port'); + $tmp_mysql_server_admin_user = $inst->free_query('MySQL master server root username', $conf['mysql']['master_admin_user'],'mysql_master_root_user'); + $tmp_mysql_server_admin_password = $inst->free_query('MySQL master server root password', $conf['mysql']['master_admin_password'],'mysql_master_root_password'); + $tmp_mysql_server_database = $inst->free_query('MySQL master server database name', $conf['mysql']['master_database'],'mysql_master_database'); + + //* Initialize the MySQL server connection + if(@mysqli_connect($tmp_mysql_server_host, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password, $tmp_mysql_server_database, (int)$tmp_mysql_server_port)) { + $conf['mysql']['master_host'] = $tmp_mysql_server_host; + $conf['mysql']['master_port'] = $tmp_mysql_server_port; + $conf['mysql']['master_admin_user'] = $tmp_mysql_server_admin_user; + $conf['mysql']['master_admin_password'] = $tmp_mysql_server_admin_password; + $conf['mysql']['master_database'] = $tmp_mysql_server_database; + $finished = true; + } else { + swriteln($inst->lng('Unable to connect to mysql server').' '.mysqli_connect_error()); + } + } while ($finished == false); + unset($finished); // initialize the connection to the master database $inst->dbmaster = new db(); if($inst->dbmaster->linkId) $inst->dbmaster->closeConn(); - $inst->dbmaster->setDBData($conf['mysql']["master_host"], $conf['mysql']["master_ispconfig_user"], $conf['mysql']["master_ispconfig_password"], $conf['mysql']["master_port"]); + $inst->dbmaster->setDBData($conf['mysql']["master_host"], $conf['mysql']["master_admin_user"], $conf['mysql']["master_admin_password"], $conf['mysql']["master_port"]); $inst->dbmaster->setDBName($conf['mysql']["master_database"]); } else { $inst->dbmaster = $inst->db; @@ -330,35 +352,6 @@ unset($tmp); $reconfigure_master_database_rights_answer = $inst->simple_query('Reconfigure Permissions in master database?', array('yes', 'no'), 'no','reconfigure_permissions_in_master_database'); if($reconfigure_master_database_rights_answer == 'yes') { - //** Get MySQL root credentials, to upgrade the dbmaster connection. - $finished = false; - do { - $tmp_mysql_server_host = $inst->free_query('MySQL master server hostname', $conf['mysql']['master_host'],'mysql_master_hostname'); - $tmp_mysql_server_port = $inst->free_query('MySQL master server port', $conf['mysql']['master_port'],'mysql_master_port'); - $tmp_mysql_server_admin_user = $inst->free_query('MySQL master server root username', $conf['mysql']['master_admin_user'],'mysql_master_root_user'); - $tmp_mysql_server_admin_password = $inst->free_query('MySQL master server root password', $conf['mysql']['master_admin_password'],'mysql_master_root_password'); - $tmp_mysql_server_database = $inst->free_query('MySQL master server database name', $conf['mysql']['master_database'],'mysql_master_database'); - - //* Initialize the MySQL server connection - if(@mysqli_connect($tmp_mysql_server_host, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password, $tmp_mysql_server_database, (int)$tmp_mysql_server_port)) { - $conf['mysql']['master_host'] = $tmp_mysql_server_host; - $conf['mysql']['master_port'] = $tmp_mysql_server_port; - $conf['mysql']['master_admin_user'] = $tmp_mysql_server_admin_user; - $conf['mysql']['master_admin_password'] = $tmp_mysql_server_admin_password; - $conf['mysql']['master_database'] = $tmp_mysql_server_database; - $finished = true; - } else { - swriteln($inst->lng('Unable to connect to mysql server').' '.mysqli_connect_error()); - } - } while ($finished == false); - unset($finished); - - // initialize the connection to the master database - $inst->dbmaster = new db(); - if($inst->dbmaster->linkId) $inst->dbmaster->closeConn(); - $inst->dbmaster->setDBData($conf['mysql']["master_host"], $conf['mysql']["master_admin_user"], $conf['mysql']["master_admin_password"], $conf['mysql']["master_port"]); - $inst->dbmaster->setDBName($conf['mysql']["master_database"]); - $inst->grant_master_database_rights(); } //} -- GitLab From b5c22ae6430d2508f30911e2badc16d20e46ce97 Mon Sep 17 00:00:00 2001 From: Till Date: Thu, 8 Feb 2024 18:49:27 +0100 Subject: [PATCH 3/7] Fixes #6644 CAA Record *.domain.tld. can not be saved --- interface/web/dns/form/dns_caa.tform.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/web/dns/form/dns_caa.tform.php b/interface/web/dns/form/dns_caa.tform.php index aa297f29d7..c17f66e181 100644 --- a/interface/web/dns/form/dns_caa.tform.php +++ b/interface/web/dns/form/dns_caa.tform.php @@ -51,7 +51,7 @@ $form['tabs']['dns'] = array ( 'type' => 'TOLOWER') ), 'validators' => array ( 0 => array ( 'type' => 'REGEX', - 'regex' => '/^[a-zA-Z0-9\.\-\_]{0,255}$/', + 'regex' => '/^[a-zA-Z0-9\.\-\_\*]{0,255}$/', 'errmsg'=> 'name_error_regex'), ), 'default' => '', -- GitLab From 31a42f88ae7d2cd2408211285823e2887982f9d6 Mon Sep 17 00:00:00 2001 From: Till Date: Fri, 9 Feb 2024 06:43:26 +0100 Subject: [PATCH 4/7] Fixes #6641 Multiserver sync issues with some older systems --- install/sql/incremental/upd_0099.sql | 6 ++++++ install/sql/ispconfig3.sql | 10 +++++----- 2 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 install/sql/incremental/upd_0099.sql diff --git a/install/sql/incremental/upd_0099.sql b/install/sql/incremental/upd_0099.sql new file mode 100644 index 0000000000..b822310c94 --- /dev/null +++ b/install/sql/incremental/upd_0099.sql @@ -0,0 +1,6 @@ +ALTER TABLE `spamfilter_policy` +CHANGE `warnvirusrecip` `warnvirusrecip` VARCHAR(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT 'N', +CHANGE `warnbannedrecip` `warnbannedrecip` VARCHAR(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT 'N', +CHANGE `warnbadhrecip` `warnbadhrecip` VARCHAR(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT 'N'; +ALTER TABLE `sys_ini` CHANGE `default_logo` `default_logo` TEXT CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL; +ALTER TABLE `sys_ini` CHANGE `custom_logo` `custom_logo` TEXT CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL; \ No newline at end of file diff --git a/install/sql/ispconfig3.sql b/install/sql/ispconfig3.sql index 75529ab82b..ff582262bb 100644 --- a/install/sql/ispconfig3.sql +++ b/install/sql/ispconfig3.sql @@ -1532,9 +1532,9 @@ CREATE TABLE `spamfilter_policy` ( `addr_extension_spam` varchar(64) default NULL, `addr_extension_banned` varchar(64) default NULL, `addr_extension_bad_header` varchar(64) default NULL, - `warnvirusrecip` enum('N','Y') default 'N', - `warnbannedrecip` enum('N','Y') default 'N', - `warnbadhrecip` enum('N','Y') default 'N', + `warnvirusrecip` VARCHAR(1) NULL default 'N', + `warnbannedrecip` VARCHAR(1) NULL default 'N', + `warnbadhrecip` VARCHAR(1) NULL default 'N', `newvirus_admin` varchar(64) default NULL, `virus_admin` varchar(64) default NULL, `banned_admin` varchar(64) default NULL, @@ -1741,8 +1741,8 @@ CREATE TABLE `sys_group` ( CREATE TABLE `sys_ini` ( `sysini_id` int(11) unsigned NOT NULL auto_increment, `config` longtext, - `default_logo` text NOT NULL, - `custom_logo` text NOT NULL, + `default_logo` text NULL, + `custom_logo` text NULL, PRIMARY KEY (`sysini_id`) ) DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- GitLab From 4e95e6063a508b0ffb842caca856839b6b3c54fc Mon Sep 17 00:00:00 2001 From: Till Date: Fri, 9 Feb 2024 06:47:29 +0100 Subject: [PATCH 5/7] Fixed #6633 Code Error - Jailkit Update on every cron change --- server/plugins-available/cron_jailkit_plugin.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/plugins-available/cron_jailkit_plugin.inc.php b/server/plugins-available/cron_jailkit_plugin.inc.php index 08f039b371..ea3cb2d04f 100644 --- a/server/plugins-available/cron_jailkit_plugin.inc.php +++ b/server/plugins-available/cron_jailkit_plugin.inc.php @@ -229,7 +229,7 @@ class cron_jailkit_plugin { function _setup_jailkit_chroot() { - global $app; + global $app, $conf; if (isset($this->jailkit_config) && isset($this->jailkit_config['jailkit_hardlinks'])) { if ($this->jailkit_config['jailkit_hardlinks'] == 'yes') { @@ -293,7 +293,7 @@ class cron_jailkit_plugin { $programs = $this->jailkit_config['jailkit_chroot_app_programs'] . ' ' . $this->jailkit_config['jailkit_chroot_cron_programs']; - if ($update_hash == $parent_domain['last_jailkit_hash']) { + if ($update_hash == $this->parent_domain['last_jailkit_hash']) { return; } -- GitLab From e6cbe72d1ccfdf8c3f0250da1213c60d13c07304 Mon Sep 17 00:00:00 2001 From: Till Date: Fri, 9 Feb 2024 06:57:17 +0100 Subject: [PATCH 6/7] Fixes #6640 DKIM key not generated for IDN domain --- interface/web/mail/ajax_get_json.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/interface/web/mail/ajax_get_json.php b/interface/web/mail/ajax_get_json.php index c40c3bf401..1a87d8f96b 100644 --- a/interface/web/mail/ajax_get_json.php +++ b/interface/web/mail/ajax_get_json.php @@ -34,8 +34,10 @@ require_once '../../lib/app.inc.php'; //* Check permissions for module $app->auth->check_module_permissions('mail'); +$app->uses('functions'); + $type = $_GET['type']; -$domain_id = $_GET['domain_id']; +$domain_id = $app->functions->idn_encode($_GET['domain_id']); if($type == 'create_dkim' && $domain_id != ''){ $dkim_public = $_GET['dkim_public']; -- GitLab From bb5020e7747458a241b4a609811d147323cc6eb7 Mon Sep 17 00:00:00 2001 From: Till Date: Fri, 9 Feb 2024 07:59:50 +0100 Subject: [PATCH 7/7] Fixes #6642 Mail user filter search hangs with javascript errors in browser --- interface/web/mailuser/templates/mail_user_filter_list.htm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/web/mailuser/templates/mail_user_filter_list.htm b/interface/web/mailuser/templates/mail_user_filter_list.htm index b81793b631..8ec5641cbf 100644 --- a/interface/web/mailuser/templates/mail_user_filter_list.htm +++ b/interface/web/mailuser/templates/mail_user_filter_list.htm @@ -21,7 +21,7 @@ - + -- GitLab