mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
2012-01-24 Ramon Novoa <rnovoa@artica.es>
* include/functions_config.php, include/functions_netflow.php, pandoradb.sql, pandoradb.postgreSQL.sql, pandoradb.oracle.sql, operation/netflow/nf_live_view.php, extras/pandoradb_migrate_4.0.x_to_4.1.mysql.sql, extras/pandoradb_migrate_4.0.x_to_4.1.oracle.sql, extras/pandoradb_migrate_4.0.x_to_4.1.postgreSQL.sql, godmode/agentes/module_manager_editor_prediction.php, godmode/agentes/configurar_agente.php, godmode/menu.php, godmode/netflow/nf_edit_form.php: Added support for enterprise netflow modules. * godmode/netflow/nf_manage.php: Moved to godmode/setup/setup_netflow.php. * godmode/netflow/nf_option_form.php: Removed from repository. Not used. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5416 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
188e4445c4
commit
e4c2d6b68e
@ -1,3 +1,25 @@
|
|||||||
|
2012-01-24 Ramon Novoa <rnovoa@artica.es>
|
||||||
|
|
||||||
|
* include/functions_config.php,
|
||||||
|
include/functions_netflow.php,
|
||||||
|
pandoradb.sql,
|
||||||
|
pandoradb.postgreSQL.sql,
|
||||||
|
pandoradb.oracle.sql,
|
||||||
|
operation/netflow/nf_live_view.php,
|
||||||
|
extras/pandoradb_migrate_4.0.x_to_4.1.mysql.sql,
|
||||||
|
extras/pandoradb_migrate_4.0.x_to_4.1.oracle.sql,
|
||||||
|
extras/pandoradb_migrate_4.0.x_to_4.1.postgreSQL.sql,
|
||||||
|
godmode/agentes/module_manager_editor_prediction.php,
|
||||||
|
godmode/agentes/configurar_agente.php,
|
||||||
|
godmode/menu.php,
|
||||||
|
godmode/netflow/nf_edit_form.php: Added support for enterprise
|
||||||
|
netflow modules.
|
||||||
|
|
||||||
|
* godmode/netflow/nf_manage.php: Moved to
|
||||||
|
godmode/setup/setup_netflow.php.
|
||||||
|
|
||||||
|
* godmode/netflow/nf_option_form.php: Removed from repository. Not used.
|
||||||
|
|
||||||
2010-01-24 Javier Lanz <javier.lanz@artica.es>
|
2010-01-24 Javier Lanz <javier.lanz@artica.es>
|
||||||
* godmode/massive/massive_delete_modules.php: Fixed a small entities
|
* godmode/massive/massive_delete_modules.php: Fixed a small entities
|
||||||
bug. Added io_safe_output
|
bug. Added io_safe_output
|
||||||
|
@ -4,12 +4,14 @@
|
|||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `tnetflow_filter` (
|
CREATE TABLE IF NOT EXISTS `tnetflow_filter` (
|
||||||
`id_sg` int(10) unsigned NOT NULL auto_increment,
|
`id_sg` int(10) unsigned NOT NULL auto_increment,
|
||||||
`id_name` varchar(60) NOT NULL default '0',
|
`id_name` varchar(600) NOT NULL default '0',
|
||||||
`id_group` int(10),
|
`id_group` int(10),
|
||||||
`ip_dst` varchar(100),
|
`ip_dst` TEXT NOT NULL,
|
||||||
`ip_src` varchar(100),
|
`ip_src` TEXT NOT NULL,
|
||||||
`dst_port` varchar(100),
|
`dst_port` TEXT NOT NULL,
|
||||||
`src_port` varchar(100),
|
`src_port` TEXT NOT NULL,
|
||||||
|
`advanced_filter` TEXT NOT NULL,
|
||||||
|
`filter_args` TEXT NOT NULL,
|
||||||
`aggregate` varchar(60),
|
`aggregate` varchar(60),
|
||||||
`output` varchar(60),
|
`output` varchar(60),
|
||||||
PRIMARY KEY (`id_sg`)
|
PRIMARY KEY (`id_sg`)
|
||||||
@ -34,7 +36,7 @@ PRIMARY KEY(`id_report`)
|
|||||||
CREATE TABLE IF NOT EXISTS `tnetflow_report_content` (
|
CREATE TABLE IF NOT EXISTS `tnetflow_report_content` (
|
||||||
`id_rc` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
|
`id_rc` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
`id_report` INTEGER UNSIGNED NOT NULL default 0,
|
`id_report` INTEGER UNSIGNED NOT NULL default 0,
|
||||||
`id_filter` INTEGER UNSIGNED NOT NULL default 0,
|
`id_filter` INTEGER UNSIGNED NOT NULL default 0,
|
||||||
`date` bigint(20) NOT NULL default '0',
|
`date` bigint(20) NOT NULL default '0',
|
||||||
`period` int(11) NOT NULL default 0,
|
`period` int(11) NOT NULL default 0,
|
||||||
`max` int (11) NOT NULL default 0,
|
`max` int (11) NOT NULL default 0,
|
||||||
@ -42,10 +44,10 @@ CREATE TABLE IF NOT EXISTS `tnetflow_report_content` (
|
|||||||
`order` int (11) NOT NULL default 0,
|
`order` int (11) NOT NULL default 0,
|
||||||
PRIMARY KEY(`id_rc`),
|
PRIMARY KEY(`id_rc`),
|
||||||
FOREIGN KEY (`id_report`) REFERENCES tnetflow_report(`id_report`)
|
FOREIGN KEY (`id_report`) REFERENCES tnetflow_report(`id_report`)
|
||||||
ON UPDATE CASCADE ON DELETE CASCADE,
|
ON DELETE CASCADE,
|
||||||
FOREIGN KEY (`id_filter`) REFERENCES tnetflow_filter(`id_sg`)
|
FOREIGN KEY (`id_filter`) REFERENCES tnetflow_filter(`id_sg`)
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE = InnoDB DEFAULT CHARSET=utf8
|
||||||
|
|
||||||
-- -----------------------------------------------------
|
-- -----------------------------------------------------
|
||||||
-- Table `tusuario`
|
-- Table `tusuario`
|
||||||
|
@ -10,12 +10,14 @@ alter table tusuario add (disabled NUMBER(10,0) default 0 NOT NULL);
|
|||||||
|
|
||||||
CREATE TABLE tnetflow_filter (
|
CREATE TABLE tnetflow_filter (
|
||||||
id_sg NUMBER(10, 0) NOT NULL PRIMARY KEY,
|
id_sg NUMBER(10, 0) NOT NULL PRIMARY KEY,
|
||||||
id_name VARCHAR2(100) NOT NULL,
|
id_name VARCHAR2(600) NOT NULL,
|
||||||
id_group NUMBER(10, 0),
|
id_group NUMBER(10, 0),
|
||||||
ip_dst VARCHAR2(100),
|
ip_dst CLOB NOT NULL,
|
||||||
ip_src VARCHAR2(100),
|
ip_src CLOB NOT NULL,
|
||||||
dst_port VARCHAR2(100),
|
dst_port CLOB NOT NULL,
|
||||||
src_port VARCHAR2(100),
|
src_port CLOB NOT NULL,
|
||||||
|
advanced_filter CLOB NOT NULL,
|
||||||
|
filter_args CLOB NOT NULL,
|
||||||
aggregate VARCHAR2(60),
|
aggregate VARCHAR2(60),
|
||||||
output VARCHAR2(60)
|
output VARCHAR2(60)
|
||||||
);
|
);
|
||||||
|
@ -9,12 +9,14 @@ ALTER TABLE "tusuario" ADD COLUMN "disabled" INTEGER NOT NULL DEFAULT 0;
|
|||||||
-- -----------------------------------------------------
|
-- -----------------------------------------------------
|
||||||
CREATE TABLE "tnetflow_filter" (
|
CREATE TABLE "tnetflow_filter" (
|
||||||
"id_sg" SERIAL NOT NULL PRIMARY KEY,
|
"id_sg" SERIAL NOT NULL PRIMARY KEY,
|
||||||
"id_name" varchar(60) NOT NULL default '',
|
"id_name" varchar(600) NOT NULL default '',
|
||||||
"id_group" INTEGER,
|
"id_group" INTEGER,
|
||||||
"ip_dst" varchar(100),
|
"ip_dst" TEXT NOT NULL,
|
||||||
"ip_src" varchar(100),
|
"ip_src" TEXT NOT NULL,
|
||||||
"dst_port" varchar(100),
|
"dst_port" TEXT NOT NULL,
|
||||||
"src_port" varchar(100),
|
"src_port" TEXT NOT NULL,
|
||||||
|
"advanced_filter" TEXT NOT NULL,
|
||||||
|
"filter_args" TEXT NOT NULL,
|
||||||
"aggregate" varchar(60),
|
"aggregate" varchar(60),
|
||||||
"output" varchar(60)
|
"output" varchar(60)
|
||||||
);
|
);
|
||||||
|
@ -706,7 +706,7 @@ if ($update_module || $create_module) {
|
|||||||
$id_tag = (array) get_parameter('id_tag_selected');
|
$id_tag = (array) get_parameter('id_tag_selected');
|
||||||
$serialize_ops = (string) get_parameter('serialize_ops');
|
$serialize_ops = (string) get_parameter('serialize_ops');
|
||||||
|
|
||||||
if($prediction_module < 3) {
|
if($prediction_module != 3) {
|
||||||
unset($serialize_ops);
|
unset($serialize_ops);
|
||||||
enterprise_hook('modules_delete_synthetic_operations', array($id_agent_module));
|
enterprise_hook('modules_delete_synthetic_operations', array($id_agent_module));
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ $row = db_get_row_sql($sql);
|
|||||||
$is_service = false;
|
$is_service = false;
|
||||||
$is_synthetic = false;
|
$is_synthetic = false;
|
||||||
$is_synthetic_avg = false;
|
$is_synthetic_avg = false;
|
||||||
|
$is_netflow = false;
|
||||||
$ops = false;
|
$ops = false;
|
||||||
if ($row !== false && is_array($row)) {
|
if ($row !== false && is_array($row)) {
|
||||||
$prediction_module = $row['prediction_module'];
|
$prediction_module = $row['prediction_module'];
|
||||||
@ -56,6 +57,10 @@ if ($row !== false && is_array($row)) {
|
|||||||
$custom_integer_1 = 0;
|
$custom_integer_1 = 0;
|
||||||
$custom_integer_2 = 0;
|
$custom_integer_2 = 0;
|
||||||
break;
|
break;
|
||||||
|
case 4:
|
||||||
|
$is_netflow = true;
|
||||||
|
$custom_integer_2 = 0;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
$prediction_module = $custom_integer_1;
|
$prediction_module = $custom_integer_1;
|
||||||
}
|
}
|
||||||
@ -79,7 +84,7 @@ $data[0] = __('Source module');
|
|||||||
$data[0] .= ui_print_help_icon ('prediction_source_module', true);
|
$data[0] .= ui_print_help_icon ('prediction_source_module', true);
|
||||||
$data[1] = '';
|
$data[1] = '';
|
||||||
// Services and Synthetic are an Enterprise feature.
|
// Services and Synthetic are an Enterprise feature.
|
||||||
$module_service_synthetic_selector = enterprise_hook('get_module_service_synthetic_selector', array($is_service, $is_synthetic, $is_synthetic_avg));
|
$module_service_synthetic_selector = enterprise_hook('get_module_service_synthetic_selector', array($is_service, $is_synthetic, $is_synthetic_avg, $is_netflow));
|
||||||
if ($module_service_synthetic_selector !== ENTERPRISE_NOT_HOOK) {
|
if ($module_service_synthetic_selector !== ENTERPRISE_NOT_HOOK) {
|
||||||
$data[1] = $module_service_synthetic_selector;
|
$data[1] = $module_service_synthetic_selector;
|
||||||
|
|
||||||
@ -145,6 +150,18 @@ if ($synthetic_module_form !== ENTERPRISE_NOT_HOOK) {
|
|||||||
push_table_simple ($data, 'synthetic_module');
|
push_table_simple ($data, 'synthetic_module');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Netflow modules are an Enterprise feature.
|
||||||
|
$netflow_module_form = enterprise_hook ('get_netflow_module_form', array($custom_integer_1));
|
||||||
|
if ($netflow_module_form !== ENTERPRISE_NOT_HOOK) {
|
||||||
|
$data = array();
|
||||||
|
$data[0] = '';
|
||||||
|
$data[1] = $netflow_module_form;
|
||||||
|
|
||||||
|
$table_simple->colspan['netflow_module_form'][1] = 3;
|
||||||
|
push_table_simple ($data, 'netflow_module');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Removed common useless parameter */
|
/* Removed common useless parameter */
|
||||||
unset ($table_advanced->data[3]);
|
unset ($table_advanced->data[3]);
|
||||||
unset ($table_advanced->data[2][2]);
|
unset ($table_advanced->data[2][2]);
|
||||||
@ -154,7 +171,7 @@ unset ($table_advanced->data[2][3]);
|
|||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
agent_module_autocomplete ("#text_agent_name", "#id_agente", "#prediction_module");
|
agent_module_autocomplete ("#text_agent_name", "#id_agente", "#prediction_module");
|
||||||
<?php
|
<?php
|
||||||
enterprise_hook('setup_services_synth', array($is_service, $is_synthetic, $is_synthetic_avg, $ops));
|
enterprise_hook('setup_services_synth', array($is_service, $is_synthetic, $is_synthetic_avg, $is_netflow, $ops));
|
||||||
?>
|
?>
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ if (check_acl ($config['id_user'], 0, "PM")) {
|
|||||||
$sub["godmode/setup/setup_visuals"]["text"] = __('Visual styles');
|
$sub["godmode/setup/setup_visuals"]["text"] = __('Visual styles');
|
||||||
$sub["godmode/setup/file_manager"]["text"] = __('File manager');
|
$sub["godmode/setup/file_manager"]["text"] = __('File manager');
|
||||||
if ($config['activate_netflow'])
|
if ($config['activate_netflow'])
|
||||||
$sub["godmode/netflow/nf_manage"]["text"] = __('Netflow');
|
$sub["godmode/setup/setup_netflow"]["text"] = __('Netflow');
|
||||||
if ($config['activate_gis'])
|
if ($config['activate_gis'])
|
||||||
$sub["godmode/setup/gis"]["text"] = __('Map conections GIS');
|
$sub["godmode/setup/gis"]["text"] = __('Map conections GIS');
|
||||||
$sub["godmode/setup/links"]["text"] = __('Links');
|
$sub["godmode/setup/links"]["text"] = __('Links');
|
||||||
|
@ -93,18 +93,22 @@ if ($update) {
|
|||||||
if ($name == '') {
|
if ($name == '') {
|
||||||
ui_print_error_message (__('Not updated. Blank name'));
|
ui_print_error_message (__('Not updated. Blank name'));
|
||||||
} else {
|
} else {
|
||||||
$result = db_process_sql_update ('tnetflow_filter',
|
$values = array ('id_sg' => $id,
|
||||||
array ('id_sg' => $id,
|
'id_name' => $name,
|
||||||
'id_name' => $name,
|
'id_group' => $assign_group,
|
||||||
'id_group' => $assign_group,
|
'aggregate' => $aggregate,
|
||||||
'aggregate' => $aggregate,
|
'ip_dst' => $ip_dst,
|
||||||
'ip_dst' => $ip_dst,
|
'ip_src' => $ip_src,
|
||||||
'ip_src' => $ip_src,
|
'dst_port' => $dst_port,
|
||||||
'dst_port' => $dst_port,
|
'src_port' => $src_port,
|
||||||
'src_port' => $src_port,
|
'advanced_filter' => $advanced_filter,
|
||||||
'advanced_filter' => $advanced_filter,
|
'output' => $output
|
||||||
'output' => $output),
|
);
|
||||||
array ('id_sg' => $id));
|
|
||||||
|
// Save filter args
|
||||||
|
$values['filter_args'] = netflow_get_filter_arguments ($values);
|
||||||
|
|
||||||
|
$result = db_process_sql_update ('tnetflow_filter', $values, array ('id_sg' => $id));
|
||||||
|
|
||||||
ui_print_result_message ($result,
|
ui_print_result_message ($result,
|
||||||
__('Successfully updated'),
|
__('Successfully updated'),
|
||||||
@ -134,6 +138,9 @@ if ($create){
|
|||||||
'advanced_filter'=>$advanced_filter,
|
'advanced_filter'=>$advanced_filter,
|
||||||
'output'=>$output
|
'output'=>$output
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Save filter args
|
||||||
|
$values['filter_args'] = netflow_get_filter_arguments ($values);
|
||||||
|
|
||||||
$id = db_process_sql_insert('tnetflow_filter', $values);
|
$id = db_process_sql_insert('tnetflow_filter', $values);
|
||||||
if ($id === false) {
|
if ($id === false) {
|
||||||
|
@ -1,143 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
// Pandora FMS - http://pandorafms.com
|
|
||||||
// ==================================================
|
|
||||||
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
|
|
||||||
// Please see http://pandorafms.org for full contribution list
|
|
||||||
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation; version 2
|
|
||||||
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
|
|
||||||
|
|
||||||
global $config;
|
|
||||||
|
|
||||||
include_once("include/functions_ui.php");
|
|
||||||
include_once("include/functions_netflow.php");
|
|
||||||
include_once ("include/functions_users.php");
|
|
||||||
include_once ("include/functions_groups.php");
|
|
||||||
|
|
||||||
check_login ();
|
|
||||||
|
|
||||||
if (! check_acl ($config["id_user"], 0, "AW")) {
|
|
||||||
db_pandora_audit("ACL Violation",
|
|
||||||
"Trying to access event viewer");
|
|
||||||
require ("general/noaccess.php");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$id = (int) get_parameter ('id');
|
|
||||||
//$name = db_get_value('id_name', 'tnetflow_filter', 'id_sg', $id);
|
|
||||||
$update = (string)get_parameter('update', 0);
|
|
||||||
$create = (string)get_parameter('create', 0);
|
|
||||||
|
|
||||||
$buttons['edit'] = '<a href="index.php?sec=netf&sec2=godmode/netflow/nf_manage">'
|
|
||||||
. html_print_image ("images/edit.png", true, array ("title" => __('Option list')))
|
|
||||||
. '</a>';
|
|
||||||
|
|
||||||
//Header
|
|
||||||
ui_print_page_header (__('Netflow Options'), "images/networkmap/so_cisco_new.png", false, "", true, $buttons);
|
|
||||||
|
|
||||||
if ($id) {
|
|
||||||
$option = netflow_options_get_options ($id);
|
|
||||||
$name = $option['id_name'];
|
|
||||||
$description = $option['description'];
|
|
||||||
$path = $option['path'];
|
|
||||||
$port = $option['port'];
|
|
||||||
|
|
||||||
} else {
|
|
||||||
$name = '';
|
|
||||||
$description = '';
|
|
||||||
$path = '';
|
|
||||||
$port = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($update) {
|
|
||||||
$name = (string) get_parameter ('name');
|
|
||||||
$description = (int) get_parameter ('description','');
|
|
||||||
$path = get_parameter('path','');
|
|
||||||
$port = get_parameter('port','');
|
|
||||||
|
|
||||||
if ($name == '') {
|
|
||||||
ui_print_error_message (__('Not updated. Blank name'));
|
|
||||||
} else {
|
|
||||||
$result = db_process_sql_update ('tnetflow_options',
|
|
||||||
array ('id_option' => $id,
|
|
||||||
'id_name' => $name,
|
|
||||||
'description' => $description,
|
|
||||||
'path' => $path,
|
|
||||||
'port' => $port
|
|
||||||
),
|
|
||||||
array ('id_option' => $id));
|
|
||||||
|
|
||||||
ui_print_result_message ($result,
|
|
||||||
__('Successfully updated'),
|
|
||||||
__('Not updated. Error updating data'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($create){
|
|
||||||
$name = (string) get_parameter ('name');
|
|
||||||
$description = (string) get_parameter ('description','');
|
|
||||||
$path = get_parameter('path','');
|
|
||||||
$port = get_parameter('port','');
|
|
||||||
|
|
||||||
if($name == db_get_value('id_name', 'tnetflow_options', 'id_name', $name)){
|
|
||||||
$result = false;
|
|
||||||
} else {
|
|
||||||
$values = array (
|
|
||||||
'id_name'=>$name,
|
|
||||||
'description' => $description,
|
|
||||||
'path'=>$path,
|
|
||||||
'port'=>$port
|
|
||||||
);
|
|
||||||
$result = db_process_sql_insert('tnetflow_options', $values);
|
|
||||||
}
|
|
||||||
if ($result === false)
|
|
||||||
echo '<h3 class="error">'.__ ('Error creating filter').'</h3>';
|
|
||||||
else
|
|
||||||
echo '<h3 class="suc">'.__ ('Option created successfully').'</h3>';
|
|
||||||
}
|
|
||||||
|
|
||||||
$table->width = '80%';
|
|
||||||
$table->border = 0;
|
|
||||||
$table->cellspacing = 3;
|
|
||||||
$table->cellpadding = 5;
|
|
||||||
$table->class = "databox_color";
|
|
||||||
$table->style[0] = 'vertical-align: top;';
|
|
||||||
|
|
||||||
$table->data = array ();
|
|
||||||
|
|
||||||
$table->data[0][0] = '<b>'.__('Name').'</b>';
|
|
||||||
$table->data[0][1] = html_print_input_text ('name', $name, false, 50, 80, true);
|
|
||||||
|
|
||||||
$table->data[1][0] = '<b>'.__('Description').'</b>';
|
|
||||||
$table->data[1][1] = html_print_textarea ('description', 2, 65, $description, '', true);
|
|
||||||
|
|
||||||
$table->data[2][0] = '<b>'.__('Path').'</b>';
|
|
||||||
//$table->data[2][1] = html_print_input_text ('path', $config['netflow_path'], false, 50, 200, true);
|
|
||||||
$table->data[2][1] = html_print_input_text ('path', $path, false, 50, 200, true);
|
|
||||||
|
|
||||||
$table->data[3][0] = '<b>'.__('Port').'</b>';
|
|
||||||
$table->data[3][1] = html_print_input_text ('port', $port, false, 10, 80, true);
|
|
||||||
|
|
||||||
|
|
||||||
echo '<form method="post" action="index.php?sec=netf&sec2=godmode/netflow/nf_option_form">';
|
|
||||||
html_print_table ($table);
|
|
||||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
|
||||||
if ($id) {
|
|
||||||
html_print_input_hidden ('update', 1);
|
|
||||||
html_print_input_hidden ('id', $id);
|
|
||||||
html_print_submit_button (__('Update'), 'crt', false, 'class="sub upd"');
|
|
||||||
} else {
|
|
||||||
html_print_input_hidden ('create', 1);
|
|
||||||
html_print_submit_button (__('Create'), 'crt', false, 'class="sub wand"');
|
|
||||||
}
|
|
||||||
echo '</div>';
|
|
||||||
echo '</form>';
|
|
||||||
?>
|
|
@ -35,17 +35,6 @@ ui_print_page_header (__('Netflow Manager'), "images/networkmap/so_cisco_new.png
|
|||||||
|
|
||||||
$update = (bool) get_parameter ("update");
|
$update = (bool) get_parameter ("update");
|
||||||
|
|
||||||
if ($update) {
|
|
||||||
|
|
||||||
$config['netflow_path'] = (string)get_parameter('netflow_path');
|
|
||||||
$config['netflow_interval'] = (int)get_parameter('netflow_interval');
|
|
||||||
$config['netflow_daemon'] = (string)get_parameter('netflow_daemon');
|
|
||||||
|
|
||||||
db_process_sql_update ('tconfig', array ('value' => $config['netflow_path']), array ('token' => 'netflow_path'));
|
|
||||||
db_process_sql_update ('tconfig', array ('value' => $config['netflow_interval']), array ('token' => 'netflow_interval'));
|
|
||||||
db_process_sql_update ('tconfig', array ('value' => $config['netflow_daemon']), array ('token' => 'netflow_daemon'));
|
|
||||||
}
|
|
||||||
|
|
||||||
$table->width = '70%';
|
$table->width = '70%';
|
||||||
$table->border = 0;
|
$table->border = 0;
|
||||||
$table->cellspacing = 3;
|
$table->cellspacing = 3;
|
||||||
@ -68,7 +57,7 @@ html_print_table ($table);
|
|||||||
|
|
||||||
// Update button
|
// Update button
|
||||||
echo '<div class="action-buttons" style="width:70%;">';
|
echo '<div class="action-buttons" style="width:70%;">';
|
||||||
html_print_input_hidden ('update', 1);
|
html_print_input_hidden ('update_config', 1);
|
||||||
html_print_submit_button (__('Update'), 'upd_button', false, 'class="sub upd"');
|
html_print_submit_button (__('Update'), 'upd_button', false, 'class="sub upd"');
|
||||||
echo '</div></form>';
|
echo '</div></form>';
|
||||||
|
|
@ -185,6 +185,9 @@ function config_update_config () {
|
|||||||
config_update_value ('timezone', (string) get_parameter ('timezone', $config['timezone']));
|
config_update_value ('timezone', (string) get_parameter ('timezone', $config['timezone']));
|
||||||
config_update_value ('activate_gis', (bool) get_parameter ('activate_gis', $config['activate_gis']));
|
config_update_value ('activate_gis', (bool) get_parameter ('activate_gis', $config['activate_gis']));
|
||||||
config_update_value ('activate_netflow', (bool) get_parameter ('activate_netflow', $config['activate_netflow']));
|
config_update_value ('activate_netflow', (bool) get_parameter ('activate_netflow', $config['activate_netflow']));
|
||||||
|
config_update_value ('netflow_path', get_parameter ('netflow_path', $config['netflow_path']));
|
||||||
|
config_update_value ('netflow_interval', get_parameter ('netflow_interval', $config['netflow_interval']));
|
||||||
|
config_update_value ('netflow_daemon', get_parameter ('netflow_daemon', $config['netflow_daemon']));
|
||||||
config_update_value ('stats_interval', get_parameter ('stats_interval', $config['stats_interval']));
|
config_update_value ('stats_interval', get_parameter ('stats_interval', $config['stats_interval']));
|
||||||
config_update_value ('realtimestats', get_parameter ('realtimestats', $config['realtimestats']));
|
config_update_value ('realtimestats', get_parameter ('realtimestats', $config['realtimestats']));
|
||||||
config_update_value ('event_purge', get_parameter ('event_purge', $config['event_purge']));
|
config_update_value ('event_purge', get_parameter ('event_purge', $config['event_purge']));
|
||||||
@ -482,6 +485,18 @@ function config_process_config () {
|
|||||||
config_update_value ( 'activate_netflow', 0);
|
config_update_value ( 'activate_netflow', 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isset ($config['netflow_path'])) {
|
||||||
|
config_update_value ( 'netflow_path', '/var/spool/pandora/data_in/netflow');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset ($config['netflow_interval'])) {
|
||||||
|
config_update_value ( 'netflow_interval', 300);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset ($config['netflow_daemon'])) {
|
||||||
|
config_update_value ( 'netflow_daemon', '/usr/bin/nfcapd');
|
||||||
|
}
|
||||||
|
|
||||||
if (!isset ($config['auth'])) {
|
if (!isset ($config['auth'])) {
|
||||||
config_update_value ( 'auth', 'mysql');
|
config_update_value ( 'auth', 'mysql');
|
||||||
}
|
}
|
||||||
|
@ -448,12 +448,27 @@ function netflow_get_command ($filter) {
|
|||||||
$command .= ' -R '.$config['netflow_path'];
|
$command .= ' -R '.$config['netflow_path'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Filter options
|
||||||
|
$command .= netflow_get_filter_arguments ($filter);
|
||||||
|
|
||||||
|
return $command;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the nfdump command line arguments that match the given filter.
|
||||||
|
*
|
||||||
|
* @param array filter Netflow filter.
|
||||||
|
*
|
||||||
|
* @return Command line argument string.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
function netflow_get_filter_arguments ($filter) {
|
||||||
|
|
||||||
// Advanced filter
|
// Advanced filter
|
||||||
$filter_args = '';
|
$filter_args = '';
|
||||||
if ($filter['advanced_filter'] != '') {
|
if ($filter['advanced_filter'] != '') {
|
||||||
$filter_args = preg_replace('/["\r\n]/','', io_safe_output ($filter['advanced_filter']));
|
$filter_args = preg_replace('/["\r\n]/','', io_safe_output ($filter['advanced_filter']));
|
||||||
$command .= ' "(' . $filter_args . ')"';
|
return ' "(' . $filter_args . ')"';
|
||||||
return $command;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Normal filter
|
// Normal filter
|
||||||
@ -524,11 +539,10 @@ function netflow_get_command ($filter) {
|
|||||||
$filter_args .= ')';
|
$filter_args .= ')';
|
||||||
}
|
}
|
||||||
if ($filter_args != '') {
|
if ($filter_args != '') {
|
||||||
$filter_args .= '"';
|
$filter_args .= '"';
|
||||||
$command .= $filter_args;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $command;
|
return $filter_args;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -67,6 +67,10 @@ ui_print_page_header (__('Netflow live view'), "images/networkmap/so_cisco_new.p
|
|||||||
|
|
||||||
// Save user defined filter
|
// Save user defined filter
|
||||||
if ($save != '') {
|
if ($save != '') {
|
||||||
|
|
||||||
|
// Save filter args
|
||||||
|
$filter['filter_args'] = netflow_get_filter_arguments ($filter);
|
||||||
|
|
||||||
$filter_id = db_process_sql_insert ('tnetflow_filter', $filter);
|
$filter_id = db_process_sql_insert ('tnetflow_filter', $filter);
|
||||||
if ($filter_id === false) {
|
if ($filter_id === false) {
|
||||||
$filter_id = 0;
|
$filter_id = 0;
|
||||||
@ -81,6 +85,9 @@ else if ($update != '' && $filter_id > 0) {
|
|||||||
$filter_copy = $filter;
|
$filter_copy = $filter;
|
||||||
unset ($filter_copy['id_name']);
|
unset ($filter_copy['id_name']);
|
||||||
unset ($filter_copy['id_group']);
|
unset ($filter_copy['id_group']);
|
||||||
|
|
||||||
|
// Save filter args
|
||||||
|
$filter_copy['filter_args'] = netflow_get_filter_arguments ($filter_copy);
|
||||||
|
|
||||||
$result = db_process_sql_update ('tnetflow_filter', $filter_copy, array ('id_sg' => $filter_id));
|
$result = db_process_sql_update ('tnetflow_filter', $filter_copy, array ('id_sg' => $filter_id));
|
||||||
ui_print_result_message ($result, __('Filter updated successfully'), __('Error updating filter'));
|
ui_print_result_message ($result, __('Filter updated successfully'), __('Error updating filter'));
|
||||||
|
@ -1491,6 +1491,7 @@ ip_src CLOB NOT NULL,
|
|||||||
dst_port CLOB NOT NULL,
|
dst_port CLOB NOT NULL,
|
||||||
src_port CLOB NOT NULL,
|
src_port CLOB NOT NULL,
|
||||||
advanced_filter CLOB NOT NULL,
|
advanced_filter CLOB NOT NULL,
|
||||||
|
filter_args CLOB NOT NULL,
|
||||||
aggregate VARCHAR2(60),
|
aggregate VARCHAR2(60),
|
||||||
output VARCHAR2(60)
|
output VARCHAR2(60)
|
||||||
);
|
);
|
||||||
|
@ -1204,6 +1204,7 @@ CREATE TABLE "tnetflow_filter" (
|
|||||||
"dst_port" TEXT NOT NULL,
|
"dst_port" TEXT NOT NULL,
|
||||||
"src_port" TEXT NOT NULL,
|
"src_port" TEXT NOT NULL,
|
||||||
"advanced_filter" TEXT NOT NULL,
|
"advanced_filter" TEXT NOT NULL,
|
||||||
|
"filter_args" TEXT NOT NULL,
|
||||||
"aggregate" varchar(60),
|
"aggregate" varchar(60),
|
||||||
"output" varchar(60)
|
"output" varchar(60)
|
||||||
);
|
);
|
||||||
|
@ -1295,6 +1295,7 @@ CREATE TABLE IF NOT EXISTS `tnetflow_filter` (
|
|||||||
`dst_port` TEXT NOT NULL,
|
`dst_port` TEXT NOT NULL,
|
||||||
`src_port` TEXT NOT NULL,
|
`src_port` TEXT NOT NULL,
|
||||||
`advanced_filter` TEXT NOT NULL,
|
`advanced_filter` TEXT NOT NULL,
|
||||||
|
`filter_args` TEXT NOT NULL,
|
||||||
`aggregate` varchar(60),
|
`aggregate` varchar(60),
|
||||||
`output` varchar(60),
|
`output` varchar(60),
|
||||||
PRIMARY KEY (`id_sg`)
|
PRIMARY KEY (`id_sg`)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user