From cd17793ecd8f8f4e9b1fe6e16f5540b21540ef37 Mon Sep 17 00:00:00 2001 From: Till Date: Wed, 2 Aug 2023 12:59:29 +0200 Subject: [PATCH 1/3] Add support for Debian 12. --- install/dist/conf/debian120.conf.php | 244 +++++++++++++++++++++++ install/dist/conf/debiantesting.conf.php | 16 +- install/lib/classes/tpl.inc.php | 2 +- install/lib/install.lib.php | 7 + interface/lib/app.inc.php | 2 +- interface/lib/classes/tpl.inc.php | 2 +- server/lib/app.inc.php | 2 +- server/lib/classes/monitor_tools.inc.php | 6 + server/lib/classes/tpl.inc.php | 2 +- 9 files changed, 270 insertions(+), 13 deletions(-) create mode 100644 install/dist/conf/debian120.conf.php diff --git a/install/dist/conf/debian120.conf.php b/install/dist/conf/debian120.conf.php new file mode 100644 index 0000000000..bd6773c623 --- /dev/null +++ b/install/dist/conf/debian120.conf.php @@ -0,0 +1,244 @@ + diff --git a/install/dist/conf/debiantesting.conf.php b/install/dist/conf/debiantesting.conf.php index e2fa04f8ab..145e213d0c 100644 --- a/install/dist/conf/debiantesting.conf.php +++ b/install/dist/conf/debiantesting.conf.php @@ -43,7 +43,7 @@ $conf['init_scripts'] = '/etc/init.d'; $conf['runlevel'] = '/etc'; $conf['shells'] = '/etc/shells'; $conf['pam'] = '/etc/pam.d'; -$conf['default_php'] = "8.1"; +$conf['default_php'] = "8.2"; //* Services provided by this server, this selection will be overridden by the expert mode $conf['services']['mail'] = true; @@ -85,8 +85,8 @@ $conf['apache']['version'] = '2.4'; $conf['apache']['vhost_conf_dir'] = '/etc/apache2/sites-available'; $conf['apache']['vhost_conf_enabled_dir'] = '/etc/apache2/sites-enabled'; $conf['apache']['vhost_port'] = '8080'; -$conf['apache']['php_ini_path_apache'] = '/etc/php/7.4/apache2/php.ini'; -$conf['apache']['php_ini_path_cgi'] = '/etc/php/7.4/cgi/php.ini'; +$conf['apache']['php_ini_path_apache'] = '/etc/php/8.2/apache2/php.ini'; +$conf['apache']['php_ini_path_cgi'] = '/etc/php/8.2/cgi/php.ini'; //* Website base settings $conf['web']['website_basedir'] = '/var/www'; @@ -101,7 +101,7 @@ $conf['web']['apps_vhost_user'] = 'ispapps'; $conf['web']['apps_vhost_group'] = 'ispapps'; //* Fastcgi -$conf['fastcgi']['fastcgi_phpini_path'] = '/etc/php/7.4/cgi/'; +$conf['fastcgi']['fastcgi_phpini_path'] = '/etc/php/8.2/cgi/'; $conf['fastcgi']['fastcgi_starter_path'] = '/var/www/php-fcgi-scripts/[system_user]/'; $conf['fastcgi']['fastcgi_bin'] = '/usr/bin/php-cgi'; @@ -212,11 +212,11 @@ $conf['nginx']['vhost_conf_enabled_dir'] = '/etc/nginx/sites-enabled'; $conf['nginx']['init_script'] = 'nginx'; $conf['nginx']['vhost_port'] = '8080'; $conf['nginx']['cgi_socket'] = '/var/run/fcgiwrap.socket'; -$conf['nginx']['php_fpm_init_script'] = 'php7.4-fpm'; -$conf['nginx']['php_fpm_ini_path'] = '/etc/php/7.4/fpm/php.ini'; -$conf['nginx']['php_fpm_pool_dir'] = '/etc/php/7.4/fpm/pool.d'; +$conf['nginx']['php_fpm_init_script'] = 'php8.2-fpm'; +$conf['nginx']['php_fpm_ini_path'] = '/etc/php/8.2/fpm/php.ini'; +$conf['nginx']['php_fpm_pool_dir'] = '/etc/php/8.2/fpm/pool.d'; $conf['nginx']['php_fpm_start_port'] = 9010; -$conf['nginx']['php_fpm_socket_dir'] = '/var/lib/php7.4-fpm'; +$conf['nginx']['php_fpm_socket_dir'] = '/var/lib/php8.2-fpm'; //* OpenVZ $conf['openvz']['installed'] = false; diff --git a/install/lib/classes/tpl.inc.php b/install/lib/classes/tpl.inc.php index 2bea1e1fd5..12f2523a36 100644 --- a/install/lib/classes/tpl.inc.php +++ b/install/lib/classes/tpl.inc.php @@ -30,7 +30,7 @@ if (!defined('vlibTemplateClassLoaded')) { include_once ISPC_INSTALL_ROOT.'/install/lib/classes/tpl_error.inc.php'; include_once ISPC_INSTALL_ROOT.'/install/lib/classes/tpl_ini.inc.php'; - class tpl{ + class tpl extends stdClass{ /*-----------------------------------------------------------------------------\ | ATTENTION | diff --git a/install/lib/install.lib.php b/install/lib/install.lib.php index 5a0b0ceaf5..885432f7ef 100644 --- a/install/lib/install.lib.php +++ b/install/lib/install.lib.php @@ -252,6 +252,13 @@ function get_distname() { $distid = 'debian60'; $distbaseid = 'debian'; swriteln("Operating System: Debian 11.0 (Bullseye) or compatible\n"); + } elseif(substr(trim(file_get_contents('/etc/debian_version')),0,2) == '12') { + $distname = 'Debian'; + $distver = 'Bookworm'; + $distconfid = 'debian120'; + $distid = 'debian60'; + $distbaseid = 'debian'; + swriteln("Operating System: Debian 12.0 (Bookworm) or compatible\n"); } elseif(strstr(trim(file_get_contents('/etc/debian_version')), '/sid')) { $distname = 'Debian'; $distver = 'Testing'; diff --git a/interface/lib/app.inc.php b/interface/lib/app.inc.php index 0350e28051..17c88b837a 100644 --- a/interface/lib/app.inc.php +++ b/interface/lib/app.inc.php @@ -46,7 +46,7 @@ if(DEVSYSTEM !== true) { /* Application Class */ -class app { +class app extends stdClass { private $_language_inc = 0; private $_wb; diff --git a/interface/lib/classes/tpl.inc.php b/interface/lib/classes/tpl.inc.php index 977ed0901d..e999ba5bfe 100644 --- a/interface/lib/classes/tpl.inc.php +++ b/interface/lib/classes/tpl.inc.php @@ -30,7 +30,7 @@ if (!defined('vlibTemplateClassLoaded')) { include_once ISPC_CLASS_PATH.'/tpl_error.inc.php'; include_once ISPC_CLASS_PATH.'/tpl_ini.inc.php'; - class tpl{ + class tpl extends stdClass{ /*-----------------------------------------------------------------------------\ | ATTENTION | diff --git a/server/lib/app.inc.php b/server/lib/app.inc.php index 940e0cae81..4bd7360218 100644 --- a/server/lib/app.inc.php +++ b/server/lib/app.inc.php @@ -50,7 +50,7 @@ if(DEVSYSTEM !== true) { * @license bsd-3-clause * @link empty **/ -class app { +class app extends stdClass { /** @var array List of modules that have been loaded. */ var $loaded_modules = []; /** @var array List of plugins that have been loaded. */ diff --git a/server/lib/classes/monitor_tools.inc.php b/server/lib/classes/monitor_tools.inc.php index fa1ea26bab..86fe3e672d 100644 --- a/server/lib/classes/monitor_tools.inc.php +++ b/server/lib/classes/monitor_tools.inc.php @@ -231,6 +231,12 @@ class monitor_tools { $distconfid = 'debian110'; $distid = 'debian60'; $distbaseid = 'debian'; + } elseif(substr(trim(file_get_contents('/etc/debian_version')),0,2) == '12') { + $distname = 'Debian'; + $distver = 'Bookworm'; + $distconfid = 'debian120'; + $distid = 'debian60'; + $distbaseid = 'debian'; } elseif(strstr(trim(file_get_contents('/etc/debian_version')), '/sid')) { $distname = 'Debian'; $distver = 'Testing'; diff --git a/server/lib/classes/tpl.inc.php b/server/lib/classes/tpl.inc.php index a4ba160252..b1f2cb8b35 100644 --- a/server/lib/classes/tpl.inc.php +++ b/server/lib/classes/tpl.inc.php @@ -30,7 +30,7 @@ if (!defined('vlibTemplateClassLoaded')) { include_once ISPC_CLASS_PATH.'/tpl_error.inc.php'; include_once ISPC_CLASS_PATH.'/tpl_ini.inc.php'; - class tpl{ + class tpl extends stdClass { /*-----------------------------------------------------------------------------\ | ATTENTION | -- GitLab From 841e96d4cd78a8cb58b4a39dd160b8e4c5c1f3f1 Mon Sep 17 00:00:00 2001 From: Till Date: Wed, 2 Aug 2023 14:25:37 +0200 Subject: [PATCH 2/3] Fixed some php 8.2 warnings --- install/lib/installer_base.lib.php | 2 +- server/plugins-available/rspamd_plugin.inc.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php index 43d312b0e6..92b2c0177e 100644 --- a/install/lib/installer_base.lib.php +++ b/install/lib/installer_base.lib.php @@ -28,7 +28,7 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -class installer_base { +class installer_base extends stdClass { var $wb = array(); var $language = 'en'; diff --git a/server/plugins-available/rspamd_plugin.inc.php b/server/plugins-available/rspamd_plugin.inc.php index 53500ef069..57663c8d43 100644 --- a/server/plugins-available/rspamd_plugin.inc.php +++ b/server/plugins-available/rspamd_plugin.inc.php @@ -528,10 +528,10 @@ class rspamd_plugin { ); foreach ($local_d as $f) { $tpl = new tpl(); - if (file_exists($conf['rootpath']."/conf-custom/install/rspamd_${f}.master")) { - $tpl->newTemplate($conf['rootpath']."/conf-custom/install/rspamd_${f}.master"); + if (file_exists($conf['rootpath']."/conf-custom/install/rspamd_{$f}.master")) { + $tpl->newTemplate($conf['rootpath']."/conf-custom/install/rspamd_{$f}.master"); } else { - $tpl->newTemplate("rspamd_${f}.master"); + $tpl->newTemplate("rspamd_{$f}.master"); } $tpl->setVar('dkim_path', $mail_config['dkim_path']); @@ -543,7 +543,7 @@ class rspamd_plugin { $tpl->setLoop('local_addrs', $local_addrs); } - $app->system->file_put_contents("/etc/rspamd/local.d/${f}", $tpl->grab()); + $app->system->file_put_contents("/etc/rspamd/local.d/{$f}", $tpl->grab()); if($mail_config['content_filter'] == 'rspamd'){ $app->services->restartServiceDelayed('rspamd', 'reload'); -- GitLab From b98377900b2353daed589f74b296bd00400b8dd8 Mon Sep 17 00:00:00 2001 From: Till Date: Wed, 2 Aug 2023 14:40:56 +0200 Subject: [PATCH 3/3] PHP 8.2 fix --- server/plugins-available/postfix_server_plugin.inc.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/server/plugins-available/postfix_server_plugin.inc.php b/server/plugins-available/postfix_server_plugin.inc.php index be81fb62a4..02455c1eb2 100644 --- a/server/plugins-available/postfix_server_plugin.inc.php +++ b/server/plugins-available/postfix_server_plugin.inc.php @@ -340,7 +340,7 @@ class postfix_server_plugin { foreach ($options as $key => $value) { $value = trim($value); if ($value == '') continue; - if (preg_match("|check_recipient_access\s+proxy:mysql:${quoted_postfix_config_dir}/mysql-verify_recipients.cf|", $value)) { + if (preg_match("|check_recipient_access\s+proxy:mysql:{$quoted_postfix_config_dir}/mysql-verify_recipients.cf|", $value)) { continue; } $new_options[] = $value; @@ -348,7 +348,7 @@ class postfix_server_plugin { if (isset($configure_lmtp) && $configure_lmtp && $mail_config['content_filter'] == 'amavisd') { for ($i = 0; isset($new_options[$i]); $i++) { if ($new_options[$i] == 'reject_unlisted_recipient') { - array_splice($new_options, $i+1, 0, array("check_recipient_access proxy:mysql:${quoted_postfix_config_dir}/mysql-verify_recipients.cf")); + array_splice($new_options, $i+1, 0, array("check_recipient_access proxy:mysql:{$quoted_postfix_config_dir}/mysql-verify_recipients.cf")); $app->system->exec_safe("postconf -e ?", 'address_verify_virtual_transport = smtp:[127.0.0.1]:10025'); $app->system->exec_safe("postconf -e ?", 'address_verify_transport_maps = static:smtp:[127.0.0.1]:10025'); @@ -378,7 +378,7 @@ class postfix_server_plugin { exec("postconf -e 'milter_mail_macros = i {mail_addr} {client_addr} {client_name} {auth_authen}'"); exec("postconf -e 'milter_default_action = accept'"); - exec("postconf -e 'smtpd_sender_restrictions = ${raslm} permit_mynetworks, check_sender_access proxy:mysql:/etc/postfix/mysql-virtual_sender.cf, ${rslm} permit_sasl_authenticated, reject_non_fqdn_sender, reject_unlisted_sender'"); + exec("postconf -e 'smtpd_sender_restrictions = {$raslm} permit_mynetworks, check_sender_access proxy:mysql:/etc/postfix/mysql-virtual_sender.cf, {$rslm} permit_sasl_authenticated, reject_non_fqdn_sender, reject_unlisted_sender'"); $new_options = array(); $options = preg_split("/,\s*/", exec("postconf -h smtpd_recipient_restrictions")); @@ -388,7 +388,7 @@ class postfix_server_plugin { if (preg_match('/check_policy_service\s+inet:127.0.0.1:10023/', $value)) { continue; } - if (preg_match("|check_recipient_access\s+proxy:mysql:${quoted_postfix_config_dir}/mysql-verify_recipients.cf|", $value)) { + if (preg_match("|check_recipient_access\s+proxy:mysql:{$quoted_postfix_config_dir}/mysql-verify_recipients.cf|", $value)) { continue; } $new_options[] = $value; @@ -420,7 +420,7 @@ class postfix_server_plugin { exec("postconf -e 'content_filter = " . ($configure_lmtp ? "lmtp" : "amavis" ) . ":[127.0.0.1]:10024'"); // fixme: should read this from conf templates - exec("postconf -e 'smtpd_sender_restrictions = ${raslm} check_sender_access regexp:/etc/postfix/tag_as_originating.re, permit_mynetworks, check_sender_access proxy:mysql:/etc/postfix/mysql-virtual_sender.cf, ${rslm} permit_sasl_authenticated, reject_non_fqdn_sender, reject_unlisted_sender, check_sender_access regexp:/etc/postfix/tag_as_foreign.re'"); + exec("postconf -e 'smtpd_sender_restrictions = {$raslm} check_sender_access regexp:/etc/postfix/tag_as_originating.re, permit_mynetworks, check_sender_access proxy:mysql:/etc/postfix/mysql-virtual_sender.cf, {$rslm} permit_sasl_authenticated, reject_non_fqdn_sender, reject_unlisted_sender, check_sender_access regexp:/etc/postfix/tag_as_foreign.re'"); } if($mail_config['content_filter'] == 'rspamd' && ($mail_config['rspamd_password'] != $old_ini_data['mail']['rspamd_password'] || $mail_config['content_filter'] != $old_ini_data['mail']['content_filter'])) { -- GitLab