From fc96c64464d2125f1518e0a80bb2e8ed5a8300f8 Mon Sep 17 00:00:00 2001 From: Michael Seevogel Date: Sun, 19 Nov 2023 20:47:05 +0100 Subject: [PATCH 01/29] Add current PHP enhancements (WiP) --- .../sql/incremental/upd_dev_collection.sql | 1 + install/sql/ispconfig3.sql | 1 + interface/web/admin/form/server_php.tform.php | 24 +++++++ .../web/admin/lib/lang/ar_server_php.lng | 2 + .../web/admin/lib/lang/bg_server_php.lng | 2 + .../web/admin/lib/lang/br_server_php.lng | 2 + .../web/admin/lib/lang/ca_server_php.lng | 2 + .../web/admin/lib/lang/cn_server_php.lng | 5 ++ .../web/admin/lib/lang/cz_server_php.lng | 2 + .../web/admin/lib/lang/de_server_php.lng | 2 + .../web/admin/lib/lang/dk_server_php.lng | 2 + .../web/admin/lib/lang/el_server_php.lng | 2 + .../web/admin/lib/lang/en_server_php.lng | 2 + .../web/admin/lib/lang/es_server_php.lng | 2 + .../web/admin/lib/lang/fi_server_php.lng | 2 + .../web/admin/lib/lang/fr_server_php.lng | 2 + .../web/admin/lib/lang/hr_server_php.lng | 2 + .../web/admin/lib/lang/hu_server_php.lng | 2 + .../web/admin/lib/lang/id_server_php.lng | 2 + .../web/admin/lib/lang/it_server_php.lng | 2 + .../web/admin/lib/lang/ja_server_php.lng | 2 + .../web/admin/lib/lang/nl_server_php.lng | 2 + .../web/admin/lib/lang/pl_server_php.lng | 2 + .../web/admin/lib/lang/pt_server_php.lng | 2 + .../web/admin/lib/lang/ro_server_php.lng | 2 + .../web/admin/lib/lang/ru_server_php.lng | 2 + .../web/admin/lib/lang/se_server_php.lng | 2 + .../web/admin/lib/lang/sk_server_php.lng | 2 + .../web/admin/lib/lang/tr_server_php.lng | 2 + .../admin/templates/server_php_cli_edit.htm | 10 +++ interface/web/sites/lib/lang/de_cron.lng | 1 + interface/web/sites/lib/lang/en_cron.lng | 3 +- interface/web/sites/templates/cron_edit.htm | 5 +- interface/web/sites/web_vhost_domain_edit.php | 19 ++++++ server/conf/bash.bashrc.master | 8 +++ server/plugins-available/cron_plugin.inc.php | 23 ++++++- .../shelluser_base_plugin.inc.php | 66 ++++++++++++++++++- .../shelluser_jailkit_plugin.inc.php | 14 ++-- 38 files changed, 218 insertions(+), 12 deletions(-) create mode 100644 interface/web/admin/templates/server_php_cli_edit.htm diff --git a/install/sql/incremental/upd_dev_collection.sql b/install/sql/incremental/upd_dev_collection.sql index e69de29bb2..1a6f847d65 100644 --- a/install/sql/incremental/upd_dev_collection.sql +++ b/install/sql/incremental/upd_dev_collection.sql @@ -0,0 +1 @@ +ALTER TABLE `server_php` ADD `php_cli_binary` varchar(255) DEFAULT NULL AFTER `php_fpm_socket_dir`; diff --git a/install/sql/ispconfig3.sql b/install/sql/ispconfig3.sql index 75529ab82b..e9aa9aaeed 100644 --- a/install/sql/ispconfig3.sql +++ b/install/sql/ispconfig3.sql @@ -1460,6 +1460,7 @@ CREATE TABLE `server_php` ( `php_fpm_ini_dir` varchar(255) DEFAULT NULL, `php_fpm_pool_dir` varchar(255) DEFAULT NULL, `php_fpm_socket_dir` varchar(255) DEFAULT NULL, + `php_cli_binary` varchar(255) DEFAULT NULL, `active` enum('n','y') NOT NULL DEFAULT 'y', `sortprio` int(20) NOT NULL DEFAULT 100, PRIMARY KEY (`server_php_id`) diff --git a/interface/web/admin/form/server_php.tform.php b/interface/web/admin/form/server_php.tform.php index 67f22cbeb4..a77a719f20 100644 --- a/interface/web/admin/form/server_php.tform.php +++ b/interface/web/admin/form/server_php.tform.php @@ -248,6 +248,30 @@ $form["tabs"]['php_fpm'] = array( //################################# ) ); +$form["tabs"]['php_cli'] = array ( +'title' => "PHP-CLI settings", +'width' => 80, +'template' => "templates/server_php_cli_edit.htm", +'fields' => array( + //################################# + // Begin Datatable fields + //################################# + 'php_cli_binary' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'filters' => array( + 0 => array( 'event' => 'SAVE', + 'type' => 'STRIPTAGS'), + 1 => array( 'event' => 'SAVE', + 'type' => 'STRIPNL') + ), + 'default' => '', + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), +) +); $form["tabs"]['php_sort'] = array ( 'title' => "PHP Sort Priority", 'width' => 80, diff --git a/interface/web/admin/lib/lang/ar_server_php.lng b/interface/web/admin/lib/lang/ar_server_php.lng index 4d71bb50b7..89b357cdbc 100644 --- a/interface/web/admin/lib/lang/ar_server_php.lng +++ b/interface/web/admin/lib/lang/ar_server_php.lng @@ -20,4 +20,6 @@ $wb['php_name_in_use_error'] = 'The name can not be changed.'; $wb['PHP Sort Priority'] = 'Priority'; $wb['sortprio_txt'] = 'Priority'; $wb['sortprio_long_txt'] = 'Priority of PHP version in the PHP version select box
Default PHP has prio 0 if enabled
Lower value is higher priority'; +$wb['PHP-CLI settings'] = 'PHP-CLI settings'; +$wb['php_cli_binary_txt'] = 'Path to the PHP CLI binary'; ?> diff --git a/interface/web/admin/lib/lang/bg_server_php.lng b/interface/web/admin/lib/lang/bg_server_php.lng index 4d71bb50b7..89b357cdbc 100644 --- a/interface/web/admin/lib/lang/bg_server_php.lng +++ b/interface/web/admin/lib/lang/bg_server_php.lng @@ -20,4 +20,6 @@ $wb['php_name_in_use_error'] = 'The name can not be changed.'; $wb['PHP Sort Priority'] = 'Priority'; $wb['sortprio_txt'] = 'Priority'; $wb['sortprio_long_txt'] = 'Priority of PHP version in the PHP version select box
Default PHP has prio 0 if enabled
Lower value is higher priority'; +$wb['PHP-CLI settings'] = 'PHP-CLI settings'; +$wb['php_cli_binary_txt'] = 'Path to the PHP CLI binary'; ?> diff --git a/interface/web/admin/lib/lang/br_server_php.lng b/interface/web/admin/lib/lang/br_server_php.lng index 791db7e3ec..cb1b93acc3 100644 --- a/interface/web/admin/lib/lang/br_server_php.lng +++ b/interface/web/admin/lib/lang/br_server_php.lng @@ -20,4 +20,6 @@ $wb['php_name_in_use_error'] = 'O nome não pode ser modificado.'; $wb['PHP Sort Priority'] = 'Priority'; $wb['sortprio_txt'] = 'Priority'; $wb['sortprio_long_txt'] = 'Priority of PHP version in the PHP version select box
Default PHP has prio 0 if enabled
Lower value is higher priority'; +$wb['PHP-CLI settings'] = 'PHP-CLI settings'; +$wb['php_cli_binary_txt'] = 'Path to the PHP CLI binary'; ?> diff --git a/interface/web/admin/lib/lang/ca_server_php.lng b/interface/web/admin/lib/lang/ca_server_php.lng index 4d71bb50b7..89b357cdbc 100644 --- a/interface/web/admin/lib/lang/ca_server_php.lng +++ b/interface/web/admin/lib/lang/ca_server_php.lng @@ -20,4 +20,6 @@ $wb['php_name_in_use_error'] = 'The name can not be changed.'; $wb['PHP Sort Priority'] = 'Priority'; $wb['sortprio_txt'] = 'Priority'; $wb['sortprio_long_txt'] = 'Priority of PHP version in the PHP version select box
Default PHP has prio 0 if enabled
Lower value is higher priority'; +$wb['PHP-CLI settings'] = 'PHP-CLI settings'; +$wb['php_cli_binary_txt'] = 'Path to the PHP CLI binary'; ?> diff --git a/interface/web/admin/lib/lang/cn_server_php.lng b/interface/web/admin/lib/lang/cn_server_php.lng index 80571fb194..102bcc1fbf 100644 --- a/interface/web/admin/lib/lang/cn_server_php.lng +++ b/interface/web/admin/lib/lang/cn_server_php.lng @@ -17,4 +17,9 @@ $wb['php_fpm_socket_dir_txt'] = 'PHP-FPM套接字目录'; $wb['active_txt'] = '激活'; $wb['php_in_use_error'] = '此PHP版本正在使用中。'; $wb['php_name_in_use_error'] = '名称无法更改。'; +$wb['PHP Sort Priority'] = 'Priority'; +$wb['sortprio_txt'] = 'Priority'; +$wb['sortprio_long_txt'] = 'Priority of PHP version in the PHP version select box
Default PHP has prio 0 if enabled
Lower value is higher priority'; +$wb['PHP-CLI settings'] = 'PHP-CLI settings'; +$wb['php_cli_binary_txt'] = 'Path to the PHP CLI binary'; ?> diff --git a/interface/web/admin/lib/lang/cz_server_php.lng b/interface/web/admin/lib/lang/cz_server_php.lng index 6490928429..eb16414a31 100644 --- a/interface/web/admin/lib/lang/cz_server_php.lng +++ b/interface/web/admin/lib/lang/cz_server_php.lng @@ -20,4 +20,6 @@ $wb['php_name_in_use_error'] = 'The name can not be changed.'; $wb['PHP Sort Priority'] = 'Priority'; $wb['sortprio_txt'] = 'Priority'; $wb['sortprio_long_txt'] = 'Priority of PHP version in the PHP version select box
Default PHP has prio 0 if enabled
Lower value is higher priority'; +$wb['PHP-CLI settings'] = 'PHP-CLI settings'; +$wb['php_cli_binary_txt'] = 'Path to the PHP CLI binary'; ?> diff --git a/interface/web/admin/lib/lang/de_server_php.lng b/interface/web/admin/lib/lang/de_server_php.lng index 4100957b9d..a63e90d80c 100644 --- a/interface/web/admin/lib/lang/de_server_php.lng +++ b/interface/web/admin/lib/lang/de_server_php.lng @@ -20,4 +20,6 @@ $wb['php_name_in_use_error'] = 'Der Name kann nicht geändert werden.'; $wb['PHP Sort Priority'] = 'Priorität'; $wb['sortprio_txt'] = 'Sorting Priority'; $wb['sortprio_long_txt'] = 'Priority of PHP Version in the PHP version select box
Default PHP has prio 0 if enabled
Lower value is higher priority'; +$wb['PHP-CLI settings'] = 'PHP-CLI-Einstellungen'; +$wb['php_cli_binary_txt'] = 'Pfad zur PHP-CLI Binary'; ?> diff --git a/interface/web/admin/lib/lang/dk_server_php.lng b/interface/web/admin/lib/lang/dk_server_php.lng index e9b42a5133..b43202ae41 100644 --- a/interface/web/admin/lib/lang/dk_server_php.lng +++ b/interface/web/admin/lib/lang/dk_server_php.lng @@ -20,4 +20,6 @@ $wb['php_name_in_use_error'] = 'The name can not be changed.'; $wb['PHP Sort Priority'] = 'Priority'; $wb['sortprio_txt'] = 'Priority'; $wb['sortprio_long_txt'] = 'Priority of PHP version in the PHP version select box
Default PHP has prio 0 if enabled
Lower value is higher priority'; +$wb['PHP-CLI settings'] = 'PHP-CLI settings'; +$wb['php_cli_binary_txt'] = 'Path to the PHP CLI binary'; ?> diff --git a/interface/web/admin/lib/lang/el_server_php.lng b/interface/web/admin/lib/lang/el_server_php.lng index 4d71bb50b7..89b357cdbc 100644 --- a/interface/web/admin/lib/lang/el_server_php.lng +++ b/interface/web/admin/lib/lang/el_server_php.lng @@ -20,4 +20,6 @@ $wb['php_name_in_use_error'] = 'The name can not be changed.'; $wb['PHP Sort Priority'] = 'Priority'; $wb['sortprio_txt'] = 'Priority'; $wb['sortprio_long_txt'] = 'Priority of PHP version in the PHP version select box
Default PHP has prio 0 if enabled
Lower value is higher priority'; +$wb['PHP-CLI settings'] = 'PHP-CLI settings'; +$wb['php_cli_binary_txt'] = 'Path to the PHP CLI binary'; ?> diff --git a/interface/web/admin/lib/lang/en_server_php.lng b/interface/web/admin/lib/lang/en_server_php.lng index 4d71bb50b7..89b357cdbc 100644 --- a/interface/web/admin/lib/lang/en_server_php.lng +++ b/interface/web/admin/lib/lang/en_server_php.lng @@ -20,4 +20,6 @@ $wb['php_name_in_use_error'] = 'The name can not be changed.'; $wb['PHP Sort Priority'] = 'Priority'; $wb['sortprio_txt'] = 'Priority'; $wb['sortprio_long_txt'] = 'Priority of PHP version in the PHP version select box
Default PHP has prio 0 if enabled
Lower value is higher priority'; +$wb['PHP-CLI settings'] = 'PHP-CLI settings'; +$wb['php_cli_binary_txt'] = 'Path to the PHP CLI binary'; ?> diff --git a/interface/web/admin/lib/lang/es_server_php.lng b/interface/web/admin/lib/lang/es_server_php.lng index e75aa0e4e4..ff81b3ae90 100644 --- a/interface/web/admin/lib/lang/es_server_php.lng +++ b/interface/web/admin/lib/lang/es_server_php.lng @@ -20,4 +20,6 @@ $wb['php_name_in_use_error'] = 'The name can not be changed.'; $wb['PHP Sort Priority'] = 'Priority'; $wb['sortprio_txt'] = 'Priority'; $wb['sortprio_long_txt'] = 'Priority of PHP version in the PHP version select box
Default PHP has prio 0 if enabled
Lower value is higher priority'; +$wb['PHP-CLI settings'] = 'PHP-CLI settings'; +$wb['php_cli_binary_txt'] = 'Path to the PHP CLI binary'; ?> diff --git a/interface/web/admin/lib/lang/fi_server_php.lng b/interface/web/admin/lib/lang/fi_server_php.lng index 4d71bb50b7..89b357cdbc 100644 --- a/interface/web/admin/lib/lang/fi_server_php.lng +++ b/interface/web/admin/lib/lang/fi_server_php.lng @@ -20,4 +20,6 @@ $wb['php_name_in_use_error'] = 'The name can not be changed.'; $wb['PHP Sort Priority'] = 'Priority'; $wb['sortprio_txt'] = 'Priority'; $wb['sortprio_long_txt'] = 'Priority of PHP version in the PHP version select box
Default PHP has prio 0 if enabled
Lower value is higher priority'; +$wb['PHP-CLI settings'] = 'PHP-CLI settings'; +$wb['php_cli_binary_txt'] = 'Path to the PHP CLI binary'; ?> diff --git a/interface/web/admin/lib/lang/fr_server_php.lng b/interface/web/admin/lib/lang/fr_server_php.lng index 4d71bb50b7..89b357cdbc 100644 --- a/interface/web/admin/lib/lang/fr_server_php.lng +++ b/interface/web/admin/lib/lang/fr_server_php.lng @@ -20,4 +20,6 @@ $wb['php_name_in_use_error'] = 'The name can not be changed.'; $wb['PHP Sort Priority'] = 'Priority'; $wb['sortprio_txt'] = 'Priority'; $wb['sortprio_long_txt'] = 'Priority of PHP version in the PHP version select box
Default PHP has prio 0 if enabled
Lower value is higher priority'; +$wb['PHP-CLI settings'] = 'PHP-CLI settings'; +$wb['php_cli_binary_txt'] = 'Path to the PHP CLI binary'; ?> diff --git a/interface/web/admin/lib/lang/hr_server_php.lng b/interface/web/admin/lib/lang/hr_server_php.lng index 9db79d4f9b..57c44ae53c 100644 --- a/interface/web/admin/lib/lang/hr_server_php.lng +++ b/interface/web/admin/lib/lang/hr_server_php.lng @@ -20,4 +20,6 @@ $wb['php_name_in_use_error'] = 'The name can not be changed.'; $wb['PHP Sort Priority'] = 'Priority'; $wb['sortprio_txt'] = 'Priority'; $wb['sortprio_long_txt'] = 'Priority of PHP version in the PHP version select box
Default PHP has prio 0 if enabled
Lower value is higher priority'; +$wb['PHP-CLI settings'] = 'PHP-CLI settings'; +$wb['php_cli_binary_txt'] = 'Path to the PHP CLI binary'; ?> diff --git a/interface/web/admin/lib/lang/hu_server_php.lng b/interface/web/admin/lib/lang/hu_server_php.lng index 4d71bb50b7..89b357cdbc 100644 --- a/interface/web/admin/lib/lang/hu_server_php.lng +++ b/interface/web/admin/lib/lang/hu_server_php.lng @@ -20,4 +20,6 @@ $wb['php_name_in_use_error'] = 'The name can not be changed.'; $wb['PHP Sort Priority'] = 'Priority'; $wb['sortprio_txt'] = 'Priority'; $wb['sortprio_long_txt'] = 'Priority of PHP version in the PHP version select box
Default PHP has prio 0 if enabled
Lower value is higher priority'; +$wb['PHP-CLI settings'] = 'PHP-CLI settings'; +$wb['php_cli_binary_txt'] = 'Path to the PHP CLI binary'; ?> diff --git a/interface/web/admin/lib/lang/id_server_php.lng b/interface/web/admin/lib/lang/id_server_php.lng index 4d71bb50b7..89b357cdbc 100644 --- a/interface/web/admin/lib/lang/id_server_php.lng +++ b/interface/web/admin/lib/lang/id_server_php.lng @@ -20,4 +20,6 @@ $wb['php_name_in_use_error'] = 'The name can not be changed.'; $wb['PHP Sort Priority'] = 'Priority'; $wb['sortprio_txt'] = 'Priority'; $wb['sortprio_long_txt'] = 'Priority of PHP version in the PHP version select box
Default PHP has prio 0 if enabled
Lower value is higher priority'; +$wb['PHP-CLI settings'] = 'PHP-CLI settings'; +$wb['php_cli_binary_txt'] = 'Path to the PHP CLI binary'; ?> diff --git a/interface/web/admin/lib/lang/it_server_php.lng b/interface/web/admin/lib/lang/it_server_php.lng index d4feb7cb0c..76c97e8adc 100644 --- a/interface/web/admin/lib/lang/it_server_php.lng +++ b/interface/web/admin/lib/lang/it_server_php.lng @@ -20,4 +20,6 @@ $wb['php_name_in_use_error'] = 'Il nome non può essere cambiato.'; $wb['PHP Sort Priority'] = 'Priority'; $wb['sortprio_txt'] = 'Priority'; $wb['sortprio_long_txt'] = 'Priority of PHP version in the PHP version select box
Default PHP has prio 0 if enabled
Lower value is higher priority'; +$wb['PHP-CLI settings'] = 'PHP-CLI settings'; +$wb['php_cli_binary_txt'] = 'Path to the PHP CLI binary'; ?> diff --git a/interface/web/admin/lib/lang/ja_server_php.lng b/interface/web/admin/lib/lang/ja_server_php.lng index 4d71bb50b7..89b357cdbc 100644 --- a/interface/web/admin/lib/lang/ja_server_php.lng +++ b/interface/web/admin/lib/lang/ja_server_php.lng @@ -20,4 +20,6 @@ $wb['php_name_in_use_error'] = 'The name can not be changed.'; $wb['PHP Sort Priority'] = 'Priority'; $wb['sortprio_txt'] = 'Priority'; $wb['sortprio_long_txt'] = 'Priority of PHP version in the PHP version select box
Default PHP has prio 0 if enabled
Lower value is higher priority'; +$wb['PHP-CLI settings'] = 'PHP-CLI settings'; +$wb['php_cli_binary_txt'] = 'Path to the PHP CLI binary'; ?> diff --git a/interface/web/admin/lib/lang/nl_server_php.lng b/interface/web/admin/lib/lang/nl_server_php.lng index 4d71bb50b7..89b357cdbc 100644 --- a/interface/web/admin/lib/lang/nl_server_php.lng +++ b/interface/web/admin/lib/lang/nl_server_php.lng @@ -20,4 +20,6 @@ $wb['php_name_in_use_error'] = 'The name can not be changed.'; $wb['PHP Sort Priority'] = 'Priority'; $wb['sortprio_txt'] = 'Priority'; $wb['sortprio_long_txt'] = 'Priority of PHP version in the PHP version select box
Default PHP has prio 0 if enabled
Lower value is higher priority'; +$wb['PHP-CLI settings'] = 'PHP-CLI settings'; +$wb['php_cli_binary_txt'] = 'Path to the PHP CLI binary'; ?> diff --git a/interface/web/admin/lib/lang/pl_server_php.lng b/interface/web/admin/lib/lang/pl_server_php.lng index d86e2cf01f..c43dd727cb 100644 --- a/interface/web/admin/lib/lang/pl_server_php.lng +++ b/interface/web/admin/lib/lang/pl_server_php.lng @@ -20,4 +20,6 @@ $wb['php_name_in_use_error'] = 'The name can not be changed.'; $wb['PHP Sort Priority'] = 'Priority'; $wb['sortprio_txt'] = 'Priority'; $wb['sortprio_long_txt'] = 'Priority of PHP version in the PHP version select box
Default PHP has prio 0 if enabled
Lower value is higher priority'; +$wb['PHP-CLI settings'] = 'PHP-CLI settings'; +$wb['php_cli_binary_txt'] = 'Path to the PHP CLI binary'; ?> diff --git a/interface/web/admin/lib/lang/pt_server_php.lng b/interface/web/admin/lib/lang/pt_server_php.lng index 4d71bb50b7..89b357cdbc 100644 --- a/interface/web/admin/lib/lang/pt_server_php.lng +++ b/interface/web/admin/lib/lang/pt_server_php.lng @@ -20,4 +20,6 @@ $wb['php_name_in_use_error'] = 'The name can not be changed.'; $wb['PHP Sort Priority'] = 'Priority'; $wb['sortprio_txt'] = 'Priority'; $wb['sortprio_long_txt'] = 'Priority of PHP version in the PHP version select box
Default PHP has prio 0 if enabled
Lower value is higher priority'; +$wb['PHP-CLI settings'] = 'PHP-CLI settings'; +$wb['php_cli_binary_txt'] = 'Path to the PHP CLI binary'; ?> diff --git a/interface/web/admin/lib/lang/ro_server_php.lng b/interface/web/admin/lib/lang/ro_server_php.lng index 4d71bb50b7..89b357cdbc 100644 --- a/interface/web/admin/lib/lang/ro_server_php.lng +++ b/interface/web/admin/lib/lang/ro_server_php.lng @@ -20,4 +20,6 @@ $wb['php_name_in_use_error'] = 'The name can not be changed.'; $wb['PHP Sort Priority'] = 'Priority'; $wb['sortprio_txt'] = 'Priority'; $wb['sortprio_long_txt'] = 'Priority of PHP version in the PHP version select box
Default PHP has prio 0 if enabled
Lower value is higher priority'; +$wb['PHP-CLI settings'] = 'PHP-CLI settings'; +$wb['php_cli_binary_txt'] = 'Path to the PHP CLI binary'; ?> diff --git a/interface/web/admin/lib/lang/ru_server_php.lng b/interface/web/admin/lib/lang/ru_server_php.lng index ca1a8147a3..6644018b3a 100644 --- a/interface/web/admin/lib/lang/ru_server_php.lng +++ b/interface/web/admin/lib/lang/ru_server_php.lng @@ -20,4 +20,6 @@ $wb['php_name_in_use_error'] = 'The name can not be changed.'; $wb['PHP Sort Priority'] = 'Priority'; $wb['sortprio_txt'] = 'Priority'; $wb['sortprio_long_txt'] = 'Priority of PHP version in the PHP version select box
Default PHP has prio 0 if enabled
Lower value is higher priority'; +$wb['PHP-CLI settings'] = 'PHP-CLI settings'; +$wb['php_cli_binary_txt'] = 'Path to the PHP CLI binary'; ?> diff --git a/interface/web/admin/lib/lang/se_server_php.lng b/interface/web/admin/lib/lang/se_server_php.lng index 4d71bb50b7..89b357cdbc 100644 --- a/interface/web/admin/lib/lang/se_server_php.lng +++ b/interface/web/admin/lib/lang/se_server_php.lng @@ -20,4 +20,6 @@ $wb['php_name_in_use_error'] = 'The name can not be changed.'; $wb['PHP Sort Priority'] = 'Priority'; $wb['sortprio_txt'] = 'Priority'; $wb['sortprio_long_txt'] = 'Priority of PHP version in the PHP version select box
Default PHP has prio 0 if enabled
Lower value is higher priority'; +$wb['PHP-CLI settings'] = 'PHP-CLI settings'; +$wb['php_cli_binary_txt'] = 'Path to the PHP CLI binary'; ?> diff --git a/interface/web/admin/lib/lang/sk_server_php.lng b/interface/web/admin/lib/lang/sk_server_php.lng index 4d71bb50b7..89b357cdbc 100644 --- a/interface/web/admin/lib/lang/sk_server_php.lng +++ b/interface/web/admin/lib/lang/sk_server_php.lng @@ -20,4 +20,6 @@ $wb['php_name_in_use_error'] = 'The name can not be changed.'; $wb['PHP Sort Priority'] = 'Priority'; $wb['sortprio_txt'] = 'Priority'; $wb['sortprio_long_txt'] = 'Priority of PHP version in the PHP version select box
Default PHP has prio 0 if enabled
Lower value is higher priority'; +$wb['PHP-CLI settings'] = 'PHP-CLI settings'; +$wb['php_cli_binary_txt'] = 'Path to the PHP CLI binary'; ?> diff --git a/interface/web/admin/lib/lang/tr_server_php.lng b/interface/web/admin/lib/lang/tr_server_php.lng index 914d28f167..447b3ab20b 100644 --- a/interface/web/admin/lib/lang/tr_server_php.lng +++ b/interface/web/admin/lib/lang/tr_server_php.lng @@ -20,4 +20,6 @@ $wb['php_name_in_use_error'] = 'The name can not be changed.'; $wb['PHP Sort Priority'] = 'Priority'; $wb['sortprio_txt'] = 'Priority'; $wb['sortprio_long_txt'] = 'Priority of PHP version in the PHP version select box
Default PHP has prio 0 if enabled
Lower value is higher priority'; +$wb['PHP-CLI settings'] = 'PHP-CLI settings'; +$wb['php_cli_binary_txt'] = 'Path to the PHP CLI binary'; ?> diff --git a/interface/web/admin/templates/server_php_cli_edit.htm b/interface/web/admin/templates/server_php_cli_edit.htm new file mode 100644 index 0000000000..72e26bd4b8 --- /dev/null +++ b/interface/web/admin/templates/server_php_cli_edit.htm @@ -0,0 +1,10 @@ +
+ +
+ + + +
+ + +
diff --git a/interface/web/sites/lib/lang/de_cron.lng b/interface/web/sites/lib/lang/de_cron.lng index 535f7e7dca..260744116a 100644 --- a/interface/web/sites/lib/lang/de_cron.lng +++ b/interface/web/sites/lib/lang/de_cron.lng @@ -23,4 +23,5 @@ $wb['command_hint_txt'] = 'z. B. /var/www/clients/clientX/webY/myscript.sh oder $wb['log_output_txt'] = 'Ausgabe loggen'; $wb['limit_cron_url_txt'] = 'Es sind nur URL cronjobs möglich. Der Cron-Befehl muss mit https:// beginnen.'; $wb['command_error_empty'] = 'Befehl ist leer.'; +$wb['variables_txt'] = 'Variablen'; ?> diff --git a/interface/web/sites/lib/lang/en_cron.lng b/interface/web/sites/lib/lang/en_cron.lng index 871d4a292e..e912da82a5 100644 --- a/interface/web/sites/lib/lang/en_cron.lng +++ b/interface/web/sites/lib/lang/en_cron.lng @@ -23,4 +23,5 @@ $wb['command_hint_txt'] = 'e.g. /var/www/clients/clientX/webY/myscript.sh or htt $wb['log_output_txt'] = 'Log output'; $wb['limit_cron_url_txt'] = 'URL cron only. Please enter a URL starting with https:// as cron command.'; $wb['command_error_empty'] = 'Command is empty.'; -?> \ No newline at end of file +$wb['variables_txt'] = 'Variables'; +?> diff --git a/interface/web/sites/templates/cron_edit.htm b/interface/web/sites/templates/cron_edit.htm index 2c0f22ddb9..ffb0254681 100644 --- a/interface/web/sites/templates/cron_edit.htm +++ b/interface/web/sites/templates/cron_edit.htm @@ -51,7 +51,8 @@
-

{tmpl_var name='command_hint_txt'}

+ {tmpl_var name='variables_txt'}: {SITE_PHP}, {DOCROOT_CLIENT}, {DOMAIN} +

{tmpl_var name='command_hint_txt'}

@@ -66,7 +67,7 @@ {tmpl_var name='active'}
- + diff --git a/interface/web/sites/web_vhost_domain_edit.php b/interface/web/sites/web_vhost_domain_edit.php index be9f0911c7..14b3965d89 100644 --- a/interface/web/sites/web_vhost_domain_edit.php +++ b/interface/web/sites/web_vhost_domain_edit.php @@ -1443,6 +1443,25 @@ class page_action extends tform_actions { global $app, $conf; if(isset($this->dataRecord['folder_directive_snippets'])) $app->db->query("UPDATE web_domain SET folder_directive_snippets = ? WHERE domain_id = ?", $this->dataRecord['folder_directive_snippets'], $this->id); + + // Trigger an update of the website's cronjobs when the PHP version is changed + if(isset($this->dataRecord['server_php_id']) && $this->oldDataRecord['server_php_id'] != $this->dataRecord['server_php_id']) { + $cronjob_list = $app->db->queryAllRecords("SELECT * FROM cron WHERE parent_domain_id = ? and active = 'y'", $this->dataRecord['id']); + if(!empty($cronjob_list)) { + foreach ($cronjob_list as $cronjob) { + // Only update cronjobs with placeholders + if(preg_match("/([\{][a-zA-Z_\-0-9]+[\}]|[\[][a-zA-Z_\-0-9]+[\]])/", $cronjob['command'])) { + $app->db->datalogUpdate('cron', $cronjob, 'id', $cronjob['id'], true); + } + } + } + $shelluser_list = $app->db->queryAllRecords("SELECT * FROM shell_user WHERE parent_domain_id = ? and active = 'y'", $this->dataRecord['id']); + if(!empty($shelluser_list)) { + foreach ($shelluser_list as $shelluser) { + $app->db->datalogUpdate('shell_user', $shelluser, 'shell_user_id', $shelluser['shell_user_id'], true); + } + } + } } function validateDefaultFastcgiPhpVersion() { diff --git a/server/conf/bash.bashrc.master b/server/conf/bash.bashrc.master index edcaf7dc58..4c5090ec55 100644 --- a/server/conf/bash.bashrc.master +++ b/server/conf/bash.bashrc.master @@ -62,4 +62,12 @@ fi #alias la='ls -A' #alias l='ls -CF' + +# Overwrite the PHP cli binaries by using $PATH: +export PATH=:$PATH + + + +alias php="" + diff --git a/server/plugins-available/cron_plugin.inc.php b/server/plugins-available/cron_plugin.inc.php index f8b16b96cb..e6aa8c2e01 100644 --- a/server/plugins-available/cron_plugin.inc.php +++ b/server/plugins-available/cron_plugin.inc.php @@ -93,7 +93,7 @@ class cron_plugin { } //* get data from web - $parent_domain = $app->db->queryOneRecord("SELECT `domain_id`, `system_user`, `system_group`, `document_root`, `hd_quota` FROM `web_domain` WHERE `domain_id` = ?", $data["new"]["parent_domain_id"]); + $parent_domain = $app->db->queryOneRecord("SELECT `domain_id`, `system_user`, `system_group`, `domain`, `document_root`, `hd_quota`, `php_cli_binary` FROM `web_domain` LEFT JOIN server_php ON web_domain.server_php_id = server_php.server_php_id WHERE `domain_id` = ?", $data["new"]["parent_domain_id"]); if(!$parent_domain["domain_id"]) { $app->log("Parent domain not found", LOGLEVEL_WARN); return 0; @@ -220,7 +220,7 @@ class cron_plugin { $chr_cmd_count = 0; //* read all active cron jobs from database and write them to file - $cron_jobs = $app->db->queryAllRecords("SELECT c.`run_min`, c.`run_hour`, c.`run_mday`, c.`run_month`, c.`run_wday`, c.`command`, c.`type`, c.`log`, `web_domain`.`domain` as `domain` FROM `cron` as c INNER JOIN `web_domain` ON `web_domain`.`domain_id` = c.`parent_domain_id` WHERE c.`parent_domain_id` = ? AND c.`active` = 'y'", $this->parent_domain["domain_id"]); + $cron_jobs = $app->db->queryAllRecords("SELECT c.`id`, c.`run_min`, c.`run_hour`, c.`run_mday`, c.`run_month`, c.`run_wday`, c.`command`, c.`type`, c.`log`, `web_domain`.`domain` as `domain` FROM `cron` as c INNER JOIN `web_domain` ON `web_domain`.`domain_id` = c.`parent_domain_id` WHERE c.`parent_domain_id` = ? AND c.`active` = 'y'", $this->parent_domain["domain_id"]); if($cron_jobs && count($cron_jobs) > 0) { foreach($cron_jobs as $job) { if($job['run_month'] == '@reboot') { @@ -259,8 +259,25 @@ class cron_plugin { $web_root = $this->parent_domain['document_root']; } + $web_domain = $this->parent_domain['domain']; + if($this->parent_domain['php_cli_binary'] == '') { + // PHP cli binary not set or default was selected, fallback to just "php" + $web_php_cli = 'php'; + $app->log("PHP CLI binary not set for the website\'s selected PHP version or Default was selected. Falling back to \"php\" for cronjob id " . $job['id'], LOGLEVEL_DEBUG); + } else { + $web_php_cli = $this->parent_domain['php_cli_binary']; + } + $web_root .= '/web'; - $job['command'] = str_replace('[web_root]', $web_root, $job['command']); + + $trans = array( + '[web_root]' => $web_root, + '{DOCROOT_CLIENT}' => $web_root, + '{DOMAIN}' => $web_domain, + '{SITE_PHP}' => $web_php_cli + ); + + $job['command'] = strtr($job['command'], $trans); $cron_line .= "\t"; //if($job['type'] != 'chrooted' && substr($job['command'], 0, 1) != "/") $cron_line .= $this->parent_domain['document_root'].'/'; diff --git a/server/plugins-available/shelluser_base_plugin.inc.php b/server/plugins-available/shelluser_base_plugin.inc.php index 5bbda0e13d..eaf7871fb1 100755 --- a/server/plugins-available/shelluser_base_plugin.inc.php +++ b/server/plugins-available/shelluser_base_plugin.inc.php @@ -80,7 +80,8 @@ class shelluser_base_plugin { } //* Check if the resulting path is inside the docroot - $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ?", $data['new']['parent_domain_id']); + $web = $app->db->queryOneRecord("SELECT * FROM web_domain LEFT JOIN server_php ON web_domain.server_php_id = server_php.server_php_id WHERE `domain_id` = ?", $data["new"]["parent_domain_id"]); + //$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ?", $data['new']['parent_domain_id']); if(substr($data['new']['dir'],0,strlen($web['document_root'])) != $web['document_root']) { $app->log('Directory of the shell user is outside of website docroot.',LOGLEVEL_WARN); return false; @@ -168,6 +169,36 @@ class shelluser_base_plugin { $app->system->chown($homedir.'/.profile', $data['new']['username']); $app->system->chgrp($homedir.'/.profile', $data['new']['pgroup']); + $app->load('tpl'); + + $tpl = new tpl(); + $tpl->newTemplate("bash.bashrc.master"); + + $tpl->setVar('jailkit_chroot', false); + $tpl->setVar('domain', $web['domain']); + //$tpl->setVar('home_dir', $this->_get_home_dir("")); + + if($web['server_php_id'] > 0) { + $tpl->setVar('use_site_php', true); + $tpl->setVar('php_bin_dir', $php_bin_dir); + } else { + $tpl->setVar('use_site_php', false); + } + + $bashrc = $this->data['new']['dir'].'/etc/bash.bashrc'; + if(@is_file($bashrc) || @is_link($bashrc)) unlink($bashrc); + + //file_put_contents($bashrc, $tpl->grab()); + $app->system->file_put_contents($bashrc, $tpl->grab()); + unset($tpl); + + $app->log("Added bashrc script: ".$bashrc, LOGLEVEL_DEBUG); + + + + + + // Create symlinks for conveniance, SFTP user should not land in an empty dir. symlink('../../web', $homedir.'/web'); symlink('../../log', $homedir.'/log'); @@ -202,7 +233,8 @@ class shelluser_base_plugin { } //* Check if the resulting path is inside the docroot - $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ?", $data['new']['parent_domain_id']); + $web = $app->db->queryOneRecord("SELECT * FROM web_domain LEFT JOIN server_php ON web_domain.server_php_id = server_php.server_php_id WHERE `domain_id` = ?", $data["new"]["parent_domain_id"]); + //$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ?", $data['new']['parent_domain_id']); if(substr($data['new']['dir'],0,strlen($web['document_root'])) != $web['document_root']) { $app->log('Directory of the shell user is outside of website docroot.',LOGLEVEL_WARN); return false; @@ -300,6 +332,36 @@ class shelluser_base_plugin { $app->system->chgrp($homedir.'/.profile', $data['new']['pgroup']); } + + + // Create .bashrc file + $app->load('tpl'); + + $tpl = new tpl(); + $tpl->newTemplate("bash.bashrc.master"); + + $tpl->setVar('jailkit_chroot', false); + //$tpl->setVar('domain', $web['domain']); + $php_bin_dir = dirname($web['php_cli_binary']); + //$tpl->setVar('home_dir', $this->_get_home_dir("")); + + if($web['server_php_id'] > 0) { + $tpl->setVar('use_site_php', false); + $tpl->setVar('php_bin_dir', $php_bin_dir); + $tpl->setVar('use_php_alias', true); + $tpl->setVar('php_alias', $web['php_cli_binary']); + } else { + $tpl->setVar('use_site_php', false); + } + + $bashrc = $homedir .'/.bashrc'; + if(@is_file($bashrc) || @is_link($bashrc)) unlink($bashrc); + + $app->system->file_put_contents($bashrc, $tpl->grab()); + unset($tpl); + + $app->log("Added bashrc script: ".$bashrc, LOGLEVEL_DEBUG); + //* Add webfolder protection again $app->system->web_folder_protection($web['document_root'], true); } else { diff --git a/server/plugins-available/shelluser_jailkit_plugin.inc.php b/server/plugins-available/shelluser_jailkit_plugin.inc.php index fc37727ad7..6ff6ee1568 100755 --- a/server/plugins-available/shelluser_jailkit_plugin.inc.php +++ b/server/plugins-available/shelluser_jailkit_plugin.inc.php @@ -82,7 +82,8 @@ class shelluser_jailkit_plugin { } - $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ?", $data['new']['parent_domain_id']); + //$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ?", $data['new']['parent_domain_id']); + $web = $app->db->queryOneRecord("SELECT * FROM web_domain LEFT JOIN server_php ON web_domain.server_php_id = server_php.server_php_id WHERE `domain_id` = ?", $data["new"]["parent_domain_id"]); if(!$app->system->is_allowed_user($data['new']['username'], false, false) || !$app->system->is_allowed_user($data['new']['puser'], true, true) @@ -190,7 +191,8 @@ class shelluser_jailkit_plugin { } if($app->system->is_user($data['new']['puser'])) { - $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ?", $data['new']['parent_domain_id']); + //$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ?", $data['new']['parent_domain_id']); + $web = $app->db->queryOneRecord("SELECT * FROM web_domain LEFT JOIN server_php ON web_domain.server_php_id = server_php.server_php_id WHERE `domain_id` = ?", $data["new"]["parent_domain_id"]); // Get the UID of the parent user $uid = intval($app->system->getuid($data['new']['puser'])); @@ -327,7 +329,8 @@ class shelluser_jailkit_plugin { $options = array('allow_hardlink'); } - $web = $app->db->queryOneRecord("SELECT domain, last_jailkit_hash FROM web_domain WHERE domain_id = ?", $this->data['new']["parent_domain_id"]); + //$web = $app->db->queryOneRecord("SELECT domain, last_jailkit_hash FROM web_domain WHERE domain_id = ?", $this->data['new']["parent_domain_id"]); + $web = $app->db->queryOneRecord("SELECT * FROM web_domain LEFT JOIN server_php ON web_domain.server_php_id = server_php.server_php_id WHERE `domain_id` = ?", $data["new"]["parent_domain_id"]); $last_updated = preg_split('/[\s,]+/', $this->jailkit_config['jailkit_chroot_app_sections'] .' '.$this->jailkit_config['jailkit_chroot_app_programs'] @@ -354,11 +357,14 @@ class shelluser_jailkit_plugin { $tpl->setVar('jailkit_chroot', true); $tpl->setVar('domain', $web['domain']); $tpl->setVar('home_dir', $this->_get_home_dir("")); + $tpl->setVar('php_cli_binary', dirname($web['php_cli_binary'])); $bashrc = $this->data['new']['dir'].'/etc/bash.bashrc'; if(@is_file($bashrc) || @is_link($bashrc)) unlink($bashrc); - file_put_contents($bashrc, $tpl->grab()); + $app->system->file_put_contents($bashrc, $tpl->grab()); + + //file_put_contents($bashrc, $tpl->grab()); unset($tpl); $app->log("Added bashrc script: ".$bashrc, LOGLEVEL_DEBUG); -- GitLab From eec29823adaaff2ca5f3d6a0d957bf6ac6d023bd Mon Sep 17 00:00:00 2001 From: Michael Seevogel Date: Wed, 29 Nov 2023 13:35:32 +0100 Subject: [PATCH 02/29] Revert changes --- server/plugins-available/shelluser_jailkit_plugin.inc.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/server/plugins-available/shelluser_jailkit_plugin.inc.php b/server/plugins-available/shelluser_jailkit_plugin.inc.php index 6ff6ee1568..24bb7e1a74 100755 --- a/server/plugins-available/shelluser_jailkit_plugin.inc.php +++ b/server/plugins-available/shelluser_jailkit_plugin.inc.php @@ -329,8 +329,8 @@ class shelluser_jailkit_plugin { $options = array('allow_hardlink'); } - //$web = $app->db->queryOneRecord("SELECT domain, last_jailkit_hash FROM web_domain WHERE domain_id = ?", $this->data['new']["parent_domain_id"]); - $web = $app->db->queryOneRecord("SELECT * FROM web_domain LEFT JOIN server_php ON web_domain.server_php_id = server_php.server_php_id WHERE `domain_id` = ?", $data["new"]["parent_domain_id"]); + $web = $app->db->queryOneRecord("SELECT domain, last_jailkit_hash FROM web_domain WHERE domain_id = ?", $this->data['new']["parent_domain_id"]); + //$web = $app->db->queryOneRecord("SELECT * FROM web_domain LEFT JOIN server_php ON web_domain.server_php_id = server_php.server_php_id WHERE `domain_id` = ?", $data["new"]["parent_domain_id"]); $last_updated = preg_split('/[\s,]+/', $this->jailkit_config['jailkit_chroot_app_sections'] .' '.$this->jailkit_config['jailkit_chroot_app_programs'] @@ -357,14 +357,13 @@ class shelluser_jailkit_plugin { $tpl->setVar('jailkit_chroot', true); $tpl->setVar('domain', $web['domain']); $tpl->setVar('home_dir', $this->_get_home_dir("")); - $tpl->setVar('php_cli_binary', dirname($web['php_cli_binary'])); $bashrc = $this->data['new']['dir'].'/etc/bash.bashrc'; if(@is_file($bashrc) || @is_link($bashrc)) unlink($bashrc); $app->system->file_put_contents($bashrc, $tpl->grab()); - //file_put_contents($bashrc, $tpl->grab()); + unset($tpl); $app->log("Added bashrc script: ".$bashrc, LOGLEVEL_DEBUG); -- GitLab From 1f1350c5ca19aa27f564845a490694631651081d Mon Sep 17 00:00:00 2001 From: Michael Seevogel Date: Fri, 8 Dec 2023 12:23:50 +0100 Subject: [PATCH 03/29] Clean up --- server/plugins-available/cron_plugin.inc.php | 4 ++-- .../shelluser_base_plugin.inc.php | 23 +++++++++++-------- .../shelluser_jailkit_plugin.inc.php | 2 +- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/server/plugins-available/cron_plugin.inc.php b/server/plugins-available/cron_plugin.inc.php index e6aa8c2e01..853f222046 100644 --- a/server/plugins-available/cron_plugin.inc.php +++ b/server/plugins-available/cron_plugin.inc.php @@ -260,8 +260,8 @@ class cron_plugin { } $web_domain = $this->parent_domain['domain']; - if($this->parent_domain['php_cli_binary'] == '') { - // PHP cli binary not set or default was selected, fallback to just "php" + if($this->parent_domain['php_cli_binary'] == '' || $job['type'] == 'chrooted') { + // PHP cli binary not set or default was selected or it is a chrooted web, fallback to just "php" $web_php_cli = 'php'; $app->log("PHP CLI binary not set for the website\'s selected PHP version or Default was selected. Falling back to \"php\" for cronjob id " . $job['id'], LOGLEVEL_DEBUG); } else { diff --git a/server/plugins-available/shelluser_base_plugin.inc.php b/server/plugins-available/shelluser_base_plugin.inc.php index eaf7871fb1..6b0f14fd71 100755 --- a/server/plugins-available/shelluser_base_plugin.inc.php +++ b/server/plugins-available/shelluser_base_plugin.inc.php @@ -332,32 +332,37 @@ class shelluser_base_plugin { $app->system->chgrp($homedir.'/.profile', $data['new']['pgroup']); } - - // Create .bashrc file $app->load('tpl'); $tpl = new tpl(); $tpl->newTemplate("bash.bashrc.master"); + // This is not a Jailkit chroot $tpl->setVar('jailkit_chroot', false); - //$tpl->setVar('domain', $web['domain']); $php_bin_dir = dirname($web['php_cli_binary']); - //$tpl->setVar('home_dir', $this->_get_home_dir("")); + // FIXME: Check if we need to add an additional field for the path environment variable that contains the path to the php binary if($web['server_php_id'] > 0) { - $tpl->setVar('use_site_php', false); - $tpl->setVar('php_bin_dir', $php_bin_dir); - $tpl->setVar('use_php_alias', true); - $tpl->setVar('php_alias', $web['php_cli_binary']); + if(preg_match('/^(\/usr\/(s)?bin|\/(s)?bin)/', $php_bin_dir)) + { + $tpl->setVar('use_site_php', false); + $tpl->setVar('use_php_alias', true); + $tpl->setVar('php_alias', $web['php_cli_binary']); + } else { + $tpl->setVar('use_site_php', true); + $tpl->setVar('use_php_alias', false); + $tpl->setVar('php_bin_dir', $php_bin_dir); + } } else { $tpl->setVar('use_site_php', false); + $tpl->setVar('use_php_alias', false); } $bashrc = $homedir .'/.bashrc'; if(@is_file($bashrc) || @is_link($bashrc)) unlink($bashrc); - $app->system->file_put_contents($bashrc, $tpl->grab()); + file_put_contents($bashrc, $tpl->grab()); unset($tpl); $app->log("Added bashrc script: ".$bashrc, LOGLEVEL_DEBUG); diff --git a/server/plugins-available/shelluser_jailkit_plugin.inc.php b/server/plugins-available/shelluser_jailkit_plugin.inc.php index 24bb7e1a74..285df2bbc6 100755 --- a/server/plugins-available/shelluser_jailkit_plugin.inc.php +++ b/server/plugins-available/shelluser_jailkit_plugin.inc.php @@ -361,7 +361,7 @@ class shelluser_jailkit_plugin { $bashrc = $this->data['new']['dir'].'/etc/bash.bashrc'; if(@is_file($bashrc) || @is_link($bashrc)) unlink($bashrc); - $app->system->file_put_contents($bashrc, $tpl->grab()); + file_put_contents($bashrc, $tpl->grab()); unset($tpl); -- GitLab From 8543fd1cf1b1cf9a8b4c037671ae22918c73fb54 Mon Sep 17 00:00:00 2001 From: Michael Seevogel Date: Sat, 13 Jan 2024 11:45:27 +0100 Subject: [PATCH 04/29] clean up of php-ssh-cron branch --- install/sql/ispconfig3.sql | 2 +- interface/web/sites/cron_edit.php | 5 +- interface/web/sites/templates/cron_edit.htm | 4 +- interface/web/sites/templates/cron_list.htm | 10 +- server/conf/bash.bashrc.master | 3 +- server/conf/bashrc_el.master | 132 ++++++++++++++++++ server/lib/classes/system.inc.php | 38 ++--- .../cron_jailkit_plugin.inc.php | 97 ++++++++++--- server/plugins-available/cron_plugin.inc.php | 37 +++-- .../shelluser_base_plugin.inc.php | 111 +++++++-------- .../shelluser_jailkit_plugin.inc.php | 104 +++++++++++--- 11 files changed, 394 insertions(+), 149 deletions(-) create mode 100644 server/conf/bashrc_el.master diff --git a/install/sql/ispconfig3.sql b/install/sql/ispconfig3.sql index e9aa9aaeed..38234751a3 100644 --- a/install/sql/ispconfig3.sql +++ b/install/sql/ispconfig3.sql @@ -1460,7 +1460,7 @@ CREATE TABLE `server_php` ( `php_fpm_ini_dir` varchar(255) DEFAULT NULL, `php_fpm_pool_dir` varchar(255) DEFAULT NULL, `php_fpm_socket_dir` varchar(255) DEFAULT NULL, - `php_cli_binary` varchar(255) DEFAULT NULL, + `php_cli_binary` varchar(255) DEFAULT NULL, `active` enum('n','y') NOT NULL DEFAULT 'y', `sortprio` int(20) NOT NULL DEFAULT 100, PRIMARY KEY (`server_php_id`) diff --git a/interface/web/sites/cron_edit.php b/interface/web/sites/cron_edit.php index 62f338f33f..eea8bdff71 100644 --- a/interface/web/sites/cron_edit.php +++ b/interface/web/sites/cron_edit.php @@ -78,6 +78,7 @@ class page_action extends tform_actions { $app->tpl->setVar("edit_disabled", 0); } + parent::onShowEnd(); } @@ -148,7 +149,7 @@ class page_action extends tform_actions { $has_error = true; } } - + if($client["limit_cron_type"] == 'url' && $this->dataRecord["type"] != 'url') { $app->error($app->tform->wordbook["limit_cron_url_txt"]); $has_error = true; @@ -178,7 +179,7 @@ class page_action extends tform_actions { $has_error = true; } } - + if($client["limit_cron_type"] == 'url' && $this->dataRecord["type"] != 'url') { $app->error($app->tform->wordbook["limit_cron_url_txt"]); $has_error = true; diff --git a/interface/web/sites/templates/cron_edit.htm b/interface/web/sites/templates/cron_edit.htm index ffb0254681..66619831c4 100644 --- a/interface/web/sites/templates/cron_edit.htm +++ b/interface/web/sites/templates/cron_edit.htm @@ -51,8 +51,8 @@
- {tmpl_var name='variables_txt'}: {SITE_PHP}, {DOCROOT_CLIENT}, {DOMAIN} -

{tmpl_var name='command_hint_txt'}

+ {tmpl_var name='variables_txt'}: {SITE_PHP}, {DOCROOT_CLIENT}, {DOMAIN} +
diff --git a/interface/web/sites/templates/cron_list.htm b/interface/web/sites/templates/cron_list.htm index fbca26a844..7597e073d4 100644 --- a/interface/web/sites/templates/cron_list.htm +++ b/interface/web/sites/templates/cron_list.htm @@ -5,12 +5,12 @@

{tmpl_var name="toolsarea_head_txt"}

- + - - - + + +

@@ -55,7 +55,7 @@ diff --git a/server/conf/bash.bashrc.master b/server/conf/bash.bashrc.master index 4c5090ec55..9393bd9b50 100644 --- a/server/conf/bash.bashrc.master +++ b/server/conf/bash.bashrc.master @@ -62,11 +62,10 @@ fi #alias la='ls -A' #alias l='ls -CF' - + # Overwrite the PHP cli binaries by using $PATH: export PATH=:$PATH - alias php="" diff --git a/server/conf/bashrc_el.master b/server/conf/bashrc_el.master new file mode 100644 index 0000000000..7282b03f5d --- /dev/null +++ b/server/conf/bashrc_el.master @@ -0,0 +1,132 @@ +# /etc/bashrc + +# Taken from EL9 + +# System wide functions and aliases +# Environment stuff goes in /etc/profile + +# It's NOT a good idea to change this file unless you know what you +# are doing. It's much better to create a custom.sh shell script in +# /etc/profile.d/ to make custom changes to your environment, as this +# will prevent the need for merging in future updates. + + + +# Set some more environment variables, they are likely not set in Jailkit setups for EL. +export TERM="xterm" +export LESSOPEN="||/usr/bin/lesspipe.sh %s" + +dircolors -b >/dev/null + + + + +# Prevent doublesourcing +if [ -z "$BASHRCSOURCED" ]; then + BASHRCSOURCED="Y" + + # are we an interactive shell? + if [ "$PS1" ]; then + if [ -z "$PROMPT_COMMAND" ]; then + case $TERM in + xterm*|vte*) + if [ -e /etc/sysconfig/bash-prompt-xterm ]; then + PROMPT_COMMAND=/etc/sysconfig/bash-prompt-xterm + else + PROMPT_COMMAND='printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/\~}"' + fi + ;; + screen*) + if [ -e /etc/sysconfig/bash-prompt-screen ]; then + PROMPT_COMMAND=/etc/sysconfig/bash-prompt-screen + else + PROMPT_COMMAND='printf "\033k%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/\~}"' + fi + ;; + *) + [ -e /etc/sysconfig/bash-prompt-default ] && PROMPT_COMMAND=/etc/sysconfig/bash-prompt-default + ;; + esac + fi + # Turn on parallel history + shopt -s histappend + history -a + # Turn on checkwinsize + shopt -s checkwinsize + [ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ " + # You might want to have e.g. tty in prompt (e.g. more virtual machines) + # and console windows + # If you want to do so, just add e.g. + # if [ "$PS1" ]; then + # PS1="[\u@\h:\l \W]\\$ " + # fi + # to your custom modification shell script in /etc/profile.d/ directory + fi + + if ! shopt -q login_shell ; then # We're not a login shell + # Need to redefine pathmunge, it gets undefined at the end of /etc/profile + pathmunge () { + case ":${PATH}:" in + *:"$1":*) + ;; + *) + if [ "$2" = "after" ] ; then + PATH=$PATH:$1 + else + PATH=$1:$PATH + fi + esac + } + + # Set default umask for non-login shell only if it is set to 0 + [ `umask` -eq 0 ] && umask 022 + + SHELL=/bin/bash + # Only display echos from profile.d scripts if we are no login shell + # and interactive - otherwise just process them to set envvars + for i in /etc/profile.d/*.sh; do + if [ -r "$i" ]; then + if [ "$PS1" ]; then + . "$i" + else + . "$i" >/dev/null + fi + fi + done + + unset i + unset -f pathmunge + fi + +fi + + +## Hack for Jailkit User to change back to the logged in user ## +if [ -n "$LOGNAME" ]; then + if [ "$LOGNAME" != $USER ]; then + export HOME=$LOGNAME + export USER=$LOGNAME + export USERNAME=$LOGNAME + cd $HOME + fi +fi + +## Change machine hostname to site domain ## +export HOSTNAME= + + + + +# Overwrite the PHP cli binaries by using $PATH: +export PATH=:$PATH + + +alias php="" + + +### Hack to source a custom bashrc +#if [ -f ~/.bashrc_ispcuser ]; then +# . ~/.bashrc_ispcuser +#fi + +# vim:ts=4:sw=4 diff --git a/server/lib/classes/system.inc.php b/server/lib/classes/system.inc.php index b2c6357d8f..5ba578a023 100644 --- a/server/lib/classes/system.inc.php +++ b/server/lib/classes/system.inc.php @@ -2064,7 +2064,7 @@ class system{ function _getinitcommand($servicename, $action, $init_script_directory = '', $check_service) { global $conf, $app; - + // upstart /* removed upstart support - deprecated if(is_executable('/sbin/initctl')){ @@ -2072,7 +2072,7 @@ class system{ if(intval($retval['retval']) == 0) return 'service '.$servicename.' '.$action; } */ - + if(!in_array($action,array('start','stop','restart','reload','force-reload'))) { $app->log('Invalid init command action '.$action,LOGLEVEL_WARN); return false; @@ -2081,10 +2081,10 @@ class system{ //* systemd (now default in all supported OS) if(is_executable('/bin/systemd') || is_executable('/usr/bin/systemctl')){ $app->log('Trying to use Systemd to restart service',LOGLEVEL_DEBUG); - + //* Test service name via regex if(preg_match('/[a-zA-Z0-9\.\-\_]/',$servicename)) { - + //* Test if systemd service is enabled if ($check_service) { $this->exec_safe("systemctl is-enabled ? 2>&1", $servicename); @@ -2092,7 +2092,7 @@ class system{ } else { $app->log('Systemd service '.$servicename.' not found or not enabled.',LOGLEVEL_DEBUG); } - + //* Return service command if ($ret_val == 0 || !$check_service) { return 'systemctl '.$action.' '.$servicename.'.service'; @@ -2108,69 +2108,69 @@ class system{ //* sysvinit fallback $app->log('Using init script to restart service',LOGLEVEL_DEBUG); - + //* Get init script directory if($init_script_directory == '') $init_script_directory = $conf['init_scripts']; if(substr($init_script_directory, -1) === '/') $init_script_directory = substr($init_script_directory, 0, -1); $init_script_directory = realpath($init_script_directory); - + //* Check init script dir if(!is_dir($init_script_directory)) { $app->log('Init script directory '.$init_script_directory.' not found',LOGLEVEL_WARN); return false; } - + //* Forbidden init script paths if(substr($init_script_directory,0,4) == '/var' || substr($init_script_directory,0,4) == '/tmp') { $app->log('Do not put init scripts in /var or /tmp folder.',LOGLEVEL_WARN); return false; } - + //* Check init script dir owner if(fileowner($init_script_directory) !== 0) { $app->log('Init script directory '.$init_script_directory.' not owned by root user',LOGLEVEL_WARN); return false; } - + $full_init_script_path = realpath($init_script_directory.'/'.$servicename); - + //** Gentoo, keep symlink as init script, but do some checks - if(file_exists('/etc/gentoo-release')) { + if(file_exists('/etc/gentoo-release')) { //* check if init script is symlink - if(is_link($init_script_directory.'/'.$servicename)) { + if(is_link($init_script_directory.'/'.$servicename)) { //* Check init script owner (realpath, symlink is checked later) if(fileowner($full_init_script_path) !== 0) { $app->log('Init script '.$full_init_script_path.' not owned by root user',LOGLEVEL_WARN); return false; } - + //* full path is symlink $full_init_script_path_symlink = $init_script_directory.'/'.$servicename; - + //* check if realpath matches symlink if(strpos($full_init_script_path_symlink,$full_init_script_path) == 0) { $full_init_script_path = $full_init_script_path_symlink; } } } - + if($full_init_script_path == '') { $app->log('No init script, we quit here.',LOGLEVEL_WARN); return false; } - + //* Check init script if(!is_file($full_init_script_path)) { $app->log('Init script '.$full_init_script_path.' not found',LOGLEVEL_WARN); return false; } - + //* Check init script owner if(fileowner($full_init_script_path) !== 0) { $app->log('Init script '.$full_init_script_path.' not owned by root user',LOGLEVEL_WARN); return false; } - + if($check_service && is_executable($full_init_script_path)) { return $full_init_script_path.' '.$action; } diff --git a/server/plugins-available/cron_jailkit_plugin.inc.php b/server/plugins-available/cron_jailkit_plugin.inc.php index 08f039b371..5d6638b9e3 100644 --- a/server/plugins-available/cron_jailkit_plugin.inc.php +++ b/server/plugins-available/cron_jailkit_plugin.inc.php @@ -77,7 +77,8 @@ class cron_jailkit_plugin { } //* get data from web - $parent_domain = $app->db->queryOneRecord("SELECT * FROM `web_domain` WHERE `domain_id` = ?", $data["new"]["parent_domain_id"]); + $parent_domain = $app->db->queryOneRecord("SELECT * FROM web_domain LEFT JOIN server_php ON web_domain.server_php_id = server_php.server_php_id WHERE domain_id = ?", $data["new"]["parent_domain_id"]); + if(!$parent_domain["domain_id"]) { $app->log("Parent domain not found", LOGLEVEL_WARN); return 0; @@ -92,6 +93,8 @@ class cron_jailkit_plugin { $this->parent_domain = $parent_domain; + $this->cronjob_id = $data['new']['id']; + $app->uses('system'); if($app->system->is_user($parent_domain['system_user'])) { @@ -121,6 +124,8 @@ class cron_jailkit_plugin { $this->_add_jailkit_user(); + $this->_add_bashrc_jailkit(); + $command .= 'usermod -U ? 2>/dev/null'; $app->system->exec_safe($command, $parent_domain["system_user"]); @@ -145,8 +150,10 @@ class cron_jailkit_plugin { $app->log("Parent domain not set", LOGLEVEL_WARN); return 0; } + //* get data from web - $parent_domain = $app->db->queryOneRecord("SELECT * FROM `web_domain` WHERE `domain_id` = ?", $data["new"]["parent_domain_id"]); + $parent_domain = $app->db->queryOneRecord("SELECT * FROM web_domain LEFT JOIN server_php ON web_domain.server_php_id = server_php.server_php_id WHERE domain_id = ?", $data["new"]["parent_domain_id"]); + if(!$parent_domain["domain_id"]) { $app->log("Parent domain not found", LOGLEVEL_WARN); return 0; @@ -161,6 +168,8 @@ class cron_jailkit_plugin { $this->parent_domain = $parent_domain; + $this->cronjob_id = $data['new']['id']; + if($app->system->is_user($parent_domain['system_user'])) { @@ -189,6 +198,8 @@ class cron_jailkit_plugin { $this->_add_jailkit_user(); + $this->_add_bashrc_jailkit(); + $this->_update_website_security_level(); $app->system->web_folder_protection($parent_domain['document_root'], true); @@ -253,33 +264,15 @@ class cron_jailkit_plugin { // check if the chroot environment is created yet if not create it with a list of program sections from the config if (!is_dir($this->parent_domain['document_root'].'/etc/jailkit')) { + $app->system->create_jailkit_chroot($this->parent_domain['document_root'], $this->jailkit_config['jailkit_chroot_app_sections'], $options); $app->log("Added jailkit chroot", LOGLEVEL_DEBUG); $this->_add_jailkit_programs($options); - $app->load('tpl'); - - $tpl = new tpl(); - $tpl->newTemplate("bash.bashrc.master"); - - $tpl->setVar('jailkit_chroot', true); - $tpl->setVar('domain', $this->parent_domain['domain']); - $tpl->setVar('home_dir', $this->_get_home_dir("")); - - $bashrc = $this->parent_domain['document_root'].'/etc/bash.bashrc'; - if(@is_file($bashrc) || @is_link($bashrc)) unlink($bashrc); - - $app->system->file_put_contents($bashrc, $tpl->grab()); - unset($tpl); - - $app->log('Added bashrc script: '.$bashrc, LOGLEVEL_DEBUG); - $tpl = new tpl(); $tpl->newTemplate('motd.master'); - $tpl->setVar('domain', $this->parent_domain['domain']); - $motd = $this->parent_domain['document_root'].'/var/run/motd'; if(@is_file($motd) || @is_link($motd)) unlink($motd); @@ -303,6 +296,7 @@ class cron_jailkit_plugin { } $app->system->update_jailkit_chroot($this->parent_domain['document_root'], $sections, $programs, $options); + } // this gets last_jailkit_update out of sync with master db, but that is ok, @@ -373,6 +367,67 @@ class cron_jailkit_plugin { } } + function _add_bashrc_jailkit() { + global $app; + + // Create .bashrc file + $app->load('tpl'); + + $tpl = new tpl(); + + // /etc/bash.bashrc is not supported by Red Hat OS + if($app->system->is_redhat_os() == true) { + $tpl->newTemplate("bashrc_el.master"); + } else { + $tpl->newTemplate("bash.bashrc.master"); + } + + // Predefine some template vars + $tpl->setVar('jailkit_chroot', true); + $tpl->setVar('domain', $this->parent_domain['domain']); + $tpl->setVar('home_dir', $this->_get_home_dir("")); + + $tpl->setVar('use_php_path', false); + $tpl->setVar('use_php_alias', false); + + $php_bin_dir = dirname($this->parent_domain['php_cli_binary']); + + if(!file_exists($this->_get_home_dir($this->parent_domain['system_user']))) $this->_add_jailkit_user(); + + + if(($this->parent_domain['server_php_id'] > 0) && !empty($this->parent_domain['php_cli_binary'])) { + if(preg_match('/^(\/usr\/(s)?bin|\/(s)?bin)/', $php_bin_dir)) { + $tpl->setVar('use_php_path', false); + $tpl->setVar('use_php_alias', true); + $tpl->setVar('php_alias', $this->parent_domain['php_cli_binary']); + } else { + $tpl->setVar('use_php_path', true); + $tpl->setVar('use_php_alias', false); + $tpl->setVar('php_bin_dir', $php_bin_dir); + } + + if(!file_exists($this->parent_domain['document_root'] . '/' . $this->parent_domain['php_cli_binary'])) { + $app->log("The PHP cli binary " . $this->parent_domain['php_cli_binary'] . " is not available in the jail of the web " . $this->parent_domain['domain'] . " / cronjob_id: " . $this->cronjob_id . ". Check your Jailkit setup!", LOGLEVEL_DEBUG); + $tpl->setVar('use_php_path', false); + $tpl->setVar('use_php_alias', false); + } + } + + if($app->system->is_redhat_os() == true) { + $bashrc = $this->parent_domain['document_root'] . '/home/' . $this->parent_domain['system_user'] . '/.bashrc'; + } else { + $bashrc = $this->parent_domain['document_root'] . '/etc/bash.bashrc'; + } + + if(@is_file($bashrc) || @is_link($bashrc)) unlink($bashrc); + file_put_contents($bashrc, $tpl->grab()); + $app->log("Added bashrc script: " . $bashrc, LOGLEVEL_DEBUG); + + unset($tpl); + + } + + private function _delete_jailkit_if_unused($parent_domain_id) { global $app, $conf; diff --git a/server/plugins-available/cron_plugin.inc.php b/server/plugins-available/cron_plugin.inc.php index 853f222046..9186ae31c9 100644 --- a/server/plugins-available/cron_plugin.inc.php +++ b/server/plugins-available/cron_plugin.inc.php @@ -171,6 +171,7 @@ class cron_plugin { $this->parent_domain = $parent_domain; + $this->_write_crontab(); $this->action = ''; @@ -207,6 +208,7 @@ class cron_plugin { $app->uses("getconf"); $cron_config = $app->getconf->get_server_config($conf["server_id"], 'cron'); + $web_config = $app->getconf->get_server_config($conf["server_id"], 'web'); //* try to find customer's mail address @@ -249,33 +251,44 @@ class cron_plugin { continue; } - $web_root = ''; + $web_docroot_client = ''; + + $web_domain = $this->parent_domain['domain']; + + // web folder is hardcoded to /web: + $web_folder = '/web'; + if($job['type'] == 'chrooted') { if(substr($job['command'], 0, strlen($this->parent_domain['document_root'])) == $this->parent_domain['document_root']) { //* delete the unneeded path part $job['command'] = substr($job['command'], strlen($this->parent_domain['document_root'])); } } else { - $web_root = $this->parent_domain['document_root']; + $web_docroot_client = $this->parent_domain['document_root']; } - $web_domain = $this->parent_domain['domain']; - if($this->parent_domain['php_cli_binary'] == '' || $job['type'] == 'chrooted') { - // PHP cli binary not set or default was selected or it is a chrooted web, fallback to just "php" - $web_php_cli = 'php'; - $app->log("PHP CLI binary not set for the website\'s selected PHP version or Default was selected. Falling back to \"php\" for cronjob id " . $job['id'], LOGLEVEL_DEBUG); + if(empty($this->parent_domain['php_cli_binary'])) { + // PHP cli binary not set or default was selected, fallback to "/usr/bin/php" + $web_php_cli = '/usr/bin/php'; + $app->log("PHP CLI binary not set for the website\'s selected PHP version or Default was selected. Fall back to \"/usr/bin/php\" for cronjob id " . $job['id'], LOGLEVEL_DEBUG); + if($job['type'] == 'chrooted') { + if(!file_exists($this->parent_domain['document_root'] . $web_php_cli)) { + echo $this->parent_domain['document_root'] . $web_php_cli."\n\n\n\n"; + $app->log("The PHP cli binary " . $web_php_cli . " is not available in the jail of the web " . $web_domain . " / cronjob_id: " . $job['id'] . ". Check your Jailkit setup!", LOGLEVEL_DEBUG); + } + } } else { $web_php_cli = $this->parent_domain['php_cli_binary']; } - $web_root .= '/web'; + $web_docroot_client .= $web_folder; $trans = array( - '[web_root]' => $web_root, - '{DOCROOT_CLIENT}' => $web_root, - '{DOMAIN}' => $web_domain, + '[web_root]' => $web_docroot_client, + '{DOCROOT_CLIENT}' => $web_docroot_client, + '{DOMAIN}' => $web_domain, '{SITE_PHP}' => $web_php_cli - ); + ); $job['command'] = strtr($job['command'], $trans); diff --git a/server/plugins-available/shelluser_base_plugin.inc.php b/server/plugins-available/shelluser_base_plugin.inc.php index 6b0f14fd71..f73414f7d5 100755 --- a/server/plugins-available/shelluser_base_plugin.inc.php +++ b/server/plugins-available/shelluser_base_plugin.inc.php @@ -169,36 +169,10 @@ class shelluser_base_plugin { $app->system->chown($homedir.'/.profile', $data['new']['username']); $app->system->chgrp($homedir.'/.profile', $data['new']['pgroup']); - $app->load('tpl'); - - $tpl = new tpl(); - $tpl->newTemplate("bash.bashrc.master"); - - $tpl->setVar('jailkit_chroot', false); - $tpl->setVar('domain', $web['domain']); - //$tpl->setVar('home_dir', $this->_get_home_dir("")); - - if($web['server_php_id'] > 0) { - $tpl->setVar('use_site_php', true); - $tpl->setVar('php_bin_dir', $php_bin_dir); - } else { - $tpl->setVar('use_site_php', false); + if($data['new']['chroot'] != "jailkit") { + $this->_add_bashrc_base(); } - $bashrc = $this->data['new']['dir'].'/etc/bash.bashrc'; - if(@is_file($bashrc) || @is_link($bashrc)) unlink($bashrc); - - //file_put_contents($bashrc, $tpl->grab()); - $app->system->file_put_contents($bashrc, $tpl->grab()); - unset($tpl); - - $app->log("Added bashrc script: ".$bashrc, LOGLEVEL_DEBUG); - - - - - - // Create symlinks for conveniance, SFTP user should not land in an empty dir. symlink('../../web', $homedir.'/web'); symlink('../../log', $homedir.'/log'); @@ -234,7 +208,9 @@ class shelluser_base_plugin { //* Check if the resulting path is inside the docroot $web = $app->db->queryOneRecord("SELECT * FROM web_domain LEFT JOIN server_php ON web_domain.server_php_id = server_php.server_php_id WHERE `domain_id` = ?", $data["new"]["parent_domain_id"]); - //$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ?", $data['new']['parent_domain_id']); + + $this->web = $web; + if(substr($data['new']['dir'],0,strlen($web['document_root'])) != $web['document_root']) { $app->log('Directory of the shell user is outside of website docroot.',LOGLEVEL_WARN); return false; @@ -332,41 +308,10 @@ class shelluser_base_plugin { $app->system->chgrp($homedir.'/.profile', $data['new']['pgroup']); } - // Create .bashrc file - $app->load('tpl'); - - $tpl = new tpl(); - $tpl->newTemplate("bash.bashrc.master"); - - // This is not a Jailkit chroot - $tpl->setVar('jailkit_chroot', false); - $php_bin_dir = dirname($web['php_cli_binary']); - - // FIXME: Check if we need to add an additional field for the path environment variable that contains the path to the php binary - if($web['server_php_id'] > 0) { - if(preg_match('/^(\/usr\/(s)?bin|\/(s)?bin)/', $php_bin_dir)) - { - $tpl->setVar('use_site_php', false); - $tpl->setVar('use_php_alias', true); - $tpl->setVar('php_alias', $web['php_cli_binary']); - } else { - $tpl->setVar('use_site_php', true); - $tpl->setVar('use_php_alias', false); - $tpl->setVar('php_bin_dir', $php_bin_dir); - } - } else { - $tpl->setVar('use_site_php', false); - $tpl->setVar('use_php_alias', false); + if($data['new']['chroot'] != "jailkit") { + $this->_add_bashrc_base(); } - $bashrc = $homedir .'/.bashrc'; - if(@is_file($bashrc) || @is_link($bashrc)) unlink($bashrc); - - file_put_contents($bashrc, $tpl->grab()); - unset($tpl); - - $app->log("Added bashrc script: ".$bashrc, LOGLEVEL_DEBUG); - //* Add webfolder protection again $app->system->web_folder_protection($web['document_root'], true); } else { @@ -604,6 +549,48 @@ class shelluser_base_plugin { } + function _add_bashrc_base() { + global $app; + + // Create .bashrc file + $app->load('tpl'); + + $tpl = new tpl(); + $tpl->newTemplate("bash.bashrc.master"); + + // Predefine some template vars + $tpl->setVar('jailkit_chroot', false); + $tpl->setVar('use_php_path', false); + $tpl->setVar('use_php_alias', false); + + $php_bin_dir = dirname($this->web['php_cli_binary']); + + if(($this->web['server_php_id'] > 0) && !empty($this->web['php_cli_binary'])) { + if(preg_match('/^(\/usr\/(s)?bin|\/(s)?bin)/', $php_bin_dir)) + { + $tpl->setVar('use_php_path', false); + $tpl->setVar('use_php_alias', true); + $tpl->setVar('php_alias', $this->web['php_cli_binary']); + } else { + $tpl->setVar('use_php_path', true); + $tpl->setVar('use_php_alias', false); + $tpl->setVar('php_bin_dir', $php_bin_dir); + } + + } elseif(($this->web['server_php_id'] > 0) && empty($this->web['php_cli_binary'])) { + $app->log("The PHP cli binary is not set for the selected PHP version. Affected web: " . $this->web['domain'], LOGLEVEL_DEBUG); + } + + $bashrc = $this->data['new']['dir'] . '/home/' . $this->data['new']['username'] . '/.bashrc'; + + if(@is_file($bashrc) || @is_link($bashrc)) unlink($bashrc); + + file_put_contents($bashrc, $tpl->grab()); + $app->log("Added bashrc script: " . $bashrc, LOGLEVEL_DEBUG); + unset($tpl); + + } + } // end class ?> diff --git a/server/plugins-available/shelluser_jailkit_plugin.inc.php b/server/plugins-available/shelluser_jailkit_plugin.inc.php index 285df2bbc6..0f9313eae5 100755 --- a/server/plugins-available/shelluser_jailkit_plugin.inc.php +++ b/server/plugins-available/shelluser_jailkit_plugin.inc.php @@ -82,9 +82,13 @@ class shelluser_jailkit_plugin { } - //$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ?", $data['new']['parent_domain_id']); + $web = $app->db->queryOneRecord("SELECT * FROM web_domain LEFT JOIN server_php ON web_domain.server_php_id = server_php.server_php_id WHERE `domain_id` = ?", $data["new"]["parent_domain_id"]); + $this->web = $web; + + $this->username = $data['new']['username']; + if(!$app->system->is_allowed_user($data['new']['username'], false, false) || !$app->system->is_allowed_user($data['new']['puser'], true, true) || !$app->system->is_allowed_group($data['new']['pgroup'], true, true)) { @@ -137,6 +141,8 @@ class shelluser_jailkit_plugin { //* call the ssh-rsa update function $this->_setup_ssh_rsa(); + $this->_add_bashrc_jailkit(); + $app->system->usermod($data['new']['username'], 0, 0, '', '/usr/sbin/jk_chrootsh', '', ''); //* Unlock user @@ -191,9 +197,14 @@ class shelluser_jailkit_plugin { } if($app->system->is_user($data['new']['puser'])) { - //$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ?", $data['new']['parent_domain_id']); + + $web = $app->db->queryOneRecord("SELECT * FROM web_domain LEFT JOIN server_php ON web_domain.server_php_id = server_php.server_php_id WHERE `domain_id` = ?", $data["new"]["parent_domain_id"]); + $this->web = $web; + + $this->username = $data['new']['username']; + // Get the UID of the parent user $uid = intval($app->system->getuid($data['new']['puser'])); if($uid > $this->min_uid) { @@ -225,6 +236,8 @@ class shelluser_jailkit_plugin { $this->_add_jailkit_user(); + $this->_add_bashrc_jailkit(); + //* call the ssh-rsa update function $this->_setup_ssh_rsa(); @@ -349,25 +362,6 @@ class shelluser_jailkit_plugin { $this->_add_jailkit_programs($options); - $app->load('tpl'); - - $tpl = new tpl(); - $tpl->newTemplate("bash.bashrc.master"); - - $tpl->setVar('jailkit_chroot', true); - $tpl->setVar('domain', $web['domain']); - $tpl->setVar('home_dir', $this->_get_home_dir("")); - - $bashrc = $this->data['new']['dir'].'/etc/bash.bashrc'; - if(@is_file($bashrc) || @is_link($bashrc)) unlink($bashrc); - - file_put_contents($bashrc, $tpl->grab()); - - - unset($tpl); - - $app->log("Added bashrc script: ".$bashrc, LOGLEVEL_DEBUG); - $tpl = new tpl(); $tpl->newTemplate("motd.master"); @@ -396,6 +390,8 @@ class shelluser_jailkit_plugin { } $app->system->update_jailkit_chroot($this->data['new']['dir'], $sections, $programs, $options); + + } // this gets last_jailkit_update out of sync with master db, but that is ok, @@ -462,13 +458,13 @@ class shelluser_jailkit_plugin { $app->system->chown($this->data['new']['dir'].$jailkit_chroot_userhome, $this->data['new']['username']); $app->system->chgrp($this->data['new']['dir'].$jailkit_chroot_userhome, $this->data['new']['pgroup']); - $app->log("Added created jailkit user home in : ".$this->data['new']['dir'].$jailkit_chroot_userhome, LOGLEVEL_DEBUG); + $app->log("Added created jailkit user home in: ".$this->data['new']['dir'].$jailkit_chroot_userhome, LOGLEVEL_DEBUG); if(!is_dir($this->data['new']['dir'].$jailkit_chroot_puserhome)) mkdir($this->data['new']['dir'].$jailkit_chroot_puserhome, 0750, true); $app->system->chown($this->data['new']['dir'].$jailkit_chroot_puserhome, $this->data['new']['puser']); $app->system->chgrp($this->data['new']['dir'].$jailkit_chroot_puserhome, $this->data['new']['pgroup']); - $app->log("Added jailkit parent user home in : ".$this->data['new']['dir'].$jailkit_chroot_puserhome, LOGLEVEL_DEBUG); + $app->log("Added jailkit parent user home in: ".$this->data['new']['dir'].$jailkit_chroot_puserhome, LOGLEVEL_DEBUG); } @@ -680,6 +676,68 @@ class shelluser_jailkit_plugin { $app->db->query("UPDATE `web_domain` SET `last_jailkit_update` = NOW(), `last_jailkit_hash` = NULL WHERE `document_root` = ?", $parent_domain['document_root']); } + + + function _add_bashrc_jailkit() { + global $app; + + // Create .bashrc file + $app->load('tpl'); + + $tpl = new tpl(); + + // /etc/bash.bashrc is not supported by Red Hat OS + if($app->system->is_redhat_os() == true) { + $tpl->newTemplate("bashrc_el.master"); + } else { + $tpl->newTemplate("bash.bashrc.master"); + } + + // Predefine some template vars + $tpl->setVar('jailkit_chroot', true); + $tpl->setVar('domain', $this->web['domain']); + $tpl->setVar('home_dir', $this->_get_home_dir("")); + + $tpl->setVar('use_php_path', false); + $tpl->setVar('use_php_alias', false); + + $php_bin_dir = dirname($this->web['php_cli_binary']); + + if(!file_exists($this->_get_home_dir($this->web['system_user']))) $this->_add_jailkit_user(); + + if(($this->web['server_php_id'] > 0) && !empty($this->web['php_cli_binary'])) { + if(preg_match('/^(\/usr\/(s)?bin|\/(s)?bin)/', $php_bin_dir)) { + $tpl->setVar('use_php_path', false); + $tpl->setVar('use_php_alias', true); + $tpl->setVar('php_alias', $this->web['php_cli_binary']); + } else { + $tpl->setVar('use_php_path', true); + $tpl->setVar('use_php_alias', false); + $tpl->setVar('php_bin_dir', $php_bin_dir); + } + + if(!file_exists($this->web['document_root'] . '/' . $this->web['php_cli_binary'])) { + $app->log("The PHP cli binary " . $this->web['php_cli_binary'] . " is not available in the jail of the web " . $this->web['domain'] . " / username: " . $this->username . ". Check your Jailkit setup!", LOGLEVEL_DEBUG); + $tpl->setVar('use_php_path', false); + $tpl->setVar('use_php_alias', false); + } + } + + if($app->system->is_redhat_os() == true) { + $bashrc = $this->web['document_root'] . '/home/' . $this->web['system_user'] . '/.bashrc'; + } else { + $bashrc = $this->web['document_root'] . '/etc/bash.bashrc'; + } + + if(@is_file($bashrc) || @is_link($bashrc)) unlink($bashrc); + file_put_contents($bashrc, $tpl->grab()); + $app->log("Added bashrc script: " . $bashrc, LOGLEVEL_DEBUG); + + unset($tpl); + + + } + } // end class ?> -- GitLab From 86f21484d2011186e080baa9f8804b3479a7a91f Mon Sep 17 00:00:00 2001 From: Michael Seevogel Date: Sun, 14 Jan 2024 12:07:32 +0100 Subject: [PATCH 05/29] remove debug line --- server/plugins-available/cron_plugin.inc.php | 1 - 1 file changed, 1 deletion(-) diff --git a/server/plugins-available/cron_plugin.inc.php b/server/plugins-available/cron_plugin.inc.php index 9186ae31c9..b0bc507b5e 100644 --- a/server/plugins-available/cron_plugin.inc.php +++ b/server/plugins-available/cron_plugin.inc.php @@ -273,7 +273,6 @@ class cron_plugin { $app->log("PHP CLI binary not set for the website\'s selected PHP version or Default was selected. Fall back to \"/usr/bin/php\" for cronjob id " . $job['id'], LOGLEVEL_DEBUG); if($job['type'] == 'chrooted') { if(!file_exists($this->parent_domain['document_root'] . $web_php_cli)) { - echo $this->parent_domain['document_root'] . $web_php_cli."\n\n\n\n"; $app->log("The PHP cli binary " . $web_php_cli . " is not available in the jail of the web " . $web_domain . " / cronjob_id: " . $job['id'] . ". Check your Jailkit setup!", LOGLEVEL_DEBUG); } } -- GitLab From 3ac0d7c02bcd3915c9cac2f46c856b382baf7f56 Mon Sep 17 00:00:00 2001 From: Michael Seevogel Date: Sun, 14 Jan 2024 12:09:37 +0100 Subject: [PATCH 06/29] Backported the patches: [PATCH] Add placeholder values, update command_hint_txt to match [PATCH] Handle chrooted sites --- interface/web/sites/cron_edit.php | 23 +++++++++++++++++++++ interface/web/sites/lib/lang/en_cron.lng | 2 +- interface/web/sites/templates/cron_edit.htm | 7 +++++-- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/interface/web/sites/cron_edit.php b/interface/web/sites/cron_edit.php index eea8bdff71..7a3e8a1461 100644 --- a/interface/web/sites/cron_edit.php +++ b/interface/web/sites/cron_edit.php @@ -78,6 +78,29 @@ class page_action extends tform_actions { $app->tpl->setVar("edit_disabled", 0); } + $parent_domain = $app->db->queryOneRecord("SELECT `domain_id`, `system_user`, `system_group`, `domain`, `document_root`, `hd_quota`, `php_cli_binary` + FROM `web_domain` + LEFT JOIN server_php ON web_domain.server_php_id = server_php.server_php_id + WHERE `domain_id` = ?", $this->dataRecord["parent_domain_id"]); + + if(!$parent_domain["domain_id"]) { + $app->log("Parent domain not found", LOGLEVEL_WARN); + return 0; + } + + $web_docroot_client = ''; + + if($this->dataRecord['type'] != 'chrooted') { + $web_docroot_client = $this->parent_domain['document_root']; + } + + // web folder is hardcoded to /web: + $web_docroot_client .= '/web'; + + // Example values for placeholders. + $app->tpl->setVar("php_cli_binary", $parent_domain['php_cli_binary']); + $app->tpl->setVar("docroot_client", $web_docroot_client); + $app->tpl->setVar("domain", $parent_domain['domain']); parent::onShowEnd(); } diff --git a/interface/web/sites/lib/lang/en_cron.lng b/interface/web/sites/lib/lang/en_cron.lng index e912da82a5..ca98207ff5 100644 --- a/interface/web/sites/lib/lang/en_cron.lng +++ b/interface/web/sites/lib/lang/en_cron.lng @@ -19,7 +19,7 @@ $wb['run_wday_error_format'] = 'Invalid format for days of the week.'; $wb['command_error_format'] = 'Invalid command format. Please note that in case of an url call only http/https is allowed.'; $wb['unknown_fieldtype_error'] = 'An unknown field type has been used.'; $wb['server_id_error_empty'] = 'The server ID is empty.'; -$wb['command_hint_txt'] = 'e.g. /var/www/clients/clientX/webY/myscript.sh or https://www.mydomain.com/path/script.php, you can use [web_root] placeholder that is replaced by /var/www/clients/clientX/webY/web.'; +$wb['command_hint_txt'] = 'e.g. /var/www/clients/clientX/webY/myscript.sh or https://www.mydomain.com/path/script.php, you can include the placeholders above that will be replaced with their value. Hover over the variable to see it\'s expected value.'; $wb['log_output_txt'] = 'Log output'; $wb['limit_cron_url_txt'] = 'URL cron only. Please enter a URL starting with https:// as cron command.'; $wb['command_error_empty'] = 'Command is empty.'; diff --git a/interface/web/sites/templates/cron_edit.htm b/interface/web/sites/templates/cron_edit.htm index 66619831c4..2053f17104 100644 --- a/interface/web/sites/templates/cron_edit.htm +++ b/interface/web/sites/templates/cron_edit.htm @@ -51,8 +51,11 @@
- {tmpl_var name='variables_txt'}: {SITE_PHP}, {DOCROOT_CLIENT}, {DOMAIN} - + {tmpl_var name='variables_txt'}: + {SITE_PHP}, + {DOCROOT_CLIENT}, + {DOMAIN} +

{tmpl_var name='command_hint_txt'}

-- GitLab From cb23b7349cceec5c4ae06f5bac2f29aa1d88111a Mon Sep 17 00:00:00 2001 From: Michael Seevogel Date: Sun, 21 Jan 2024 16:51:28 +0100 Subject: [PATCH 07/29] Update the placeholders when changing domains However, detection of cron_type needs some work --- interface/web/sites/ajax_get_json.php | 32 ++++++++++++++++++++- interface/web/sites/cron_edit.php | 20 ++++++------- interface/web/sites/lib/lang/de_cron.lng | 2 +- interface/web/sites/templates/cron_edit.htm | 27 +++++++++++++++-- 4 files changed, 66 insertions(+), 15 deletions(-) diff --git a/interface/web/sites/ajax_get_json.php b/interface/web/sites/ajax_get_json.php index f1d8433c8a..a5fef0edb0 100644 --- a/interface/web/sites/ajax_get_json.php +++ b/interface/web/sites/ajax_get_json.php @@ -41,6 +41,7 @@ $web_id = $app->functions->intval($_GET["web_id"]); $php_type = $_GET["php_type"]; $client_group_id = $app->functions->intval($_GET['client_group_id']); $type = $_GET["type"]; +$cron_type = $_GET["cron_type"]; //if($_SESSION["s"]["user"]["typ"] == 'admin') { @@ -248,7 +249,36 @@ if($type == 'getclientssldata'){ $json = $app->functions->json_encode($client); } -//} +if($type == 'getcronplaceholders') { + + $web = $app->db->queryOneRecord("SELECT `domain`, `document_root`, `php_cli_binary` + FROM `web_domain` + LEFT JOIN server_php ON web_domain.server_php_id = server_php.server_php_id + WHERE `domain_id` = ? AND ".$app->tform->getAuthSQL('r'), $web_id); + + + + if($cron_type != 'chrooted') { + $web_docroot_client = $web['document_root']; + } else { + $web_docroot_client = ''; + } + + if(empty($web['php_cli_binary'])) { + $web['php_cli_binary'] = "/usr/bin/php"; + } + + $web_docroot_client .= '/web'; + + $json = json_encode(array( + 'php_cli_binary' => $web['php_cli_binary'], + 'docroot_client' => $web_docroot_client, + 'domain' => $web['domain'] + )); + + + +} header('Content-type: application/json'); echo $json; diff --git a/interface/web/sites/cron_edit.php b/interface/web/sites/cron_edit.php index 7a3e8a1461..bf67ae5748 100644 --- a/interface/web/sites/cron_edit.php +++ b/interface/web/sites/cron_edit.php @@ -79,21 +79,20 @@ class page_action extends tform_actions { } $parent_domain = $app->db->queryOneRecord("SELECT `domain_id`, `system_user`, `system_group`, `domain`, `document_root`, `hd_quota`, `php_cli_binary` - FROM `web_domain` - LEFT JOIN server_php ON web_domain.server_php_id = server_php.server_php_id - WHERE `domain_id` = ?", $this->dataRecord["parent_domain_id"]); + FROM `web_domain` + LEFT JOIN server_php ON web_domain.server_php_id = server_php.server_php_id + WHERE `domain_id` = ?", $this->dataRecord["parent_domain_id"]); - if(!$parent_domain["domain_id"]) { - $app->log("Parent domain not found", LOGLEVEL_WARN); - return 0; - } - - $web_docroot_client = ''; if($this->dataRecord['type'] != 'chrooted') { - $web_docroot_client = $this->parent_domain['document_root']; + $web_docroot_client = $parent_domain['document_root']; + } else { + $web_docroot_client = ''; } + //TODO: Fix cron type detection + $app->tpl->setVar("cron_type", $this->dataRecord['type']); + // web folder is hardcoded to /web: $web_docroot_client .= '/web'; @@ -153,6 +152,7 @@ class page_action extends tform_actions { } } + parent::onSubmit(); } diff --git a/interface/web/sites/lib/lang/de_cron.lng b/interface/web/sites/lib/lang/de_cron.lng index 260744116a..e07a2432fc 100644 --- a/interface/web/sites/lib/lang/de_cron.lng +++ b/interface/web/sites/lib/lang/de_cron.lng @@ -19,7 +19,7 @@ $wb['run_wday_error_format'] = 'Das Format für Wochentage ist nicht korrekt.'; $wb['command_error_format'] = 'Das Format für den Befehl ist nicht korrekt. Beachten Sie, dass bei einem URL Aufruf nur http und https erlaubt ist.'; $wb['unknown_fieldtype_error'] = 'Es wurde ein unbekanntes Feld verwendet.'; $wb['server_id_error_empty'] = 'Die Server-ID ist leer.'; -$wb['command_hint_txt'] = 'z. B. /var/www/clients/clientX/webY/myscript.sh oder https://www.mydomain.com/path/script.php. Der Platzhalter [web_root] wird durch /var/www/clients/clientX/webY/web ersetzt.'; +$wb['command_hint_txt'] = 'z.B. /var/www/clients/clientX/webY/myscript.sh oder https://www.mydomain.com/path/script.php, können Sie die obigen Platzhalter einfügen, die dann durch ihren Wert ersetzt werden. Bewegen Sie den Mauszeiger über die Variable, um den erwarteten Wert zu sehen.'; $wb['log_output_txt'] = 'Ausgabe loggen'; $wb['limit_cron_url_txt'] = 'Es sind nur URL cronjobs möglich. Der Cron-Befehl muss mit https:// beginnen.'; $wb['command_error_empty'] = 'Befehl ist leer.'; diff --git a/interface/web/sites/templates/cron_edit.htm b/interface/web/sites/templates/cron_edit.htm index 2053f17104..34c0ef8360 100644 --- a/interface/web/sites/templates/cron_edit.htm +++ b/interface/web/sites/templates/cron_edit.htm @@ -52,9 +52,9 @@
{tmpl_var name='variables_txt'}: - {SITE_PHP}, - {DOCROOT_CLIENT}, - {DOMAIN} + {SITE_PHP}, + {DOCROOT_CLIENT}, + {DOMAIN}

{tmpl_var name='command_hint_txt'}

@@ -73,8 +73,29 @@ +
+ + + -- GitLab From 3d74e935e438f9dc5a508813eef411c85ece255d Mon Sep 17 00:00:00 2001 From: Michael Seevogel Date: Mon, 22 Jan 2024 13:32:58 +0100 Subject: [PATCH 08/29] Fixed jquery controlled chroot/full placeholders --- interface/web/sites/ajax_get_json.php | 48 ++++++++++++++------- interface/web/sites/cron_edit.php | 15 +++++-- interface/web/sites/lib/lang/ar_cron.lng | 1 + interface/web/sites/lib/lang/bg_cron.lng | 1 + interface/web/sites/lib/lang/br_cron.lng | 1 + interface/web/sites/lib/lang/ca_cron.lng | 1 + interface/web/sites/lib/lang/cn_cron.lng | 1 + interface/web/sites/lib/lang/cz_cron.lng | 1 + interface/web/sites/lib/lang/de_cron.lng | 3 +- interface/web/sites/lib/lang/dk_cron.lng | 2 +- interface/web/sites/lib/lang/el_cron.lng | 2 +- interface/web/sites/lib/lang/en_cron.lng | 2 +- interface/web/sites/lib/lang/es_cron.lng | 2 +- interface/web/sites/lib/lang/fi_cron.lng | 3 +- interface/web/sites/lib/lang/fr_cron.lng | 3 +- interface/web/sites/lib/lang/hr_cron.lng | 3 +- interface/web/sites/lib/lang/hu_cron.lng | 3 +- interface/web/sites/lib/lang/id_cron.lng | 3 +- interface/web/sites/lib/lang/it_cron.lng | 3 +- interface/web/sites/lib/lang/ja_cron.lng | 3 +- interface/web/sites/lib/lang/nl_cron.lng | 2 +- interface/web/sites/lib/lang/pl_cron.lng | 2 +- interface/web/sites/lib/lang/pt_cron.lng | 2 +- interface/web/sites/lib/lang/ro_cron.lng | 2 +- interface/web/sites/lib/lang/ru_cron.lng | 2 +- interface/web/sites/lib/lang/se_cron.lng | 2 +- interface/web/sites/lib/lang/sk_cron.lng | 2 +- interface/web/sites/lib/lang/tr_cron.lng | 2 +- interface/web/sites/templates/cron_edit.htm | 7 +-- 29 files changed, 79 insertions(+), 45 deletions(-) diff --git a/interface/web/sites/ajax_get_json.php b/interface/web/sites/ajax_get_json.php index a5fef0edb0..413f1cde55 100644 --- a/interface/web/sites/ajax_get_json.php +++ b/interface/web/sites/ajax_get_json.php @@ -251,33 +251,49 @@ if($type == 'getclientssldata'){ if($type == 'getcronplaceholders') { - $web = $app->db->queryOneRecord("SELECT `domain`, `document_root`, `php_cli_binary` - FROM `web_domain` - LEFT JOIN server_php ON web_domain.server_php_id = server_php.server_php_id - WHERE `domain_id` = ? AND ".$app->tform->getAuthSQL('r'), $web_id); + $web_docroot_client = ''; + if($web_id > 0) { + $web = $app->db->queryOneRecord("SELECT wd.sys_groupid, wd.domain, wd.document_root, sp.php_cli_binary + FROM web_domain wd + LEFT JOIN server_php sp ON wd.server_php_id = sp.server_php_id + WHERE wd.domain_id = ? AND ".$app->tform->getAuthSQL('r'), $web_id); + $php_cli_binary = $web['php_cli_binary']; - if($cron_type != 'chrooted') { - $web_docroot_client = $web['document_root']; - } else { - $web_docroot_client = ''; - } + $domain = $web['domain']; - if(empty($web['php_cli_binary'])) { - $web['php_cli_binary'] = "/usr/bin/php"; + $domain_owner = $app->db->queryOneRecord("SELECT limit_cron_type FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ?", $web["sys_groupid"]); + + //* True when the site is assigned to a client + if(isset($domain_owner["limit_cron_type"])) { + if($domain_owner["limit_cron_type"] == 'full') { + $cron_type = 'full'; + } else { + $cron_type = 'chrooted'; + } + } else { + //* True when the site is assigned to the admin + $cron_type = 'full'; + } + + if($cron_type != 'chrooted') { + $web_docroot_client = $web['document_root']; + } } $web_docroot_client .= '/web'; + if(empty($web['php_cli_binary'])) { + $php_cli_binary = "/usr/bin/php"; + } + $json = json_encode(array( - 'php_cli_binary' => $web['php_cli_binary'], + 'php_cli_binary' => $php_cli_binary, 'docroot_client' => $web_docroot_client, - 'domain' => $web['domain'] + //'cron_type' => $cron_type, + 'domain' => $domain )); - - - } header('Content-type: application/json'); diff --git a/interface/web/sites/cron_edit.php b/interface/web/sites/cron_edit.php index bf67ae5748..ebe2c97a32 100644 --- a/interface/web/sites/cron_edit.php +++ b/interface/web/sites/cron_edit.php @@ -83,6 +83,8 @@ class page_action extends tform_actions { LEFT JOIN server_php ON web_domain.server_php_id = server_php.server_php_id WHERE `domain_id` = ?", $this->dataRecord["parent_domain_id"]); + $php_cli_binary = $parent_domain['php_cli_binary']; + $domain = $parent_domain['domain']; if($this->dataRecord['type'] != 'chrooted') { $web_docroot_client = $parent_domain['document_root']; @@ -90,16 +92,21 @@ class page_action extends tform_actions { $web_docroot_client = ''; } - //TODO: Fix cron type detection - $app->tpl->setVar("cron_type", $this->dataRecord['type']); + if(empty($parent_domain['php_cli_binary'])) { + $php_cli_binary = "/usr/bin/php"; + } + + if(empty($parent_domain['domain'])) { + $domain = $app->tform->wordbook["domain_not_selected_placeholder_txt"]; + } // web folder is hardcoded to /web: $web_docroot_client .= '/web'; // Example values for placeholders. - $app->tpl->setVar("php_cli_binary", $parent_domain['php_cli_binary']); + $app->tpl->setVar("php_cli_binary", $php_cli_binary); $app->tpl->setVar("docroot_client", $web_docroot_client); - $app->tpl->setVar("domain", $parent_domain['domain']); + $app->tpl->setVar("domain", $domain); parent::onShowEnd(); } diff --git a/interface/web/sites/lib/lang/ar_cron.lng b/interface/web/sites/lib/lang/ar_cron.lng index 5cdf5ee15f..74911e8d03 100644 --- a/interface/web/sites/lib/lang/ar_cron.lng +++ b/interface/web/sites/lib/lang/ar_cron.lng @@ -23,4 +23,5 @@ $wb['limit_cron_url_txt'] = 'URL cron only. Please enter a URL starting with htt $wb['command_error_empty'] = 'Command is empty.'; $wb['command_hint_txt'] = 'e.g. /var/www/clients/clientX/webY/myscript.sh or https://www.mydomain.com/path/script.php, you can use [web_root] placeholder that is replaced by /var/www/clients/clientX/webY/web.'; $wb['log_output_txt'] = 'Log output'; +$wb['domain_not_selected_placeholder_txt'] = 'No Domain selected'; ?> diff --git a/interface/web/sites/lib/lang/bg_cron.lng b/interface/web/sites/lib/lang/bg_cron.lng index 2ab58ec6d2..fedfb73393 100644 --- a/interface/web/sites/lib/lang/bg_cron.lng +++ b/interface/web/sites/lib/lang/bg_cron.lng @@ -23,4 +23,5 @@ $wb['limit_cron_url_txt'] = 'URL cron only. Please enter a URL starting with htt $wb['command_error_empty'] = 'Command is empty.'; $wb['command_hint_txt'] = 'e.g. /var/www/clients/clientX/webY/myscript.sh or https://www.mydomain.com/path/script.php, you can use [web_root] placeholder that is replaced by /var/www/clients/clientX/webY/web.'; $wb['log_output_txt'] = 'Log output'; +$wb['domain_not_selected_placeholder_txt'] = 'No Domain selected'; ?> diff --git a/interface/web/sites/lib/lang/br_cron.lng b/interface/web/sites/lib/lang/br_cron.lng index 19aa1e96dc..263b3177aa 100644 --- a/interface/web/sites/lib/lang/br_cron.lng +++ b/interface/web/sites/lib/lang/br_cron.lng @@ -24,3 +24,4 @@ $wb['log_output_txt'] = 'Gravar saída do log'; $wb['limit_cron_url_txt'] = 'Somente URL no Cron. Por favor insira uma URL iniciando com https:// como um comando no Cron.'; $wb['command_error_empty'] = 'Comando a executar está vazio.'; $wb['Cron Job'] = 'Tarefas no Cron'; +$wb['domain_not_selected_placeholder_txt'] = 'No Domain selected'; diff --git a/interface/web/sites/lib/lang/ca_cron.lng b/interface/web/sites/lib/lang/ca_cron.lng index 4124abd16a..420c3390a2 100644 --- a/interface/web/sites/lib/lang/ca_cron.lng +++ b/interface/web/sites/lib/lang/ca_cron.lng @@ -23,4 +23,5 @@ $wb['limit_cron_url_txt'] = 'Cron de type URL seulement. Merci d\'introduire une $wb['command_error_empty'] = 'Le champ Commande à exécuter est vide.'; $wb['command_hint_txt'] = 'par exemple /var/www/clients/clientX/webY/monscript.sh ou https://www.mondomaine.com/chemin/script.php, vous pouvez utiliser la constante [web_root] qui sera remplacée par /var/www/clients/clientX/webY/web.'; $wb['log_output_txt'] = 'Journaliser la sortie du cron'; +$wb['domain_not_selected_placeholder_txt'] = 'No Domain selected'; ?> diff --git a/interface/web/sites/lib/lang/cn_cron.lng b/interface/web/sites/lib/lang/cn_cron.lng index 5b517d762e..65385864c3 100644 --- a/interface/web/sites/lib/lang/cn_cron.lng +++ b/interface/web/sites/lib/lang/cn_cron.lng @@ -23,4 +23,5 @@ $wb['command_hint_txt'] = '例如,/var/www/clients/clientX/webY/myscript.sh $wb['log_output_txt'] = '记录输出'; $wb['limit_cron_url_txt'] = '仅限 URL 计划任务。请将以 https:// 开头的 URL 作为计划任务命令输入。'; $wb['command_error_empty'] = '命令为空。'; +$wb['domain_not_selected_placeholder_txt'] = 'No Domain selected'; ?> diff --git a/interface/web/sites/lib/lang/cz_cron.lng b/interface/web/sites/lib/lang/cz_cron.lng index 8588408041..b98a4cbe2a 100644 --- a/interface/web/sites/lib/lang/cz_cron.lng +++ b/interface/web/sites/lib/lang/cz_cron.lng @@ -23,3 +23,4 @@ $wb['limit_cron_url_txt'] = 'URL cron only. Please enter a URL starting with htt $wb['command_error_empty'] = 'Command is empty.'; $wb['command_hint_txt'] = 'e.g. /var/www/clients/clientX/webY/myscript.sh or http://www.mydomain.com/path/script.php, you can use [web_root] placeholder that is replaced by /var/www/clients/clientX/webY/web.'; $wb['log_output_txt'] = 'Log output'; +$wb['domain_not_selected_placeholder_txt'] = 'No Domain selected'; diff --git a/interface/web/sites/lib/lang/de_cron.lng b/interface/web/sites/lib/lang/de_cron.lng index e07a2432fc..81f1f61e7d 100644 --- a/interface/web/sites/lib/lang/de_cron.lng +++ b/interface/web/sites/lib/lang/de_cron.lng @@ -24,4 +24,5 @@ $wb['log_output_txt'] = 'Ausgabe loggen'; $wb['limit_cron_url_txt'] = 'Es sind nur URL cronjobs möglich. Der Cron-Befehl muss mit https:// beginnen.'; $wb['command_error_empty'] = 'Befehl ist leer.'; $wb['variables_txt'] = 'Variablen'; -?> +$wb['domain_not_selected_placeholder_txt'] = 'Bitte wähle eine Domain aus'; + diff --git a/interface/web/sites/lib/lang/dk_cron.lng b/interface/web/sites/lib/lang/dk_cron.lng index ac290d4076..8b27dae089 100644 --- a/interface/web/sites/lib/lang/dk_cron.lng +++ b/interface/web/sites/lib/lang/dk_cron.lng @@ -23,4 +23,4 @@ $wb['limit_cron_url_txt'] = 'URL cron only. Please enter a URL starting with htt $wb['command_error_empty'] = 'Command er tom.'; $wb['command_hint_txt'] = 'e.g. /var/www/clients/clientX/webY/myscript.sh or https://www.mydomain.com/path/script.php, you can use [web_root] placeholder that is replaced by /var/www/clients/clientX/webY/web.'; $wb['log_output_txt'] = 'Log output'; -?> +$wb['domain_not_selected_placeholder_txt'] = 'No Domain selected'; diff --git a/interface/web/sites/lib/lang/el_cron.lng b/interface/web/sites/lib/lang/el_cron.lng index 9efec9d5ff..c014de779a 100644 --- a/interface/web/sites/lib/lang/el_cron.lng +++ b/interface/web/sites/lib/lang/el_cron.lng @@ -23,4 +23,4 @@ $wb['limit_cron_url_txt'] = 'URL cron only. Please enter a URL starting with htt $wb['command_error_empty'] = 'Command is empty.'; $wb['command_hint_txt'] = 'e.g. /var/www/clients/clientX/webY/myscript.sh or https://www.mydomain.com/path/script.php, you can use [web_root] placeholder that is replaced by /var/www/clients/clientX/webY/web.'; $wb['log_output_txt'] = 'Log output'; -?> +$wb['domain_not_selected_placeholder_txt'] = 'No Domain selected'; diff --git a/interface/web/sites/lib/lang/en_cron.lng b/interface/web/sites/lib/lang/en_cron.lng index ca98207ff5..2634a1c9c4 100644 --- a/interface/web/sites/lib/lang/en_cron.lng +++ b/interface/web/sites/lib/lang/en_cron.lng @@ -24,4 +24,4 @@ $wb['log_output_txt'] = 'Log output'; $wb['limit_cron_url_txt'] = 'URL cron only. Please enter a URL starting with https:// as cron command.'; $wb['command_error_empty'] = 'Command is empty.'; $wb['variables_txt'] = 'Variables'; -?> +$wb['domain_not_selected_placeholder_txt'] = 'No Domain selected'; diff --git a/interface/web/sites/lib/lang/es_cron.lng b/interface/web/sites/lib/lang/es_cron.lng index c8e2d567b4..2a53c6f64a 100644 --- a/interface/web/sites/lib/lang/es_cron.lng +++ b/interface/web/sites/lib/lang/es_cron.lng @@ -23,4 +23,4 @@ $wb['run_wday_txt'] = 'Días de la semana'; $wb['server_id_error_empty'] = 'La ID del servidor está vacía.'; $wb['server_id_txt'] = 'Servidor'; $wb['unknown_fieldtype_error'] = 'Se ha usado un tipo de campo desconocido.'; -?> +$wb['domain_not_selected_placeholder_txt'] = 'No Domain selected'; diff --git a/interface/web/sites/lib/lang/fi_cron.lng b/interface/web/sites/lib/lang/fi_cron.lng index cb019571b4..2b34c6c755 100644 --- a/interface/web/sites/lib/lang/fi_cron.lng +++ b/interface/web/sites/lib/lang/fi_cron.lng @@ -23,4 +23,5 @@ $wb['limit_cron_url_txt'] = 'URL cron only. Please enter a URL starting with htt $wb['command_error_empty'] = 'Command is empty.'; $wb['command_hint_txt'] = 'e.g. /var/www/clients/clientX/webY/myscript.sh or https://www.mydomain.com/path/script.php, you can use [web_root] placeholder that is replaced by /var/www/clients/clientX/webY/web.'; $wb['log_output_txt'] = 'Log output'; -?> +$wb['domain_not_selected_placeholder_txt'] = 'No Domain selected'; + diff --git a/interface/web/sites/lib/lang/fr_cron.lng b/interface/web/sites/lib/lang/fr_cron.lng index 4124abd16a..c05a02cc96 100644 --- a/interface/web/sites/lib/lang/fr_cron.lng +++ b/interface/web/sites/lib/lang/fr_cron.lng @@ -23,4 +23,5 @@ $wb['limit_cron_url_txt'] = 'Cron de type URL seulement. Merci d\'introduire une $wb['command_error_empty'] = 'Le champ Commande à exécuter est vide.'; $wb['command_hint_txt'] = 'par exemple /var/www/clients/clientX/webY/monscript.sh ou https://www.mondomaine.com/chemin/script.php, vous pouvez utiliser la constante [web_root] qui sera remplacée par /var/www/clients/clientX/webY/web.'; $wb['log_output_txt'] = 'Journaliser la sortie du cron'; -?> +$wb['domain_not_selected_placeholder_txt'] = 'No Domain selected'; + diff --git a/interface/web/sites/lib/lang/hr_cron.lng b/interface/web/sites/lib/lang/hr_cron.lng index 6ae8d6d3b8..a1ae73ae42 100644 --- a/interface/web/sites/lib/lang/hr_cron.lng +++ b/interface/web/sites/lib/lang/hr_cron.lng @@ -23,4 +23,5 @@ $wb['limit_cron_url_txt'] = 'Samo za URL cron. Unesite URL koji počinje sa http $wb['command_error_empty'] = 'Naredba je prazna.'; $wb['command_hint_txt'] = 'e.g. /var/www/clients/clientX/webY/myscript.sh or https://www.mydomain.com/path/script.php, you can use [web_root] placeholder that is replaced by /var/www/clients/clientX/webY/web.'; $wb['log_output_txt'] = 'Log output'; -?> +$wb['domain_not_selected_placeholder_txt'] = 'No Domain selected'; + diff --git a/interface/web/sites/lib/lang/hu_cron.lng b/interface/web/sites/lib/lang/hu_cron.lng index 29d3f87be3..4f76cc9fe4 100644 --- a/interface/web/sites/lib/lang/hu_cron.lng +++ b/interface/web/sites/lib/lang/hu_cron.lng @@ -23,4 +23,5 @@ $wb['limit_cron_url_txt'] = 'URL cron only. Please enter a URL starting with htt $wb['command_error_empty'] = 'Command is empty.'; $wb['command_hint_txt'] = 'e.g. /var/www/clients/clientX/webY/myscript.sh or https://www.mydomain.com/path/script.php, you can use [web_root] placeholder that is replaced by /var/www/clients/clientX/webY/web.'; $wb['log_output_txt'] = 'Log output'; -?> +$wb['domain_not_selected_placeholder_txt'] = 'No Domain selected'; + diff --git a/interface/web/sites/lib/lang/id_cron.lng b/interface/web/sites/lib/lang/id_cron.lng index d5e94fae21..113ebd1d20 100644 --- a/interface/web/sites/lib/lang/id_cron.lng +++ b/interface/web/sites/lib/lang/id_cron.lng @@ -23,4 +23,5 @@ $wb['limit_cron_url_txt'] = 'URL cron only. Please enter a URL starting with htt $wb['command_error_empty'] = 'Command is empty.'; $wb['command_hint_txt'] = 'e.g. /var/www/clients/clientX/webY/myscript.sh or https://www.mydomain.com/path/script.php, you can use [web_root] placeholder that is replaced by /var/www/clients/clientX/webY/web.'; $wb['log_output_txt'] = 'Log output'; -?> +$wb['domain_not_selected_placeholder_txt'] = 'No Domain selected'; + diff --git a/interface/web/sites/lib/lang/it_cron.lng b/interface/web/sites/lib/lang/it_cron.lng index ee38450186..5d46d2acbe 100644 --- a/interface/web/sites/lib/lang/it_cron.lng +++ b/interface/web/sites/lib/lang/it_cron.lng @@ -23,4 +23,5 @@ $wb['limit_cron_url_txt'] = 'Solo URL cron. Per cortesia inserire una URL che in $wb['command_error_empty'] = 'Command vuoto.'; $wb['command_hint_txt'] = 'esempio: /var/www/clients/clientX/webY/myscript.sh o https://www.mydomain.com/path/script.php, puoi usare [web_root] come sostitutivo che viene rimpiazzato da /var/www/clients/clientX/webY/web.'; $wb['log_output_txt'] = 'Log output'; -?> +$wb['domain_not_selected_placeholder_txt'] = 'No Domain selected'; + diff --git a/interface/web/sites/lib/lang/ja_cron.lng b/interface/web/sites/lib/lang/ja_cron.lng index 5cdf5ee15f..6dcc300f31 100644 --- a/interface/web/sites/lib/lang/ja_cron.lng +++ b/interface/web/sites/lib/lang/ja_cron.lng @@ -23,4 +23,5 @@ $wb['limit_cron_url_txt'] = 'URL cron only. Please enter a URL starting with htt $wb['command_error_empty'] = 'Command is empty.'; $wb['command_hint_txt'] = 'e.g. /var/www/clients/clientX/webY/myscript.sh or https://www.mydomain.com/path/script.php, you can use [web_root] placeholder that is replaced by /var/www/clients/clientX/webY/web.'; $wb['log_output_txt'] = 'Log output'; -?> +$wb['domain_not_selected_placeholder_txt'] = 'No Domain selected'; + diff --git a/interface/web/sites/lib/lang/nl_cron.lng b/interface/web/sites/lib/lang/nl_cron.lng index c79a3c2a0d..978b12778e 100644 --- a/interface/web/sites/lib/lang/nl_cron.lng +++ b/interface/web/sites/lib/lang/nl_cron.lng @@ -23,4 +23,4 @@ $wb['limit_cron_url_txt'] = 'URL cron only. Please enter a URL starting with htt $wb['command_error_empty'] = 'Command is empty.'; $wb['command_hint_txt'] = 'e.g. /var/www/clients/clientX/webY/myscript.sh or https://www.mydomain.com/path/script.php, you can use [web_root] placeholder that is replaced by /var/www/clients/clientX/webY/web.'; $wb['log_output_txt'] = 'Log output'; -?> +$wb['domain_not_selected_placeholder_txt'] = 'No Domain selected'; diff --git a/interface/web/sites/lib/lang/pl_cron.lng b/interface/web/sites/lib/lang/pl_cron.lng index d5f60d3e34..d82036ac1a 100644 --- a/interface/web/sites/lib/lang/pl_cron.lng +++ b/interface/web/sites/lib/lang/pl_cron.lng @@ -23,4 +23,4 @@ $wb['limit_cron_url_txt'] = 'URL cron only. Please enter a URL starting with htt $wb['command_error_empty'] = 'Command is empty.'; $wb['command_hint_txt'] = 'e.g. /var/www/clients/clientX/webY/myscript.sh or https://www.mydomain.com/path/script.php, you can use [web_root] placeholder that is replaced by /var/www/clients/clientX/webY/web.'; $wb['log_output_txt'] = 'Log output'; -?> +$wb['domain_not_selected_placeholder_txt'] = 'No Domain selected'; diff --git a/interface/web/sites/lib/lang/pt_cron.lng b/interface/web/sites/lib/lang/pt_cron.lng index 618f47fc8b..1edf37c509 100644 --- a/interface/web/sites/lib/lang/pt_cron.lng +++ b/interface/web/sites/lib/lang/pt_cron.lng @@ -23,4 +23,4 @@ $wb['limit_cron_url_txt'] = 'URL cron only. Please enter a URL starting with htt $wb['command_error_empty'] = 'Command is empty.'; $wb['command_hint_txt'] = 'e.g. /var/www/clients/clientX/webY/myscript.sh or https://www.mydomain.com/path/script.php, you can use [web_root] placeholder that is replaced by /var/www/clients/clientX/webY/web.'; $wb['log_output_txt'] = 'Log output'; -?> +$wb['domain_not_selected_placeholder_txt'] = 'No Domain selected'; diff --git a/interface/web/sites/lib/lang/ro_cron.lng b/interface/web/sites/lib/lang/ro_cron.lng index 5cdf5ee15f..6757f7b4fe 100644 --- a/interface/web/sites/lib/lang/ro_cron.lng +++ b/interface/web/sites/lib/lang/ro_cron.lng @@ -23,4 +23,4 @@ $wb['limit_cron_url_txt'] = 'URL cron only. Please enter a URL starting with htt $wb['command_error_empty'] = 'Command is empty.'; $wb['command_hint_txt'] = 'e.g. /var/www/clients/clientX/webY/myscript.sh or https://www.mydomain.com/path/script.php, you can use [web_root] placeholder that is replaced by /var/www/clients/clientX/webY/web.'; $wb['log_output_txt'] = 'Log output'; -?> +$wb['domain_not_selected_placeholder_txt'] = 'No Domain selected'; diff --git a/interface/web/sites/lib/lang/ru_cron.lng b/interface/web/sites/lib/lang/ru_cron.lng index 46a5a7dac8..3c7c2fc1df 100644 --- a/interface/web/sites/lib/lang/ru_cron.lng +++ b/interface/web/sites/lib/lang/ru_cron.lng @@ -23,4 +23,4 @@ $wb['limit_cron_url_txt'] = 'Только URL может быть в задан $wb['command_error_empty'] = 'Команда отсутствует.'; $wb['command_hint_txt'] = 'Например, /var/www/clients/clientX/webY/myscript.sh или https://www.mydomain.com/path/script.php, Вы можете использовать заполнитель [web_root], который заменяется на /var/www/clients/clientX/webY/web.'; $wb['log_output_txt'] = 'Журнал вывода'; -?> +$wb['domain_not_selected_placeholder_txt'] = 'No Domain selected'; diff --git a/interface/web/sites/lib/lang/se_cron.lng b/interface/web/sites/lib/lang/se_cron.lng index de4cb1f9cb..fec186582d 100644 --- a/interface/web/sites/lib/lang/se_cron.lng +++ b/interface/web/sites/lib/lang/se_cron.lng @@ -23,4 +23,4 @@ $wb['limit_cron_url_txt'] = 'URL cron only. Please enter a URL starting with htt $wb['command_error_empty'] = 'Kommandofältet är tomt.'; $wb['command_hint_txt'] = 'e.g. /var/www/clients/clientX/webY/myscript.sh or https://www.mydomain.com/path/script.php, you can use [web_root] placeholder that is replaced by /var/www/clients/clientX/webY/web.'; $wb['log_output_txt'] = 'Log output'; -?> +$wb['domain_not_selected_placeholder_txt'] = 'No Domain selected'; diff --git a/interface/web/sites/lib/lang/sk_cron.lng b/interface/web/sites/lib/lang/sk_cron.lng index f510b7e0ad..f635611113 100644 --- a/interface/web/sites/lib/lang/sk_cron.lng +++ b/interface/web/sites/lib/lang/sk_cron.lng @@ -23,4 +23,4 @@ $wb['limit_cron_url_txt'] = 'URL cron only. Please enter a URL starting with htt $wb['command_error_empty'] = 'Command is empty.'; $wb['command_hint_txt'] = 'e.g. /var/www/clients/clientX/webY/myscript.sh or https://www.mydomain.com/path/script.php, you can use [web_root] placeholder that is replaced by /var/www/clients/clientX/webY/web.'; $wb['log_output_txt'] = 'Log output'; -?> +$wb['domain_not_selected_placeholder_txt'] = 'No Domain selected'; diff --git a/interface/web/sites/lib/lang/tr_cron.lng b/interface/web/sites/lib/lang/tr_cron.lng index 6e97152184..3970c3e1eb 100644 --- a/interface/web/sites/lib/lang/tr_cron.lng +++ b/interface/web/sites/lib/lang/tr_cron.lng @@ -23,4 +23,4 @@ $wb['command_hint_txt'] = 'Örnek: /var/www/clients/musteriX/webY/betigim.sh ya $wb['log_output_txt'] = 'Günlük çıktısı'; $wb['limit_cron_url_txt'] = 'Yalnız İnternet adresli zamanlanmış görev kullanılabilir. Lütfen zamanlanmış görev komutu olarak https:// ile başlayan bir İnternet adresi yazın.'; $wb['command_error_empty'] = 'Komut boş olamaz.'; -?> +$wb['domain_not_selected_placeholder_txt'] = 'No Domain selected'; diff --git a/interface/web/sites/templates/cron_edit.htm b/interface/web/sites/templates/cron_edit.htm index 34c0ef8360..2a8f2b5b22 100644 --- a/interface/web/sites/templates/cron_edit.htm +++ b/interface/web/sites/templates/cron_edit.htm @@ -73,7 +73,6 @@ -
@@ -87,14 +86,12 @@ function reloadCronPlaceholders() { var parentDomainId = jQuery('#parent_domain_id').val() - var cron_type = jQuery('#cron_type').val() - jQuery.getJSON('sites/ajax_get_json.php'+ '?' + Math.round(new Date().getTime()), {web_id: parentDomainId, cron_type: cron_type, 'type': 'getcronplaceholders'}, function(data) { - console.log(data); + jQuery.getJSON('sites/ajax_get_json.php'+ '?' + Math.round(new Date().getTime()), {web_id: parentDomainId, 'type': 'getcronplaceholders'}, function(data) { + //console.log(data); $("#php_cli_binary").attr('data-original-title', data.php_cli_binary); $('#docroot_client').attr('data-original-title', data.docroot_client); $('#domain').attr('data-original-title', data.domain); - }); } -- GitLab From 3315b7dc6e9761b0c42b300ac29dec4087a13cd2 Mon Sep 17 00:00:00 2001 From: Michael Seevogel Date: Mon, 22 Jan 2024 13:35:15 +0100 Subject: [PATCH 09/29] Removed unnecessary GET --- interface/web/sites/ajax_get_json.php | 1 - 1 file changed, 1 deletion(-) diff --git a/interface/web/sites/ajax_get_json.php b/interface/web/sites/ajax_get_json.php index 413f1cde55..4cb6280454 100644 --- a/interface/web/sites/ajax_get_json.php +++ b/interface/web/sites/ajax_get_json.php @@ -41,7 +41,6 @@ $web_id = $app->functions->intval($_GET["web_id"]); $php_type = $_GET["php_type"]; $client_group_id = $app->functions->intval($_GET['client_group_id']); $type = $_GET["type"]; -$cron_type = $_GET["cron_type"]; //if($_SESSION["s"]["user"]["typ"] == 'admin') { -- GitLab From fd9b8930fb1d723ce960703159007020768e62b0 Mon Sep 17 00:00:00 2001 From: Michael Seevogel Date: Mon, 22 Jan 2024 15:17:18 +0100 Subject: [PATCH 10/29] Don't check permissions of the web when a user wants to create a new cronjob --- interface/web/sites/ajax_get_json.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/interface/web/sites/ajax_get_json.php b/interface/web/sites/ajax_get_json.php index 4cb6280454..2783f01f6c 100644 --- a/interface/web/sites/ajax_get_json.php +++ b/interface/web/sites/ajax_get_json.php @@ -253,10 +253,11 @@ if($type == 'getcronplaceholders') { $web_docroot_client = ''; if($web_id > 0) { + $web = $app->db->queryOneRecord("SELECT wd.sys_groupid, wd.domain, wd.document_root, sp.php_cli_binary FROM web_domain wd LEFT JOIN server_php sp ON wd.server_php_id = sp.server_php_id - WHERE wd.domain_id = ? AND ".$app->tform->getAuthSQL('r'), $web_id); + WHERE wd.domain_id = ?", $web_id); $php_cli_binary = $web['php_cli_binary']; -- GitLab From 8d58b8963640ac77eef9b4730c7aacda9406b2dd Mon Sep 17 00:00:00 2001 From: Michael Seevogel Date: Mon, 22 Jan 2024 22:21:10 +0100 Subject: [PATCH 11/29] Select and load placeholder data of the first existing domain --- interface/web/sites/templates/cron_edit.htm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/interface/web/sites/templates/cron_edit.htm b/interface/web/sites/templates/cron_edit.htm index 2a8f2b5b22..fe5b2c27a5 100644 --- a/interface/web/sites/templates/cron_edit.htm +++ b/interface/web/sites/templates/cron_edit.htm @@ -80,6 +80,12 @@
-- GitLab From 4058fa9cf2544a29899bd8947ef4cecb9045cb40 Mon Sep 17 00:00:00 2001 From: Michael Seevogel Date: Sun, 28 Jan 2024 16:50:20 +0100 Subject: [PATCH 13/29] Fix issue #6633 Jailkit update on every cron change Patch by WHO --- 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 5d6638b9e3..667553c219 100644 --- a/server/plugins-available/cron_jailkit_plugin.inc.php +++ b/server/plugins-available/cron_jailkit_plugin.inc.php @@ -240,7 +240,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') { @@ -286,7 +286,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 242f3c94e53570a68cdf0dbc3601bd03eaad1fc7 Mon Sep 17 00:00:00 2001 From: Michael Seevogel Date: Sun, 28 Jan 2024 21:24:16 +0100 Subject: [PATCH 14/29] Update reloadCronPlaceholders() --- interface/web/sites/templates/cron_edit.htm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/interface/web/sites/templates/cron_edit.htm b/interface/web/sites/templates/cron_edit.htm index 7f9f05ae4f..9eef8091d8 100644 --- a/interface/web/sites/templates/cron_edit.htm +++ b/interface/web/sites/templates/cron_edit.htm @@ -95,11 +95,11 @@ //console.log(data); $("#php_cli_binary").attr('data-original-title', data.php_cli_binary); $('#docroot_client').attr('data-original-title', data.docroot_client); - // Load and display a hint to the user that no domain was selected yet. Should only happen if no web_domain has been created or assigned by the user. - if(data.domain == null || data.domain == '') { - $('#domain').attr('data-original-title', "{tmpl_var name='domain_not_selected_placeholder_txt'}"); - } else { + // Update the data-original-title of the {DOMAIN} placeholder or load and display a hint to the user that no domain was selected yet. Should only happen if no web has been created or assigned by or to the user. + if(data.domain) { $('#domain').attr('data-original-title', data.domain); + } else { + $('#domain').attr('data-original-title', "{tmpl_var name='domain_not_selected_placeholder_txt'}"); } }); } -- GitLab From 50266744372e85f82ce694db0ec5058bbf322318 Mon Sep 17 00:00:00 2001 From: Michael Seevogel Date: Thu, 8 Feb 2024 00:17:14 +0100 Subject: [PATCH 15/29] Load tpl in _setup_jailkit_chroot Check prior creating symlinks in SFTP home directory if the symlinks already exists --- server/plugins-available/cron_jailkit_plugin.inc.php | 2 ++ server/plugins-available/shelluser_base_plugin.inc.php | 6 +++--- server/plugins-available/shelluser_jailkit_plugin.inc.php | 4 +++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/server/plugins-available/cron_jailkit_plugin.inc.php b/server/plugins-available/cron_jailkit_plugin.inc.php index 667553c219..b51964a0b7 100644 --- a/server/plugins-available/cron_jailkit_plugin.inc.php +++ b/server/plugins-available/cron_jailkit_plugin.inc.php @@ -242,6 +242,8 @@ class cron_jailkit_plugin { { global $app, $conf; + $app->load('tpl'); + if (isset($this->jailkit_config) && isset($this->jailkit_config['jailkit_hardlinks'])) { if ($this->jailkit_config['jailkit_hardlinks'] == 'yes') { $options = array('hardlink'); diff --git a/server/plugins-available/shelluser_base_plugin.inc.php b/server/plugins-available/shelluser_base_plugin.inc.php index f73414f7d5..a9d4357069 100755 --- a/server/plugins-available/shelluser_base_plugin.inc.php +++ b/server/plugins-available/shelluser_base_plugin.inc.php @@ -174,9 +174,9 @@ class shelluser_base_plugin { } // Create symlinks for conveniance, SFTP user should not land in an empty dir. - symlink('../../web', $homedir.'/web'); - symlink('../../log', $homedir.'/log'); - symlink('../../private', $homedir.'/private'); + if(!is_link($homedir.'/web')) symlink('../../web', $homedir.'/web'); + if(!is_link($homedir.'/log')) symlink('../../log', $homedir.'/log'); + if(!is_link($homedir.'/private')) symlink('../../private', $homedir.'/private'); //* Disable shell user temporarily if we use jailkit if($data['new']['chroot'] == 'jailkit') { diff --git a/server/plugins-available/shelluser_jailkit_plugin.inc.php b/server/plugins-available/shelluser_jailkit_plugin.inc.php index 0f9313eae5..d462e4a693 100755 --- a/server/plugins-available/shelluser_jailkit_plugin.inc.php +++ b/server/plugins-available/shelluser_jailkit_plugin.inc.php @@ -330,6 +330,8 @@ class shelluser_jailkit_plugin { { global $app, $conf; + $app->load('tpl'); + if (isset($this->jailkit_config) && isset($this->jailkit_config['jailkit_hardlinks'])) { if ($this->jailkit_config['jailkit_hardlinks'] == 'yes') { $options = array('hardlink'); @@ -724,7 +726,7 @@ class shelluser_jailkit_plugin { } if($app->system->is_redhat_os() == true) { - $bashrc = $this->web['document_root'] . '/home/' . $this->web['system_user'] . '/.bashrc'; + $bashrc = $this->web['document_root'] . '/etc/bashrc'; } else { $bashrc = $this->web['document_root'] . '/etc/bash.bashrc'; } -- GitLab From 4f6eb2c277e6d06e24ed7b974d3535f911b697b1 Mon Sep 17 00:00:00 2001 From: Michael Seevogel Date: Sun, 11 Feb 2024 00:13:37 +0100 Subject: [PATCH 16/29] Transform the domain placeholder in command_format function --- interface/lib/classes/validate_cron.inc.php | 24 ++++++++++++++++++- interface/web/sites/templates/cron_edit.htm | 8 +++---- server/plugins-available/cron_plugin.inc.php | 11 +++++++-- .../shelluser_jailkit_plugin.inc.php | 1 + 4 files changed, 37 insertions(+), 7 deletions(-) diff --git a/interface/lib/classes/validate_cron.inc.php b/interface/lib/classes/validate_cron.inc.php index 888fdd5cb7..c99f13ef52 100644 --- a/interface/lib/classes/validate_cron.inc.php +++ b/interface/lib/classes/validate_cron.inc.php @@ -45,15 +45,37 @@ class validate_cron { Validator function to check if a given cron command is in correct form (url only). */ function command_format($field_name, $field_value, $validator) { + global $app, $page; + if(preg_match("'^(\w+):\/\/'", $field_value, $matches)) { + if(preg_match("/\{DOMAIN\}/", $field_value)) { + if(isset($app->remoting_lib->primary_id)) { + $domain = $app->remoting_lib->dataRecord; + } else { + $domain = $page->dataRecord; + } + + if($domain['parent_domain_id'] > 0){ + $parent_domain = $app->db->queryOneRecord("SELECT `domain` FROM `web_domain` WHERE `domain_id` = ?", $domain['parent_domain_id']); + } + + $trans = array( + '{DOMAIN}' => $parent_domain['domain'] + ); + + $field_value = strtr($field_value, $trans); + } $parsed = parse_url($field_value); + if($parsed === false) return $this->get_error($validator['errmsg']); if($parsed["scheme"] != "http" && $parsed["scheme"] != "https") return $this->get_error($validator['errmsg']); + if(preg_match("'^([a-z0-9][a-z0-9\-]{0,62}\.)+([A-Za-z0-9\-]{2,63})$'i", $parsed["host"]) == false) return $this->get_error($validator['errmsg']); + - if(preg_match("'^([a-z0-9][a-z0-9_\-]{0,62}\.)+([A-Za-z0-9\-]{2,63})$'i", $parsed["host"]) == false) return $this->get_error($validator['errmsg']); } + if(strpos($field_value, "\n") !== false || strpos($field_value, "\r") !== false || strpos($field_value, chr(0)) !== false) { return $this->get_error($validator['errmsg']); } diff --git a/interface/web/sites/templates/cron_edit.htm b/interface/web/sites/templates/cron_edit.htm index 9eef8091d8..20417849fb 100644 --- a/interface/web/sites/templates/cron_edit.htm +++ b/interface/web/sites/templates/cron_edit.htm @@ -1,7 +1,8 @@
+ -
{tmpl_var name='parent_domain_id'}
@@ -12,6 +13,7 @@
+
@@ -70,8 +72,6 @@ {tmpl_var name='active'}
- -
@@ -85,7 +85,7 @@ jQuery('#parent_domain_id').trigger('change'); }); // Reload cron placeholders if a different domain was selected - jQuery('#parent_domain_id').change(function(){ + jQuery('#parent_domain_id').change(function() { reloadCronPlaceholders(); }); diff --git a/server/plugins-available/cron_plugin.inc.php b/server/plugins-available/cron_plugin.inc.php index b0bc507b5e..c11b4b06af 100644 --- a/server/plugins-available/cron_plugin.inc.php +++ b/server/plugins-available/cron_plugin.inc.php @@ -231,6 +231,7 @@ class cron_plugin { $cron_line = str_replace(" ", "", $job['run_min']) . "\t" . str_replace(" ", "", $job['run_hour']) . "\t" . str_replace(" ", "", $job['run_mday']) . "\t" . str_replace(" ", "", $job['run_month']) . "\t" . str_replace(" ", "", $job['run_wday']); } + $web_domain = $this->parent_domain['domain']; $log_target = ""; $log_wget_target = '/dev/null'; $log_root = ''; @@ -242,8 +243,16 @@ class cron_plugin { $log_wget_target = $log_root . '/cron_wget.log'; } + + $cron_line .= "\t{$this->parent_domain['system_user']}"; //* running as user if($job['type'] == 'url') { + $trans = array( + '{DOMAIN}' => $web_domain + ); + + $job['command'] = strtr($job['command'], $trans); + $cron_line .= "\t{$cron_config['wget']} --no-check-certificate --user-agent='Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0' -q -t 1 -T 7200 -O " . $log_wget_target . " " . escapeshellarg($job['command']) . " " . $log_target; } else { if(strpos($job['command'], "\n") !== false || strpos($job['command'], "\r") !== false || strpos($job['command'], chr(0)) !== false) { @@ -253,8 +262,6 @@ class cron_plugin { $web_docroot_client = ''; - $web_domain = $this->parent_domain['domain']; - // web folder is hardcoded to /web: $web_folder = '/web'; diff --git a/server/plugins-available/shelluser_jailkit_plugin.inc.php b/server/plugins-available/shelluser_jailkit_plugin.inc.php index d462e4a693..05e0315f0a 100755 --- a/server/plugins-available/shelluser_jailkit_plugin.inc.php +++ b/server/plugins-available/shelluser_jailkit_plugin.inc.php @@ -726,6 +726,7 @@ class shelluser_jailkit_plugin { } if($app->system->is_redhat_os() == true) { + //$bashrc = $this->web['document_root'] . '/home/' . $this->web['system_user'] . '/.bashrc'; $bashrc = $this->web['document_root'] . '/etc/bashrc'; } else { $bashrc = $this->web['document_root'] . '/etc/bash.bashrc'; -- GitLab From b78a8eb5bf2811b3e82ce2858f5350c41b431dd6 Mon Sep 17 00:00:00 2001 From: Michael Seevogel Date: Sun, 11 Feb 2024 00:15:52 +0100 Subject: [PATCH 17/29] Revert div --- interface/web/sites/templates/cron_edit.htm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/web/sites/templates/cron_edit.htm b/interface/web/sites/templates/cron_edit.htm index 20417849fb..68bc8669ca 100644 --- a/interface/web/sites/templates/cron_edit.htm +++ b/interface/web/sites/templates/cron_edit.htm @@ -2,7 +2,7 @@ -
{tmpl_var name='parent_domain_id'}
-- GitLab From d2b8a4ea1762d0af35e9b7e343be82fa6bf0cb28 Mon Sep 17 00:00:00 2001 From: Michael Seevogel Date: Mon, 4 Mar 2024 15:53:22 +0100 Subject: [PATCH 18/29] Update of branch: - Use alternatives for jailed shell accounts in Debian/Ubuntu systems instead of an alias - Made the file /etc/bash.bashrc obsolete - command_format updated so that the domain placeholder can be used for wget commands - Introduction of the .bashrc.d directory for shell users so that they can extend their Bash environment more flexibly and easily via resource files - Minor refactoring and other changes --- interface/lib/classes/validate_cron.inc.php | 13 +- interface/web/sites/ajax_get_json.php | 4 +- interface/web/sites/cron_edit.php | 2 +- interface/web/sites/lib/lang/ar_cron.lng | 2 +- interface/web/sites/lib/lang/bg_cron.lng | 2 +- interface/web/sites/lib/lang/br_cron.lng | 2 +- interface/web/sites/lib/lang/ca_cron.lng | 2 +- interface/web/sites/lib/lang/cn_cron.lng | 2 +- interface/web/sites/lib/lang/cz_cron.lng | 2 +- interface/web/sites/lib/lang/dk_cron.lng | 2 +- interface/web/sites/lib/lang/el_cron.lng | 2 +- interface/web/sites/lib/lang/en_cron.lng | 2 +- interface/web/sites/lib/lang/es_cron.lng | 2 +- interface/web/sites/lib/lang/fi_cron.lng | 2 +- interface/web/sites/lib/lang/fr_cron.lng | 2 +- interface/web/sites/lib/lang/hr_cron.lng | 2 +- interface/web/sites/lib/lang/hu_cron.lng | 2 +- interface/web/sites/lib/lang/id_cron.lng | 2 +- interface/web/sites/lib/lang/it_cron.lng | 2 +- interface/web/sites/lib/lang/ja_cron.lng | 2 +- interface/web/sites/lib/lang/nl_cron.lng | 2 +- interface/web/sites/lib/lang/pl_cron.lng | 2 +- interface/web/sites/lib/lang/pt_cron.lng | 2 +- interface/web/sites/lib/lang/ro_cron.lng | 2 +- interface/web/sites/lib/lang/ru_cron.lng | 2 +- interface/web/sites/lib/lang/se_cron.lng | 2 +- interface/web/sites/lib/lang/sk_cron.lng | 2 +- interface/web/sites/lib/lang/tr_cron.lng | 2 +- server/conf/bash.bashrc.master | 9 -- server/conf/bashrc_el.master | 132 ----------------- server/conf/bashrc_user_deb.master | 137 ++++++++++++++++++ server/conf/bashrc_user_generic.master | 35 +++++ server/conf/bashrc_user_redhat.master | 52 +++++++ server/lib/classes/system.inc.php | 21 +++ .../cron_jailkit_plugin.inc.php | 40 +++-- .../shelluser_base_plugin.inc.php | 54 +++++-- .../shelluser_jailkit_plugin.inc.php | 78 ++++++---- 37 files changed, 395 insertions(+), 232 deletions(-) delete mode 100644 server/conf/bashrc_el.master create mode 100644 server/conf/bashrc_user_deb.master create mode 100644 server/conf/bashrc_user_generic.master create mode 100644 server/conf/bashrc_user_redhat.master diff --git a/interface/lib/classes/validate_cron.inc.php b/interface/lib/classes/validate_cron.inc.php index c99f13ef52..be28a87d4c 100644 --- a/interface/lib/classes/validate_cron.inc.php +++ b/interface/lib/classes/validate_cron.inc.php @@ -48,15 +48,17 @@ class validate_cron { global $app, $page; if(preg_match("'^(\w+):\/\/'", $field_value, $matches)) { - if(preg_match("/\{DOMAIN\}/", $field_value)) { + //* Add the {DOMAIN} placeholder to the validation process + if(preg_match("/{DOMAIN}/", $field_value)) { + if(isset($app->remoting_lib->primary_id)) { - $domain = $app->remoting_lib->dataRecord; + $cronjob = $app->remoting_lib->dataRecord; } else { - $domain = $page->dataRecord; + $cronjob = $page->dataRecord; } - if($domain['parent_domain_id'] > 0){ - $parent_domain = $app->db->queryOneRecord("SELECT `domain` FROM `web_domain` WHERE `domain_id` = ?", $domain['parent_domain_id']); + if($cronjob['parent_domain_id'] > 0) { + $parent_domain = $app->db->queryOneRecord("SELECT `domain` FROM `web_domain` WHERE `domain_id` = ?", $cronjob['parent_domain_id']); } $trans = array( @@ -64,6 +66,7 @@ class validate_cron { ); $field_value = strtr($field_value, $trans); + } $parsed = parse_url($field_value); diff --git a/interface/web/sites/ajax_get_json.php b/interface/web/sites/ajax_get_json.php index 6fd7d09185..914371ab73 100644 --- a/interface/web/sites/ajax_get_json.php +++ b/interface/web/sites/ajax_get_json.php @@ -264,7 +264,7 @@ if($type == 'getcronplaceholders') { $domain_owner = $app->db->queryOneRecord("SELECT limit_cron_type FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ?", $web["sys_groupid"]); - //* True when the site is assigned to a client + //* True if the site is assigned to a client if(isset($domain_owner["limit_cron_type"])) { if($domain_owner["limit_cron_type"] == 'full') { $cron_type = 'full'; @@ -272,7 +272,7 @@ if($type == 'getcronplaceholders') { $cron_type = 'chrooted'; } } else { - //* True when the site is assigned to the admin + //* True if the site is assigned to the admin $cron_type = 'full'; } diff --git a/interface/web/sites/cron_edit.php b/interface/web/sites/cron_edit.php index ebe2c97a32..ab3f34d7e0 100644 --- a/interface/web/sites/cron_edit.php +++ b/interface/web/sites/cron_edit.php @@ -80,7 +80,7 @@ class page_action extends tform_actions { $parent_domain = $app->db->queryOneRecord("SELECT `domain_id`, `system_user`, `system_group`, `domain`, `document_root`, `hd_quota`, `php_cli_binary` FROM `web_domain` - LEFT JOIN server_php ON web_domain.server_php_id = server_php.server_php_id + LEFT JOIN server_php ON web_domain.server_php_id = server_php.server_php_id WHERE `domain_id` = ?", $this->dataRecord["parent_domain_id"]); $php_cli_binary = $parent_domain['php_cli_binary']; diff --git a/interface/web/sites/lib/lang/ar_cron.lng b/interface/web/sites/lib/lang/ar_cron.lng index 74911e8d03..fb114d1a5b 100644 --- a/interface/web/sites/lib/lang/ar_cron.lng +++ b/interface/web/sites/lib/lang/ar_cron.lng @@ -23,5 +23,5 @@ $wb['limit_cron_url_txt'] = 'URL cron only. Please enter a URL starting with htt $wb['command_error_empty'] = 'Command is empty.'; $wb['command_hint_txt'] = 'e.g. /var/www/clients/clientX/webY/myscript.sh or https://www.mydomain.com/path/script.php, you can use [web_root] placeholder that is replaced by /var/www/clients/clientX/webY/web.'; $wb['log_output_txt'] = 'Log output'; -$wb['domain_not_selected_placeholder_txt'] = 'No Domain selected'; +$wb['domain_not_selected_placeholder_txt'] = 'No domain selected'; ?> diff --git a/interface/web/sites/lib/lang/bg_cron.lng b/interface/web/sites/lib/lang/bg_cron.lng index fedfb73393..c4877f8972 100644 --- a/interface/web/sites/lib/lang/bg_cron.lng +++ b/interface/web/sites/lib/lang/bg_cron.lng @@ -23,5 +23,5 @@ $wb['limit_cron_url_txt'] = 'URL cron only. Please enter a URL starting with htt $wb['command_error_empty'] = 'Command is empty.'; $wb['command_hint_txt'] = 'e.g. /var/www/clients/clientX/webY/myscript.sh or https://www.mydomain.com/path/script.php, you can use [web_root] placeholder that is replaced by /var/www/clients/clientX/webY/web.'; $wb['log_output_txt'] = 'Log output'; -$wb['domain_not_selected_placeholder_txt'] = 'No Domain selected'; +$wb['domain_not_selected_placeholder_txt'] = 'No domain selected'; ?> diff --git a/interface/web/sites/lib/lang/br_cron.lng b/interface/web/sites/lib/lang/br_cron.lng index 263b3177aa..bf26c58310 100644 --- a/interface/web/sites/lib/lang/br_cron.lng +++ b/interface/web/sites/lib/lang/br_cron.lng @@ -24,4 +24,4 @@ $wb['log_output_txt'] = 'Gravar saída do log'; $wb['limit_cron_url_txt'] = 'Somente URL no Cron. Por favor insira uma URL iniciando com https:// como um comando no Cron.'; $wb['command_error_empty'] = 'Comando a executar está vazio.'; $wb['Cron Job'] = 'Tarefas no Cron'; -$wb['domain_not_selected_placeholder_txt'] = 'No Domain selected'; +$wb['domain_not_selected_placeholder_txt'] = 'No domain selected'; diff --git a/interface/web/sites/lib/lang/ca_cron.lng b/interface/web/sites/lib/lang/ca_cron.lng index 420c3390a2..8d04a71e03 100644 --- a/interface/web/sites/lib/lang/ca_cron.lng +++ b/interface/web/sites/lib/lang/ca_cron.lng @@ -23,5 +23,5 @@ $wb['limit_cron_url_txt'] = 'Cron de type URL seulement. Merci d\'introduire une $wb['command_error_empty'] = 'Le champ Commande à exécuter est vide.'; $wb['command_hint_txt'] = 'par exemple /var/www/clients/clientX/webY/monscript.sh ou https://www.mondomaine.com/chemin/script.php, vous pouvez utiliser la constante [web_root] qui sera remplacée par /var/www/clients/clientX/webY/web.'; $wb['log_output_txt'] = 'Journaliser la sortie du cron'; -$wb['domain_not_selected_placeholder_txt'] = 'No Domain selected'; +$wb['domain_not_selected_placeholder_txt'] = 'No domain selected'; ?> diff --git a/interface/web/sites/lib/lang/cn_cron.lng b/interface/web/sites/lib/lang/cn_cron.lng index 65385864c3..f689a930cf 100644 --- a/interface/web/sites/lib/lang/cn_cron.lng +++ b/interface/web/sites/lib/lang/cn_cron.lng @@ -23,5 +23,5 @@ $wb['command_hint_txt'] = '例如,/var/www/clients/clientX/webY/myscript.sh $wb['log_output_txt'] = '记录输出'; $wb['limit_cron_url_txt'] = '仅限 URL 计划任务。请将以 https:// 开头的 URL 作为计划任务命令输入。'; $wb['command_error_empty'] = '命令为空。'; -$wb['domain_not_selected_placeholder_txt'] = 'No Domain selected'; +$wb['domain_not_selected_placeholder_txt'] = 'No domain selected'; ?> diff --git a/interface/web/sites/lib/lang/cz_cron.lng b/interface/web/sites/lib/lang/cz_cron.lng index b98a4cbe2a..5144015d6f 100644 --- a/interface/web/sites/lib/lang/cz_cron.lng +++ b/interface/web/sites/lib/lang/cz_cron.lng @@ -23,4 +23,4 @@ $wb['limit_cron_url_txt'] = 'URL cron only. Please enter a URL starting with htt $wb['command_error_empty'] = 'Command is empty.'; $wb['command_hint_txt'] = 'e.g. /var/www/clients/clientX/webY/myscript.sh or http://www.mydomain.com/path/script.php, you can use [web_root] placeholder that is replaced by /var/www/clients/clientX/webY/web.'; $wb['log_output_txt'] = 'Log output'; -$wb['domain_not_selected_placeholder_txt'] = 'No Domain selected'; +$wb['domain_not_selected_placeholder_txt'] = 'No domain selected'; diff --git a/interface/web/sites/lib/lang/dk_cron.lng b/interface/web/sites/lib/lang/dk_cron.lng index 8b27dae089..798cb4ea49 100644 --- a/interface/web/sites/lib/lang/dk_cron.lng +++ b/interface/web/sites/lib/lang/dk_cron.lng @@ -23,4 +23,4 @@ $wb['limit_cron_url_txt'] = 'URL cron only. Please enter a URL starting with htt $wb['command_error_empty'] = 'Command er tom.'; $wb['command_hint_txt'] = 'e.g. /var/www/clients/clientX/webY/myscript.sh or https://www.mydomain.com/path/script.php, you can use [web_root] placeholder that is replaced by /var/www/clients/clientX/webY/web.'; $wb['log_output_txt'] = 'Log output'; -$wb['domain_not_selected_placeholder_txt'] = 'No Domain selected'; +$wb['domain_not_selected_placeholder_txt'] = 'No domain selected'; diff --git a/interface/web/sites/lib/lang/el_cron.lng b/interface/web/sites/lib/lang/el_cron.lng index c014de779a..fe49854430 100644 --- a/interface/web/sites/lib/lang/el_cron.lng +++ b/interface/web/sites/lib/lang/el_cron.lng @@ -23,4 +23,4 @@ $wb['limit_cron_url_txt'] = 'URL cron only. Please enter a URL starting with htt $wb['command_error_empty'] = 'Command is empty.'; $wb['command_hint_txt'] = 'e.g. /var/www/clients/clientX/webY/myscript.sh or https://www.mydomain.com/path/script.php, you can use [web_root] placeholder that is replaced by /var/www/clients/clientX/webY/web.'; $wb['log_output_txt'] = 'Log output'; -$wb['domain_not_selected_placeholder_txt'] = 'No Domain selected'; +$wb['domain_not_selected_placeholder_txt'] = 'No domain selected'; diff --git a/interface/web/sites/lib/lang/en_cron.lng b/interface/web/sites/lib/lang/en_cron.lng index 2634a1c9c4..ecd146deea 100644 --- a/interface/web/sites/lib/lang/en_cron.lng +++ b/interface/web/sites/lib/lang/en_cron.lng @@ -24,4 +24,4 @@ $wb['log_output_txt'] = 'Log output'; $wb['limit_cron_url_txt'] = 'URL cron only. Please enter a URL starting with https:// as cron command.'; $wb['command_error_empty'] = 'Command is empty.'; $wb['variables_txt'] = 'Variables'; -$wb['domain_not_selected_placeholder_txt'] = 'No Domain selected'; +$wb['domain_not_selected_placeholder_txt'] = 'No domain selected'; diff --git a/interface/web/sites/lib/lang/es_cron.lng b/interface/web/sites/lib/lang/es_cron.lng index 2a53c6f64a..ccf7753b68 100644 --- a/interface/web/sites/lib/lang/es_cron.lng +++ b/interface/web/sites/lib/lang/es_cron.lng @@ -23,4 +23,4 @@ $wb['run_wday_txt'] = 'Días de la semana'; $wb['server_id_error_empty'] = 'La ID del servidor está vacía.'; $wb['server_id_txt'] = 'Servidor'; $wb['unknown_fieldtype_error'] = 'Se ha usado un tipo de campo desconocido.'; -$wb['domain_not_selected_placeholder_txt'] = 'No Domain selected'; +$wb['domain_not_selected_placeholder_txt'] = 'No domain selected'; diff --git a/interface/web/sites/lib/lang/fi_cron.lng b/interface/web/sites/lib/lang/fi_cron.lng index 2b34c6c755..b45f2e8849 100644 --- a/interface/web/sites/lib/lang/fi_cron.lng +++ b/interface/web/sites/lib/lang/fi_cron.lng @@ -23,5 +23,5 @@ $wb['limit_cron_url_txt'] = 'URL cron only. Please enter a URL starting with htt $wb['command_error_empty'] = 'Command is empty.'; $wb['command_hint_txt'] = 'e.g. /var/www/clients/clientX/webY/myscript.sh or https://www.mydomain.com/path/script.php, you can use [web_root] placeholder that is replaced by /var/www/clients/clientX/webY/web.'; $wb['log_output_txt'] = 'Log output'; -$wb['domain_not_selected_placeholder_txt'] = 'No Domain selected'; +$wb['domain_not_selected_placeholder_txt'] = 'No domain selected'; diff --git a/interface/web/sites/lib/lang/fr_cron.lng b/interface/web/sites/lib/lang/fr_cron.lng index c05a02cc96..407b246a11 100644 --- a/interface/web/sites/lib/lang/fr_cron.lng +++ b/interface/web/sites/lib/lang/fr_cron.lng @@ -23,5 +23,5 @@ $wb['limit_cron_url_txt'] = 'Cron de type URL seulement. Merci d\'introduire une $wb['command_error_empty'] = 'Le champ Commande à exécuter est vide.'; $wb['command_hint_txt'] = 'par exemple /var/www/clients/clientX/webY/monscript.sh ou https://www.mondomaine.com/chemin/script.php, vous pouvez utiliser la constante [web_root] qui sera remplacée par /var/www/clients/clientX/webY/web.'; $wb['log_output_txt'] = 'Journaliser la sortie du cron'; -$wb['domain_not_selected_placeholder_txt'] = 'No Domain selected'; +$wb['domain_not_selected_placeholder_txt'] = 'No domain selected'; diff --git a/interface/web/sites/lib/lang/hr_cron.lng b/interface/web/sites/lib/lang/hr_cron.lng index a1ae73ae42..a847d94087 100644 --- a/interface/web/sites/lib/lang/hr_cron.lng +++ b/interface/web/sites/lib/lang/hr_cron.lng @@ -23,5 +23,5 @@ $wb['limit_cron_url_txt'] = 'Samo za URL cron. Unesite URL koji počinje sa http $wb['command_error_empty'] = 'Naredba je prazna.'; $wb['command_hint_txt'] = 'e.g. /var/www/clients/clientX/webY/myscript.sh or https://www.mydomain.com/path/script.php, you can use [web_root] placeholder that is replaced by /var/www/clients/clientX/webY/web.'; $wb['log_output_txt'] = 'Log output'; -$wb['domain_not_selected_placeholder_txt'] = 'No Domain selected'; +$wb['domain_not_selected_placeholder_txt'] = 'No domain selected'; diff --git a/interface/web/sites/lib/lang/hu_cron.lng b/interface/web/sites/lib/lang/hu_cron.lng index 4f76cc9fe4..fce63b11f0 100644 --- a/interface/web/sites/lib/lang/hu_cron.lng +++ b/interface/web/sites/lib/lang/hu_cron.lng @@ -23,5 +23,5 @@ $wb['limit_cron_url_txt'] = 'URL cron only. Please enter a URL starting with htt $wb['command_error_empty'] = 'Command is empty.'; $wb['command_hint_txt'] = 'e.g. /var/www/clients/clientX/webY/myscript.sh or https://www.mydomain.com/path/script.php, you can use [web_root] placeholder that is replaced by /var/www/clients/clientX/webY/web.'; $wb['log_output_txt'] = 'Log output'; -$wb['domain_not_selected_placeholder_txt'] = 'No Domain selected'; +$wb['domain_not_selected_placeholder_txt'] = 'No domain selected'; diff --git a/interface/web/sites/lib/lang/id_cron.lng b/interface/web/sites/lib/lang/id_cron.lng index 113ebd1d20..c001dfb28f 100644 --- a/interface/web/sites/lib/lang/id_cron.lng +++ b/interface/web/sites/lib/lang/id_cron.lng @@ -23,5 +23,5 @@ $wb['limit_cron_url_txt'] = 'URL cron only. Please enter a URL starting with htt $wb['command_error_empty'] = 'Command is empty.'; $wb['command_hint_txt'] = 'e.g. /var/www/clients/clientX/webY/myscript.sh or https://www.mydomain.com/path/script.php, you can use [web_root] placeholder that is replaced by /var/www/clients/clientX/webY/web.'; $wb['log_output_txt'] = 'Log output'; -$wb['domain_not_selected_placeholder_txt'] = 'No Domain selected'; +$wb['domain_not_selected_placeholder_txt'] = 'No domain selected'; diff --git a/interface/web/sites/lib/lang/it_cron.lng b/interface/web/sites/lib/lang/it_cron.lng index 5d46d2acbe..7227cab4e6 100644 --- a/interface/web/sites/lib/lang/it_cron.lng +++ b/interface/web/sites/lib/lang/it_cron.lng @@ -23,5 +23,5 @@ $wb['limit_cron_url_txt'] = 'Solo URL cron. Per cortesia inserire una URL che in $wb['command_error_empty'] = 'Command vuoto.'; $wb['command_hint_txt'] = 'esempio: /var/www/clients/clientX/webY/myscript.sh o https://www.mydomain.com/path/script.php, puoi usare [web_root] come sostitutivo che viene rimpiazzato da /var/www/clients/clientX/webY/web.'; $wb['log_output_txt'] = 'Log output'; -$wb['domain_not_selected_placeholder_txt'] = 'No Domain selected'; +$wb['domain_not_selected_placeholder_txt'] = 'No domain selected'; diff --git a/interface/web/sites/lib/lang/ja_cron.lng b/interface/web/sites/lib/lang/ja_cron.lng index 6dcc300f31..cb02ffe8c6 100644 --- a/interface/web/sites/lib/lang/ja_cron.lng +++ b/interface/web/sites/lib/lang/ja_cron.lng @@ -23,5 +23,5 @@ $wb['limit_cron_url_txt'] = 'URL cron only. Please enter a URL starting with htt $wb['command_error_empty'] = 'Command is empty.'; $wb['command_hint_txt'] = 'e.g. /var/www/clients/clientX/webY/myscript.sh or https://www.mydomain.com/path/script.php, you can use [web_root] placeholder that is replaced by /var/www/clients/clientX/webY/web.'; $wb['log_output_txt'] = 'Log output'; -$wb['domain_not_selected_placeholder_txt'] = 'No Domain selected'; +$wb['domain_not_selected_placeholder_txt'] = 'No domain selected'; diff --git a/interface/web/sites/lib/lang/nl_cron.lng b/interface/web/sites/lib/lang/nl_cron.lng index 978b12778e..587cb4d5ce 100644 --- a/interface/web/sites/lib/lang/nl_cron.lng +++ b/interface/web/sites/lib/lang/nl_cron.lng @@ -23,4 +23,4 @@ $wb['limit_cron_url_txt'] = 'URL cron only. Please enter a URL starting with htt $wb['command_error_empty'] = 'Command is empty.'; $wb['command_hint_txt'] = 'e.g. /var/www/clients/clientX/webY/myscript.sh or https://www.mydomain.com/path/script.php, you can use [web_root] placeholder that is replaced by /var/www/clients/clientX/webY/web.'; $wb['log_output_txt'] = 'Log output'; -$wb['domain_not_selected_placeholder_txt'] = 'No Domain selected'; +$wb['domain_not_selected_placeholder_txt'] = 'Geen domein geselecteerd'; diff --git a/interface/web/sites/lib/lang/pl_cron.lng b/interface/web/sites/lib/lang/pl_cron.lng index d82036ac1a..7212a3a213 100644 --- a/interface/web/sites/lib/lang/pl_cron.lng +++ b/interface/web/sites/lib/lang/pl_cron.lng @@ -23,4 +23,4 @@ $wb['limit_cron_url_txt'] = 'URL cron only. Please enter a URL starting with htt $wb['command_error_empty'] = 'Command is empty.'; $wb['command_hint_txt'] = 'e.g. /var/www/clients/clientX/webY/myscript.sh or https://www.mydomain.com/path/script.php, you can use [web_root] placeholder that is replaced by /var/www/clients/clientX/webY/web.'; $wb['log_output_txt'] = 'Log output'; -$wb['domain_not_selected_placeholder_txt'] = 'No Domain selected'; +$wb['domain_not_selected_placeholder_txt'] = 'No domain selected'; diff --git a/interface/web/sites/lib/lang/pt_cron.lng b/interface/web/sites/lib/lang/pt_cron.lng index 1edf37c509..a6b06a5305 100644 --- a/interface/web/sites/lib/lang/pt_cron.lng +++ b/interface/web/sites/lib/lang/pt_cron.lng @@ -23,4 +23,4 @@ $wb['limit_cron_url_txt'] = 'URL cron only. Please enter a URL starting with htt $wb['command_error_empty'] = 'Command is empty.'; $wb['command_hint_txt'] = 'e.g. /var/www/clients/clientX/webY/myscript.sh or https://www.mydomain.com/path/script.php, you can use [web_root] placeholder that is replaced by /var/www/clients/clientX/webY/web.'; $wb['log_output_txt'] = 'Log output'; -$wb['domain_not_selected_placeholder_txt'] = 'No Domain selected'; +$wb['domain_not_selected_placeholder_txt'] = 'No domain selected'; diff --git a/interface/web/sites/lib/lang/ro_cron.lng b/interface/web/sites/lib/lang/ro_cron.lng index 6757f7b4fe..8a8d2aa79f 100644 --- a/interface/web/sites/lib/lang/ro_cron.lng +++ b/interface/web/sites/lib/lang/ro_cron.lng @@ -23,4 +23,4 @@ $wb['limit_cron_url_txt'] = 'URL cron only. Please enter a URL starting with htt $wb['command_error_empty'] = 'Command is empty.'; $wb['command_hint_txt'] = 'e.g. /var/www/clients/clientX/webY/myscript.sh or https://www.mydomain.com/path/script.php, you can use [web_root] placeholder that is replaced by /var/www/clients/clientX/webY/web.'; $wb['log_output_txt'] = 'Log output'; -$wb['domain_not_selected_placeholder_txt'] = 'No Domain selected'; +$wb['domain_not_selected_placeholder_txt'] = 'No domain selected'; diff --git a/interface/web/sites/lib/lang/ru_cron.lng b/interface/web/sites/lib/lang/ru_cron.lng index 3c7c2fc1df..1774ba5c64 100644 --- a/interface/web/sites/lib/lang/ru_cron.lng +++ b/interface/web/sites/lib/lang/ru_cron.lng @@ -23,4 +23,4 @@ $wb['limit_cron_url_txt'] = 'Только URL может быть в задан $wb['command_error_empty'] = 'Команда отсутствует.'; $wb['command_hint_txt'] = 'Например, /var/www/clients/clientX/webY/myscript.sh или https://www.mydomain.com/path/script.php, Вы можете использовать заполнитель [web_root], который заменяется на /var/www/clients/clientX/webY/web.'; $wb['log_output_txt'] = 'Журнал вывода'; -$wb['domain_not_selected_placeholder_txt'] = 'No Domain selected'; +$wb['domain_not_selected_placeholder_txt'] = 'No domain selected'; diff --git a/interface/web/sites/lib/lang/se_cron.lng b/interface/web/sites/lib/lang/se_cron.lng index fec186582d..7ecf078210 100644 --- a/interface/web/sites/lib/lang/se_cron.lng +++ b/interface/web/sites/lib/lang/se_cron.lng @@ -23,4 +23,4 @@ $wb['limit_cron_url_txt'] = 'URL cron only. Please enter a URL starting with htt $wb['command_error_empty'] = 'Kommandofältet är tomt.'; $wb['command_hint_txt'] = 'e.g. /var/www/clients/clientX/webY/myscript.sh or https://www.mydomain.com/path/script.php, you can use [web_root] placeholder that is replaced by /var/www/clients/clientX/webY/web.'; $wb['log_output_txt'] = 'Log output'; -$wb['domain_not_selected_placeholder_txt'] = 'No Domain selected'; +$wb['domain_not_selected_placeholder_txt'] = 'No domain selected'; diff --git a/interface/web/sites/lib/lang/sk_cron.lng b/interface/web/sites/lib/lang/sk_cron.lng index f635611113..7c9341d813 100644 --- a/interface/web/sites/lib/lang/sk_cron.lng +++ b/interface/web/sites/lib/lang/sk_cron.lng @@ -23,4 +23,4 @@ $wb['limit_cron_url_txt'] = 'URL cron only. Please enter a URL starting with htt $wb['command_error_empty'] = 'Command is empty.'; $wb['command_hint_txt'] = 'e.g. /var/www/clients/clientX/webY/myscript.sh or https://www.mydomain.com/path/script.php, you can use [web_root] placeholder that is replaced by /var/www/clients/clientX/webY/web.'; $wb['log_output_txt'] = 'Log output'; -$wb['domain_not_selected_placeholder_txt'] = 'No Domain selected'; +$wb['domain_not_selected_placeholder_txt'] = 'No domain selected'; diff --git a/interface/web/sites/lib/lang/tr_cron.lng b/interface/web/sites/lib/lang/tr_cron.lng index 3970c3e1eb..c41267b922 100644 --- a/interface/web/sites/lib/lang/tr_cron.lng +++ b/interface/web/sites/lib/lang/tr_cron.lng @@ -23,4 +23,4 @@ $wb['command_hint_txt'] = 'Örnek: /var/www/clients/musteriX/webY/betigim.sh ya $wb['log_output_txt'] = 'Günlük çıktısı'; $wb['limit_cron_url_txt'] = 'Yalnız İnternet adresli zamanlanmış görev kullanılabilir. Lütfen zamanlanmış görev komutu olarak https:// ile başlayan bir İnternet adresi yazın.'; $wb['command_error_empty'] = 'Komut boş olamaz.'; -$wb['domain_not_selected_placeholder_txt'] = 'No Domain selected'; +$wb['domain_not_selected_placeholder_txt'] = 'No domain selected'; diff --git a/server/conf/bash.bashrc.master b/server/conf/bash.bashrc.master index 9393bd9b50..b6577569de 100644 --- a/server/conf/bash.bashrc.master +++ b/server/conf/bash.bashrc.master @@ -12,7 +12,6 @@ fi ## Change machine hostname to site domain ## export HOSTNAME= -
@@ -62,11 +61,3 @@ fi #alias la='ls -A' #alias l='ls -CF' - -# Overwrite the PHP cli binaries by using $PATH: -export PATH=:$PATH - - -alias php="" - - diff --git a/server/conf/bashrc_el.master b/server/conf/bashrc_el.master deleted file mode 100644 index 7282b03f5d..0000000000 --- a/server/conf/bashrc_el.master +++ /dev/null @@ -1,132 +0,0 @@ -# /etc/bashrc - -# Taken from EL9 - -# System wide functions and aliases -# Environment stuff goes in /etc/profile - -# It's NOT a good idea to change this file unless you know what you -# are doing. It's much better to create a custom.sh shell script in -# /etc/profile.d/ to make custom changes to your environment, as this -# will prevent the need for merging in future updates. - - - -# Set some more environment variables, they are likely not set in Jailkit setups for EL. -export TERM="xterm" -export LESSOPEN="||/usr/bin/lesspipe.sh %s" - -dircolors -b >/dev/null - - - - -# Prevent doublesourcing -if [ -z "$BASHRCSOURCED" ]; then - BASHRCSOURCED="Y" - - # are we an interactive shell? - if [ "$PS1" ]; then - if [ -z "$PROMPT_COMMAND" ]; then - case $TERM in - xterm*|vte*) - if [ -e /etc/sysconfig/bash-prompt-xterm ]; then - PROMPT_COMMAND=/etc/sysconfig/bash-prompt-xterm - else - PROMPT_COMMAND='printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/\~}"' - fi - ;; - screen*) - if [ -e /etc/sysconfig/bash-prompt-screen ]; then - PROMPT_COMMAND=/etc/sysconfig/bash-prompt-screen - else - PROMPT_COMMAND='printf "\033k%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/\~}"' - fi - ;; - *) - [ -e /etc/sysconfig/bash-prompt-default ] && PROMPT_COMMAND=/etc/sysconfig/bash-prompt-default - ;; - esac - fi - # Turn on parallel history - shopt -s histappend - history -a - # Turn on checkwinsize - shopt -s checkwinsize - [ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ " - # You might want to have e.g. tty in prompt (e.g. more virtual machines) - # and console windows - # If you want to do so, just add e.g. - # if [ "$PS1" ]; then - # PS1="[\u@\h:\l \W]\\$ " - # fi - # to your custom modification shell script in /etc/profile.d/ directory - fi - - if ! shopt -q login_shell ; then # We're not a login shell - # Need to redefine pathmunge, it gets undefined at the end of /etc/profile - pathmunge () { - case ":${PATH}:" in - *:"$1":*) - ;; - *) - if [ "$2" = "after" ] ; then - PATH=$PATH:$1 - else - PATH=$1:$PATH - fi - esac - } - - # Set default umask for non-login shell only if it is set to 0 - [ `umask` -eq 0 ] && umask 022 - - SHELL=/bin/bash - # Only display echos from profile.d scripts if we are no login shell - # and interactive - otherwise just process them to set envvars - for i in /etc/profile.d/*.sh; do - if [ -r "$i" ]; then - if [ "$PS1" ]; then - . "$i" - else - . "$i" >/dev/null - fi - fi - done - - unset i - unset -f pathmunge - fi - -fi - - -## Hack for Jailkit User to change back to the logged in user ## -if [ -n "$LOGNAME" ]; then - if [ "$LOGNAME" != $USER ]; then - export HOME=$LOGNAME - export USER=$LOGNAME - export USERNAME=$LOGNAME - cd $HOME - fi -fi - -## Change machine hostname to site domain ## -export HOSTNAME= - - - - -# Overwrite the PHP cli binaries by using $PATH: -export PATH=:$PATH - - -alias php="" - - -### Hack to source a custom bashrc -#if [ -f ~/.bashrc_ispcuser ]; then -# . ~/.bashrc_ispcuser -#fi - -# vim:ts=4:sw=4 diff --git a/server/conf/bashrc_user_deb.master b/server/conf/bashrc_user_deb.master new file mode 100644 index 0000000000..10b4b94da2 --- /dev/null +++ b/server/conf/bashrc_user_deb.master @@ -0,0 +1,137 @@ +# ~/.bashrc: executed by bash(1) for non-login shells. +# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) +# for examples + +# If not running interactively, don't do anything +case $- in + *i*) ;; + *) return;; +esac + +# don't put duplicate lines or lines starting with space in the history. +# See bash(1) for more options +HISTCONTROL=ignoreboth + +# append to the history file, don't overwrite it +shopt -s histappend + +# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) +HISTSIZE=1000 +HISTFILESIZE=2000 + +# check the window size after each command and, if necessary, +# update the values of LINES and COLUMNS. +shopt -s checkwinsize + +# If set, the pattern "**" used in a pathname expansion context will +# match all files and zero or more directories and subdirectories. +#shopt -s globstar + +# make less more friendly for non-text input files, see lesspipe(1) +#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" + +# set variable identifying the chroot you work in (used in the prompt below) +if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then + debian_chroot=$(cat /etc/debian_chroot) +fi + +# set a fancy prompt (non-color, unless we know we "want" color) +case "$TERM" in + xterm-color|*-256color) color_prompt=yes;; +esac + +# uncomment for a colored prompt, if the terminal has the capability; turned +# off by default to not distract the user: the focus in a terminal window +# should be on the output of commands, not on the prompt +#force_color_prompt=yes + +if [ -n "$force_color_prompt" ]; then + if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then + # We have color support; assume it's compliant with Ecma-48 + # (ISO/IEC-6429). (Lack of such support is extremely rare, and such + # a case would tend to support setf rather than setaf.) + color_prompt=yes + else + color_prompt= + fi +fi + +if [ "$color_prompt" = yes ]; then + PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' +else + PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' +fi +unset color_prompt force_color_prompt + +# If this is an xterm set the title to user@host:dir +case "$TERM" in +xterm*|rxvt*) + PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" + ;; +*) + ;; +esac + +# enable color support of ls and also add handy aliases +if [ -x /usr/bin/dircolors ]; then + test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" + alias ls='ls --color=auto' + #alias dir='dir --color=auto' + #alias vdir='vdir --color=auto' + + #alias grep='grep --color=auto' + #alias fgrep='fgrep --color=auto' + #alias egrep='egrep --color=auto' +fi + +# colored GCC warnings and errors +#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' + +# some more ls aliases +#alias ll='ls -l' +#alias la='ls -A' +#alias l='ls -CF' + + + +# Overwrite the PHP cli binaries by using $PATH: +export PATH=:$PATH + + +alias php="" + + + +# Alias definitions. +# You may want to put all your additions into a separate file like +# ~/.bash_aliases, instead of adding them here directly. +# See /usr/share/doc/bash-doc/examples in the bash-doc package. + +if [ -f ~/.bash_aliases ]; then + . ~/.bash_aliases +fi + +# enable programmable completion features (you don't need to enable +# this, if it's already enabled in /etc/bash.bashrc and /etc/profile +# sources /etc/bash.bashrc). +if ! shopt -oq posix; then + if [ -f /usr/share/bash-completion/bash_completion ]; then + . /usr/share/bash-completion/bash_completion + elif [ -f /etc/bash_completion ]; then + . /etc/bash_completion + fi +fi + + +# Source custom bashrc files +if [ -d ~/.bashrc.d ] +then + for brc in ~/.bashrc.d/* + do + if [ -f "$brc" ]; then + . "$brc" + fi + done +fi + +unset brc diff --git a/server/conf/bashrc_user_generic.master b/server/conf/bashrc_user_generic.master new file mode 100644 index 0000000000..563ebefdb2 --- /dev/null +++ b/server/conf/bashrc_user_generic.master @@ -0,0 +1,35 @@ + +## Hack for Jailkit User to change back to the logged in user ## +if [ -n "$LOGNAME" ]; then + if [ "$LOGNAME" != $USER ]; then + export HOME=$LOGNAME + export USER=$LOGNAME + export USERNAME=$LOGNAME + cd $HOME + fi +fi + +## Change machine hostname to site domain ## +export HOSTNAME= + + + +# Overwrite the PHP cli binaries by using $PATH: +export PATH=:$PATH + + +alias php="" + + +# Source custom bashrc files +if [ -d ~/.bashrc.d ] +then + for brc in ~/.bashrc.d/* + do + if [ -f "$brc" ]; then + . "$brc" + fi + done +fi + +unset brc diff --git a/server/conf/bashrc_user_redhat.master b/server/conf/bashrc_user_redhat.master new file mode 100644 index 0000000000..0d5b7ef607 --- /dev/null +++ b/server/conf/bashrc_user_redhat.master @@ -0,0 +1,52 @@ +# .bashrc + +# Source global definitions +if [ -f /etc/bashrc ]; then + . /etc/bashrc +fi + + +## Hack for Jailkit User to change back to the logged in user ## +if [ -n "$LOGNAME" ]; then + if [ "$LOGNAME" != $USER ]; then + export HOME=$LOGNAME + export USER=$LOGNAME + export USERNAME=$LOGNAME + cd $HOME + fi +fi + +## Change machine hostname to site domain ## +export HOSTNAME= + + + +# Overwrite the PHP cli binaries by using $PATH: +export PATH=:$PATH + + +alias php="" + + +# User specific environment +if ! [[ "$PATH" =~ "$HOME/.local/bin:$HOME/bin:" ]] +then + PATH="$HOME/.local/bin:$HOME/bin:$PATH" +fi +export PATH + +# Uncomment the following line if you don't like systemctl's auto-paging feature: +# export SYSTEMD_PAGER= + +# Source custom bashrc files +if [ -d ~/.bashrc.d ] +then + for brc in ~/.bashrc.d/* + do + if [ -f "$brc" ]; then + . "$brc" + fi + done +fi + +unset brc diff --git a/server/lib/classes/system.inc.php b/server/lib/classes/system.inc.php index 5ba578a023..0947afced7 100644 --- a/server/lib/classes/system.inc.php +++ b/server/lib/classes/system.inc.php @@ -2358,6 +2358,27 @@ class system{ } } + public function get_os_type() { + global $app; + + + $dist = "undetected"; + + if(file_exists('/etc/redhat-release') && (filesize('/etc/redhat-release') > 0)) { + $dist = "redhat"; + } elseif(file_exists('/etc/debian_version') && (filesize('/etc/debian_version') > 0)) { + $dist = "debian"; + } elseif(strstr(trim(file_get_contents('/etc/issue')), 'Ubuntu') || (is_file('/etc/os-release') && stristr(file_get_contents('/etc/os-release'), 'Ubuntu'))) { + $dist = "ubuntu"; + } elseif(file_exists('/etc/SuSE-release') && (filesize('/etc/SuSE-release') > 0)) { + $dist = "suse"; + } elseif(file_exists('/etc/gentoo-release') && (filesize('/etc/gentoo-release') > 0)) { + $dist = "gentoo"; + } + + return $dist; + } + public function is_allowed_path($path) { global $app; diff --git a/server/plugins-available/cron_jailkit_plugin.inc.php b/server/plugins-available/cron_jailkit_plugin.inc.php index b51964a0b7..4b50b561d5 100644 --- a/server/plugins-available/cron_jailkit_plugin.inc.php +++ b/server/plugins-available/cron_jailkit_plugin.inc.php @@ -124,7 +124,7 @@ class cron_jailkit_plugin { $this->_add_jailkit_user(); - $this->_add_bashrc_jailkit(); + $this->_setup_php_jailkit(); $command .= 'usermod -U ? 2>/dev/null'; $app->system->exec_safe($command, $parent_domain["system_user"]); @@ -198,7 +198,7 @@ class cron_jailkit_plugin { $this->_add_jailkit_user(); - $this->_add_bashrc_jailkit(); + $this->_setup_php_jailkit(); $this->_update_website_security_level(); @@ -369,7 +369,7 @@ class cron_jailkit_plugin { } } - function _add_bashrc_jailkit() { + function _setup_php_jailkit() { global $app; // Create .bashrc file @@ -377,15 +377,16 @@ class cron_jailkit_plugin { $tpl = new tpl(); - // /etc/bash.bashrc is not supported by Red Hat OS - if($app->system->is_redhat_os() == true) { - $tpl->newTemplate("bashrc_el.master"); + if($app->system->get_os_type() == "debian" || $app->system->get_os_type() == "ubuntu") { + $tpl->newTemplate("bashrc_user_deb.master"); + } elseif($app->system->get_os_type() == "redhat") { + $tpl->newTemplate("bashrc_user_redhat.master"); } else { - $tpl->newTemplate("bash.bashrc.master"); + $tpl->newTemplate("bashrc_user_generic.master"); } // Predefine some template vars - $tpl->setVar('jailkit_chroot', true); + $tpl->setVar('jailkit_chroot', 'y'); $tpl->setVar('domain', $this->parent_domain['domain']); $tpl->setVar('home_dir', $this->_get_home_dir("")); @@ -394,9 +395,6 @@ class cron_jailkit_plugin { $php_bin_dir = dirname($this->parent_domain['php_cli_binary']); - if(!file_exists($this->_get_home_dir($this->parent_domain['system_user']))) $this->_add_jailkit_user(); - - if(($this->parent_domain['server_php_id'] > 0) && !empty($this->parent_domain['php_cli_binary'])) { if(preg_match('/^(\/usr\/(s)?bin|\/(s)?bin)/', $php_bin_dir)) { $tpl->setVar('use_php_path', false); @@ -412,14 +410,24 @@ class cron_jailkit_plugin { $app->log("The PHP cli binary " . $this->parent_domain['php_cli_binary'] . " is not available in the jail of the web " . $this->parent_domain['domain'] . " / cronjob_id: " . $this->cronjob_id . ". Check your Jailkit setup!", LOGLEVEL_DEBUG); $tpl->setVar('use_php_path', false); $tpl->setVar('use_php_alias', false); + if(is_link($this->parent_domain['document_root'] . '/etc/alternatives/php')) + { + unlink($this->parent_domain['document_root'] . '/etc/alternatives/php'); + } + } else { + if($app->system->get_os_type() == "debian" || $app->system->get_os_type() == "ubuntu") { + if(is_link($this->parent_domain['document_root'] . '/etc/alternatives/php') || is_file($this->parent_domain['document_root'] . '/etc/alternatives/php')) + { + unlink($this->parent_domain['document_root'] . '/etc/alternatives/php'); + symlink($this->parent_domain['php_cli_binary'], $this->parent_domain['document_root'] . '/etc/alternatives/php'); + } else { + symlink($this->parent_domain['php_cli_binary'], $this->parent_domain['document_root'] . '/etc/alternatives/php'); + } + } } } - if($app->system->is_redhat_os() == true) { - $bashrc = $this->parent_domain['document_root'] . '/home/' . $this->parent_domain['system_user'] . '/.bashrc'; - } else { - $bashrc = $this->parent_domain['document_root'] . '/etc/bash.bashrc'; - } + $bashrc = $this->parent_domain['document_root'] . '/home/' .$this->parent_domain['system_user'] . '/.bashrc'; if(@is_file($bashrc) || @is_link($bashrc)) unlink($bashrc); file_put_contents($bashrc, $tpl->grab()); diff --git a/server/plugins-available/shelluser_base_plugin.inc.php b/server/plugins-available/shelluser_base_plugin.inc.php index a9d4357069..5a911d0659 100755 --- a/server/plugins-available/shelluser_base_plugin.inc.php +++ b/server/plugins-available/shelluser_base_plugin.inc.php @@ -81,7 +81,9 @@ class shelluser_base_plugin { //* Check if the resulting path is inside the docroot $web = $app->db->queryOneRecord("SELECT * FROM web_domain LEFT JOIN server_php ON web_domain.server_php_id = server_php.server_php_id WHERE `domain_id` = ?", $data["new"]["parent_domain_id"]); - //$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ?", $data['new']['parent_domain_id']); + + $this->web = $web; + if(substr($data['new']['dir'],0,strlen($web['document_root'])) != $web['document_root']) { $app->log('Directory of the shell user is outside of website docroot.',LOGLEVEL_WARN); return false; @@ -134,9 +136,18 @@ class shelluser_base_plugin { $app->system->chown($homedir,$data['new']['puser'],false); $app->system->chgrp($homedir,$data['new']['pgroup'],false); } + $command = 'useradd -d ? -g ? -o'; // non unique $command .= ' -s ? -u ? ?'; $app->system->exec_safe($command, $homedir, $data['new']['pgroup'], $data['new']['shell'], $uid, $data['new']['username']); + + //* Create .bashrc.d directory + if(!is_dir($homedir.'/.bashrc.d')){ + $app->file->mkdirs($homedir.'/.bashrc.d', '0750'); + $app->system->chown($homedir.'/.bashrc.d', $data['new']['username']); + $app->system->chgrp($homedir.'/.bashrc.d', $data['new']['pgroup']); + } + $app->log("Executed command: ".$command, LOGLEVEL_DEBUG); $app->log("Added shelluser: ".$data['new']['username'], LOGLEVEL_DEBUG); @@ -169,10 +180,15 @@ class shelluser_base_plugin { $app->system->chown($homedir.'/.profile', $data['new']['username']); $app->system->chgrp($homedir.'/.profile', $data['new']['pgroup']); - if($data['new']['chroot'] != "jailkit") { - $this->_add_bashrc_base(); + //* Create .bashrc.d directory + if(!is_dir($homedir.'/.bashrc.d')){ + $app->file->mkdirs($homedir.'/.bashrc.d', '0750'); + $app->system->chown($homedir.'/.bashrc.d', $data['new']['username']); + $app->system->chgrp($homedir.'/.bashrc.d', $data['new']['pgroup']); } + $this->_add_user_bashrc(); + // Create symlinks for conveniance, SFTP user should not land in an empty dir. if(!is_link($homedir.'/web')) symlink('../../web', $homedir.'/web'); if(!is_link($homedir.'/log')) symlink('../../log', $homedir.'/log'); @@ -296,7 +312,7 @@ class shelluser_base_plugin { if(!is_file($data['new']['dir']).'/.bash_history') { $app->system->touch($homedir.'/.bash_history'); $app->system->chmod($homedir.'/.bash_history', 0750); - $app->system->chown($homedir.'/.bash_history', $data['new']['username']); + $app->system->chown($homedir.'/.bash_history', $data['new']['puser']); $app->system->chgrp($homedir.'/.bash_history', $data['new']['pgroup']); } @@ -304,14 +320,19 @@ class shelluser_base_plugin { if(!is_file($data['new']['dir']).'/.profile') { $app->system->touch($homedir.'/.profile'); $app->system->chmod($homedir.'/.profile', 0644); - $app->system->chown($homedir.'/.profile', $data['new']['username']); + $app->system->chown($homedir.'/.profile', $data['new']['puser']); $app->system->chgrp($homedir.'/.profile', $data['new']['pgroup']); } - if($data['new']['chroot'] != "jailkit") { - $this->_add_bashrc_base(); + //* Create .bashrc.d directory + if(!is_dir($homedir.'/.bashrc.d')){ + $app->file->mkdirs($homedir.'/.bashrc.d', '0750'); + $app->system->chown($homedir.'/.bashrc.d', $data['new']['puser']); + $app->system->chgrp($homedir.'/.bashrc.d', $data['new']['pgroup']); } + $this->_add_user_bashrc(); + //* Add webfolder protection again $app->system->web_folder_protection($web['document_root'], true); } else { @@ -549,25 +570,32 @@ class shelluser_base_plugin { } - function _add_bashrc_base() { + function _add_user_bashrc() { global $app; // Create .bashrc file $app->load('tpl'); + $tpl = new tpl(); - $tpl->newTemplate("bash.bashrc.master"); // Predefine some template vars - $tpl->setVar('jailkit_chroot', false); + $tpl->setVar('jailkit_chroot', 'n'); $tpl->setVar('use_php_path', false); $tpl->setVar('use_php_alias', false); + if($app->system->get_os_type() == "debian" || $app->system->get_os_type() == "ubuntu") { + $tpl->newTemplate("bashrc_user_deb.master"); + } elseif($app->system->get_os_type() == "redhat") { + $tpl->newTemplate("bashrc_user_redhat.master"); + } else { + $tpl->newTemplate("bashrc_user_generic.master"); + } + $php_bin_dir = dirname($this->web['php_cli_binary']); if(($this->web['server_php_id'] > 0) && !empty($this->web['php_cli_binary'])) { - if(preg_match('/^(\/usr\/(s)?bin|\/(s)?bin)/', $php_bin_dir)) - { + if(preg_match('/^(\/usr\/(s)?bin|\/(s)?bin)/', $php_bin_dir)) { $tpl->setVar('use_php_path', false); $tpl->setVar('use_php_alias', true); $tpl->setVar('php_alias', $this->web['php_cli_binary']); @@ -586,6 +614,8 @@ class shelluser_base_plugin { if(@is_file($bashrc) || @is_link($bashrc)) unlink($bashrc); file_put_contents($bashrc, $tpl->grab()); + $app->system->chown($bashrc, $this->data['new']['username']); + $app->system->chgrp($bashrc, $this->data['new']['pgroup']); $app->log("Added bashrc script: " . $bashrc, LOGLEVEL_DEBUG); unset($tpl); diff --git a/server/plugins-available/shelluser_jailkit_plugin.inc.php b/server/plugins-available/shelluser_jailkit_plugin.inc.php index 05e0315f0a..8ffe6b1715 100755 --- a/server/plugins-available/shelluser_jailkit_plugin.inc.php +++ b/server/plugins-available/shelluser_jailkit_plugin.inc.php @@ -141,7 +141,7 @@ class shelluser_jailkit_plugin { //* call the ssh-rsa update function $this->_setup_ssh_rsa(); - $this->_add_bashrc_jailkit(); + $this->_setup_php_jailkit(); $app->system->usermod($data['new']['username'], 0, 0, '', '/usr/sbin/jk_chrootsh', '', ''); @@ -236,7 +236,7 @@ class shelluser_jailkit_plugin { $this->_add_jailkit_user(); - $this->_add_bashrc_jailkit(); + $this->_setup_php_jailkit(); //* call the ssh-rsa update function $this->_setup_ssh_rsa(); @@ -345,7 +345,6 @@ class shelluser_jailkit_plugin { } $web = $app->db->queryOneRecord("SELECT domain, last_jailkit_hash FROM web_domain WHERE domain_id = ?", $this->data['new']["parent_domain_id"]); - //$web = $app->db->queryOneRecord("SELECT * FROM web_domain LEFT JOIN server_php ON web_domain.server_php_id = server_php.server_php_id WHERE `domain_id` = ?", $data["new"]["parent_domain_id"]); $last_updated = preg_split('/[\s,]+/', $this->jailkit_config['jailkit_chroot_app_sections'] .' '.$this->jailkit_config['jailkit_chroot_app_programs'] @@ -680,65 +679,84 @@ class shelluser_jailkit_plugin { - function _add_bashrc_jailkit() { + function _setup_php_jailkit() { global $app; + $app->uses('system'); + // Create .bashrc file $app->load('tpl'); $tpl = new tpl(); - - // /etc/bash.bashrc is not supported by Red Hat OS - if($app->system->is_redhat_os() == true) { - $tpl->newTemplate("bashrc_el.master"); - } else { - $tpl->newTemplate("bash.bashrc.master"); - } + $tpl_deb_user_bashrc = new tpl(); // Predefine some template vars - $tpl->setVar('jailkit_chroot', true); + $tpl->setVar('jailkit_chroot', 'y'); $tpl->setVar('domain', $this->web['domain']); $tpl->setVar('home_dir', $this->_get_home_dir("")); - $tpl->setVar('use_php_path', false); $tpl->setVar('use_php_alias', false); - $php_bin_dir = dirname($this->web['php_cli_binary']); + if($app->system->get_os_type() == "debian" || $app->system->get_os_type() == "ubuntu") { + $tpl->newTemplate("bashrc_user_deb.master"); + } elseif($app->system->get_os_type() == "redhat") { + $tpl->newTemplate("bashrc_user_redhat.master"); + } else { + $tpl->newTemplate("bashrc_user_generic.master"); + } + - if(!file_exists($this->_get_home_dir($this->web['system_user']))) $this->_add_jailkit_user(); + $php_bin_dir = dirname($this->web['php_cli_binary']); if(($this->web['server_php_id'] > 0) && !empty($this->web['php_cli_binary'])) { - if(preg_match('/^(\/usr\/(s)?bin|\/(s)?bin)/', $php_bin_dir)) { - $tpl->setVar('use_php_path', false); - $tpl->setVar('use_php_alias', true); - $tpl->setVar('php_alias', $this->web['php_cli_binary']); - } else { - $tpl->setVar('use_php_path', true); - $tpl->setVar('use_php_alias', false); - $tpl->setVar('php_bin_dir', $php_bin_dir); + if($app->system->get_os_type() != "debian" || $app->system->get_os_type() != "ubuntu") { + if(preg_match('/^(\/usr\/(s)?bin|\/(s)?bin)/', $php_bin_dir)) { + $tpl->setVar('use_php_path', false); + $tpl->setVar('use_php_alias', true); + $tpl->setVar('php_alias', $this->web['php_cli_binary']); + } else { + $tpl->setVar('use_php_path', true); + $tpl->setVar('use_php_alias', false); + $tpl->setVar('php_bin_dir', $php_bin_dir); + } } if(!file_exists($this->web['document_root'] . '/' . $this->web['php_cli_binary'])) { - $app->log("The PHP cli binary " . $this->web['php_cli_binary'] . " is not available in the jail of the web " . $this->web['domain'] . " / username: " . $this->username . ". Check your Jailkit setup!", LOGLEVEL_DEBUG); + $app->log("The PHP cli binary " . $this->web['php_cli_binary'] . " is not available in the jail of the web " . $this->web['domain'] . " / SSH/SFTP user: " . $this->username . ". Check your Jailkit setup!", LOGLEVEL_DEBUG); $tpl->setVar('use_php_path', false); $tpl->setVar('use_php_alias', false); + if(is_link($this->web['document_root'] . '/etc/alternatives/php')) + { + unlink($this->web['document_root'] . '/etc/alternatives/php'); + } + } else { + if($app->system->get_os_type() == "debian" || $app->system->get_os_type() == "ubuntu") { + if(is_link($this->web['document_root'] . '/etc/alternatives/php') || is_file($this->web['document_root'] . '/etc/alternatives/php')) + { + unlink($this->web['document_root'] . '/etc/alternatives/php'); + symlink($this->web['php_cli_binary'], $this->web['document_root'] . '/etc/alternatives/php'); + } else { + symlink($this->web['php_cli_binary'], $this->web['document_root'] . '/etc/alternatives/php'); + } + } + } } - if($app->system->is_redhat_os() == true) { - //$bashrc = $this->web['document_root'] . '/home/' . $this->web['system_user'] . '/.bashrc'; - $bashrc = $this->web['document_root'] . '/etc/bashrc'; - } else { - $bashrc = $this->web['document_root'] . '/etc/bash.bashrc'; - } + $bashrc = $this->web['document_root'] . '/home/' . $this->data['new']['username'] . '/.bashrc'; if(@is_file($bashrc) || @is_link($bashrc)) unlink($bashrc); file_put_contents($bashrc, $tpl->grab()); + $app->system->chown($bashrc, $this->data['new']['username']); + $app->system->chgrp($bashrc, $this->data['new']['pgroup']); + $app->log("Added bashrc script: " . $bashrc, LOGLEVEL_DEBUG); unset($tpl); + + } } // end class -- GitLab From 32bbf9a3dba9a2ba1b353dc8112f7bcffe740764 Mon Sep 17 00:00:00 2001 From: Herman van Rink Date: Wed, 6 Mar 2024 15:52:57 +0100 Subject: [PATCH 19/29] Indents --- interface/web/sites/ajax_get_json.php | 6 +++--- interface/web/sites/cron_edit.php | 6 +++--- server/plugins-available/cron_plugin.inc.php | 10 ++++++++-- server/plugins-available/shelluser_base_plugin.inc.php | 8 ++++++-- 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/interface/web/sites/ajax_get_json.php b/interface/web/sites/ajax_get_json.php index 914371ab73..5cbf4729a3 100644 --- a/interface/web/sites/ajax_get_json.php +++ b/interface/web/sites/ajax_get_json.php @@ -255,9 +255,9 @@ if($type == 'getcronplaceholders') { if($web_id > 0) { $web = $app->db->queryOneRecord("SELECT wd.sys_groupid, wd.domain, wd.document_root, sp.php_cli_binary - FROM web_domain wd - LEFT JOIN server_php sp ON wd.server_php_id = sp.server_php_id - WHERE wd.domain_id = ?", $web_id); + FROM web_domain wd + LEFT JOIN server_php sp ON wd.server_php_id = sp.server_php_id + WHERE wd.domain_id = ?", $web_id); $php_cli_binary = $web['php_cli_binary']; $domain = $web['domain']; diff --git a/interface/web/sites/cron_edit.php b/interface/web/sites/cron_edit.php index ab3f34d7e0..34ed6eb32a 100644 --- a/interface/web/sites/cron_edit.php +++ b/interface/web/sites/cron_edit.php @@ -79,9 +79,9 @@ class page_action extends tform_actions { } $parent_domain = $app->db->queryOneRecord("SELECT `domain_id`, `system_user`, `system_group`, `domain`, `document_root`, `hd_quota`, `php_cli_binary` - FROM `web_domain` - LEFT JOIN server_php ON web_domain.server_php_id = server_php.server_php_id - WHERE `domain_id` = ?", $this->dataRecord["parent_domain_id"]); + FROM `web_domain` + LEFT JOIN server_php ON web_domain.server_php_id = server_php.server_php_id + WHERE `domain_id` = ?", $this->dataRecord["parent_domain_id"]); $php_cli_binary = $parent_domain['php_cli_binary']; $domain = $parent_domain['domain']; diff --git a/server/plugins-available/cron_plugin.inc.php b/server/plugins-available/cron_plugin.inc.php index c11b4b06af..c4fb02d9e2 100644 --- a/server/plugins-available/cron_plugin.inc.php +++ b/server/plugins-available/cron_plugin.inc.php @@ -93,7 +93,10 @@ class cron_plugin { } //* get data from web - $parent_domain = $app->db->queryOneRecord("SELECT `domain_id`, `system_user`, `system_group`, `domain`, `document_root`, `hd_quota`, `php_cli_binary` FROM `web_domain` LEFT JOIN server_php ON web_domain.server_php_id = server_php.server_php_id WHERE `domain_id` = ?", $data["new"]["parent_domain_id"]); + $parent_domain = $app->db->queryOneRecord("SELECT `domain_id`, `system_user`, `system_group`, `domain`, `document_root`, `hd_quota`, `php_cli_binary` + FROM `web_domain` + LEFT JOIN server_php ON web_domain.server_php_id = server_php.server_php_id + WHERE `domain_id` = ?", $data["new"]["parent_domain_id"]); if(!$parent_domain["domain_id"]) { $app->log("Parent domain not found", LOGLEVEL_WARN); return 0; @@ -222,7 +225,10 @@ class cron_plugin { $chr_cmd_count = 0; //* read all active cron jobs from database and write them to file - $cron_jobs = $app->db->queryAllRecords("SELECT c.`id`, c.`run_min`, c.`run_hour`, c.`run_mday`, c.`run_month`, c.`run_wday`, c.`command`, c.`type`, c.`log`, `web_domain`.`domain` as `domain` FROM `cron` as c INNER JOIN `web_domain` ON `web_domain`.`domain_id` = c.`parent_domain_id` WHERE c.`parent_domain_id` = ? AND c.`active` = 'y'", $this->parent_domain["domain_id"]); + $cron_jobs = $app->db->queryAllRecords("SELECT c.`id`, c.`run_min`, c.`run_hour`, c.`run_mday`, c.`run_month`, c.`run_wday`, c.`command`, c.`type`, c.`log`, `web_domain`.`domain` as `domain` + FROM `cron` as c + INNER JOIN `web_domain` ON `web_domain`.`domain_id` = c.`parent_domain_id` + WHERE c.`parent_domain_id` = ? AND c.`active` = 'y'", $this->parent_domain["domain_id"]); if($cron_jobs && count($cron_jobs) > 0) { foreach($cron_jobs as $job) { if($job['run_month'] == '@reboot') { diff --git a/server/plugins-available/shelluser_base_plugin.inc.php b/server/plugins-available/shelluser_base_plugin.inc.php index 5a911d0659..c9d0b8b4fd 100755 --- a/server/plugins-available/shelluser_base_plugin.inc.php +++ b/server/plugins-available/shelluser_base_plugin.inc.php @@ -80,7 +80,9 @@ class shelluser_base_plugin { } //* Check if the resulting path is inside the docroot - $web = $app->db->queryOneRecord("SELECT * FROM web_domain LEFT JOIN server_php ON web_domain.server_php_id = server_php.server_php_id WHERE `domain_id` = ?", $data["new"]["parent_domain_id"]); + $web = $app->db->queryOneRecord("SELECT * FROM web_domain + LEFT JOIN server_php ON web_domain.server_php_id = server_php.server_php_id + WHERE `domain_id` = ?", $data["new"]["parent_domain_id"]); $this->web = $web; @@ -223,7 +225,9 @@ class shelluser_base_plugin { } //* Check if the resulting path is inside the docroot - $web = $app->db->queryOneRecord("SELECT * FROM web_domain LEFT JOIN server_php ON web_domain.server_php_id = server_php.server_php_id WHERE `domain_id` = ?", $data["new"]["parent_domain_id"]); + $web = $app->db->queryOneRecord("SELECT * FROM web_domain + LEFT JOIN server_php ON web_domain.server_php_id = server_php.server_php_id + WHERE `domain_id` = ?", $data["new"]["parent_domain_id"]); $this->web = $web; -- GitLab From 1ac5be950d0d923adefb1247981a700b8d06bb16 Mon Sep 17 00:00:00 2001 From: Michael Seevogel Date: Sun, 10 Mar 2024 15:06:35 +0100 Subject: [PATCH 20/29] Source .bashrc from the ~/.profile file --- .../shelluser_base_plugin.inc.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/server/plugins-available/shelluser_base_plugin.inc.php b/server/plugins-available/shelluser_base_plugin.inc.php index c9d0b8b4fd..7e3d3aa9fb 100755 --- a/server/plugins-available/shelluser_base_plugin.inc.php +++ b/server/plugins-available/shelluser_base_plugin.inc.php @@ -181,6 +181,13 @@ class shelluser_base_plugin { $app->system->chmod($homedir.'/.profile', 0644); $app->system->chown($homedir.'/.profile', $data['new']['username']); $app->system->chgrp($homedir.'/.profile', $data['new']['pgroup']); + $profile_content = " +if [ -d ~/.bashrc ] +then + . ~/.bashrc +fi +"; + $app->system->file_put_contents($homedir.'/.profile', $profile_content); //* Create .bashrc.d directory if(!is_dir($homedir.'/.bashrc.d')){ @@ -326,6 +333,13 @@ class shelluser_base_plugin { $app->system->chmod($homedir.'/.profile', 0644); $app->system->chown($homedir.'/.profile', $data['new']['puser']); $app->system->chgrp($homedir.'/.profile', $data['new']['pgroup']); + $profile_content = " +if [ -d ~/.bashrc ] + then + . ~/.bashrc + fi +"; + $app->system->file_put_contents(($data['new']['dir']).'/.profile', $profile_content); } //* Create .bashrc.d directory -- GitLab From c476308e6df2de18d624e8d78b3867ad7217affb Mon Sep 17 00:00:00 2001 From: Michael Seevogel Date: Sun, 10 Mar 2024 16:43:32 +0100 Subject: [PATCH 21/29] Use instead of --- .../shelluser_base_plugin.inc.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/server/plugins-available/shelluser_base_plugin.inc.php b/server/plugins-available/shelluser_base_plugin.inc.php index 7e3d3aa9fb..c23245d1d4 100755 --- a/server/plugins-available/shelluser_base_plugin.inc.php +++ b/server/plugins-available/shelluser_base_plugin.inc.php @@ -181,11 +181,11 @@ class shelluser_base_plugin { $app->system->chmod($homedir.'/.profile', 0644); $app->system->chown($homedir.'/.profile', $data['new']['username']); $app->system->chgrp($homedir.'/.profile', $data['new']['pgroup']); - $profile_content = " -if [ -d ~/.bashrc ] + $profile_content = "if [ -d ~/.bashrc ] then . ~/.bashrc fi + "; $app->system->file_put_contents($homedir.'/.profile', $profile_content); @@ -333,13 +333,13 @@ fi $app->system->chmod($homedir.'/.profile', 0644); $app->system->chown($homedir.'/.profile', $data['new']['puser']); $app->system->chgrp($homedir.'/.profile', $data['new']['pgroup']); - $profile_content = " -if [ -d ~/.bashrc ] - then - . ~/.bashrc - fi + $profile_content = "if [ -d ~/.bashrc ] +then + . ~/.bashrc +fi + "; - $app->system->file_put_contents(($data['new']['dir']).'/.profile', $profile_content); + $app->system->file_put_contents($homedir.'/.profile', $profile_content); } //* Create .bashrc.d directory -- GitLab From 62afa4f34e711562b9ff78aacc939a2811e329da Mon Sep 17 00:00:00 2001 From: Herman van Rink Date: Wed, 13 Mar 2024 16:25:11 +0100 Subject: [PATCH 22/29] Match on files, not dirs --- server/plugins-available/shelluser_base_plugin.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/plugins-available/shelluser_base_plugin.inc.php b/server/plugins-available/shelluser_base_plugin.inc.php index c23245d1d4..953f6aa52d 100755 --- a/server/plugins-available/shelluser_base_plugin.inc.php +++ b/server/plugins-available/shelluser_base_plugin.inc.php @@ -181,7 +181,7 @@ class shelluser_base_plugin { $app->system->chmod($homedir.'/.profile', 0644); $app->system->chown($homedir.'/.profile', $data['new']['username']); $app->system->chgrp($homedir.'/.profile', $data['new']['pgroup']); - $profile_content = "if [ -d ~/.bashrc ] + $profile_content = "if [ -f ~/.bashrc ] then . ~/.bashrc fi @@ -333,7 +333,7 @@ fi $app->system->chmod($homedir.'/.profile', 0644); $app->system->chown($homedir.'/.profile', $data['new']['puser']); $app->system->chgrp($homedir.'/.profile', $data['new']['pgroup']); - $profile_content = "if [ -d ~/.bashrc ] + $profile_content = "if [ -f ~/.bashrc ] then . ~/.bashrc fi -- GitLab From e7cab9758dbf65f7cb17a6061757e0314bd28f28 Mon Sep 17 00:00:00 2001 From: Michael Seevogel Date: Sun, 31 Mar 2024 15:31:59 +0200 Subject: [PATCH 23/29] Use the more appropriate is_array instead of !empty --- interface/web/sites/web_vhost_domain_edit.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/interface/web/sites/web_vhost_domain_edit.php b/interface/web/sites/web_vhost_domain_edit.php index 0734e2d1b6..ca8550f0fa 100644 --- a/interface/web/sites/web_vhost_domain_edit.php +++ b/interface/web/sites/web_vhost_domain_edit.php @@ -1451,11 +1451,11 @@ class page_action extends tform_actions { if(isset($this->dataRecord['folder_directive_snippets'])) $app->db->query("UPDATE web_domain SET folder_directive_snippets = ? WHERE domain_id = ?", $this->dataRecord['folder_directive_snippets'], $this->id); - // Trigger an update of the website's cronjobs when the PHP version is changed + // Triggers an update of the website's cronjobs and shell users when the PHP version is changed if(isset($this->dataRecord['server_php_id']) && $this->oldDataRecord['server_php_id'] != $this->dataRecord['server_php_id']) { $cronjob_list = $app->db->queryAllRecords("SELECT * FROM cron WHERE parent_domain_id = ? and active = 'y'", $this->dataRecord['id']); - if(!empty($cronjob_list)) { - foreach ($cronjob_list as $cronjob) { + if(is_array($cronjob_list)) { + foreach($cronjob_list as $cronjob) { // Only update cronjobs with placeholders if(preg_match("/([\{][a-zA-Z_\-0-9]+[\}]|[\[][a-zA-Z_\-0-9]+[\]])/", $cronjob['command'])) { $app->db->datalogUpdate('cron', $cronjob, 'id', $cronjob['id'], true); @@ -1463,8 +1463,8 @@ class page_action extends tform_actions { } } $shelluser_list = $app->db->queryAllRecords("SELECT * FROM shell_user WHERE parent_domain_id = ? and active = 'y'", $this->dataRecord['id']); - if(!empty($shelluser_list)) { - foreach ($shelluser_list as $shelluser) { + if(is_array($shelluser_list)) { + foreach($shelluser_list as $shelluser) { $app->db->datalogUpdate('shell_user', $shelluser, 'shell_user_id', $shelluser['shell_user_id'], true); } } -- GitLab From f1627daf45efbd59803cde9d5055dcb765c9c3ae Mon Sep 17 00:00:00 2001 From: Herman van Rink Date: Wed, 3 Apr 2024 15:54:28 +0200 Subject: [PATCH 24/29] Make sure we have a clean $options for each iteration --- server/lib/classes/cron.d/600-jailkit_maintenance.inc.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/server/lib/classes/cron.d/600-jailkit_maintenance.inc.php b/server/lib/classes/cron.d/600-jailkit_maintenance.inc.php index e38ee58210..345026eeee 100644 --- a/server/lib/classes/cron.d/600-jailkit_maintenance.inc.php +++ b/server/lib/classes/cron.d/600-jailkit_maintenance.inc.php @@ -42,12 +42,12 @@ class cronjob_jailkit_maintenance extends cronjob { $jailkit_config = $app->getconf->get_server_config($conf['server_id'], 'jailkit'); if (isset($this->jailkit_config) && isset($this->jailkit_config['jailkit_hardlinks'])) { if ($this->jailkit_config['jailkit_hardlinks'] == 'yes') { - $options = array('hardlink'); + $global_options = array('hardlink'); } elseif ($this->jailkit_config['jailkit_hardlinks'] == 'no') { - $options = array(); + $global_options = array(); } } else { - $options = array('allow_hardlink'); + $global_options = array('allow_hardlink'); } // force all jails to update every 2 weeks @@ -74,6 +74,8 @@ class cronjob_jailkit_maintenance extends cronjob { continue; } + $options = $global_options; + //$app->log('Beginning jailkit maintenance for domain '.$rec['domain'].' at '.$rec['document_root'], LOGLEVEL_DEBUG); print 'Beginning jailkit maintenance for domain '.$rec['domain'].' at '.$rec['document_root']."\n"; -- GitLab From bf791d47e4bf882d22d1f655476ade5810341d50 Mon Sep 17 00:00:00 2001 From: Herman van Rink Date: Wed, 3 Apr 2024 16:01:21 +0200 Subject: [PATCH 25/29] Move /etc/alternatives/php code to update_jailkit_chroot() --- .../cron.d/600-jailkit_maintenance.inc.php | 8 +++++- server/lib/classes/system.inc.php | 26 +++++++++++++++---- .../shelluser_jailkit_plugin.inc.php | 21 ++++----------- 3 files changed, 33 insertions(+), 22 deletions(-) diff --git a/server/lib/classes/cron.d/600-jailkit_maintenance.inc.php b/server/lib/classes/cron.d/600-jailkit_maintenance.inc.php index 345026eeee..ec4b76e080 100644 --- a/server/lib/classes/cron.d/600-jailkit_maintenance.inc.php +++ b/server/lib/classes/cron.d/600-jailkit_maintenance.inc.php @@ -65,7 +65,12 @@ class cronjob_jailkit_maintenance extends cronjob { // limit the number of jails we update at one time according to time of day $num_jails_to_update = (date('H') < 6) ? 25 : 3; - $sql = "SELECT domain_id, domain, document_root, system_user, system_group, php_fpm_chroot, jailkit_chroot_app_sections, jailkit_chroot_app_programs, delete_unused_jailkit, last_jailkit_hash FROM web_domain WHERE type = 'vhost' AND (last_jailkit_update IS NULL OR last_jailkit_update < (NOW() - INTERVAL 24 HOUR)) AND server_id = ? ORDER by last_jailkit_update LIMIT ?"; + $sql = "SELECT domain_id, domain, document_root, system_user, system_group, php_fpm_chroot, jailkit_chroot_app_sections, jailkit_chroot_app_programs, delete_unused_jailkit, last_jailkit_hash, `php_cli_binary` + FROM web_domain + LEFT JOIN server_php ON web_domain.server_php_id = server_php.server_php_id + WHERE type = 'vhost' AND (last_jailkit_update IS NULL OR last_jailkit_update < (NOW() - INTERVAL 24 HOUR)) AND web_domain.server_id = ? and domain_id=57 + ORDER by last_jailkit_update + LIMIT ?"; $records = $app->db->queryAllRecords($sql, $conf['server_id'], $num_jails_to_update); foreach($records as $rec) { @@ -75,6 +80,7 @@ class cronjob_jailkit_maintenance extends cronjob { } $options = $global_options; + $options['php_cli_binary'] = $rec['php_cli_binary']; //$app->log('Beginning jailkit maintenance for domain '.$rec['domain'].' at '.$rec['document_root'], LOGLEVEL_DEBUG); print 'Beginning jailkit maintenance for domain '.$rec['domain'].' at '.$rec['document_root']."\n"; diff --git a/server/lib/classes/system.inc.php b/server/lib/classes/system.inc.php index 0947afced7..a995f36562 100644 --- a/server/lib/classes/system.inc.php +++ b/server/lib/classes/system.inc.php @@ -2829,11 +2829,27 @@ $app->log("update_jailkit_chroot: removing deprecated directory which jk_update $this->chmod($home_dir . '/var/tmp', 0770, true); } - // TODO: Set /usr/bin/php symlink to php version of the website. - // - // Currently server_php does not have a field for the cli path; - // we can guess/determing according to OS-specific conventions or add that field. - // Then symlink /usr/bin/php (or correct OS-specific path) to that location. + if (!empty($options['php_cli_binary'])) { + if(!file_exists($home_dir . '/' . $options['php_cli_binary'])) { + $app->log("The PHP cli binary " . $options['php_cli_binary'] . " is not available in the jail of the web " . $this->web['domain'] . " / SSH/SFTP user: " . $this->username . ". Check your Jailkit setup!", LOGLEVEL_DEBUG); + $tpl->setVar('use_php_path', false); + $tpl->setVar('use_php_alias', false); + if(is_link($home_dir . '/etc/alternatives/php')) + { + unlink($home_dir . '/etc/alternatives/php'); + } + } else { + if($app->system->get_os_type() == "debian" || $app->system->get_os_type() == "ubuntu") { + $app->log("update_jailkit_chroot: setting alternatives/php to " . $options['php_cli_binary'], LOGLEVEL_DEBUG); + if(is_link($home_dir . '/etc/alternatives/php') || is_file($home_dir . '/etc/alternatives/php')) + { + unlink($home_dir . '/etc/alternatives/php'); + } + symlink($options['php_cli_binary'], $home_dir . '/etc/alternatives/php'); + } + + } + } // search for any hardlinked files which are now missing if (!(in_array('hardlink', $opts) || in_array('allow_hardlink', $options))) { diff --git a/server/plugins-available/shelluser_jailkit_plugin.inc.php b/server/plugins-available/shelluser_jailkit_plugin.inc.php index 8ffe6b1715..e93c608421 100755 --- a/server/plugins-available/shelluser_jailkit_plugin.inc.php +++ b/server/plugins-available/shelluser_jailkit_plugin.inc.php @@ -344,7 +344,10 @@ class shelluser_jailkit_plugin { $options = array('allow_hardlink'); } - $web = $app->db->queryOneRecord("SELECT domain, last_jailkit_hash FROM web_domain WHERE domain_id = ?", $this->data['new']["parent_domain_id"]); + $web = $app->db->queryOneRecord("SELECT `domain`, `last_jailkit_hash`, `php_cli_binary` FROM web_domain + LEFT JOIN server_php ON web_domain.server_php_id = server_php.server_php_id + WHERE `domain_id` = ?", $data["new"]["parent_domain_id"]); + $last_updated = preg_split('/[\s,]+/', $this->jailkit_config['jailkit_chroot_app_sections'] .' '.$this->jailkit_config['jailkit_chroot_app_programs'] @@ -389,6 +392,7 @@ class shelluser_jailkit_plugin { foreach ($records as $record) { $options[] = 'skip='.$record['web_folder']; } + $options['php_cli_binary'] = $web['php_cli_binary']; $app->system->update_jailkit_chroot($this->data['new']['dir'], $sections, $programs, $options); @@ -725,21 +729,6 @@ class shelluser_jailkit_plugin { $app->log("The PHP cli binary " . $this->web['php_cli_binary'] . " is not available in the jail of the web " . $this->web['domain'] . " / SSH/SFTP user: " . $this->username . ". Check your Jailkit setup!", LOGLEVEL_DEBUG); $tpl->setVar('use_php_path', false); $tpl->setVar('use_php_alias', false); - if(is_link($this->web['document_root'] . '/etc/alternatives/php')) - { - unlink($this->web['document_root'] . '/etc/alternatives/php'); - } - } else { - if($app->system->get_os_type() == "debian" || $app->system->get_os_type() == "ubuntu") { - if(is_link($this->web['document_root'] . '/etc/alternatives/php') || is_file($this->web['document_root'] . '/etc/alternatives/php')) - { - unlink($this->web['document_root'] . '/etc/alternatives/php'); - symlink($this->web['php_cli_binary'], $this->web['document_root'] . '/etc/alternatives/php'); - } else { - symlink($this->web['php_cli_binary'], $this->web['document_root'] . '/etc/alternatives/php'); - } - } - } } -- GitLab From 59ac32995f0ffb7f2e665465a861b197e4dc429e Mon Sep 17 00:00:00 2001 From: Michael Seevogel Date: Thu, 4 Apr 2024 15:48:59 +0200 Subject: [PATCH 26/29] Remove unneeded tpl initiation in shelluser_jailkit_plugin.inc.php --- server/plugins-available/shelluser_jailkit_plugin.inc.php | 1 - 1 file changed, 1 deletion(-) diff --git a/server/plugins-available/shelluser_jailkit_plugin.inc.php b/server/plugins-available/shelluser_jailkit_plugin.inc.php index e93c608421..912f33c2e0 100755 --- a/server/plugins-available/shelluser_jailkit_plugin.inc.php +++ b/server/plugins-available/shelluser_jailkit_plugin.inc.php @@ -692,7 +692,6 @@ class shelluser_jailkit_plugin { $app->load('tpl'); $tpl = new tpl(); - $tpl_deb_user_bashrc = new tpl(); // Predefine some template vars $tpl->setVar('jailkit_chroot', 'y'); -- GitLab From 8f27d75c7f5c22fa43c13afc78330d7881cfdb81 Mon Sep 17 00:00:00 2001 From: Michael Seevogel Date: Sat, 6 Apr 2024 16:27:02 +0200 Subject: [PATCH 27/29] add term export to bashrc_user_redhat.master --- server/conf/bashrc_user_redhat.master | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/conf/bashrc_user_redhat.master b/server/conf/bashrc_user_redhat.master index 0d5b7ef607..ce314b99c6 100644 --- a/server/conf/bashrc_user_redhat.master +++ b/server/conf/bashrc_user_redhat.master @@ -1,5 +1,7 @@ # .bashrc +export TERM=xterm + # Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc -- GitLab From 2636c73a6998cdecd3336dc0553b5c14dd0edbdd Mon Sep 17 00:00:00 2001 From: Michael Seevogel Date: Sat, 6 Apr 2024 16:27:57 +0200 Subject: [PATCH 28/29] Include export in jailkit-only block --- server/conf/bashrc_user_redhat.master | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/conf/bashrc_user_redhat.master b/server/conf/bashrc_user_redhat.master index ce314b99c6..1d91bb971b 100644 --- a/server/conf/bashrc_user_redhat.master +++ b/server/conf/bashrc_user_redhat.master @@ -1,6 +1,6 @@ # .bashrc -export TERM=xterm + # Source global definitions if [ -f /etc/bashrc ]; then @@ -8,6 +8,7 @@ if [ -f /etc/bashrc ]; then fi +export TERM=xterm ## Hack for Jailkit User to change back to the logged in user ## if [ -n "$LOGNAME" ]; then if [ "$LOGNAME" != $USER ]; then -- GitLab From 711247a7d33ea5a8b34a983e2d1b7ec156f2dbab Mon Sep 17 00:00:00 2001 From: Michael Seevogel Date: Sat, 6 Apr 2024 16:50:31 +0200 Subject: [PATCH 29/29] Wrap term env var export in a separate jailkit only block --- server/conf/bashrc_user_redhat.master | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/conf/bashrc_user_redhat.master b/server/conf/bashrc_user_redhat.master index 1d91bb971b..e88235b426 100644 --- a/server/conf/bashrc_user_redhat.master +++ b/server/conf/bashrc_user_redhat.master @@ -1,6 +1,8 @@ # .bashrc - + +export TERM=xterm + # Source global definitions if [ -f /etc/bashrc ]; then @@ -8,7 +10,6 @@ if [ -f /etc/bashrc ]; then fi -export TERM=xterm ## Hack for Jailkit User to change back to the logged in user ## if [ -n "$LOGNAME" ]; then if [ "$LOGNAME" != $USER ]; then -- GitLab
{tmpl_var name="run_wday"} {tmpl_var name="command"} -
+