From 120706248b1df6cd308218d2989ecebb7060281e Mon Sep 17 00:00:00 2001 From: alejandro-campos Date: Tue, 19 Mar 2019 13:24:06 +0100 Subject: [PATCH] fix auth parameters not being included in agent config file when creating module through SNMP interface wizard using SNMP version 3 Former-commit-id: 86cfc2f9573ecba48af68ca01c43394cd2c23390 --- .../agent_wizard.snmp_interfaces_explorer.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/pandora_console/godmode/agentes/agent_wizard.snmp_interfaces_explorer.php b/pandora_console/godmode/agentes/agent_wizard.snmp_interfaces_explorer.php index f4c432cb7a..e09c0ea10d 100644 --- a/pandora_console/godmode/agentes/agent_wizard.snmp_interfaces_explorer.php +++ b/pandora_console/godmode/agentes/agent_wizard.snmp_interfaces_explorer.php @@ -367,7 +367,24 @@ if ($create_modules) { if ($row['server_type'] == 13) { $module_type_name = db_get_value_filter('nombre', 'ttipo_modulo', ['id_tipo' => $values['id_tipo_modulo']]); - $new_module_configuration_data = "module_begin\nmodule_name ".io_safe_input($name)."\nmodule_description ".io_safe_output($values['descripcion'])."\nmodule_type ".$module_type_name."\nmodule_snmp\nmodule_oid ".$conf_oid."\nmodule_community ".$values['snmp_community']."\nmodule_end"; + $new_module_configuration_data = "module_begin\nmodule_name ".io_safe_input($name)."\nmodule_description ".io_safe_output($values['descripcion'])."\nmodule_type ".$module_type_name."\nmodule_snmp\nmodule_version ".$snmp_version."\nmodule_oid ".$conf_oid."\nmodule_community ".$values['snmp_community']; + + if ($snmp_version == '3') { + $new_module_configuration_data .= "\nmodule_secname ".$snmp3_auth_user; + $new_module_configuration_data .= "\nmodule_seclevel ".$snmp3_security_level; + + if ($snmp3_security_level=='authNoPriv' || $snmp3_security_level=='authPriv') { + $new_module_configuration_data .= "\nmodule_authpass ".$snmp3_auth_pass; + $new_module_configuration_data .= "\nmodule_authproto ".$snmp3_auth_method; + } + + if ($snmp3_security_level=='authPriv') { + $new_module_configuration_data .= "\nmodule_privproto ".$snmp3_privacy_method; + $new_module_configuration_data .= "\nmodule_privpass ".$snmp3_privacy_pass; + } + } + + $new_module_configuration_data .= "\nmodule_end"; config_agents_add_module_in_conf($id_agent, $new_module_configuration_data); }