diff --git a/pandora_agents/pc/Linux/pandora_agent.conf b/pandora_agents/pc/Linux/pandora_agent.conf index 4ad837f943..e25a82a517 100644 --- a/pandora_agents/pc/Linux/pandora_agent.conf +++ b/pandora_agents/pc/Linux/pandora_agent.conf @@ -234,6 +234,21 @@ module_description Number of cron task files module_unit files module_end +# This module /var/log/syslog file, under the module name "syslog" +# And search for "ssh" string into it, sending only that information. +module_begin +module_name Syslog +module_description Search for ssh string into /var/log/syslog file +module_type log +module_regexp /var/log/syslog +module_pattern ssh +module_end + +#Hardening plugin for security compliance analysis. Enable to use it. +#module_begin +#module_plugin /usr/share/pandora_agent/plugins/pandora_hardening -t 150 +#module_absoluteinterval 7d +#module_end # Plugin example @@ -241,11 +256,6 @@ module_end module_plugin pandora_df -# This parses /var/log/syslog file, under the module name "syslog" -# And search for "ssh" string into it, sending only that information. - -module_plugin grep_log /var/log/syslog Syslog ssh - # Get disk space free in MB #module_begin #module_name disk_root_free @@ -270,7 +280,6 @@ module_plugin grep_log /var/log/syslog Syslog ssh #module_end # Plugin for inventory on the agent. - # module_plugin inventory 1 cpu ram video nic hd cdrom software init_services filesystem users process ip route # Example of preconditions @@ -303,4 +312,13 @@ module_plugin grep_log /var/log/syslog Syslog ssh # This plugin runs several security checks in a Linux system -#module_plugin pandora_security_check \ No newline at end of file +#module_plugin pandora_security_check + +# Extraction module example +#module_begin +#module_name Collector +#module_description Logs extraction module +#module_type log +#module_regexp /var/log/logfile.log +#module_pattern .* +#module_end \ No newline at end of file diff --git a/pandora_agents/pc/Win32/pandora_agent.conf b/pandora_agents/pc/Win32/pandora_agent.conf index 621c1d24ac..27f0326da0 100644 --- a/pandora_agents/pc/Win32/pandora_agent.conf +++ b/pandora_agents/pc/Win32/pandora_agent.conf @@ -147,22 +147,23 @@ module_max_critical 20 module_end # Log events + +# Get logs from System source. module_begin module_name System Events (TermService) -module_type async_string -module_logevent module_description Log Events coming from Terminal Service +module_type log +module_logevent module_source System -module_application TermService module_end +# Get logs from Security source. module_begin -module_name Security Events (Invalid Login) -module_type async_string -module_description Security log events for invalid login attempt +module_name Security Events +module_description Security log events +module_type log module_logevent module_source Security -module_eventcode 529 module_end # Check if Dhcp service is enabled @@ -219,6 +220,12 @@ module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\df.vbs" # module_description Free space on drive D: (%) # module_end +# Hardening plugin for security compliance analysis. +# module_begin +# module_plugin "%PROGRAMFILES%\Pandora_Agent\util\pandora_hardening.exe -t 150" +# module_absoluteinterval 7d +# module_end + # Sample of Windows inventory module (ONLY ENTERPRISE)! #module_begin #module_name Inventory @@ -344,4 +351,13 @@ module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\df.vbs" #module_condition (3,8) cmd.exe /c echo range >> c:\log.txt #module_exec echo 5 #module_description Postcondition test module +#module_end + +# Example of collector module +#module_begin +#module_name Collector +#module_description Logs extraction module +#module_type log +#module_regexp /var/log/logfile.log +#module_pattern .* #module_end \ No newline at end of file diff --git a/pandora_agents/pc/pandora_agent b/pandora_agents/pc/pandora_agent index 67e603b225..88f78e31ac 100644 --- a/pandora_agents/pc/pandora_agent +++ b/pandora_agents/pc/pandora_agent @@ -2179,16 +2179,7 @@ sub configure ($) { #Launch tentacle server in proxy mode if configured if ($Conf{'proxy_mode'}) { - - #Check if user is root - if ($> != 0) { - if (launch_tentacle_proxy() != 0) { - return 1; - } - } else { - error ('Proxy mode can not be launched as root'); - return 1; - } + return 1 if (launch_tentacle_proxy() != 0); } # Add the plugins directory to the PATH diff --git a/pandora_agents/shellscript/linux/pandora_agent.conf b/pandora_agents/shellscript/linux/pandora_agent.conf index 98c137741e..49e8866f9a 100644 --- a/pandora_agents/shellscript/linux/pandora_agent.conf +++ b/pandora_agents/shellscript/linux/pandora_agent.conf @@ -157,12 +157,32 @@ module_exec last | head -1 module_description Last Login module_end -# Plugin example +#Hardening plugin for security compliance analysis. Enable to use it. +#module_begin +#module_plugin /usr/share/pandora_agent/plugins/pandora_hardening -t 150 +#module_absoluteinterval 7d +#module_end -# This parses /var/log/syslog file, under the module name "syslog" +# This module parses /var/log/syslog file, under the module name "syslog" # And search for "ssh" string into it, sending only that information. +module_begin +module_name Syslog +module_description Search for ssh string into /var/log/syslog file +module_type log +module_regexp /var/log/syslog +module_pattern ssh +module_end -module_plugin grep_log /var/log/syslog Syslog ssh +# Plugin example # Plugin for inventory on the agent. # module_plugin inventory 1 cpu ram video nic hd cdrom software + +# Extraction module example +#module_begin +#module_name Collector +#module_description Logs extraction module +#module_type log +#module_regexp /var/log/logfile.log +#module_pattern .* +#module_end \ No newline at end of file diff --git a/pandora_agents/shellscript/mac_osx/pandora_agent.conf b/pandora_agents/shellscript/mac_osx/pandora_agent.conf index b4b3c35ac8..ba9c0079a3 100644 --- a/pandora_agents/shellscript/mac_osx/pandora_agent.conf +++ b/pandora_agents/shellscript/mac_osx/pandora_agent.conf @@ -372,13 +372,32 @@ module_end #module_description XGrid #module_end +#Hardening plugin for security compliance analysis. Enable to use it. +#module_begin +#module_plugin /usr/share/pandora_agent/plugins/pandora_hardening -t 150 +#module_absoluteinterval 7d +#module_end + +# This module parses /var/log/syslog file, under the module name "syslog" +# And search for "ssh" string into it, sending only that information. +module_begin +module_name Syslog +module_description Log collection modules +module_type log +module_regexp /var/log/syslog +module_pattern ssh +module_end + # Plugin example -# This parses /var/log/syslog file, under the module name "syslog" -# And search for "ssh" string into it, sending only that information. - -#module_plugin grep_log /var/log/syslog Syslog ssh - # Plugin for inventory on the agent. - # module_plugin inventory 1 cpu ram video nic hd cdrom software + +# Extraction module example +#module_begin +#module_name Collector +#module_description Logs extraction module +#module_type log +#module_regexp /var/log/logfile.log +#module_pattern .* +#module_end \ No newline at end of file diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 3c97c6e154..f8b810d817 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.774-231201 +Version: 7.0NG.774-231213 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 ca4c9222aa..fe934f5bb2 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.774-231201" +pandora_version="7.0NG.774-231213" 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/Linux/pandora_agent.conf b/pandora_agents/unix/Linux/pandora_agent.conf index 10458ddba5..42fddd39f5 100644 --- a/pandora_agents/unix/Linux/pandora_agent.conf +++ b/pandora_agents/unix/Linux/pandora_agent.conf @@ -271,11 +271,17 @@ module_plugin pandora_netusage module_plugin autodiscover --default # Plugin for inventory on the agent. -#module_plugin inventory 1 cpu ram video nic hd cdrom software init_services filesystem users route +# module_plugin inventory 1 cpu ram video nic hd cdrom software init_services filesystem users route # Log collection modules. This will collect log files for forensic analysis and store everything # This is for LOG monitoring. Different than log monitoring. -#module_plugin grep_log_module /var/log/messages Syslog \.\* +module_begin +module_name Syslog +module_description Log collection modules +module_type log +module_regexp /var/log/messages +module_pattern .* +module_end # Another samples of monitoring modules @@ -317,9 +323,9 @@ module_plugin autodiscover --default #module_absoluteinterval 7d #module_end -# Logs extraction +# Extraction module example #module_begin -#module_name Syslog +#module_name Collector #module_description Logs extraction module #module_type log #module_regexp /var/log/logfile.log diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index e3f19fa5f7..263b12b006 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -1039,7 +1039,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.774'; -use constant AGENT_BUILD => '231201'; +use constant AGENT_BUILD => '231213'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; @@ -4436,14 +4436,7 @@ my $PID = $$; #Launch tentacle server in proxy mode if configured if ($Conf{'proxy_mode'}) { - - #Check if user is root - if ($> != 0) { - launch_tentacle_proxy(); - } else { - log_message ('error', 'Proxy mode can not be launched as root'); - exit 1; - } + launch_tentacle_proxy(); } # Advice if YAML::Tiny is allowed in this system diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 856bf29aae..c8b79b5432 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_agent_linux %define version 7.0NG.774 -%define release 231201 +%define release 231213 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.redhat_bin.el8.spec b/pandora_agents/unix/pandora_agent.redhat_bin.el8.spec index 1166df20f9..e15c66a2b0 100644 --- a/pandora_agents/unix/pandora_agent.redhat_bin.el8.spec +++ b/pandora_agents/unix/pandora_agent.redhat_bin.el8.spec @@ -5,7 +5,7 @@ %define name pandorafms_agent_linux_bin %define source_name pandorafms_agent_linux %define version 7.0NG.774 -%define release 231201 +%define release 231213 %define debug_package %{nil} Summary: Pandora FMS Linux agent, binary version diff --git a/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec b/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec index 0ee91358de..c8b9c5bab9 100644 --- a/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec +++ b/pandora_agents/unix/pandora_agent.redhat_bin.el9.spec @@ -5,7 +5,7 @@ %define name pandorafms_agent_linux_bin %define source_name pandorafms_agent_linux %define version 7.0NG.774 -%define release 231201 +%define release 231213 %define debug_package %{nil} Summary: Pandora FMS Linux agent, binary version diff --git a/pandora_agents/unix/pandora_agent.redhat_bin.spec b/pandora_agents/unix/pandora_agent.redhat_bin.spec index d30857834b..54311de34a 100644 --- a/pandora_agents/unix/pandora_agent.redhat_bin.spec +++ b/pandora_agents/unix/pandora_agent.redhat_bin.spec @@ -5,7 +5,7 @@ %define name pandorafms_agent_linux_bin %define source_name pandorafms_agent_linux %define version 7.0NG.774 -%define release 231201 +%define release 231213 Summary: Pandora FMS Linux agent, binary version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 088ad4eba0..bfeb6b46be 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_agent_linux %define version 7.0NG.774 -%define release 231201 +%define release 231213 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 beab7ebf7e..ccd8e1bbe9 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.774" -PI_BUILD="231201" +PI_BUILD="231213" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/bin/pandora_agent.conf b/pandora_agents/win32/bin/pandora_agent.conf index bae2841fd5..c0a1560b38 100644 --- a/pandora_agents/win32/bin/pandora_agent.conf +++ b/pandora_agents/win32/bin/pandora_agent.conf @@ -179,6 +179,22 @@ module_description Total number of TCP connections active module_group Networking module_end +# Get logs from System source. +module_begin +module_name Eventlog_System +module_type log +module_logevent +module_source System +module_end + +# Get logs from Security source. +module_begin +module_name Eventlog_Security +module_type log +module_logevent +module_source Security +module_end + # Example plugin to retrieve drive usage module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\df_percent_used.vbs" @@ -273,22 +289,6 @@ module_plugin "%PROGRAMFILES%\Pandora_Agent\util\autodiscover.exe" --default #module_type generic_data_string #module_end -# Get logs from System source. Need enterprise version. -#module_begin -#module_name Eventlog_System -#module_type log -#module_logevent -#module_source System -#module_end - -# Get logs from Security source. Need enterprise version. -#module_begin -#module_name Eventlog_Security -#module_type log -#module_logevent -#module_source Security -#module_end - # Get logs from Application source. Need enterprise version. #module_begin #module_name Eventlog_Application diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 8af046be0c..af055f92d2 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{231201} +{231213} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 99b210ee5b..0c717e94de 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.774 Build 231201") +#define PANDORA_VERSION ("7.0NG.774 Build 231213") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 9195fac0d2..d0c4b12420 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Pandora FMS" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.774(Build 231201))" + VALUE "ProductVersion", "(7.0NG.774(Build 231213))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index a02531535c..3db8b82868 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.774-231201 +Version: 7.0NG.774-231213 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 6ae0812782..ed5bacf153 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.774-231201" +pandora_version="7.0NG.774-231213" package_pear=0 package_pandora=1 diff --git a/pandora_console/ajax.php b/pandora_console/ajax.php index b3b9463ee6..a5dcf2cb0d 100644 --- a/pandora_console/ajax.php +++ b/pandora_console/ajax.php @@ -183,7 +183,9 @@ if (isset($config['force_instant_logout']) === true $_SESSION = []; session_destroy(); header_remove('Set-Cookie'); - setcookie(session_name(), $_COOKIE[session_name()], (time() - 4800), '/'); + if (isset($_COOKIE[session_name()]) === true) { + setcookie(session_name(), $_COOKIE[session_name()], (time() - 4800), '/'); + } if ($config['auth'] === 'saml' && empty($public_hash) === true) { include_once $config['saml_path'].'simplesamlphp/lib/_autoload.php'; diff --git a/pandora_console/extensions/agents_modules_csv.php b/pandora_console/extensions/agents_modules_csv.php index e4a331338f..35893b4414 100644 --- a/pandora_console/extensions/agents_modules_csv.php +++ b/pandora_console/extensions/agents_modules_csv.php @@ -34,11 +34,11 @@ if ((bool) $config['metaconsole']) { include_once $config['homedir'].'/include/functions_modules.php'; include_once $config['homedir'].'/include/functions_users.php'; } else { - include_once '../include/config.php'; - include_once '../include/functions_agents.php'; - include_once '../include/functions_reporting.php'; - include_once '../include/functions_modules.php'; - include_once '../include/functions_users.php'; + include_once __DIR__.'/../include/config.php'; + include_once __DIR__.'/../include/functions_agents.php'; + include_once __DIR__.'/../include/functions_reporting.php'; + include_once __DIR__.'/../include/functions_modules.php'; + include_once __DIR__.'/../include/functions_users.php'; } diff --git a/pandora_console/extensions/pandora_logs.php b/pandora_console/extensions/pandora_logs.php index e63b719cfe..202000e0bf 100644 --- a/pandora_console/extensions/pandora_logs.php +++ b/pandora_console/extensions/pandora_logs.php @@ -31,7 +31,7 @@ function view_logfile($file_name, $toggle=false) } else { $file_size = filesize($file_name); - if ($memory_limit < $file_size) { + if ($memory_limit < $file_size && $memory_limit !== '-1') { $code .= '
'.$file_name.' ('.__('File is too large than PHP memory allocated in the system.').')
'; $code .= ''.__('The preview file is imposible.').'
'; } else if ($file_size > ($config['max_log_size'] * 1000)) { @@ -117,6 +117,7 @@ function pandoralogs_extension_main() view_logfile($config['homedir'].'/log/console.log', true); } + view_logfile('/var/log/php-fpm/www-error.log', true); view_logfile($logs_directory.'/pandora_server.log', true); view_logfile($logs_directory.'/pandora_server.error', true); diff --git a/pandora_console/extras/delete_files/delete_files.txt b/pandora_console/extras/delete_files/delete_files.txt index 234ec4e997..03db82db4e 100644 --- a/pandora_console/extras/delete_files/delete_files.txt +++ b/pandora_console/extras/delete_files/delete_files.txt @@ -1720,3 +1720,4 @@ include/functions_integriaims.php include/ajax/integria_incidents.ajax.php enterprise/operation/log/log_source.php enterprise/include/class/LogSource.class.php +include/chart_generator.php \ No newline at end of file diff --git a/pandora_console/extras/discovery/DiscoveryApplicationsMigrateCodes.ini b/pandora_console/extras/discovery/DiscoveryApplicationsMigrateCodes.ini index 6323aec140..c0cee7d03f 100644 --- a/pandora_console/extras/discovery/DiscoveryApplicationsMigrateCodes.ini +++ b/pandora_console/extras/discovery/DiscoveryApplicationsMigrateCodes.ini @@ -1,4 +1,4 @@ -pandorafms.vmware=9959cc3e5cc6bfcfadd6d05b56d4a11b +pandorafms.vmware=248788e0fb2cd4e11623e4a52ee7d05b pandorafms.mysql=fadb4750d18285c0eca34f47c6aa3cfe pandorafms.mssql=1cc215409741d19080269ffba112810e pandorafms.oracle=2d9320a514d1e48a0b2804e1653c31c6 diff --git a/pandora_console/extras/mr/67.sql b/pandora_console/extras/mr/67.sql index fe022e45e3..06253a5f54 100644 --- a/pandora_console/extras/mr/67.sql +++ b/pandora_console/extras/mr/67.sql @@ -3,25 +3,31 @@ START TRANSACTION; ALTER TABLE `tevento` ADD COLUMN `event_custom_id` TEXT NULL AFTER `module_status`; --- Telegram and vonage default alerts -UPDATE talert_actions - SET field2='[PANDORA] Alert FIRED on _agent_ / _module_ / _timestamp_ / _data_' - WHERE id=9; -UPDATE talert_actions - SET field2='[PANDORA] Alert FIRED on _agent_ / _module_ / _timestamp_ / _data_' - WHERE id=11; +SET @exist = (SELECT count(*) FROM information_schema.columns WHERE TABLE_NAME='tmetaconsole_agent' AND COLUMN_NAME='transactional_agent' AND table_schema = DATABASE()); +SET @sqlstmt = IF (@exist>0, 'ALTER TABLE `tmetaconsole_agent` DROP COLUMN `transactional_agent`', 'SELECT ""'); +prepare stmt from @sqlstmt; +execute stmt; + +SET @exist = (SELECT count(*) FROM information_schema.columns WHERE TABLE_NAME='tagente' AND COLUMN_NAME='transactional_agent' AND table_schema = DATABASE()); +SET @sqlstmt = IF (@exist>0, 'ALTER TABLE `tagente` DROP COLUMN `transactional_agent`', 'SELECT ""'); +prepare stmt from @sqlstmt; +execute stmt; + +ALTER TABLE `tdashboard` +ADD COLUMN `date_range` TINYINT NOT NULL DEFAULT 0 AFTER `cells_slideshow`, +ADD COLUMN `date_from` INT NOT NULL DEFAULT 0 AFTER `date_range`, +ADD COLUMN `date_to` INT NOT NULL DEFAULT 0 AFTER `date_from`; + -- Delete table tagent_access -DROP TABLE tagent_access; +DROP TABLE IF EXISTS tagent_access; ALTER TABLE `tevent_rule` DROP COLUMN `user_comment`; ALTER TABLE `tevent_rule` DROP COLUMN `operator_user_comment`; ALTER TABLE treport_content ADD check_unknowns_graph tinyint DEFAULT 0 NULL; -ALTER TABLE `tevent_filter` -ADD COLUMN `regex` TEXT NULL AFTER `private_filter_user`; +ALTER TABLE `tevent_filter` ADD COLUMN `regex` TEXT NULL AFTER `private_filter_user`; -- Update macros for plugin oracle - UPDATE `tdiscovery_apps` SET `version` = '1.1' WHERE `short_name` = 'pandorafms.oracle'; SET @id_app := (SELECT `id_app` FROM `tdiscovery_apps` WHERE `short_name` = 'pandorafms.oracle'); @@ -35,11 +41,6 @@ UPDATE `trecon_task` SET `setup_complete` = 1 WHERE `id_app` = @id_app; -- Update lts updates UPDATE tconfig SET value='1' WHERE token='lts_updates'; -ALTER TABLE `tdashboard` -ADD COLUMN `date_range` TINYINT NOT NULL DEFAULT 0 AFTER `cells_slideshow`, -ADD COLUMN `date_from` INT NOT NULL DEFAULT 0 AFTER `date_range`, -ADD COLUMN `date_to` INT NOT NULL DEFAULT 0 AFTER `date_from`; - SELECT @generic_data := `id_tipo` FROM `ttipo_modulo` WHERE `nombre` = "generic_data"; SELECT @generic_proc := `id_tipo` FROM `ttipo_modulo` WHERE `nombre` = "generic_proc"; SELECT @async_data := `id_tipo` FROM `ttipo_modulo` WHERE `nombre` = "async_data"; @@ -47,4 +48,10 @@ SELECT @async_proc := `id_tipo` FROM `ttipo_modulo` WHERE `nombre` = "async_proc UPDATE `tagente_modulo` INNER JOIN `tservice` ON `tagente_modulo`.`custom_integer_1` = `tservice`.`id` SET `tagente_modulo`.`id_tipo_modulo` = @generic_data WHERE `tagente_modulo`.`id_tipo_modulo` = @async_data; UPDATE `tagente_modulo` INNER JOIN `tservice` ON `tagente_modulo`.`custom_integer_1` = `tservice`.`id` SET `tagente_modulo`.`id_tipo_modulo` = @generic_proc WHERE `tagente_modulo`.`id_tipo_modulo` = @async_proc; +-- Telegram and vonage default alerts +UPDATE talert_actions SET field2='[PANDORA] Alert FIRED on _agent_ / _module_ / _timestamp_ / _data_' WHERE id=9; +UPDATE talert_actions SET field2='[PANDORA] Alert FIRED on _agent_ / _module_ / _timestamp_ / _data_' WHERE id=11; + +UPDATE `tdiscovery_apps` SET `version` = '1.2' WHERE `short_name` = 'pandorafms.vmware'; + COMMIT; diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php index 28311371bf..102d8e3136 100644 --- a/pandora_console/general/header.php +++ b/pandora_console/general/header.php @@ -35,7 +35,7 @@ echo sprintf('', $menuTypeClass); $notifications_numbers['last_id'] ).''; $header_welcome = ''; - if (check_acl($config['id_user'], $group, 'AW')) { + if (check_acl($config['id_user'], 0, 'AW')) { $header_welcome .= ''; $header_welcome .= html_print_image( 'images/wizard@svg.svg', @@ -455,19 +455,28 @@ echo sprintf('', $menuTypeClass); ); $header_logout .= ''; + if (enterprise_installed()) { + $subtitle_header = $config['custom_subtitle_header']; + $class_header = ''; + } else { + $subtitle_header = __('the Flexible Monitoring System (OpenSource version)'); + echo ''; + $class_header = 'underline-hover modal_module_list'; + } + if (is_reporting_console_node() === true) { - echo ''; + echo ''; echo ''; echo $config['custom_title_header']; echo ''; echo ''; - echo $config['custom_subtitle_header']; + echo $subtitle_header; echo ''; echo ''; echo ''; echo ''.$modal_help, $header_user, $header_logout.''; } else { - echo ''.$config['custom_title_header'].''.$config['custom_subtitle_header'].'+ echo ''.$config['custom_title_header'].''.$subtitle_header.''.$header_searchbar.''.$header_autorefresh, $header_autorefresh_counter, $header_discovery, $header_welcome, $servers_list, $modal_help, $header_setup, $header_user, $header_logout.''; } @@ -916,6 +925,46 @@ echo sprintf('', $menuTypeClass); $(document).ready (function () { + + $('.header_left').on('click', function(){ + // Hidden tips modal. + $(".window").css("display", "none"); + jQuery.post( + "ajax.php", + { + page: "include/functions_menu", + 'why_enterprise': "true" + }, + function(data) { + if (data) { + $("#dialog_why_enterprise").html(data); + // Open dialog + $("#dialog_why_enterprise").dialog({ + resizable: false, + draggable: false, + modal: true, + show: { + effect: "fade", + duration: 200 + }, + hide: { + effect: "fade", + duration: 200 + }, + closeOnEscape: true, + width: 700, + height: 450, + close: function(){ + $('#dialog_why_enterprise').html(''); + } + }); + } + }, + "html" + ); + }); + + // Check new notifications on a periodic way setInterval(check_new_notifications, 60000); diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php index 557b855e09..26bae75929 100644 --- a/pandora_console/godmode/agentes/agent_manager.php +++ b/pandora_console/godmode/agentes/agent_manager.php @@ -600,43 +600,176 @@ html_print_div( 'content' => html_print_table($tableAgent, true).$CodeQRTable, ] ); -/* - TODO REVIEW - $table_satellite = ''; - if ($remote_agent === true) { - // Satellite server selector. - $satellite_servers = db_get_all_rows_filter( - 'tserver', - ['server_type' => SERVER_TYPE_ENTERPRISE_SATELLITE], - [ - 'id_server', - 'name', - ] - ); - $satellite_names = []; - if (empty($satellite_servers) === false) { - foreach ($satellite_servers as $s_server) { - $satellite_names[$s_server['id_server']] = $s_server['name']; +// Basic Options. +$tableBasicAgent = new stdClass(); +$tableBasicAgent->class = 'filter-table-adv'; +$tableBasicAgent->data = []; +$disabledBasic = false; +$tableClassDisabled = ''; +if ($new_agent === true || $remote_agent === false || $has_remote_conf === false) { + $disabledBasic = true; + $tableClassDisabled = ' basic-options-disabled'; +} + +if (enterprise_installed()) { + // Get all plugins (BASIC OPTIONS). + $agent_plugin = new PandoraFMS\Agent($id_agente); + $plugins = $agent_plugin->getPlugins(); + // Check if some plugin was enabled/disabled in conf. + foreach ($plugins as $key => $row) { + if (preg_match('/pandora_hardening/', $row['raw']) === 1) { + if ($row['disabled'] === 1) { + $security_hardening = 0; + } else { + $security_hardening = 1; + } } - $table_satellite = ''; + ).html_print_input_hidden('options_package', '1', true) + ); + + $tableBasicAgent->data[] = html_print_label_input_block( + __('Enable log collection'), + html_print_input( + [ + 'type' => 'switch', + 'id' => 'enable_log_collector', + 'name' => 'enable_log_collector', + 'value' => $enable_log_collector, + 'disabled' => $disabledBasic, + ] + ) + ); } + + $tableBasicAgent->data[] = html_print_label_input_block( + __('Enable inventory'), + html_print_input( + [ + 'type' => 'switch', + 'id' => 'enable_inventory', + 'name' => 'enable_inventory', + 'value' => $enable_inventory, + 'disabled' => $disabledBasic, + ] + ).html_print_input_hidden('enable_basic_options', '1', true) + ); + + if ($config['ehorus_enabled'] === '1') { + $pandoraRC_Id = html_print_image( + 'images/alert_recovered@svg.svg', + true, + [ + 'class' => 'invert_filter main_menu_icon', + 'title' => __('Pandora RC connected with id ').$config['ehorus_custom_field'], + ] + ); + } else { + $pandoraRC_Id = html_print_image( + 'images/alerts.svg', + true, + [ + 'class' => 'invert_filter main_menu_icon', + 'title' => __('This agent do not have a Pandora RC agent installed, install one.'), + ] + ); } -*/ + + $tableBasicAgent->data[] = html_print_label_input_block( + __('Enable remote control'), + $pandoraRC_Id + ); + + $WarningPackage = ''; + if (($new_agent === true && $config['current_package'] < 774) || ($agent_version < 774 && $new_agent === false)) { + $WarningPackage = html_print_image( + 'images/alert-yellow@svg.svg', + true, + [ + 'title' => __('Only available for agents 774 or higher'), + 'alt' => __('Only available for agents 774 or higher'), + 'class' => 'main_menu_icon mrgn_lft_5px', + ] + ); + } +} else { + $tableBasicAgent->data[] = ''.__('Remote config is enabled only in the Enteprise version').''; + $tableBasicAgent->data[] .= html_print_input_hidden( + 'enable_basic_options', + '0', + true + ); +} + +ui_toggle( + html_print_table($tableBasicAgent, true), + ''.__('Basic options').$WarningPackage.'', + '', + 'basic_options', + true, + false, + 'white_box_content', + 'no-border white_table_graph'.$tableClassDisabled, + 'box-flat white_table_graph invisible' +); // Advanced options. $tableAdvancedAgent = new stdClass(); @@ -1256,7 +1389,8 @@ ui_require_jquery_file('bgiframe'); }); $("#checkbox-cascade_protection").change(function () { - var checked = $("#checkbox-cascade_protection").is(":checked"); if (checked) { + var checked = $("#checkbox-cascade_protection").is(":checked"); + if (checked) { $("#cascade_protection_module").removeAttr("disabled"); $("#text-id_parent").attr("required", "required"); } @@ -1266,7 +1400,7 @@ ui_require_jquery_file('bgiframe'); $("#text-id_parent").removeAttr("required"); } }); - + var safe_mode_checked = $("#checkbox-safe_mode").is(":checked"); if (safe_mode_checked) { $("#safe_mode_module").removeAttr("disabled"); @@ -1274,10 +1408,10 @@ ui_require_jquery_file('bgiframe'); else { $("#safe_mode_module").attr("disabled", 'disabled'); } - + $("#checkbox-safe_mode").change(function () { var safe_mode_checked = $("#checkbox-safe_mode").is(":checked"); - + if (safe_mode_checked) { $("#safe_mode_module").removeAttr("disabled"); } @@ -1311,5 +1445,17 @@ ui_require_jquery_file('bgiframe'); } }); + check_basic_options(); + $('#id_os').on('change', function(){ + check_basic_options(); + }) }); + + function check_basic_options(){ + if ($('#id_os').val() == 1 || $('#id_os').val() == 8 || $('#id_os').val() == 9) { + $('#basic_options').removeClass('invisible'); + } else { + $('#basic_options').addClass('invisible'); + } + } diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index 09ca22062e..b4abfa1ad7 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -232,7 +232,7 @@ if ($create_agent) { $cps = (int) get_parameter_switch('cps', -1); $fixed_ip = (int) get_parameter_switch('fixed_ip', 0); $vul_scan_enabled = (int) get_parameter_switch('vul_scan_enabled', 2); - + $agent_version = $config['current_package']; $secondary_groups = (array) get_parameter('secondary_groups_selected', ''); $fields = db_get_all_fields_in_table('tagent_custom_fields'); @@ -300,6 +300,7 @@ if ($create_agent) { 'cps' => $cps, 'fixed_ip' => $fixed_ip, 'vul_scan_enabled' => $vul_scan_enabled, + 'agent_version' => $agent_version, ] ); } else { @@ -1015,6 +1016,13 @@ if ($update_agent) { $satellite_server = (int) get_parameter('satellite_server', 0); $fixed_ip = (int) get_parameter_switch('fixed_ip', 0); $vul_scan_enabled = (int) get_parameter_switch('vul_scan_enabled', 2); + $security_vunerability = (int) get_parameter_switch('security_vunerability', 0); + $security_hardening = (int) get_parameter_switch('security_hardening', 0); + $security_monitoring = (int) get_parameter_switch('security_monitoring', 0); + $enable_log_collector = (int) get_parameter_switch('enable_log_collector', 0); + $enable_inventory = (int) get_parameter_switch('enable_inventory', 0); + $enable_basic_options = get_parameter('enable_basic_options'); + $options_package = get_parameter('options_package', '0'); if ($fields === false) { $fields = []; @@ -1243,6 +1251,81 @@ if ($update_agent) { ); } } + + if ($enable_basic_options === '1') { + // Get all plugins (BASIC OPTIONS). + $agent = new PandoraFMS\Agent($id_agente); + $plugins = $agent->getPlugins(); + foreach ($plugins as $key => $row) { + // Only check plugins when agent package is bigger than 774. + if ($options_package === '1') { + if (preg_match('/pandora_hardening/', $row['raw']) === 1) { + if ($security_hardening === 1) { + if ($row['disabled'] === 1) { + $agent->enablePlugins($row['raw']); + } + } else { + if ($row['disabled'] !== 1) { + $agent->disablePlugins($row['raw']); + } + } + } + + if (preg_match('/(module_plugin grep_log_module ).*/', $row['raw']) === 1) { + if ($enable_log_collector === 1) { + if ($row['disabled'] === 1) { + $agent->enablePlugins($row['raw']); + } + } else { + if ($row['disabled'] !== 1) { + $agent->disablePlugins($row['raw']); + } + } + } + } + + // Inventory switch enable when basic options are enabled. + if (preg_match('/(module_plugin inventory).*/', $row['raw']) === 1) { + if ($enable_inventory === 1) { + if ($row['disabled'] === 1) { + $agent->enablePlugins($row['raw']); + } + } else { + if ($row['disabled'] !== 1) { + $agent->disablePlugins($row['raw']); + } + } + } + + // Inventory switch enable when basic options are enabled. + if (preg_match('/.vbs/', $row['raw']) === 1 && preg_match('/nettraffic.vbs/', $row['raw']) === 0 && preg_match('/software_installed.vbs/', $row['raw']) === 0 && preg_match('/df.vbs/', $row['raw']) === 0 && preg_match('/win_cf.vbs/', $row['raw']) === 0) { + if ($enable_inventory === 1) { + if ($row['disabled'] === 1) { + $agent->enablePlugins($row['raw']); + } + } else { + if ($row['disabled'] !== 1) { + $agent->disablePlugins($row['raw']); + } + } + } + } + + $modules = $agent->getModules(); + foreach ($modules as $key => $row) { + if (preg_match('/PandoraAgent_log/', $row['raw']) === 1) { + if ($enable_log_collector === 1) { + if ($row['disabled'] === 1) { + $agent->enableModule($row['module_name'], $row); + } + } else { + if ($row['disabled'] !== 1) { + $agent->disableModule($row['module_name'], $row); + } + } + } + } + } } // Read agent data @@ -1300,6 +1383,19 @@ if ($id_agente) { $satellite_server = (int) $agent['satellite_server']; $fixed_ip = (int) $agent['fixed_ip']; $vul_scan_enabled = (int) $agent['vul_scan_enabled']; + if (strpos($agent['agent_version'], '(')) { + $agent_version = (int) explode('.', explode('(', $agent['agent_version'])[0])[2]; + } else { + if (strpos($agent['agent_version'], 'build') || strpos($agent['agent_version'], 'Build')) { + $agent_version = (int) explode('.', explode('build', $agent['agent_version'])[0])[2]; + } else { + if (strpos($agent['agent_version'], '.')) { + $agent_version = (int) explode('.', $agent['agent_version'])[2]; + } else { + $agent_version = $agent['agent_version']; + } + } + } } $update_module = (bool) get_parameter('update_module'); diff --git a/pandora_console/godmode/agentes/modificar_agente.php b/pandora_console/godmode/agentes/modificar_agente.php index 487fe54e07..5ea31914c6 100644 --- a/pandora_console/godmode/agentes/modificar_agente.php +++ b/pandora_console/godmode/agentes/modificar_agente.php @@ -566,10 +566,10 @@ if ($search != '') { if ($id != '') { $aux = $id[0]['id_agent']; $search_sql = sprintf( - ' AND ( nombre LIKE "%%%s%%" - OR alias LIKE "%%%s%%" - OR comentarios LIKE "%%%s%%" - OR EXISTS (SELECT * FROM tagent_custom_data WHERE id_agent = id_agente AND description LIKE "%%%s%%") + ' AND ( REPLACE(nombre, " ", " ") LIKE "%%%s%%" + OR REPLACE(alias, " ", " ") LIKE "%%%s%%" + OR REPLACE(comentarios, " ", " ") LIKE "%%%s%%" + OR EXISTS (SELECT * FROM tagent_custom_data WHERE id_agent = id_agente AND REPLACE(description, " ", " ") LIKE "%%%s%%") OR tagente.id_agente = %d', $search, $search, @@ -591,10 +591,10 @@ if ($search != '') { $search_sql .= ')'; } else { $search_sql = sprintf( - ' AND ( nombre - LIKE "%%%s%%" OR alias - LIKE "%%%s%%" OR comentarios LIKE "%%%s%%" - OR EXISTS (SELECT * FROM tagent_custom_data WHERE id_agent = id_agente AND description LIKE "%%%s%%"))', + ' AND ( REPLACE(nombre, " ", " ") + LIKE "%%%s%%" OR REPLACE(alias, " ", " ") + LIKE "%%%s%%" OR REPLACE(comentarios, " ", " ") LIKE "%%%s%%" + OR EXISTS (SELECT * FROM tagent_custom_data WHERE id_agent = id_agente AND REPLACE(description, " ", " ") LIKE "%%%s%%"))', $search, $search, $search, diff --git a/pandora_console/godmode/agentes/module_manager.php b/pandora_console/godmode/agentes/module_manager.php index c3772c00d3..b4cd0e2351 100644 --- a/pandora_console/godmode/agentes/module_manager.php +++ b/pandora_console/godmode/agentes/module_manager.php @@ -575,7 +575,7 @@ $where = sprintf('delete_pending = 0 AND id_agente = %s', $id_agente); $search_string_entities = io_safe_input($search_string); $basic_where = sprintf( - "(nombre LIKE '%%%s%%' OR nombre LIKE '%%%s%%' OR descripcion LIKE '%%%s%%' OR descripcion LIKE '%%%s%%') AND", + "(REPLACE(nombre, ' ', ' ') LIKE '%%%s%%' OR REPLACE(nombre, ' ', ' ') LIKE '%%%s%%' OR REPLACE(descripcion, ' ', ' ') LIKE '%%%s%%' OR REPLACE(descripcion, ' ', ' ') LIKE '%%%s%%') AND", $search_string, $search_string_entities, $search_string, diff --git a/pandora_console/godmode/agentes/module_manager_editor_plugin.php b/pandora_console/godmode/agentes/module_manager_editor_plugin.php index 970a2c4d9f..9b5d98c27d 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_plugin.php +++ b/pandora_console/godmode/agentes/module_manager_editor_plugin.php @@ -171,7 +171,7 @@ foreach ($password_fields as $k => $p) { } $(document).ready(function () { - if ($("#id_plugin").val() === 0) { + if ($("#id_plugin").val() !== 0) { changePluginSelect(); } }); diff --git a/pandora_console/godmode/gis_maps/configure_gis_map.php b/pandora_console/godmode/gis_maps/configure_gis_map.php index 524ab245fb..cc9ed5d5f0 100644 --- a/pandora_console/godmode/gis_maps/configure_gis_map.php +++ b/pandora_console/godmode/gis_maps/configure_gis_map.php @@ -243,10 +243,15 @@ switch ($action) { $map_default_altitude = get_parameter('map_default_altitude'); $map_group_id = get_parameter('map_group_id'); $map_levels_zoom = get_parameter('map_levels_zoom', 16); - $map_connection_list_temp = explode(',', get_parameter('map_connection_list')); + $map_connection_list_temp_string = implode(',', $map_connection_list_temp); + if (strlen($map_connection_list_temp_string) > 0) { + $where_map_connection = ' WHERE id_tmap_connection IN('.$map_connection_list_temp_string.')'; + } else { + $where_map_connection = ''; + } - $listConnectionTemp = db_get_all_rows_sql('SELECT id_tmap_connection, conection_name, group_id FROM tgis_map_connection'); + $listConnectionTemp = db_get_all_rows_sql('SELECT id_tmap_connection, conection_name, group_id FROM tgis_map_connection'.$where_map_connection); foreach ($map_connection_list_temp as $index => $value) { $cleanValue = trim($value); @@ -256,7 +261,6 @@ switch ($action) { } $map_connection_default = get_parameter('map_connection_default'); - $map_connection_list = []; foreach ($listConnectionTemp as $idMapConnection) { $default = 0; @@ -345,7 +349,7 @@ function deleteConnectionMap(idConnectionMap) { checked = $("#radiobtn0001", $("#map_connection_" + idConnectionMap)).attr('checked'); $("#map_connection_" + idConnectionMap).remove(); - + if (checked) { //Checked first, but not is index = 0 maybe. @@ -485,7 +489,7 @@ foreach ($listConnectionTemp as $connectionTemp) { $table->data[1][0] = __('Add Map connection').$iconError; $table->data[1][1] = "'.__('Satellite').'
'; - $table_satellite .= ''; + if ($id_os === '1' || $id_os === '8') { + if (preg_match('/(module_plugin grep_log_module ).*/', $row['raw']) === 1) { + if ($row['disabled'] === 1) { + $enable_log_collector = 0; + } else { + $enable_log_collector = 1; + } + } - $table_satellite .= html_print_input( + if (preg_match('/(module_plugin inventory).*/', $row['raw']) === 1) { + if ($row['disabled'] === 1) { + $enable_inventory = 0; + } else { + $enable_inventory = 1; + } + } + } else { + if (preg_match('/.vbs/', $row['raw']) === 1 && preg_match('/nettraffic.vbs/', $row['raw']) === 0 && preg_match('/software_installed.vbs/', $row['raw']) === 0 && preg_match('/df.vbs/', $row['raw']) === 0 && preg_match('/win_cf.vbs/', $row['raw']) === 0) { + if ($row['disabled'] === 1) { + $enable_inventory = 0; + } else { + $enable_inventory = 1; + } + } + } + } + + if ($id_os === '9') { + $modules = $agent_plugin->getModules(); + foreach ($modules as $key => $row) { + if (preg_match('/PandoraAgent_log/', $row['raw']) === 1) { + if ($row['disabled'] === 1) { + $enable_log_collector = 0; + } else { + $enable_log_collector = 1; + } + } + } + } + + unset($agent_plugin, $plugins); + if (($new_agent === true && $config['current_package'] >= 774) || ($agent_version >= 774 && $new_agent === false)) { + if ($disabledBasic === true || $has_remote_conf === false) { + $message = __('Remote config disabled, please activate to enable agent basic options'); + $tableBasicAgent->data[] = ''.$message.''; + } + + $tableBasicAgent->data[] = html_print_label_input_block( + __('Enable security hardening monitoring'), + html_print_input( [ - 'type' => 'select', - 'fields' => $satellite_names, - 'name' => 'satellite_server', - 'selected' => $satellite_server, - 'nothing' => __('None'), - 'nothinf_value' => 0, - 'return' => true, + 'type' => 'switch', + 'id' => 'security_hardening', + 'name' => 'security_hardening', + 'value' => $security_hardening, + 'disabled' => $disabledBasic, ] - ).'