From 168dfcf32dab938f6a6b08862b4d1f36e0f2609d Mon Sep 17 00:00:00 2001 From: marcos Date: Tue, 17 Dec 2019 15:23:01 +0100 Subject: [PATCH 1/5] minnor error --- pandora_console/godmode/setup/setup_auth.php | 229 ++++++++++++++----- 1 file changed, 171 insertions(+), 58 deletions(-) diff --git a/pandora_console/godmode/setup/setup_auth.php b/pandora_console/godmode/setup/setup_auth.php index 1394063e5e..53fe7059f8 100644 --- a/pandora_console/godmode/setup/setup_auth.php +++ b/pandora_console/godmode/setup/setup_auth.php @@ -1,18 +1,25 @@ data['fallback_local_auth'] = $row; if (enterprise_installed()) { - // Autocreate remote users + // Autocreate remote users. $row = []; $row['name'] = __('Autocreate remote users'); - $row['control'] = html_print_checkbox_switch_extended('autocreate_remote_users', 1, $config['autocreate_remote_users'], false, '', '', true).'  '; + $row['control'] = html_print_checkbox_switch_extended( + 'autocreate_remote_users', + 1, + $config['autocreate_remote_users'], + false, + '', + '', + true + ).'  '; $table->data['autocreate_remote_users'] = $row; add_enterprise_auth_autocreate_profiles($table, $type_auth); @@ -63,19 +86,33 @@ if (is_ajax()) { break; case 'ldap': - // LDAP server + // LDAP server. $row = []; $row['name'] = __('LDAP server'); - $row['control'] = html_print_input_text('ldap_server', $config['ldap_server'], '', 30, 100, true); + $row['control'] = html_print_input_text( + 'ldap_server', + $config['ldap_server'], + '', + 30, + 100, + true + ); $table->data['ldap_server'] = $row; - // LDAP port + // LDAP port. $row = []; $row['name'] = __('LDAP port'); - $row['control'] = html_print_input_text('ldap_port', $config['ldap_port'], '', 10, 100, true); + $row['control'] = html_print_input_text( + 'ldap_port', + $config['ldap_port'], + '', + 10, + 100, + true + ); $table->data['ldap_port'] = $row; - // LDAP version + // LDAP version. $ldap_versions = [ 1 => 'LDAPv1', 2 => 'LDAPv2', @@ -83,37 +120,78 @@ if (is_ajax()) { ]; $row = []; $row['name'] = __('LDAP version'); - $row['control'] = html_print_select($ldap_versions, 'ldap_version', $config['ldap_version'], '', '', 0, true); + $row['control'] = html_print_select( + $ldap_versions, + 'ldap_version', + $config['ldap_version'], + '', + '', + 0, + true + ); $table->data['ldap_version'] = $row; - // Start TLS + // Start TLS. $row = []; $row['name'] = __('Start TLS'); - $row['control'] = html_print_checkbox_switch('ldap_start_tls', 1, $config['ldap_start_tls'], true); + $row['control'] = html_print_checkbox_switch( + 'ldap_start_tls', + 1, + $config['ldap_start_tls'], + true + ); $table->data['ldap_start_tls'] = $row; - // Base DN + // Base DN. $row = []; $row['name'] = __('Base DN'); - $row['control'] = html_print_input_text('ldap_base_dn', $config['ldap_base_dn'], '', 60, 100, true); + $row['control'] = html_print_input_text( + 'ldap_base_dn', + $config['ldap_base_dn'], + '', + 60, + 100, + true + ); $table->data['ldap_base_dn'] = $row; - // Login attribute + // Login attribute. $row = []; $row['name'] = __('Login attribute'); - $row['control'] = html_print_input_text('ldap_login_attr', $config['ldap_login_attr'], '', 60, 100, true); + $row['control'] = html_print_input_text( + 'ldap_login_attr', + $config['ldap_login_attr'], + '', + 60, + 100, + true + ); $table->data['ldap_login_attr'] = $row; - // Admin LDAP login + // Admin LDAP login. $row = []; $row['name'] = __('Admin LDAP login'); - $row['control'] = html_print_input_text('ldap_admin_login', $config['ldap_admin_login'], '', 60, 100, true); + $row['control'] = html_print_input_text( + 'ldap_admin_login', + $config['ldap_admin_login'], + '', + 60, + 100, + true + ); $table->data['ldap_admin_login'] = $row; - // Admin LDAP password + // Admin LDAP password. $row = []; $row['name'] = __('Admin LDAP password'); - $row['control'] = html_print_input_password('ldap_admin_pass', $config['ldap_admin_pass'], $alt = '', 60, 100, true); + $row['control'] = html_print_input_password( + 'ldap_admin_pass', + io_output_password($config['ldap_admin_pass']), + $alt = '', + 60, + 100, + true + ); $table->data['ldap_admin_pass'] = $row; break; @@ -121,28 +199,50 @@ if (is_ajax()) { case 'ad': case 'saml': case 'integria': - // Add enterprise authentication options + // Add enterprise authentication options. if (enterprise_installed()) { add_enterprise_auth_options($table, $type_auth); } break; + + default: + // Default case. + break; } - // field for all types - // Enable double authentication - // Set default value + // Field for all types. + // Enable double authentication. + // Set default value. set_unless_defined($config['double_auth_enabled'], false); $row = []; - $row['name'] = __('Double authentication').ui_print_help_tip(__('If this option is enabled, the users can use double authentication with their accounts'), true); - $row['control'] .= html_print_checkbox_switch('double_auth_enabled', 1, $config['double_auth_enabled'], true); + $row['name'] = __('Double authentication').ui_print_help_tip( + __('If this option is enabled, the users can use double authentication with their accounts'), + true + ); + $row['control'] .= html_print_checkbox_switch( + 'double_auth_enabled', + 1, + $config['double_auth_enabled'], + true + ); $table->data['double_auth_enabled'] = $row; - // Session timeout - // Default session timeout + // Session timeout. + // Default session timeout. set_when_empty($config['session_timeout'], 90); $row = []; - $row['name'] = __('Session timeout (mins)').ui_print_help_tip(__('This is defined in minutes, If you wish a permanent session should putting -1 in this field.'), true); - $row['control'] = html_print_input_text('session_timeout', $config['session_timeout'], '', 10, 10, true); + $row['name'] = __('Session timeout (mins)').ui_print_help_tip( + __('This is defined in minutes, If you wish a permanent session should putting -1 in this field.'), + true + ); + $row['control'] = html_print_input_text( + 'session_timeout', + $config['session_timeout'], + '', + 10, + 10, + true + ); $table->data['session_timeout'] = $row; html_print_table($table); @@ -159,23 +259,23 @@ $table->class = 'databox filters'; $table->size['name'] = '30%'; $table->style['name'] = 'font-weight: bold'; -// Auth methods added to the table (doesn't take in account mysql) +// Auth methods added to the table (doesn't take in account mysql). $auth_methods_added = []; -// Remote options row names -// Fill this array for every matched row +// Remote options row names. +// Fill this array for every matched row. $remote_rows = []; -// Autocreate options row names -// Fill this array for every matched row +// Autocreate options row names. +// Fill this array for every matched row. $autocreate_rows = []; $no_autocreate_rows = []; -// LDAP data row names -// Fill this array for every matched row +// LDAP data row names. +// Fill this array for every matched row. $ldap_rows = []; -// Method +// Method. $auth_methods = [ 'mysql' => __('Local %s', get_product_name()), 'ldap' => __('ldap'), @@ -186,16 +286,24 @@ if (enterprise_installed()) { $row = []; $row['name'] = __('Authentication method'); -$row['control'] = html_print_select($auth_methods, 'auth', $config['auth'], '', '', 0, true); +$row['control'] = html_print_select( + $auth_methods, + 'auth', + $config['auth'], + '', + '', + 0, + true +); $table->data['auth'] = $row; -// Form +// Form. echo '
'; if (!is_metaconsole()) { html_print_input_hidden('update_config', 1); } else { - // To use it in the metasetup + // To use it in the metasetup. html_print_input_hidden('action', 'save'); html_print_input_hidden('hash_save_config', md5('save'.$config['dbpass'])); } @@ -203,7 +311,12 @@ if (!is_metaconsole()) { html_print_table($table); echo '
'; echo '
'; -html_print_submit_button(__('Update'), 'update_button', false, 'class="sub upd"'); +html_print_submit_button( + __('Update'), + 'update_button', + false, + 'class="sub upd"' +); echo '
'; echo '
'; ?> From 35136ada8eb47b2f23545708c122c71ac1285b79 Mon Sep 17 00:00:00 2001 From: marcos Date: Tue, 17 Dec 2019 15:25:28 +0100 Subject: [PATCH 2/5] minnor error --- pandora_console/include/functions_config.php | 29 +++++++------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index 92491fb02b..2a409a343e 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -350,7 +350,7 @@ function config_update_config() $error_update[] = __('Email user'); } - if (!config_update_value('email_password', get_parameter('email_password'))) { + if (!config_update_value('email_password', io_input_password(get_parameter('email_password')))) { $error_update[] = __('Email password'); } @@ -608,7 +608,7 @@ function config_update_config() $error_update[] = __('Admin LDAP login'); } - if (!config_update_value('ldap_admin_pass', get_parameter('ldap_admin_pass'))) { + if (!config_update_value('ldap_admin_pass', io_input_password(get_parameter('ldap_admin_pass')))) { $error_update[] = __('Admin LDAP password'); } @@ -1289,10 +1289,6 @@ function config_update_config() $error_update[] = __('Font size for items reports'); } - if (!config_update_value('interval_description', (string) get_parameter('interval_description', 'large'))) { - $error_update[] = __('Interval description'); - } - if (!config_update_value('custom_report_front', get_parameter('custom_report_front'))) { $error_update[] = __('Custom report front'); } @@ -1915,6 +1911,14 @@ function config_process_config() * Parse the ACL IP list for access API */ + $temp_list_ACL_IPs_for_API = []; + if (isset($config['list_ACL_IPs_for_API'])) { + if (!empty($config['list_ACL_IPs_for_API'])) { + $temp_list_ACL_IPs_for_API = explode(';', $config['list_ACL_IPs_for_API']); + } + } + + $config['list_ACL_IPs_for_API'] = $temp_list_ACL_IPs_for_API; $keysConfig = array_keys($config); /* @@ -2817,10 +2821,6 @@ function config_process_config() config_update_value('font_size_item_report', 2); } - if (!isset($config['interval_description'])) { - config_update_value('interval_description', 'large'); - } - if (!isset($config['custom_report_front_font'])) { config_update_value('custom_report_front_font', 'FreeSans.ttf'); } @@ -2976,15 +2976,6 @@ function config_process_config() // Finally, check if any value was overwritten in a form. config_update_config(); - - $temp_list_ACL_IPs_for_API = []; - if (isset($config['list_ACL_IPs_for_API'])) { - if (!empty($config['list_ACL_IPs_for_API'])) { - $temp_list_ACL_IPs_for_API = explode(';', $config['list_ACL_IPs_for_API']); - } - } - - $config['list_ACL_IPs_for_API'] = $temp_list_ACL_IPs_for_API; } From 91fe85e90ebd9e828bdd51bbd7a22c876a9901f9 Mon Sep 17 00:00:00 2001 From: marcos Date: Wed, 18 Dec 2019 15:15:25 +0100 Subject: [PATCH 3/5] updates2 --- .../update_manager/update_manager.setup.php | 2 ++ pandora_console/include/functions_config.php | 16 ++++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/pandora_console/godmode/update_manager/update_manager.setup.php b/pandora_console/godmode/update_manager/update_manager.setup.php index 1a81cf457c..edf7749a4f 100644 --- a/pandora_console/godmode/update_manager/update_manager.setup.php +++ b/pandora_console/godmode/update_manager/update_manager.setup.php @@ -179,6 +179,7 @@ if (!$action_update_url_update_manager) { } echo '
'; +html_print_input_hidden('update_config', 1); $table = new stdClass(); $table->width = '100%'; @@ -259,6 +260,7 @@ if (license_free()) { } html_print_input_hidden('action_update_url_update_manager', 1); +html_print_input_hidden('update_config', 1); html_print_table($table); echo '
'; diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index 2a409a343e..f4e2bef1e6 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -148,8 +148,15 @@ function config_update_config() $error_update = []; - $sec2 = get_parameter_get('sec2'); + $sec2 = get_parameter('sec2'); + switch ($sec2) { + case 'godmode/update_manager/update_manager': + if (!config_update_value('update_manager_proxy_password', io_input_password(get_parameter('update_manager_proxy_password', $config['update_manager_proxy_password'])))) { + $error_update[] = __('update manager'); + } + break; + case 'godmode/setup/setup': $section_setup = get_parameter('section'); // MAIN SETUP. @@ -2895,13 +2902,6 @@ function config_process_config() ); } - if (!isset($config['update_manager_proxy_password'])) { - config_update_value( - 'update_manager_proxy_password', - '' - ); - } - if (!isset($config['session_timeout'])) { config_update_value('session_timeout', 90); } From f3ddec44365e2e3ee9095766d9e21a8e7c7b629a Mon Sep 17 00:00:00 2001 From: marcos Date: Wed, 18 Dec 2019 15:30:23 +0100 Subject: [PATCH 4/5] updates --- pandora_console/include/functions_config.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index f4e2bef1e6..490ffe8d51 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -152,7 +152,7 @@ function config_update_config() switch ($sec2) { case 'godmode/update_manager/update_manager': - if (!config_update_value('update_manager_proxy_password', io_input_password(get_parameter('update_manager_proxy_password', $config['update_manager_proxy_password'])))) { + if (!config_update_value('update_manager_proxy_password', io_input_password((string) get_parameter('update_manager_proxy_password', $config['update_manager_proxy_password'])))) { $error_update[] = __('update manager'); } break; @@ -2902,6 +2902,13 @@ function config_process_config() ); } + if (!isset($config['update_manager_proxy_password'])) { + config_update_value( + 'update_manager_proxy_password', + '' + ); + } + if (!isset($config['session_timeout'])) { config_update_value('session_timeout', 90); } From b551f1a13cef3dad89ef8397e846f704765d910f Mon Sep 17 00:00:00 2001 From: marcos Date: Wed, 18 Dec 2019 17:48:29 +0100 Subject: [PATCH 5/5] update --- .../godmode/update_manager/update_manager.setup.php | 7 +++++-- pandora_console/include/functions_config.php | 6 ------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/pandora_console/godmode/update_manager/update_manager.setup.php b/pandora_console/godmode/update_manager/update_manager.setup.php index edf7749a4f..7b07c4bd01 100644 --- a/pandora_console/godmode/update_manager/update_manager.setup.php +++ b/pandora_console/godmode/update_manager/update_manager.setup.php @@ -60,7 +60,10 @@ if (users_is_admin()) { } if (!$action_update_url_update_manager) { - $url_update_manager = get_parameter('url_update_manager', $config['url_update_manager']); + $url_update_manager = get_parameter( + 'url_update_manager', + $config['url_update_manager'] + ); $update_manager_proxy_server = get_parameter( 'update_manager_proxy_server', $config['update_manager_proxy_server'] @@ -162,7 +165,7 @@ if (!$action_update_url_update_manager) { if ($result) { $result = config_update_value( 'update_manager_proxy_password', - $update_manager_proxy_password + io_input_password($update_manager_proxy_password) ); } diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index 490ffe8d51..d12cf68c65 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -151,12 +151,6 @@ function config_update_config() $sec2 = get_parameter('sec2'); switch ($sec2) { - case 'godmode/update_manager/update_manager': - if (!config_update_value('update_manager_proxy_password', io_input_password((string) get_parameter('update_manager_proxy_password', $config['update_manager_proxy_password'])))) { - $error_update[] = __('update manager'); - } - break; - case 'godmode/setup/setup': $section_setup = get_parameter('section'); // MAIN SETUP.