From 5e8e37494d1d68083c54a88012b8268fe8f5f3b0 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Thu, 12 Nov 2020 16:55:31 +0100 Subject: [PATCH 01/31] WIP: Backup upload --- pandora_server/lib/PandoraFMS/DiscoveryServer.pm | 3 ++- pandora_server/lib/PandoraFMS/Recon/Base.pm | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pandora_server/lib/PandoraFMS/DiscoveryServer.pm b/pandora_server/lib/PandoraFMS/DiscoveryServer.pm index 2b57922a80..f49e9bffb4 100644 --- a/pandora_server/lib/PandoraFMS/DiscoveryServer.pm +++ b/pandora_server/lib/PandoraFMS/DiscoveryServer.pm @@ -387,7 +387,7 @@ sub exec_recon_script ($$$) { } else { $ent_script = 1; } - + logger($pa_config, 'Executing command args: ' . $command . ' ' . $args, 1); if (-x $command) { my $exec_output = `$command $args`; logger($pa_config, "Execution output: \n". $exec_output, 10); @@ -1769,6 +1769,7 @@ sub PandoraFMS::Recon::Base::update_progress ($$) { my $stats = {}; eval { + logger($self->{'pa_config'}, 'Summary es '.$self->{'summary'}, 3); local $SIG{__DIE__}; if (defined($self->{'summary'}) && $self->{'summary'} ne '') { $stats->{'summary'} = $self->{'summary'}; diff --git a/pandora_server/lib/PandoraFMS/Recon/Base.pm b/pandora_server/lib/PandoraFMS/Recon/Base.pm index e14b200fa3..c78dac354f 100644 --- a/pandora_server/lib/PandoraFMS/Recon/Base.pm +++ b/pandora_server/lib/PandoraFMS/Recon/Base.pm @@ -1898,7 +1898,7 @@ sub scan($) { # 1% $self->call('update_progress', 1); - + logger($self->{'pa_config'}, 'Tipo de Task: '.$self->{'task_data'}->{'type'}); if (defined($self->{'task_data'})) { if ( $self->{'task_data'}->{'type'} == DISCOVERY_APP_MYSQL || $self->{'task_data'}->{'type'} == DISCOVERY_APP_ORACLE From c3044b5d13cdb70b203ed1557c4d5fd811709ac2 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Thu, 12 Nov 2020 17:15:33 +0100 Subject: [PATCH 02/31] WIP: Backup upload --- pandora_server/lib/PandoraFMS/DiscoveryServer.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandora_server/lib/PandoraFMS/DiscoveryServer.pm b/pandora_server/lib/PandoraFMS/DiscoveryServer.pm index f49e9bffb4..88e7f37e62 100644 --- a/pandora_server/lib/PandoraFMS/DiscoveryServer.pm +++ b/pandora_server/lib/PandoraFMS/DiscoveryServer.pm @@ -32,7 +32,7 @@ use MIME::Base64; # Default lib dir for RPM and DEB packages use lib '/usr/lib/perl5'; - +use Data::Dumper; use PandoraFMS::Tools; use PandoraFMS::DB; use PandoraFMS::Core; @@ -1769,7 +1769,7 @@ sub PandoraFMS::Recon::Base::update_progress ($$) { my $stats = {}; eval { - logger($self->{'pa_config'}, 'Summary es '.$self->{'summary'}, 3); + logger($self->{'pa_config'}, 'Summary es '.Dumper($self->{'summary'}), 3); local $SIG{__DIE__}; if (defined($self->{'summary'}) && $self->{'summary'} ne '') { $stats->{'summary'} = $self->{'summary'}; From e98a3bf5f3863c8faf9538967124870d60b75086 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Thu, 12 Nov 2020 17:21:16 +0100 Subject: [PATCH 03/31] WIP: Backup upload --- pandora_server/lib/PandoraFMS/DiscoveryServer.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_server/lib/PandoraFMS/DiscoveryServer.pm b/pandora_server/lib/PandoraFMS/DiscoveryServer.pm index 88e7f37e62..8dc6f644a0 100644 --- a/pandora_server/lib/PandoraFMS/DiscoveryServer.pm +++ b/pandora_server/lib/PandoraFMS/DiscoveryServer.pm @@ -1769,7 +1769,7 @@ sub PandoraFMS::Recon::Base::update_progress ($$) { my $stats = {}; eval { - logger($self->{'pa_config'}, 'Summary es '.Dumper($self->{'summary'}), 3); + logger($self->{'pa_config'}, 'Task data: '.$self->{'task_data'}.' - summary es '.Dumper($self->{'summary'}), 3); local $SIG{__DIE__}; if (defined($self->{'summary'}) && $self->{'summary'} ne '') { $stats->{'summary'} = $self->{'summary'}; From c8ea054614513efa44ba214aafa5fde28c9ff215 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Thu, 12 Nov 2020 17:23:46 +0100 Subject: [PATCH 04/31] WIP: Backup upload --- pandora_server/lib/PandoraFMS/DiscoveryServer.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_server/lib/PandoraFMS/DiscoveryServer.pm b/pandora_server/lib/PandoraFMS/DiscoveryServer.pm index 8dc6f644a0..735114a985 100644 --- a/pandora_server/lib/PandoraFMS/DiscoveryServer.pm +++ b/pandora_server/lib/PandoraFMS/DiscoveryServer.pm @@ -1769,7 +1769,7 @@ sub PandoraFMS::Recon::Base::update_progress ($$) { my $stats = {}; eval { - logger($self->{'pa_config'}, 'Task data: '.$self->{'task_data'}.' - summary es '.Dumper($self->{'summary'}), 3); + logger($self->{'pa_config'}, 'Task data: '.Dumper($self->{'task_data'}).' - summary es '.Dumper($self->{'summary'}), 3); local $SIG{__DIE__}; if (defined($self->{'summary'}) && $self->{'summary'} ne '') { $stats->{'summary'} = $self->{'summary'}; From 064ae49d56dae374190f7760189fb20f76c07782 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Thu, 12 Nov 2020 17:36:31 +0100 Subject: [PATCH 05/31] WIP: Backup upload --- pandora_server/lib/PandoraFMS/DiscoveryServer.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_server/lib/PandoraFMS/DiscoveryServer.pm b/pandora_server/lib/PandoraFMS/DiscoveryServer.pm index 735114a985..74c713fd38 100644 --- a/pandora_server/lib/PandoraFMS/DiscoveryServer.pm +++ b/pandora_server/lib/PandoraFMS/DiscoveryServer.pm @@ -1769,7 +1769,7 @@ sub PandoraFMS::Recon::Base::update_progress ($$) { my $stats = {}; eval { - logger($self->{'pa_config'}, 'Task data: '.Dumper($self->{'task_data'}).' - summary es '.Dumper($self->{'summary'}), 3); + logger($self->{'pa_config'}, 'Task data: '.Dumper($self->{'task_data'}->{'description'}).' - summary es '.Dumper($self->{'summary'}), 3); local $SIG{__DIE__}; if (defined($self->{'summary'}) && $self->{'summary'} ne '') { $stats->{'summary'} = $self->{'summary'}; From 08cc67696a4b1697afd864b63492117acdef68cf Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Fri, 13 Nov 2020 11:36:06 +0100 Subject: [PATCH 06/31] WIP: Backup upload --- .../wizards/DiscoveryTaskList.class.php | 36 +++++++++++++------ 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php index 59a9fab84a..f664b761c1 100644 --- a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php +++ b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php @@ -546,16 +546,26 @@ class DiscoveryTaskList extends HTML true ); } else if ($task['review_mode'] == DISCOVERY_STANDARD) { - if ($task['status'] <= 0 - && empty($task['summary']) === false - ) { - $data[5] = __('Done'); - } else if ($task['utimestamp'] == 0 - && empty($task['summary']) - ) { - $data[5] = __('Not started'); + if ($task['type'] === DISCOVERY_APP_VMWARE) { + if ($task['status'] <= 0) { + $data[5] == __('Done'); + } else if ($task['status'] > 0 && $task['utimestamp'] == 0) { + $data[5] == __('Pending'); + } else { + $data[5] == __('Not started'); + } } else { - $data[5] = __('Pending'); + if ($task['status'] <= 0 + && empty($task['summary']) === false + ) { + $data[5] = __('Done'); + } else if ($task['utimestamp'] == 0 + && empty($task['summary']) + ) { + $data[5] = __('Not started'); + } else { + $data[5] = __('Pending'); + } } } else { if ($task['status'] <= 0 @@ -1201,8 +1211,14 @@ class DiscoveryTaskList extends HTML // Header information. if ((int) $task['status'] <= 0 && empty($summary)) { + if ($task['type'] == DISCOVERY_APP_VMWARE) { + $outputMessage = __('Task completed.'); + } else { + $outputMessage = __('This task has never executed'); + } + $output .= ui_print_info_message( - __('This task has never executed'), + $outputMessage, '', true ); From 98205973a5873214055b48990b21271ba9523d0e Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Fri, 13 Nov 2020 11:43:26 +0100 Subject: [PATCH 07/31] WIP: Backup upload --- pandora_console/godmode/wizards/DiscoveryTaskList.class.php | 4 ++-- pandora_server/lib/PandoraFMS/DiscoveryServer.pm | 3 +-- pandora_server/lib/PandoraFMS/Recon/Base.pm | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php index f664b761c1..b43be9e4ff 100644 --- a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php +++ b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php @@ -547,9 +547,9 @@ class DiscoveryTaskList extends HTML ); } else if ($task['review_mode'] == DISCOVERY_STANDARD) { if ($task['type'] === DISCOVERY_APP_VMWARE) { - if ($task['status'] <= 0) { + if ($task['status'] <= 0 && $task['utimestamp'] != 0) { $data[5] == __('Done'); - } else if ($task['status'] > 0 && $task['utimestamp'] == 0) { + } else if ($task['status'] > 0) { $data[5] == __('Pending'); } else { $data[5] == __('Not started'); diff --git a/pandora_server/lib/PandoraFMS/DiscoveryServer.pm b/pandora_server/lib/PandoraFMS/DiscoveryServer.pm index 74c713fd38..7e562f06ca 100644 --- a/pandora_server/lib/PandoraFMS/DiscoveryServer.pm +++ b/pandora_server/lib/PandoraFMS/DiscoveryServer.pm @@ -387,7 +387,7 @@ sub exec_recon_script ($$$) { } else { $ent_script = 1; } - logger($pa_config, 'Executing command args: ' . $command . ' ' . $args, 1); + if (-x $command) { my $exec_output = `$command $args`; logger($pa_config, "Execution output: \n". $exec_output, 10); @@ -1769,7 +1769,6 @@ sub PandoraFMS::Recon::Base::update_progress ($$) { my $stats = {}; eval { - logger($self->{'pa_config'}, 'Task data: '.Dumper($self->{'task_data'}->{'description'}).' - summary es '.Dumper($self->{'summary'}), 3); local $SIG{__DIE__}; if (defined($self->{'summary'}) && $self->{'summary'} ne '') { $stats->{'summary'} = $self->{'summary'}; diff --git a/pandora_server/lib/PandoraFMS/Recon/Base.pm b/pandora_server/lib/PandoraFMS/Recon/Base.pm index c78dac354f..e14b200fa3 100644 --- a/pandora_server/lib/PandoraFMS/Recon/Base.pm +++ b/pandora_server/lib/PandoraFMS/Recon/Base.pm @@ -1898,7 +1898,7 @@ sub scan($) { # 1% $self->call('update_progress', 1); - logger($self->{'pa_config'}, 'Tipo de Task: '.$self->{'task_data'}->{'type'}); + if (defined($self->{'task_data'})) { if ( $self->{'task_data'}->{'type'} == DISCOVERY_APP_MYSQL || $self->{'task_data'}->{'type'} == DISCOVERY_APP_ORACLE From a0a1be254d676055a4b14c83e86fe228c7b184d0 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Fri, 13 Nov 2020 13:28:07 +0100 Subject: [PATCH 08/31] WIP: Backup upload --- pandora_console/godmode/wizards/DiscoveryTaskList.class.php | 1 + pandora_server/lib/PandoraFMS/DiscoveryServer.pm | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php index b43be9e4ff..1354464cf3 100644 --- a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php +++ b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php @@ -546,6 +546,7 @@ class DiscoveryTaskList extends HTML true ); } else if ($task['review_mode'] == DISCOVERY_STANDARD) { + hd($task); if ($task['type'] === DISCOVERY_APP_VMWARE) { if ($task['status'] <= 0 && $task['utimestamp'] != 0) { $data[5] == __('Done'); diff --git a/pandora_server/lib/PandoraFMS/DiscoveryServer.pm b/pandora_server/lib/PandoraFMS/DiscoveryServer.pm index 7e562f06ca..2b57922a80 100644 --- a/pandora_server/lib/PandoraFMS/DiscoveryServer.pm +++ b/pandora_server/lib/PandoraFMS/DiscoveryServer.pm @@ -32,7 +32,7 @@ use MIME::Base64; # Default lib dir for RPM and DEB packages use lib '/usr/lib/perl5'; -use Data::Dumper; + use PandoraFMS::Tools; use PandoraFMS::DB; use PandoraFMS::Core; @@ -387,7 +387,7 @@ sub exec_recon_script ($$$) { } else { $ent_script = 1; } - + if (-x $command) { my $exec_output = `$command $args`; logger($pa_config, "Execution output: \n". $exec_output, 10); From 1ca65e59d51c5f0ca48502172b38b9c8e87c1912 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Fri, 13 Nov 2020 13:31:13 +0100 Subject: [PATCH 09/31] WIP: Backup upload --- pandora_console/godmode/wizards/DiscoveryTaskList.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php index 1354464cf3..62aa92da31 100644 --- a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php +++ b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php @@ -546,8 +546,8 @@ class DiscoveryTaskList extends HTML true ); } else if ($task['review_mode'] == DISCOVERY_STANDARD) { - hd($task); if ($task['type'] === DISCOVERY_APP_VMWARE) { + hd($task); if ($task['status'] <= 0 && $task['utimestamp'] != 0) { $data[5] == __('Done'); } else if ($task['status'] > 0) { From 63395dd88fe7230f40767e500db75a9483cc000c Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Fri, 13 Nov 2020 13:33:05 +0100 Subject: [PATCH 10/31] WIP: Backup upload --- pandora_console/godmode/wizards/DiscoveryTaskList.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php index 62aa92da31..926d031a94 100644 --- a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php +++ b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php @@ -546,8 +546,7 @@ class DiscoveryTaskList extends HTML true ); } else if ($task['review_mode'] == DISCOVERY_STANDARD) { - if ($task['type'] === DISCOVERY_APP_VMWARE) { - hd($task); + if ($task['type'] == DISCOVERY_APP_VMWARE) { if ($task['status'] <= 0 && $task['utimestamp'] != 0) { $data[5] == __('Done'); } else if ($task['status'] > 0) { From d623606c0fea08ceb86e214c731a83713dc262e3 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Fri, 13 Nov 2020 13:38:54 +0100 Subject: [PATCH 11/31] WIP: Backup upload --- pandora_console/godmode/wizards/DiscoveryTaskList.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php index 926d031a94..08162606f6 100644 --- a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php +++ b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php @@ -546,6 +546,7 @@ class DiscoveryTaskList extends HTML true ); } else if ($task['review_mode'] == DISCOVERY_STANDARD) { + hd($task['type']); if ($task['type'] == DISCOVERY_APP_VMWARE) { if ($task['status'] <= 0 && $task['utimestamp'] != 0) { $data[5] == __('Done'); From a049ff1e16e9c11448f1b449168868884c2b118c Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Fri, 13 Nov 2020 13:44:40 +0100 Subject: [PATCH 12/31] WIP: Backup upload --- pandora_console/godmode/wizards/DiscoveryTaskList.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php index 08162606f6..a56f93e1f9 100644 --- a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php +++ b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php @@ -547,6 +547,7 @@ class DiscoveryTaskList extends HTML ); } else if ($task['review_mode'] == DISCOVERY_STANDARD) { hd($task['type']); + hd($task['type'] == DISCOVERY_APP_VMWARE); if ($task['type'] == DISCOVERY_APP_VMWARE) { if ($task['status'] <= 0 && $task['utimestamp'] != 0) { $data[5] == __('Done'); From 2fdd34265fa2b7d18dcc20bd60111b5364a49c35 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Fri, 13 Nov 2020 13:53:54 +0100 Subject: [PATCH 13/31] WIP: Backup upload --- .../godmode/wizards/DiscoveryTaskList.class.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php index a56f93e1f9..20f3d78f9d 100644 --- a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php +++ b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php @@ -546,15 +546,13 @@ class DiscoveryTaskList extends HTML true ); } else if ($task['review_mode'] == DISCOVERY_STANDARD) { - hd($task['type']); - hd($task['type'] == DISCOVERY_APP_VMWARE); if ($task['type'] == DISCOVERY_APP_VMWARE) { if ($task['status'] <= 0 && $task['utimestamp'] != 0) { - $data[5] == __('Done'); + $data[5] = __('Done'); } else if ($task['status'] > 0) { - $data[5] == __('Pending'); + $data[5] = __('Pending'); } else { - $data[5] == __('Not started'); + $data[5] = __('Not started'); } } else { if ($task['status'] <= 0 From 8baf5df61a56214822e84fd16c38266c5b541839 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Fri, 13 Nov 2020 14:09:22 +0100 Subject: [PATCH 14/31] Fix visual issue --- pandora_console/godmode/wizards/DiscoveryTaskList.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php index 20f3d78f9d..39d76f1286 100644 --- a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php +++ b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php @@ -407,7 +407,7 @@ class DiscoveryTaskList extends HTML // Status. $table->headstyle[5] .= 'min-width: 50px; width: 100px;'; // Task type. - $table->headstyle[6] .= 'min-width: 150px; width: 150px;'; + $table->headstyle[6] .= 'min-width: 200px; width: 200px;'; // Progress. $table->headstyle[7] .= 'min-width: 50px; width: 150px;'; // Updated at. From a1b6d316be45a65a48e5bbfb41e09980d6af4405 Mon Sep 17 00:00:00 2001 From: Luis Calvo Date: Fri, 13 Nov 2020 20:12:03 +0100 Subject: [PATCH 15/31] WIP:Added CSV an JSON formats in console task report save to disk --- pandora_console/include/functions_cron.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pandora_console/include/functions_cron.php b/pandora_console/include/functions_cron.php index abc7d45984..7895779e25 100644 --- a/pandora_console/include/functions_cron.php +++ b/pandora_console/include/functions_cron.php @@ -623,6 +623,9 @@ function cron_list_table() break; case 'cron_task_save_xml_report_to_disk': + case 'cron_task_save_json_report_to_disk': + case 'cron_task_save_csv_report_to_disk': + if ($write_perms || $manage_pandora) { $data[0] = ''; From e9fb346ecd113ae68bcfe82acb42d22b249be63e Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Tue, 24 Nov 2020 18:10:39 +0100 Subject: [PATCH 16/31] Definition matching Entity --- pandora_console/include/lib/Entity.php | 4 ++-- pandora_console/include/lib/Module.php | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/pandora_console/include/lib/Entity.php b/pandora_console/include/lib/Entity.php index 85901db309..1bc1b219ac 100644 --- a/pandora_console/include/lib/Entity.php +++ b/pandora_console/include/lib/Entity.php @@ -61,12 +61,12 @@ abstract class Entity /** * Instances a new object using array definition. * - * @param string $class_str Class name. * @param array $data Fields data. + * @param string $class_str Class name. * * @return object With current definition. */ - public static function build(string $class_str, array $data=[]) + public static function build(array $data=[], string $class_str=__CLASS__) { $obj = new $class_str(); // Set values. diff --git a/pandora_console/include/lib/Module.php b/pandora_console/include/lib/Module.php index 000d71b0c2..203b6001f1 100644 --- a/pandora_console/include/lib/Module.php +++ b/pandora_console/include/lib/Module.php @@ -136,13 +136,16 @@ class Module extends Entity /** * Creates a module object from given data. Avoid query duplication. * - * @param array $data Module information. + * @param array $data Module information. + * @param string $class_str Class type. * * @return PandoraFMS\Module Object. */ - public static function build(array $data=[]) - { - $obj = new Module(); + public static function build( + array $data=[], + string $class_str='\PandoraFMS\Module' + ) { + $obj = new $class_str(); // Set values. foreach ($data as $k => $v) { From a419c2ec468fce7f18da1c296468ebf08b370474 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Wed, 25 Nov 2020 20:16:30 +0100 Subject: [PATCH 17/31] Minor fix avoid notice --- pandora_console/include/functions_ui.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 2506b3e051..8710a77d31 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -4087,13 +4087,17 @@ function ui_get_url_refresh($params=false, $relative=true, $add_post=true) function ui_forced_public_url() { global $config; - $exclusions = preg_split("/[\n\s,]+/", io_safe_output($config['public_url_exclusions'])); + + $exclusions = []; + if (empty($config['public_url_exclusions']) === false) { + $exclusions = preg_split("/[\n\s,]+/", io_safe_output($config['public_url_exclusions'])); + } if (in_array($_SERVER['REMOTE_ADDR'], $exclusions)) { return false; } - return (bool) $config['force_public_url']; + return isset($config['force_public_url']) && (bool) $config['force_public_url']; } From 41daa24c3937e4158fa4dccac0b834f38450f298 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Thu, 26 Nov 2020 17:01:47 +0100 Subject: [PATCH 18/31] interval selector auto-with --- pandora_console/include/functions_html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index bda3a759e0..76dbba17b1 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -1734,7 +1734,7 @@ function html_print_extended_select_for_time( ob_start(); // Use the no_meta parameter because this image is only in the base console. - echo '
'; + echo '
'; html_print_select( $fields, $uniq_name.'_select', From 210f2057cddcfc3d1220db2f56b4eeebded6c496 Mon Sep 17 00:00:00 2001 From: Luis Calvo Date: Mon, 21 Dec 2020 17:56:24 +0100 Subject: [PATCH 19/31] Removes event_statistics view --- .../operation/events/event_statistics.php | 108 ------------------ pandora_console/operation/menu.php | 2 - 2 files changed, 110 deletions(-) delete mode 100644 pandora_console/operation/events/event_statistics.php diff --git a/pandora_console/operation/events/event_statistics.php b/pandora_console/operation/events/event_statistics.php deleted file mode 100644 index 00dd1f4bc6..0000000000 --- a/pandora_console/operation/events/event_statistics.php +++ /dev/null @@ -1,108 +0,0 @@ -'; - - echo ''; - echo ""; - echo '

'.__('Event graph').'

'; - echo ''; - - echo ""; - echo '

'.__('Event graph by user').'

'; - echo ''; - echo ''; - - echo ''; - echo ""; - echo grafico_eventos_total(); - echo ''; - - echo ""; - echo grafico_eventos_usuario(320, 280); - echo ''; - echo ''; - - echo ''; - echo ""; - echo '

'.__('Event graph by agent').'

'; - echo ''; - - echo ""; - echo '

'.__('Amount events validated').'

'; - echo ''; - echo ''; - - $where = ''; -if (!users_is_admin()) { - $where = 'AND event_type NOT IN (\'recon_host_detected\', \'system\',\'error\', \'new_agent\', \'configuration_change\')'; -} - - echo ''; - echo ""; - echo grafico_eventos_grupo(300, 250, $where); - echo ''; - - echo ""; - $extra_filter = []; -if (!users_is_admin()) { - $extra_filter['event_type'] = [ - 'unknown', - 'alert_fired', - 'alert_recovered', - 'alert_ceased', - 'alert_manual_validation', - 'critical', - 'warning', - 'normal', - ]; -} - - echo graph_events_validated(320, 250, $extra_filter); - echo ''; - echo ''; - -echo ''; diff --git a/pandora_console/operation/menu.php b/pandora_console/operation/menu.php index e4221d08bf..7d13bab9dd 100644 --- a/pandora_console/operation/menu.php +++ b/pandora_console/operation/menu.php @@ -393,8 +393,6 @@ if (check_acl($config['id_user'], 0, 'ER') $sub['operation/events/events']['text'] = __('View events'); $sub['operation/events/events']['id'] = 'View events'; $sub['operation/events/events']['pages'] = ['godmode/events/events']; - $sub['operation/events/event_statistics']['text'] = __('Statistics'); - $sub['operation/events/event_statistics']['id'] = 'Statistics'; // If ip doesn't is in list of allowed IP, isn't show this options. include_once 'include/functions_api.php'; From f74476d8eeb15f9c8ffb2e42a86b48f0c7ad7802 Mon Sep 17 00:00:00 2001 From: rafael Date: Mon, 25 Jan 2021 09:20:33 +0100 Subject: [PATCH 20/31] adding deploy script for centos 7 --- .../pandora_deploy_community.sh | 424 ++++++++++++++++++ 1 file changed, 424 insertions(+) create mode 100644 extras/deploy-scripts/pandora_deploy_community.sh diff --git a/extras/deploy-scripts/pandora_deploy_community.sh b/extras/deploy-scripts/pandora_deploy_community.sh new file mode 100644 index 0000000000..98e2990ef2 --- /dev/null +++ b/extras/deploy-scripts/pandora_deploy_community.sh @@ -0,0 +1,424 @@ +#!/bin/bash + +# define variables +PANDORA_CONSOLE=/var/www/html/pandora_console +CONSOLE_PATH=/var/www/html/pandora_console +PANDORA_SERVER_CONF=/etc/pandora/pandora_server.conf +PANDORA_SERVER_BIN=/usr/bin/pandora_server +PANDORA_HA_BIN=/usr/bin/pandora_ha +PANDORA_TABLES_MIN=160 +DBHOST=127.0.0.1 +DBNAME=pandora +DBUSER=pandora +DBPASS=pandora +DBPORT=3306 +LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log" + +# Ansi color code variables +red="\e[0;91m" +green="\e[0;92m" +bold="\e[1m" +cyan="\e[0;36m" +reset="\e[0m" + +# initialice logfile +echo 'Starting deploy' > $LOGFILE + +# reference +# echo -e "${red}fail${reset}" +# echo -e "${green}adios${reset}" + +# Functions + +execute_cmd () { + local cmd="$1" + local msg="$2" + + echo -en "> ${cyan}$msg... ${reset}" + $cmd &>> $LOGFILE + if [ $? -ne 0 ]; then + echo -e "${red}Fail${reset}" + echo "Error installing Pandora FMS for detailed error please check log: $LOGFILE" + exit 1 + else + echo -e "${green}OK${reset}" + return 0 + fi +} + +check_repo_connection () { + execute_cmd "ping -c 2 8.8.8.8" "Checking internet connection" + execute_cmd "ping -c 2 support.artica.es" "Checking Artica repo connection" + execute_cmd "ping -c 2 firefly.artica.es" "Checking Firefly repo connection" +} + +check_root_permissions () { + echo -en "> ${cyan}Checking root account... ${reset}" + if [ "$(whoami)" != "root" ]; then + echo -e "${red}Fail${reset}" + echo "Please use a root account or sudo for installing PandoraFMS" + echo "Error installing Pandora FMS for detailed error please check log: $LOGFILE" + exit 1 + + else + echo -e "${green}OK${reset}" + fi +} + +## Main + +# Pre checks +check_repo_connection +check_root_permissions + +# Creating working directory + +mkdir $HOME/pandora_deploy_tmp &>> $LOGFILE +execute_cmd "cd $HOME/pandora_deploy_tmp" "Moving to workspace: $HOME/pandora_deploy_tmp" + +rm -rf $HOME/pandora_deploy_tmp/*.rpm* + +# Downloading Pandora Packages + +execute_cmd "yum install -y wget" "Installing wget" +execute_cmd "wget http://firefly.artica.es/centos7/pandorafms_server-7.0NG.751.noarch.rpm" "Downloading Pandora FMS Server community" +execute_cmd "wget http://firefly.artica.es/centos7/pandorafms_console-7.0NG.751.noarch.rpm" "Downloading Pandora FMS Console community" +execute_cmd "wget http://firefly.artica.es/centos7/pandorafms_agent_unix-7.0NG.751_x86_64.rpm" "Downloading Pandora FMS Agent community" + +#Installing extra repositiries +extra_repos=" \ +tar \ +yum-utils \ +https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm \ +http://rpms.remirepo.net/enterprise/remi-release-7.rpm \ +https://repo.percona.com/yum/percona-release-latest.noarch.rpm" + +execute_cmd "yum install -y $extra_repos" "Installing extra repositories" +execute_cmd "yum-config-manager --enable remi-php73" "Configuring PHP 7.3" + +# Install percona Database +rm -rf /etc/my.cnf +execute_cmd "yum install -y Percona-Server-server-57" "Installing Percona Server" + +# Console dependencies +console_dependencies=" \ + php \ + postfix \ + php-mcrypt \ + php-cli \ + php-gd \ + php-curl \ + php-session \ + php-mysqlnd \ + php-ldap \ + php-zip \ + php-zlib \ + php-fileinfo \ + php-gettext \ + php-snmp \ + php-mbstring \ + php-pecl-zip \ + php-xmlrpc \ + libxslt \ + wget \ + php-xml \ + httpd \ + mod_php \ + atk \ + avahi-libs \ + cairo \ + cups-libs \ + fribidi \ + gd \ + gdk-pixbuf2 \ + ghostscript \ + graphite2 \ + graphviz \ + gtk2 \ + harfbuzz \ + hicolor-icon-theme \ + hwdata \ + jasper-libs \ + lcms2 \ + libICE \ + libSM \ + libXaw \ + libXcomposite \ + libXcursor \ + libXdamage \ + libXext \ + libXfixes \ + libXft \ + libXi \ + libXinerama \ + libXmu \ + libXrandr \ + libXrender \ + libXt \ + libXxf86vm \ + libcroco \ + libdrm \ + libfontenc \ + libglvnd \ + libglvnd-egl \ + libglvnd-glx \ + libpciaccess \ + librsvg2 \ + libthai \ + libtool-ltdl \ + libwayland-client \ + libwayland-server \ + libxshmfence \ + mesa-libEGL \ + mesa-libGL \ + mesa-libgbm \ + mesa-libglapi \ + pango \ + pixman \ + xorg-x11-fonts-75dpi \ + xorg-x11-fonts-misc \ + poppler-data \ + php-yaml \ + http://firefly.artica.es/centos8/phantomjs-2.1.1-1.el7.x86_64.rpm" +execute_cmd "yum install -y $console_dependencies" "Installing Pandora FMS Console dependencies" + +# Server dependencies +server_dependencies=" \ + vim \ + fping \ + perl-IO-Compress \ + nmap \ + sudo \ + perl-Time-HiRes \ + nfdump \ + net-snmp-utils \ + http://www6.atomicorp.com/channels/atomic/centos/7/x86_64/RPMS/wmi-1.3.14-4.el7.art.x86_64.rpm" +execute_cmd "yum install -y $server_dependencies" "Installing Pandora FMS Server dependencies" + +# SDK VMware perl dependencies +vmware_dependencies=" \ + http://firefly.artica.es/centos8/VMware-vSphere-Perl-SDK-6.5.0-4566394.x86_64.rpm \ + perl-JSON \ + perl-Archive-Zip \ + openssl-devel \ + perl-Crypt-CBC \ + perl-Digest-SHA \ + http://firefly.artica.es/centos7/perl-Crypt-OpenSSL-AES-0.02-1.el7.x86_64.rpm" +execute_cmd "yum install -y $vmware_dependencies" "Installing SDK VMware perl dependencies" + +# Instant client Oracle +oracle_dependencier=" \ + https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-basic-19.8.0.0.0-1.x86_64.rpm \ + https://download.oracle.com/otn_software/linux/instantclient/19800/oracle-instantclient19.8-sqlplus-19.8.0.0.0-1.x86_64.rpm" +execute_cmd "yum install -y $vmware_dependencies" "Installing Oracle Instant client" + +# Disabling SELINUX and firewalld +setenforce 0 +sed -i -e "s/^SELINUX=.*/SELINUX=disabled/g" /etc/sysconfig/selinux +systemctl disable firewalld --now &>> $LOGFILE + +cat > /etc/issue.net << EOF_banner + +Welcome to Pandora FMS appliance on CentOS +------------------------------------------ +$(ip addr | grep -w "inet" | grep -v "127.0.0.1" | grep -v "172.17.0.1" | awk '{print $2}' | awk -F '/' '{print "Go to http://"$1"/pandora_console to manage this server"}') + +You can find more information at http://pandorafms.com + +EOF_banner + +rm -f /etc/issue +ln -s /etc/issue.net /etc/issue + +execute_cmd "echo 'Banner /etc/issue.net' >> /etc/ssh/sshd_config" "Adding SSH banner" + +#Configuring Database +execute_cmd "systemctl start mysqld" "Starting database engine" +export MYSQL_PWD=$(grep "temporary password" /var/log/mysqld.log | rev | cut -d' ' -f1 | rev) +echo """ + SET PASSWORD FOR 'root'@'localhost' = PASSWORD('Pandor4!'); + UNINSTALL PLUGIN validate_password; + SET PASSWORD FOR 'root'@'localhost' = PASSWORD('pandora'); + """ | mysql --connect-expired-password -uroot + +export MYSQL_PWD=$DBPASS +echo -en "> ${cyan}Creating Pandora FMS database...${reset}" +echo "create database $DBNAME" | mysql -uroot -P$DBPORT -h$DBHOST + +if [ $? -ne 0 ]; then + echo -e "${red}Fail${reset}" + echo "Error installing Pandora FMS for detailed error please check log: $LOGFILE" + exit 1 +else + echo -e "${green}OK${reset}" +fi + +echo "GRANT ALL PRIVILEGES ON $DBNAME.* TO \"$DBUSER\"@'%' identified by \"$DBPASS\"" | mysql -uroot -P$DBPORT -h$DBHOST + +#Generating my.cnf +POOL_SIZE=$(grep -i total /proc/meminfo | head -1 | awk '{printf "%.2f \n", $(NF-1)*0.4/1024}' | sed "s/\\..*$/M/g") +cat > /etc/my.cnf << EO_CONFIG_F +[mysqld] +datadir=/var/lib/mysql +socket=/var/lib/mysql/mysql.sock +user=mysql +character-set-server=utf8 +skip-character-set-client-handshake +# Disabling symbolic-links is recommended to prevent assorted security risks +symbolic-links=0 +# Mysql optimizations for Pandora FMS +# Please check the documentation in http://pandorafms.com for better results + +max_allowed_packet = 64M +innodb_buffer_pool_size = $POOL_SIZE +innodb_lock_wait_timeout = 90 +innodb_file_per_table +innodb_flush_log_at_trx_commit = 0 +innodb_flush_method = O_DIRECT +innodb_log_file_size = 64M +innodb_log_buffer_size = 16M +innodb_io_capacity = 100 +thread_cache_size = 8 +thread_stack = 256K +max_connections = 100 + +key_buffer_size=4M +read_buffer_size=128K +read_rnd_buffer_size=128K +sort_buffer_size=128K +join_buffer_size=4M + +query_cache_type = 1 +query_cache_size = 64M +query_cache_min_res_unit = 2k +query_cache_limit = 256K + +sql_mode="" + +[mysqld_safe] +log-error=/var/log/mysqld.log +pid-file=/var/run/mysqld/mysqld.pid + +EO_CONFIG_F + +execute_cmd "systemctl restart mysqld" "Configuring database engine" + +# Enable Services +execute_cmd "systemctl enable mysqld --now" "Enabling Database service" +execute_cmd "systemctl enable httpd --now" "Enabling HTTPD service" + + +# Install Pandora +execute_cmd "yum install -y $HOME/pandora_deploy_tmp/pandorafms*.rpm" "installing PandoraFMS packages" + +# Populate Database +echo -en "> ${cyan}Loading pandoradb.sql to $DBNAME database...${reset}" +mysql -u$DBUSER -P$DBPORT -h$DBHOST $DBNAME < $PANDORA_CONSOLE/pandoradb.sql &>> $LOGFILE +if [ $? -ne 0 ]; then + echo -e "${red}Fail${reset}" + echo "Error installing Pandora FMS for detailed error please check log: $LOGFILE" + exit 1 +else + echo -e "${green}OK${reset}" +fi + +echo -en "> ${cyan}Loading pandoradb_data.sql to $DBNAME database...${reset}" +mysql -u$DBUSER -P$DBPORT -h$DBHOST $DBNAME < $PANDORA_CONSOLE/pandoradb_data.sql &>> $LOGFILE +if [ $? -ne 0 ]; then + echo -e "${red}Fail${reset}" + echo "Error installing Pandora FMS for detailed error please check log: $LOGFILE" + exit 1 +else + echo -e "${green}OK${reset}" +fi + +# configure console +cat > $CONSOLE_PATH/include/config.php << EO_CONFIG_F + /etc/httpd/conf.d/pandora.conf << EO_CONFIG_F + + Options Indexes FollowSymLinks + AllowOverride All + Require all granted + + +EO_CONFIG_F + +# Temporal quitar htaccess + +sed -i -e "s/php_flag engine off//g" $PANDORA_CONSOLE/images/.htaccess +sed -i -e "s/php_flag engine off//g" $PANDORA_CONSOLE/attachment/.htaccess + +# Fixing console permissions +chmod 600 $CONSOLE_PATH/include/config.php +chown apache. $CONSOLE_PATH/include/config.php +mv $CONSOLE_PATH/install.php $CONSOLE_PATH/install.done + +# Prepare php.ini +sed -i -e "s/^max_input_time.*/max_input_time = -1/g" /etc/php.ini +sed -i -e "s/^max_execution_time.*/max_execution_time = 0/g" /etc/php.ini +sed -i -e "s/^upload_max_filesize.*/upload_max_filesize = 800M/g" /etc/php.ini +sed -i -e "s/^memory_limit.*/memory_limit = 500M/g" /etc/php.ini + +cat > /var/www/html/index.html << EOF_INDEX + +EOF_INDEX + +execute_cmd "systemctl restart httpd" "Restarting httpd after configuration" + +# prepare snmptrapd +cat > /etc/snmp/snmptrapd.conf << EOF +authCommunity log public +disableAuthorization yes +EOF + +# Prepare Server conf +sed -i -e "s/^dbhost.*/dbhost $DBHOST/g" $PANDORA_SERVER_CONF +sed -i -e "s/^dbname.*/dbname $DBNAME/g" $PANDORA_SERVER_CONF +sed -i -e "s/^dbuser.*/dbuser $DBUSER/g" $PANDORA_SERVER_CONF +sed -i -e "s|^dbpass.*|dbpass $DBPASS|g" $PANDORA_SERVER_CONF +sed -i -e "s/^dbport.*/dbport $DBPORT/g" $PANDORA_SERVER_CONF + +# Set Oracle environment for pandora_server +cat > /etc/pandora/pandora_server.env << 'EOF_ENV' +#!/bin/bash +VERSION=19.8 +export PATH=$PATH:$HOME/bin:/usr/lib/oracle/$VERSION/client64/bin +export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/oracle/$VERSION/client64/lib +export ORACLE_HOME=/usr/lib/oracle/$VERSION/client64 +EOF_ENV + +# Enable pandora ha service +systemctl enable pandora_server --now &>> $LOGFILE +execute_cmd "systemctl start pandora_server" "Starting Pandora FMS Server" + +# starting tentacle server +systemctl enable tentacle_serverd &>> $LOGFILE +execute_cmd "service tentacle_serverd start" "Starting Tentacle Server" + +# Enabling condole cron +execute_cmd "echo \"* * * * * root wget -q -O - --no-check-certificate http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log\" >> /etc/crontab" "Enabling Pandora FMS Console cron" + +## Enabling agent +systemctl enable pandora_agent_daemon &>> $LOGFILE +execute_cmd "systemctl start pandora_agent_daemon" "starting Pandora FMS Agent" + +execute_cmd "echo done" "Pandora FMS Community installed" + +GREEN='\033[01;32m' +NONE='\033[0m' + +ip addr | grep -w "inet" | grep -v "127.0.0.1" | grep -v -e "172.1[0-9].0.1" | awk '{print $2}' | awk -v g=$GREEN -v n=$NONE -F '/' '{printf "\n-> Go to "g"http://"$1"/pandora_console"n" to manage this server \n"}' \ No newline at end of file From 84f3ead86a02828c520547b151ae4be4a98505ed Mon Sep 17 00:00:00 2001 From: Luis Calvo Date: Mon, 25 Jan 2021 11:51:53 +0100 Subject: [PATCH 21/31] Added csv, json, xml formats to save report to disk task --- pandora_console/include/functions_cron.php | 42 ++-------------------- 1 file changed, 3 insertions(+), 39 deletions(-) diff --git a/pandora_console/include/functions_cron.php b/pandora_console/include/functions_cron.php index 7895779e25..dd51e10cb3 100644 --- a/pandora_console/include/functions_cron.php +++ b/pandora_console/include/functions_cron.php @@ -600,45 +600,6 @@ function cron_list_table() $data[0] = ''; } - $data[1] = $task['id_usuario']; - $data[2] = db_get_value( - 'name', - 'tuser_task', - 'id', - $task['id_user_task'] - ); - - $args = unserialize($task['args']); - $report = reports_get_report($args[0]); - - // Check ACL in reports_get_report return false. - if ($report === false) { - continue; - } - - $path = $args[1]; - $data[2] .= '
- '.__('Report').":
".$report['name'].''; - $data[2] .= '
- '.__('Path').': '.$path.''; - break; - - case 'cron_task_save_xml_report_to_disk': - case 'cron_task_save_json_report_to_disk': - case 'cron_task_save_csv_report_to_disk': - - if ($write_perms || $manage_pandora) { - $data[0] = ''; - $data[0] .= html_print_image( - 'images/target.png', - true, - ['title' => __('Force run')] - ); - $data[0] .= ''; - } else { - $data[0] = ''; - } - $data[1] = $task['id_usuario']; $data[2] = db_get_value('name', 'tuser_task', 'id', $task['id_user_task']); $args = unserialize($task['args']); @@ -650,9 +611,12 @@ function cron_list_table() } $path = $args[1]; + $report_type = $args[3]; $data[2] .= '
- '.__('Report').": ".$report['name'].''; $data[2] .= '
- '.__('Path').': '.$path.''; + $data[2] .= '
- '.__('Report type').': '.$report_type; + break; case 'cron_task_do_backup': From d5b99f255a57e8099fbd0cb2a1626a6eb453ed58 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Tue, 26 Jan 2021 13:46:12 +0100 Subject: [PATCH 22/31] Solved issue --- pandora_console/godmode/wizards/DiscoveryTaskList.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php index 94177226c7..a37a04d6d5 100644 --- a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php +++ b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php @@ -1218,7 +1218,7 @@ class DiscoveryTaskList extends HTML // Header information. if ((int) $task['status'] <= 0 && empty($summary)) { - if ($task['type'] == DISCOVERY_APP_VMWARE) { + if ($task['type'] == DISCOVERY_APP_VMWARE && $task['utimestamp'] != 0) { $outputMessage = __('Task completed.'); } else { $outputMessage = __('This task has never executed'); From dc3ee2d553be22a3b288cfc297a28ec08577cf8b Mon Sep 17 00:00:00 2001 From: Luis Calvo Date: Tue, 26 Jan 2021 16:36:13 +0100 Subject: [PATCH 23/31] Added task save report to disk changes to MR --- pandora_console/extras/mr/44.sql | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/pandora_console/extras/mr/44.sql b/pandora_console/extras/mr/44.sql index 527d1e0b2f..3241c2001e 100644 --- a/pandora_console/extras/mr/44.sql +++ b/pandora_console/extras/mr/44.sql @@ -133,4 +133,19 @@ ADD COLUMN `field16` TEXT NOT NULL AFTER `field15` ALTER TABLE `trecon_task` MODIFY COLUMN `review_mode` TINYINT(1) UNSIGNED DEFAULT 1; -COMMIT; +DELETE FROM `tuser_task` WHERE id = 6; + +UPDATE `tuser_task` SET `parameters`='a:4:{i:0;a:6:{s:11:"description";s:28:"Report pending to be created";s:5:"table";s:7:"treport";s:8:"field_id";s:9:"id_report";s:10:"field_name";s:4:"name";s:4:"type";s:3:"int";s:9:"acl_group";s:8:"id_group";}i:1;a:2:{s:11:"description";s:426:"Save to disk in pathThe Apache user should have read-write access on this folder. E.g. /var/www/html/pandora_console/attachment";s:4:"type";s:6:"string";}i:2;a:2:{s:11:"description";s:16:"File nane prefix";s:4:"type";s:6:"string";}i:3;a:2:{s:11:"description";s:11:"Report Type";s:4:"type";s:11:"report_type";}}' WHERE `id`=3; + +UPDATE `tuser_task_scheduled` SET + `args` = REPLACE (`args`, 'a:3', 'a:5'), + `args`= REPLACE(`args`, 's:15:"first_execution"', 'i:2;s:0:"";i:3;s:3:"PDF";s:15:"first_execution"') + WHERE `id_user_task` = 3; + +UPDATE `tuser_task_scheduled` SET + `id_user_task` = 3, + `args` = REPLACE (`args`, 'a:3', 'a:5'), + `args`= REPLACE(`args`, 's:15:"first_execution"', 'i:2;s:0:"";i:3;s:3:"XML";s:15:"first_execution"') + WHERE `id_user_task` = 6; + +COMMIT; \ No newline at end of file From 954c12646b6609e0264745fd3a8c045262d313ff Mon Sep 17 00:00:00 2001 From: Luis Calvo Date: Tue, 26 Jan 2021 16:46:45 +0100 Subject: [PATCH 24/31] Added task save report to disk changes to migrate --- .../pandoradb_migrate_6.0_to_7.0.mysql.sql | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql index b06a4c3c56..46cbef2bbc 100644 --- a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql @@ -2525,6 +2525,20 @@ ALTER TABLE `tnetflow_filter` MODIFY COLUMN `router_ip` text NOT NULL; -- ---------------------------------------------------------------------- UPDATE tuser_task set parameters = 'a:5:{i:0;a:6:{s:11:\"description\";s:28:\"Report pending to be created\";s:5:\"table\";s:7:\"treport\";s:8:\"field_id\";s:9:\"id_report\";s:10:\"field_name\";s:4:\"name\";s:4:\"type\";s:3:\"int\";s:9:\"acl_group\";s:8:\"id_group\";}i:1;a:2:{s:11:\"description\";s:46:\"Send to email addresses (separated by a comma)\";s:4:\"type\";s:4:\"text\";}i:2;a:2:{s:11:\"description\";s:7:\"Subject\";s:8:\"optional\";i:1;}i:3;a:3:{s:11:\"description\";s:7:\"Message\";s:4:\"type\";s:4:\"text\";s:8:\"optional\";i:1;}i:4;a:2:{s:11:\"description\";s:11:\"Report Type\";s:4:\"type\";s:11:\"report_type\";}}' where function_name = "cron_task_generate_report"; INSERT IGNORE INTO tuser_task VALUES (8, 'cron_task_generate_csv_log', 'a:1:{i:0;a:2:{s:11:"description";s:14:"Send to e-mail";s:4:"type";s:4:"text";}}', 'Send csv log'); +UPDATE `tuser_task` SET `parameters`='a:4:{i:0;a:6:{s:11:"description";s:28:"Report pending to be created";s:5:"table";s:7:"treport";s:8:"field_id";s:9:"id_report";s:10:"field_name";s:4:"name";s:4:"type";s:3:"int";s:9:"acl_group";s:8:"id_group";}i:1;a:2:{s:11:"description";s:426:"Save to disk in pathThe Apache user should have read-write access on this folder. E.g. /var/www/html/pandora_console/attachment";s:4:"type";s:6:"string";}i:2;a:2:{s:11:"description";s:16:"File nane prefix";s:4:"type";s:6:"string";}i:3;a:2:{s:11:"description";s:11:"Report Type";s:4:"type";s:11:"report_type";}}' WHERE `id`=3; +DELETE FROM `tuser_task` WHERE id = 6; + +-- Migrate old tasks +UPDATE `tuser_task_scheduled` SET + `args` = REPLACE (`args`, 'a:3', 'a:5'), + `args`= REPLACE(`args`, 's:15:"first_execution"', 'i:2;s:0:"";i:3;s:3:"PDF";s:15:"first_execution"') + WHERE `id_user_task` = 3; + +UPDATE `tuser_task_scheduled` SET + `id_user_task` = 3, + `args` = REPLACE (`args`, 'a:3', 'a:5'), + `args`= REPLACE(`args`, 's:15:"first_execution"', 'i:2;s:0:"";i:3;s:3:"XML";s:15:"first_execution"') + WHERE `id_user_task` = 6; -- ---------------------------------------------------------------------- -- ADD message in table 'tnews' @@ -3967,4 +3981,5 @@ SELECT `id_recon_script`,`type`, `name`, `description`, `script`, `macros` FROM DELETE FROM `tconfig` WHERE `token` = 'ipam_installed'; -DELETE FROM `tconfig` WHERE `token` = 'ipam_recon_script_id'; \ No newline at end of file +DELETE FROM `tconfig` WHERE `token` = 'ipam_recon_script_id'; + From a09ee55d137cc08fdb9010aee64b9bf42585af14 Mon Sep 17 00:00:00 2001 From: Luis Calvo Date: Wed, 27 Jan 2021 09:42:50 +0100 Subject: [PATCH 25/31] Added event_statistics to delete txt --- pandora_console/extras/delete_files/delete_files.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/pandora_console/extras/delete_files/delete_files.txt b/pandora_console/extras/delete_files/delete_files.txt index c647447c84..ce06258202 100644 --- a/pandora_console/extras/delete_files/delete_files.txt +++ b/pandora_console/extras/delete_files/delete_files.txt @@ -1,5 +1,6 @@ operation/servers/recon_view.php operation/users/webchat.php +operation/events/event_statistics.php include/javascript/webchat.js attachment/pandora_chat.log.json.txt attachment/pandora_chat.user_list.json.txt From d3612c9ba913f773774f46defb22c7eee9676306 Mon Sep 17 00:00:00 2001 From: rafael Date: Wed, 27 Jan 2021 12:29:49 +0100 Subject: [PATCH 26/31] adding features --- .../pandora_deploy_community.sh | 283 ++++++++++++++---- 1 file changed, 218 insertions(+), 65 deletions(-) diff --git a/extras/deploy-scripts/pandora_deploy_community.sh b/extras/deploy-scripts/pandora_deploy_community.sh index 98e2990ef2..59cb3abef0 100644 --- a/extras/deploy-scripts/pandora_deploy_community.sh +++ b/extras/deploy-scripts/pandora_deploy_community.sh @@ -21,24 +21,32 @@ bold="\e[1m" cyan="\e[0;36m" reset="\e[0m" -# initialice logfile -echo 'Starting deploy' > $LOGFILE - -# reference -# echo -e "${red}fail${reset}" -# echo -e "${green}adios${reset}" - # Functions execute_cmd () { local cmd="$1" local msg="$2" - - echo -en "> ${cyan}$msg... ${reset}" + + echo -e "${cyan}$msg...${reset}" $cmd &>> $LOGFILE if [ $? -ne 0 ]; then echo -e "${red}Fail${reset}" + [ "$3" ] && echo "$3" echo "Error installing Pandora FMS for detailed error please check log: $LOGFILE" + rm -rf $HOME/pandora_deploy_tmp &>> $LOGFILE + exit 1 + else + echo -e "\e[1A\e ${cyan}$msg...${reset} ${green}OK${reset}" + return 0 + fi +} + +check_cmd_status () { + if [ $? -ne 0 ]; then + echo -e "${red}Fail${reset}" + [ "$1" ] && echo "$1" + echo "Error installing Pandora FMS for detailed error please check log: $LOGFILE" + rm -rf $HOME/pandora_deploy_tmp/*.rpm* &>> $LOGFILE exit 1 else echo -e "${green}OK${reset}" @@ -46,44 +54,87 @@ execute_cmd () { fi } +check_pre_pandora () { + export MYSQL_PWD=$DBPASS + + echo -en "${cyan}Checking environment ... ${reset}" + rpm -qa | grep pandora &>> /dev/null && local fail=true + [ -d "$CONSOLE_PATH" ] && local fail=true + [ -f /usr/bin/pandora_server ] && local fail=true + echo "use $DBNAME" | mysql -uroot -P$DBPORT -h$DBHOST &>> /dev/null && local fail=true + + [ ! $fail ] + check_cmd_status 'Error there is a current Pandora FMS installation on this node, please remove it to execute a clean install' +} + check_repo_connection () { execute_cmd "ping -c 2 8.8.8.8" "Checking internet connection" - execute_cmd "ping -c 2 support.artica.es" "Checking Artica repo connection" - execute_cmd "ping -c 2 firefly.artica.es" "Checking Firefly repo connection" + execute_cmd "ping -c 2 firefly.artica.es" "Checking Community repo" + execute_cmd "ping -c 2 support.artica.es" "Checking Enterprise repo" } check_root_permissions () { - echo -en "> ${cyan}Checking root account... ${reset}" + echo -en "${cyan}Checking root account... ${reset}" if [ "$(whoami)" != "root" ]; then echo -e "${red}Fail${reset}" echo "Please use a root account or sudo for installing PandoraFMS" echo "Error installing Pandora FMS for detailed error please check log: $LOGFILE" exit 1 - else - echo -e "${green}OK${reset}" + else + echo -e "${green}OK${reset}" fi } -## Main +## Main + +# Centos Version +if [ ! "$(grep -i centos /etc/redhat-release)" ]; then + printf "${red}Error this is not a Centos Base system, this installer is compatible with Centos systems only${reset}\n" + exit 1 +fi + +execute_cmd "grep -i centos /etc/redhat-release" "Checking Centos" 'Error This is not a Centos Base system' + +echo -en "${cyan}Check Centos Version...${reset}" +[ $(sed -nr 's/VERSION_ID+=\s*"([0-9])"$/\1/p' /etc/os-release) -eq '7' ] +check_cmd_status 'Error OS version, Centos 7 is expected' + +# initialice logfile +execute_cmd "echo 'Starting deploy' > $LOGFILE" "All installer activity is logged on $LOGFILE" # Pre checks -check_repo_connection +# Root permisions check_root_permissions -# Creating working directory +# Pre installed pandora +check_pre_pandora +# Connectivity +check_repo_connection + +# Systemd +execute_cmd "systemctl status" "Cheking SystemD" 'This is not a SystemD enable system, if tryng to use in a docker env plese check: https://github.com/pandorafms/pandorafms/tree/develop/extras/docker/centos8' + +# Check memomry greather or equal to 2G +execute_cmd "[ $(grep MemTotal /proc/meminfo | awk '{print $2}') -le 2000000 ]" 'Checking memory (required: 2 GB)' + +# Check disk size at least 10 Gb free space +execute_cmd "[ $(df -BM / | tail -1 | awk '{print $4}' | tr -d M) -gt 10000 ]" 'Checking Disk (required: 10 GB free min)' + +# Execute tools check +execute_cmd "awk --version" 'Checking needed tools: awk' +execute_cmd "grep --version" 'Checking needed tools: grep' +execute_cmd "sed --version" 'Checking needed tools: sed' +execute_cmd "yum --version" 'Checking needed tools: yum' + +# Creating working directory +rm -rf $HOME/pandora_deploy_tmp/*.rpm* &>> $LOGFILE mkdir $HOME/pandora_deploy_tmp &>> $LOGFILE execute_cmd "cd $HOME/pandora_deploy_tmp" "Moving to workspace: $HOME/pandora_deploy_tmp" -rm -rf $HOME/pandora_deploy_tmp/*.rpm* - -# Downloading Pandora Packages - +#Installing wget execute_cmd "yum install -y wget" "Installing wget" -execute_cmd "wget http://firefly.artica.es/centos7/pandorafms_server-7.0NG.751.noarch.rpm" "Downloading Pandora FMS Server community" -execute_cmd "wget http://firefly.artica.es/centos7/pandorafms_console-7.0NG.751.noarch.rpm" "Downloading Pandora FMS Console community" -execute_cmd "wget http://firefly.artica.es/centos7/pandorafms_agent_unix-7.0NG.751_x86_64.rpm" "Downloading Pandora FMS Agent community" #Installing extra repositiries extra_repos=" \ @@ -94,10 +145,10 @@ http://rpms.remirepo.net/enterprise/remi-release-7.rpm \ https://repo.percona.com/yum/percona-release-latest.noarch.rpm" execute_cmd "yum install -y $extra_repos" "Installing extra repositories" -execute_cmd "yum-config-manager --enable remi-php73" "Configuring PHP 7.3" +execute_cmd "yum-config-manager --enable remi-php73" "Configuring PHP" # Install percona Database -rm -rf /etc/my.cnf +[ -f /etc/resolv.conf ] && rm -rf /etc/my.cnf execute_cmd "yum install -y Percona-Server-server-57" "Installing Percona Server" # Console dependencies @@ -184,6 +235,7 @@ execute_cmd "yum install -y $console_dependencies" "Installing Pandora FMS Conso # Server dependencies server_dependencies=" \ + perl \ vim \ fping \ perl-IO-Compress \ @@ -235,23 +287,16 @@ execute_cmd "echo 'Banner /etc/issue.net' >> /etc/ssh/sshd_config" "Adding SSH b #Configuring Database execute_cmd "systemctl start mysqld" "Starting database engine" export MYSQL_PWD=$(grep "temporary password" /var/log/mysqld.log | rev | cut -d' ' -f1 | rev) -echo """ +echo """ SET PASSWORD FOR 'root'@'localhost' = PASSWORD('Pandor4!'); UNINSTALL PLUGIN validate_password; SET PASSWORD FOR 'root'@'localhost' = PASSWORD('pandora'); - """ | mysql --connect-expired-password -uroot + """ | mysql --connect-expired-password -uroot export MYSQL_PWD=$DBPASS -echo -en "> ${cyan}Creating Pandora FMS database...${reset}" +echo -en "${cyan}Creating Pandora FMS database...${reset}" echo "create database $DBNAME" | mysql -uroot -P$DBPORT -h$DBHOST - -if [ $? -ne 0 ]; then - echo -e "${red}Fail${reset}" - echo "Error installing Pandora FMS for detailed error please check log: $LOGFILE" - exit 1 -else - echo -e "${green}OK${reset}" -fi +check_cmd_status 'Error creating database pandora, is this an empty node? if you have a previus installation please contact with support.' echo "GRANT ALL PRIVILEGES ON $DBNAME.* TO \"$DBUSER\"@'%' identified by \"$DBPASS\"" | mysql -uroot -P$DBPORT -h$DBHOST @@ -303,36 +348,33 @@ EO_CONFIG_F execute_cmd "systemctl restart mysqld" "Configuring database engine" -# Enable Services -execute_cmd "systemctl enable mysqld --now" "Enabling Database service" -execute_cmd "systemctl enable httpd --now" "Enabling HTTPD service" - +# Downloading Pandora Packages +execute_cmd "wget http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_server-7.0NG.noarch.rpm" "Downloading Pandora FMS Server community" +execute_cmd "wget http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_console-7.0NG.noarch.rpm" "Downloading Pandora FMS Console community" +execute_cmd "wget http://firefly.artica.es/centos7/pandorafms_agent_unix-7.0NG.751_x86_64.rpm" "Downloading Pandora FMS Agent community" # Install Pandora execute_cmd "yum install -y $HOME/pandora_deploy_tmp/pandorafms*.rpm" "installing PandoraFMS packages" +# Copy gotty utility +execute_cmd "wget https://github.com/yudai/gotty/releases/download/v1.0.1/gotty_linux_amd64.tar.gz" 'Dowloading gotty util' +tar xvzf gotty_linux_amd64.tar.gz &>> $LOGFILE +execute_cmd "mv gotty /usr/bin/" 'Installing gotty util' + +# Enable Services +execute_cmd "systemctl enable mysqld --now" "Enabling Database service" +execute_cmd "systemctl enable httpd --now" "Enabling HTTPD service" + # Populate Database -echo -en "> ${cyan}Loading pandoradb.sql to $DBNAME database...${reset}" +echo -en "${cyan}Loading pandoradb.sql to $DBNAME database...${reset}" mysql -u$DBUSER -P$DBPORT -h$DBHOST $DBNAME < $PANDORA_CONSOLE/pandoradb.sql &>> $LOGFILE -if [ $? -ne 0 ]; then - echo -e "${red}Fail${reset}" - echo "Error installing Pandora FMS for detailed error please check log: $LOGFILE" - exit 1 -else - echo -e "${green}OK${reset}" -fi +check_cmd_status 'Error Loading database schema' -echo -en "> ${cyan}Loading pandoradb_data.sql to $DBNAME database...${reset}" +echo -en "${cyan}Loading pandoradb_data.sql to $DBNAME database...${reset}" mysql -u$DBUSER -P$DBPORT -h$DBHOST $DBNAME < $PANDORA_CONSOLE/pandoradb_data.sql &>> $LOGFILE -if [ $? -ne 0 ]; then - echo -e "${red}Fail${reset}" - echo "Error installing Pandora FMS for detailed error please check log: $LOGFILE" - exit 1 -else - echo -e "${green}OK${reset}" -fi +check_cmd_status 'Error Loading database schema data' -# configure console +# Configure console cat > $CONSOLE_PATH/include/config.php << EO_CONFIG_F $CONSOLE_PATH/include/config.php << EO_CONFIG_F \$config["dbpass"]="$DBPASS"; \$config["dbhost"]="$DBHOST"; \$config["homedir"]="$PANDORA_CONSOLE"; -\$config["homeurl"]="/pandora_console"; -error_reporting(0); +\$config["homeurl"]="/pandora_console"; +error_reporting(0); \$ownDir = dirname(__FILE__) . '/'; include (\$ownDir . "config_process.php"); @@ -357,13 +399,29 @@ cat > /etc/httpd/conf.d/pandora.conf << EO_CONFIG_F EO_CONFIG_F -# Temporal quitar htaccess +# Add ws proxy options to apache. +cat >> /etc/httpd/conf.modules.d/00-proxy.conf << 'EO_HTTPD_MOD' +LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so +EO_HTTPD_MOD + +cat >> /etc/httpd/conf.d/wstunnel.conf << 'EO_HTTPD_WSTUNNEL' +ProxyRequests Off + + Require all granted + + +ProxyPass /ws ws://127.0.0.1:8080 +ProxyPassReverse /ws ws://127.0.0.1:8080 + +EO_HTTPD_WSTUNNEL + +# Temporal quitar htaccess sed -i -e "s/php_flag engine off//g" $PANDORA_CONSOLE/images/.htaccess sed -i -e "s/php_flag engine off//g" $PANDORA_CONSOLE/attachment/.htaccess # Fixing console permissions -chmod 600 $CONSOLE_PATH/include/config.php +chmod 600 $CONSOLE_PATH/include/config.php chown apache. $CONSOLE_PATH/include/config.php mv $CONSOLE_PATH/install.php $CONSOLE_PATH/install.done @@ -401,6 +459,97 @@ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/oracle/$VERSION/client64/lib export ORACLE_HOME=/usr/lib/oracle/$VERSION/client64 EOF_ENV +# Kernel optimization +cat >> /etc/sysctl.conf < /etc/logrotate.d/pandora_server < /etc/logrotate.d/pandora_agent <> $LOGFILE + +# Configure websocket to be started at start. +systemctl enable pandora_websocket_engine &>> $LOGFILE + # Enable pandora ha service systemctl enable pandora_server --now &>> $LOGFILE execute_cmd "systemctl start pandora_server" "Starting Pandora FMS Server" @@ -411,14 +560,18 @@ execute_cmd "service tentacle_serverd start" "Starting Tentacle Server" # Enabling condole cron execute_cmd "echo \"* * * * * root wget -q -O - --no-check-certificate http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log\" >> /etc/crontab" "Enabling Pandora FMS Console cron" - -## Enabling agent +echo "* * * * * root wget -q -O - --no-check-certificate http://127.0.0.1/pandora_console/enterprise/cron.php >> $PANDORA_CONSOLE/log/cron.log" >> /etc/crontab +## Enabling agent systemctl enable pandora_agent_daemon &>> $LOGFILE execute_cmd "systemctl start pandora_agent_daemon" "starting Pandora FMS Agent" execute_cmd "echo done" "Pandora FMS Community installed" +cd +execute_cmd "rm -rf $HOME/pandora_deploy_tmp" "Removing temporary files" GREEN='\033[01;32m' NONE='\033[0m' -ip addr | grep -w "inet" | grep -v "127.0.0.1" | grep -v -e "172.1[0-9].0.1" | awk '{print $2}' | awk -v g=$GREEN -v n=$NONE -F '/' '{printf "\n-> Go to "g"http://"$1"/pandora_console"n" to manage this server \n"}' \ No newline at end of file +[ "$(curl -s ifconfig.me)" ] && ipplublic=$(curl -s ifconfig.me) +printf " -> Go to Public ${green}http://"$ipplublic"/pandora_console${reset} to manage this server" +ip addr | grep -w "inet" | grep -v "127.0.0.1" | grep -v -e "172.1[0-9].0.1" | awk '{print $2}' | awk -v g=$GREEN -v n=$NONE -F '/' '{printf "\n -> Go to Local "g"http://"$1"/pandora_console"n" to manage this server \n -> Use this credentials to login in the console "g"[ User: admin / Password: pandora ]"n" \n"}' From 905f8801b7963c00d38ffff83a93fc6bc98298cb Mon Sep 17 00:00:00 2001 From: Luis Date: Wed, 27 Jan 2021 13:37:20 +0100 Subject: [PATCH 27/31] Update 44.sql --- pandora_console/extras/mr/44.sql | 1 - 1 file changed, 1 deletion(-) diff --git a/pandora_console/extras/mr/44.sql b/pandora_console/extras/mr/44.sql index ecb2280f48..aaa2202e56 100644 --- a/pandora_console/extras/mr/44.sql +++ b/pandora_console/extras/mr/44.sql @@ -150,7 +150,6 @@ UPDATE `tuser_task_scheduled` SET `args`= REPLACE(`args`, 's:15:"first_execution"', 'i:2;s:0:"";i:3;s:3:"XML";s:15:"first_execution"') WHERE `id_user_task` = 6; -COMMIT; ALTER TABLE `ttag` MODIFY COLUMN `name` text NOT NULL default ''; COMMIT; From ff80c974dae472ba0e10c581e374a000aa854b39 Mon Sep 17 00:00:00 2001 From: artica Date: Thu, 28 Jan 2021 01:00:18 +0100 Subject: [PATCH 28/31] Auto-updated build strings. --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.rhel7.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/lib/PandoraFMS/PluginTools.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 25 files changed, 25 insertions(+), 25 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index facda2ea16..4184fa468b 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.752-210127 +Version: 7.0NG.752-210128 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index c1d6de00af..e0a33a305b 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.752-210127" +pandora_version="7.0NG.752-210128" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 639cb8ce72..0b11f9a048 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -1016,7 +1016,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.752'; -use constant AGENT_BUILD => '210127'; +use constant AGENT_BUILD => '210128'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 4fc92c76c6..68c3eb64b9 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.752 -%define release 210127 +%define release 210128 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index feab1f5747..6c68ea6850 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.752 -%define release 210127 +%define release 210128 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index 7f990b0b0e..09b1c04fa4 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.752" -PI_BUILD="210127" +PI_BUILD="210128" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 9bb75c8323..d342954307 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{210127} +{210128} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 6d765916c4..b66e7ca954 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.752(Build 210127)") +#define PANDORA_VERSION ("7.0NG.752(Build 210128)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 1dea94f568..e1fdffe78f 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.752(Build 210127))" + VALUE "ProductVersion", "(7.0NG.752(Build 210128))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 38a661ab1a..18e827f7fc 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.752-210127 +Version: 7.0NG.752-210128 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index 77701707b9..4cd781a928 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.752-210127" +pandora_version="7.0NG.752-210128" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 20ef0ffd12..2667855afb 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -20,7 +20,7 @@ /** * Pandora build version and version */ -$build_version = 'PC210127'; +$build_version = 'PC210128'; $pandora_version = 'v7.0NG.752'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 50ecd0df0f..884f217623 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -129,7 +129,7 @@
[ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index 985181c6e8..7ff4a34cdc 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.752 -%define release 210127 +%define release 210128 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index f1353b18ac..bf2c4883f4 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.752 -%define release 210127 +%define release 210128 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 1742edca8d..01556b69eb 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.752" -PI_BUILD="210127" +PI_BUILD="210128" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index e2631ee780..874c8bd758 100755 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -35,7 +35,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.752 PS210127"; +my $version = "7.0NG.752 PS210128"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 1098ac7a14..ff37a3d13d 100755 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -36,7 +36,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "7.0NG.752 PS210127"; +my $version = "7.0NG.752 PS210128"; # save program name for logging my $progname = basename($0); From e6cf2fe9eb56bd07036b552a8829b8a869e11bad Mon Sep 17 00:00:00 2001 From: Luis Date: Thu, 28 Jan 2021 11:57:52 +0100 Subject: [PATCH 29/31] Remove visual console manager extension --- pandora_console/extras/delete_files/delete_files.txt | 4 +++- pandora_console/godmode/reporting/map_builder.php | 1 - pandora_console/godmode/reporting/visual_console_favorite.php | 1 - 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pandora_console/extras/delete_files/delete_files.txt b/pandora_console/extras/delete_files/delete_files.txt index ce06258202..4524cbbd79 100644 --- a/pandora_console/extras/delete_files/delete_files.txt +++ b/pandora_console/extras/delete_files/delete_files.txt @@ -69,4 +69,6 @@ enterprise/extensions/ipam/include/javascript/ipam.js enterprise/extensions/ipam/include/javascript/IpamMapController.js enterprise/extensions/ipam/ipam_action.php enterprise/extensions/ipam.php -enterprise/extensions/ipam \ No newline at end of file +enterprise/extensions/ipam +enterprise/extensions/disabled/visual_console_manager.php +enterprise/extensions/visual_console_manager.php \ No newline at end of file diff --git a/pandora_console/godmode/reporting/map_builder.php b/pandora_console/godmode/reporting/map_builder.php index 93f809c21b..f93bfc825d 100644 --- a/pandora_console/godmode/reporting/map_builder.php +++ b/pandora_console/godmode/reporting/map_builder.php @@ -42,7 +42,6 @@ if (!$is_metaconsole) { $url_visual_console_favorite = 'index.php?sec=screen&sec2=screens/screens&action=visualmap_favorite'; $url_visual_console_template = 'index.php?sec=screen&sec2=screens/screens&action=visualmap_template'; $url_visual_console_template_wizard = 'index.php?sec=screen&sec2=screens/screens&action=visualmap_wizard'; - $url_visual_console_manager = 'index.php?sec=screen&sec2=enterprise/extensions/visual_console_manager'; } $pure = (int) get_parameter('pure', 0); diff --git a/pandora_console/godmode/reporting/visual_console_favorite.php b/pandora_console/godmode/reporting/visual_console_favorite.php index 1dcd7636c5..76e14e5195 100644 --- a/pandora_console/godmode/reporting/visual_console_favorite.php +++ b/pandora_console/godmode/reporting/visual_console_favorite.php @@ -41,7 +41,6 @@ if (!$is_metaconsole) { $url_visual_console_favorite = 'index.php?sec=screen&sec2=screens/screens&action=visualmap_favorite'; $url_visual_console_template = 'index.php?sec=screen&sec2=screens/screens&action=visualmap_template'; $url_visual_console_template_wizard = 'index.php?sec=screen&sec2=screens/screens&action=visualmap_wizard'; - $url_visual_console_manager = 'index.php?sec=screen&sec2=enterprise/extensions/visual_console_manager'; } $buttons['visual_console'] = [ From 01742670a508a5b6f9ac259347d69cb7a98f94bb Mon Sep 17 00:00:00 2001 From: rafael Date: Thu, 28 Jan 2021 15:28:05 +0100 Subject: [PATCH 30/31] adding localhost to condole config and adding versioning --- extras/deploy-scripts/pandora_deploy_community.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/extras/deploy-scripts/pandora_deploy_community.sh b/extras/deploy-scripts/pandora_deploy_community.sh index 59cb3abef0..e05a5fe62e 100644 --- a/extras/deploy-scripts/pandora_deploy_community.sh +++ b/extras/deploy-scripts/pandora_deploy_community.sh @@ -12,6 +12,7 @@ DBNAME=pandora DBUSER=pandora DBPASS=pandora DBPORT=3306 +S_VERSION='v1.0' LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log" # Ansi color code variables @@ -87,6 +88,7 @@ check_root_permissions () { } ## Main +echo 'Starting PandoraFMS Community deployment $S_VERSION' # Centos Version if [ ! "$(grep -i centos /etc/redhat-release)" ]; then @@ -381,7 +383,7 @@ cat > $CONSOLE_PATH/include/config.php << EO_CONFIG_F \$config["dbname"]="$DBNAME"; \$config["dbuser"]="$DBUSER"; \$config["dbpass"]="$DBPASS"; -\$config["dbhost"]="$DBHOST"; +\$config["dbhost"]="localhost"; \$config["homedir"]="$PANDORA_CONSOLE"; \$config["homeurl"]="/pandora_console"; error_reporting(0); @@ -574,4 +576,4 @@ NONE='\033[0m' [ "$(curl -s ifconfig.me)" ] && ipplublic=$(curl -s ifconfig.me) printf " -> Go to Public ${green}http://"$ipplublic"/pandora_console${reset} to manage this server" -ip addr | grep -w "inet" | grep -v "127.0.0.1" | grep -v -e "172.1[0-9].0.1" | awk '{print $2}' | awk -v g=$GREEN -v n=$NONE -F '/' '{printf "\n -> Go to Local "g"http://"$1"/pandora_console"n" to manage this server \n -> Use this credentials to login in the console "g"[ User: admin / Password: pandora ]"n" \n"}' +ip addr | grep -w "inet" | grep -v "127.0.0.1" | grep -v -e "172.1[0-9].0.1" | awk '{print $2}' | awk -v g=$GREEN -v n=$NONE -F '/' '{printf "\n -> Go to Local "g"http://"$1"/pandora_console"n" to manage this server \n -> Use this credentials to login in the console "g"[ User: admin / Password: pandora ]"n" \n"}' \ No newline at end of file From a5c09bebd7e4d131204b9950e4feb9ec9d20b22d Mon Sep 17 00:00:00 2001 From: rafael Date: Thu, 28 Jan 2021 15:30:09 +0100 Subject: [PATCH 31/31] adding localhost to condole config and adding versioning --- extras/deploy-scripts/pandora_deploy_community.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extras/deploy-scripts/pandora_deploy_community.sh b/extras/deploy-scripts/pandora_deploy_community.sh index e05a5fe62e..8eec7eee9c 100644 --- a/extras/deploy-scripts/pandora_deploy_community.sh +++ b/extras/deploy-scripts/pandora_deploy_community.sh @@ -12,7 +12,7 @@ DBNAME=pandora DBUSER=pandora DBPASS=pandora DBPORT=3306 -S_VERSION='v1.0' +S_VERSION='2021012801' LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log" # Ansi color code variables @@ -103,7 +103,7 @@ echo -en "${cyan}Check Centos Version...${reset}" check_cmd_status 'Error OS version, Centos 7 is expected' # initialice logfile -execute_cmd "echo 'Starting deploy' > $LOGFILE" "All installer activity is logged on $LOGFILE" +execute_cmd "echo 'Starting community deployment #S_VERSION' > $LOGFILE" "All installer activity is logged on $LOGFILE" # Pre checks # Root permisions