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
This commit is contained in:
alejandro-campos 2019-03-19 13:24:06 +01:00
parent 3b2d72308e
commit 120706248b
1 changed files with 18 additions and 1 deletions

View File

@ -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);
}