From 2bf6062ea2e9e504ed3917748f6975445f85aa89 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Mon, 20 Aug 2012 18:06:04 +0000 Subject: [PATCH] 2012-08-20 Miguel de Dios * index.php, extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql, extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql, extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql, general/login_page.php, general/logon_failed.php, godmode/users/configure_user.php, include/api.php, include/auth/mysql.php, pandoradb.sql, pandoradb.postgreSQL.sql, pandoradb.oracle.sql: added the feature to set any user with "not login" for only the user can work across the API. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6891 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 11 + .../pandoradb_migrate_4.0.x_to_5.0.mysql.sql | 181 +++--- .../pandoradb_migrate_4.0.x_to_5.0.oracle.sql | 115 ++-- ...doradb_migrate_4.0.x_to_5.0.postgreSQL.sql | 45 +- pandora_console/general/login_page.php | 19 +- pandora_console/general/logon_failed.php | 4 +- .../godmode/users/configure_user.php | 13 +- pandora_console/include/api.php | 2 +- pandora_console/include/auth/mysql.php | 189 +++--- pandora_console/index.php | 16 +- pandora_console/pandoradb.oracle.sql | 41 +- pandora_console/pandoradb.postgreSQL.sql | 79 ++- pandora_console/pandoradb.sql | 558 ++++++++++-------- 13 files changed, 683 insertions(+), 590 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 75794e7802..c47be74402 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,14 @@ +2012-08-20 Miguel de Dios + + * index.php, extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql, + extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql, + extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql, + general/login_page.php, general/logon_failed.php, + godmode/users/configure_user.php, include/api.php, + include/auth/mysql.php, pandoradb.sql, pandoradb.postgreSQL.sql, + pandoradb.oracle.sql: added the feature to set any user with + "not login" for only the user can work across the API. + 2012-08-20 Sergio Martin * godmode/agentes/configurar_agente.php: Add enterprise tab diff --git a/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql index ba918fcd8c..dcdf7ae39f 100644 --- a/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql @@ -1,42 +1,39 @@ -- ----------------------------------------------------- -- Table `tnetflow_filter` -- ----------------------------------------------------- - CREATE TABLE IF NOT EXISTS `tnetflow_filter` ( - `id_sg` int(10) unsigned NOT NULL auto_increment, - `id_name` varchar(600) NOT NULL default '0', - `id_group` int(10), - `ip_dst` TEXT NOT NULL, - `ip_src` TEXT NOT NULL, - `dst_port` TEXT NOT NULL, - `src_port` TEXT NOT NULL, - `advanced_filter` TEXT NOT NULL, - `filter_args` TEXT NOT NULL, - `aggregate` varchar(60), - `output` varchar(60), -PRIMARY KEY (`id_sg`) + `id_sg` int(10) unsigned NOT NULL auto_increment, + `id_name` varchar(600) NOT NULL default '0', + `id_group` int(10), + `ip_dst` TEXT NOT NULL, + `ip_src` TEXT NOT NULL, + `dst_port` TEXT NOT NULL, + `src_port` TEXT NOT NULL, + `advanced_filter` TEXT NOT NULL, + `filter_args` TEXT NOT NULL, + `aggregate` varchar(60), + `output` varchar(60), + PRIMARY KEY (`id_sg`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ----------------------------------------------------- -- Table `tnetflow_report` -- ----------------------------------------------------- - CREATE TABLE IF NOT EXISTS `tnetflow_report` ( - `id_report` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, - `id_name` varchar(150) NOT NULL default '', - `description` TEXT NOT NULL, - `id_group` int(10), -PRIMARY KEY(`id_report`) + `id_report` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, + `id_name` varchar(150) NOT NULL default '', + `description` TEXT NOT NULL, + `id_group` int(10), + PRIMARY KEY(`id_report`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ----------------------------------------------------- -- Table `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_filter` INTEGER UNSIGNED NOT NULL default 0, + `id_filter` INTEGER UNSIGNED NOT NULL default 0, `date` bigint(20) NOT NULL default '0', `period` int(11) NOT NULL default 0, `max` int (11) NOT NULL default 0, @@ -44,35 +41,24 @@ CREATE TABLE IF NOT EXISTS `tnetflow_report_content` ( `order` int (11) NOT NULL default 0, PRIMARY KEY(`id_rc`), FOREIGN KEY (`id_report`) REFERENCES tnetflow_report(`id_report`) - ON DELETE CASCADE, + ON DELETE CASCADE, FOREIGN KEY (`id_filter`) REFERENCES tnetflow_filter(`id_sg`) - ON DELETE CASCADE + ON DELETE CASCADE ) ENGINE = InnoDB DEFAULT CHARSET=utf8; --- ----------------------------------------------------- --- Table `tusuario` --- ----------------------------------------------------- - -ALTER TABLE `tusuario` ADD COLUMN `disabled` int(4) NOT NULL DEFAULT 0; -ALTER TABLE `tusuario` ADD COLUMN `shortcut` tinyint(1) DEFAULT 0; -ALTER TABLE tusuario ADD COLUMN `shortcut_data` text; - -- ----------------------------------------------------- -- Table `tincidencia` -- ----------------------------------------------------- - ALTER TABLE `tincidencia` ADD COLUMN `id_agent` int(10) unsigned NULL default 0; -- ----------------------------------------------------- -- Table `tagente` -- ----------------------------------------------------- - ALTER TABLE `tagente` ADD COLUMN `url_address` mediumtext NULL; -- ----------------------------------------------------- -- Table `talert_special_days` -- ----------------------------------------------------- - CREATE TABLE IF NOT EXISTS `talert_special_days` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `date` date NOT NULL DEFAULT '0000-00-00', @@ -84,23 +70,21 @@ CREATE TABLE IF NOT EXISTS `talert_special_days` ( -- ----------------------------------------------------- -- Table `talert_templates` -- ----------------------------------------------------- - ALTER TABLE `talert_templates` ADD COLUMN `special_day` tinyint(1) DEFAULT '0'; -- ----------------------------------------------------- -- Table `tplanned_downtime_agents` -- ----------------------------------------------------- DELETE FROM tplanned_downtime_agents -WHERE id_downtime NOT IN (SELECT id FROM tplanned_downtime); + WHERE id_downtime NOT IN (SELECT id FROM tplanned_downtime); ALTER TABLE tplanned_downtime_agents -ADD FOREIGN KEY(`id_downtime`) REFERENCES tplanned_downtime(`id`) -ON DELETE CASCADE; + ADD FOREIGN KEY(`id_downtime`) REFERENCES tplanned_downtime(`id`) + ON DELETE CASCADE; -- ----------------------------------------------------- -- Table `tevento` -- ----------------------------------------------------- - ALTER TABLE `tevento` ADD COLUMN (`source` tinytext NOT NULL, `id_extra` tinytext NOT NULL); @@ -131,24 +115,23 @@ ALTER TABLE tgraph_source MODIFY weight FLOAT(5,3) NOT NULL DEFAULT '0.000'; -- ----------------------------------------------------- -- Table `tevent_filter` -- ----------------------------------------------------- - CREATE TABLE IF NOT EXISTS `tevent_filter` ( - `id_filter` int(10) unsigned NOT NULL auto_increment, - `id_group_filter` int(10) NOT NULL default 0, - `id_name` varchar(600) NOT NULL, - `id_group` int(10) NOT NULL default 0, - `event_type` text NOT NULL, - `severity` int(10) NOT NULL default -1, - `status` int(10) NOT NULL default -1, - `search` TEXT, - `text_agent` TEXT, - `pagination` int(10) NOT NULL default 25, - `event_view_hr` int(10) NOT NULL default 8, - `id_user_ack` TEXT, - `group_rep` int(10) NOT NULL default 0, - `tag` varchar(600) NOT NULL default '', - `filter_only_alert` int(10) NOT NULL default -1, -PRIMARY KEY (`id_filter`) + `id_filter` int(10) unsigned NOT NULL auto_increment, + `id_group_filter` int(10) NOT NULL default 0, + `id_name` varchar(600) NOT NULL, + `id_group` int(10) NOT NULL default 0, + `event_type` text NOT NULL, + `severity` int(10) NOT NULL default -1, + `status` int(10) NOT NULL default -1, + `search` TEXT, + `text_agent` TEXT, + `pagination` int(10) NOT NULL default 25, + `event_view_hr` int(10) NOT NULL default 8, + `id_user_ack` TEXT, + `group_rep` int(10) NOT NULL default 0, + `tag` varchar(600) NOT NULL default '', + `filter_only_alert` int(10) NOT NULL default -1, + PRIMARY KEY (`id_filter`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ----------------------------------------------------- @@ -180,7 +163,6 @@ ALTER TABLE `tgraph` ADD COLUMN `id_graph_template` int(11) NOT NULL DEFAULT 0; -- Table `ttipo_modulo` -- ----------------------------------------------------- UPDATE ttipo_modulo SET descripcion='Generic data' WHERE id_tipo=1; - UPDATE ttipo_modulo SET descripcion='Generic data incremental' WHERE id_tipo=4; -- ----------------------------------------------------- @@ -189,6 +171,16 @@ UPDATE ttipo_modulo SET descripcion='Generic data incremental' WHERE id_tipo=4; ALTER TABLE `tusuario` ADD COLUMN `section` TEXT NOT NULL; INSERT INTO `tusuario` (`section`) VALUES ('Default'); ALTER TABLE `tusuario` ADD COLUMN `data_section` TEXT NOT NULL; +ALTER TABLE `tusuario` ADD COLUMN `disabled` int(4) NOT NULL DEFAULT 0; +ALTER TABLE `tusuario` ADD COLUMN `shortcut` tinyint(1) DEFAULT 0; +ALTER TABLE `tusuario` ADD COLUMN `shortcut_data` text; +ALTER TABLE `tusuario` ADD COLUMN `not_login` tinyint(1) unsigned NOT NULL DEFAULT 0; +ALTER TABLE `tusuario` ADD COLUMN `force_change_pass` tinyint(1) DEFAULT 0; +ALTER TABLE `tusuario` ADD COLUMN `last_pass_change` DATETIME NOT NULL DEFAULT 0; +ALTER TABLE `tusuario` ADD COLUMN `last_failed_login` DATETIME NOT NULL DEFAULT 0; +ALTER TABLE `tusuario` ADD COLUMN `failed_attempt` int(4) NOT NULL DEFAULT 0; +ALTER TABLE `tusuario` ADD COLUMN `login_blocked` tinyint(1) DEFAULT 0; +ALTER TABLE `tusuario` ADD COLUMN `metaconsole_access` enum('basic','advanced','custom','all','only_console') DEFAULT 'only_console'; -- ----------------------------------------------------- -- Table `treport_content_item` @@ -203,65 +195,51 @@ ALTER TABLE `tmensajes` MODIFY COLUMN `mensaje` TEXT NOT NULL; -- ----------------------------------------------------- -- Table `talert_compound` -- ----------------------------------------------------- - ALTER TABLE `talert_compound` ADD COLUMN `special_day` tinyint(1) DEFAULT '0'; --- ----------------------------------------------------- --- Table `tusuario` --- ----------------------------------------------------- - -ALTER TABLE `tusuario` ADD COLUMN `force_change_pass` tinyint(1) DEFAULT 0; -ALTER TABLE `tusuario` ADD COLUMN `last_pass_change` DATETIME NOT NULL DEFAULT 0; -ALTER TABLE `tusuario` ADD COLUMN `last_failed_login` DATETIME NOT NULL DEFAULT 0; -ALTER TABLE `tusuario` ADD COLUMN `failed_attempt` int(4) NOT NULL DEFAULT 0; -ALTER TABLE `tusuario` ADD COLUMN `login_blocked` tinyint(1) DEFAULT 0; - -- ----------------------------------------------------- -- Table `talert_commands` -- ----------------------------------------------------- - INSERT INTO `talert_commands` (`name`, `command`, `description`, `internal`) VALUES ('Validate Event','Internal type','This alert validate the events matched with a module given the agent name (_field1_) and module name (_field2_)', 1); -- ----------------------------------------------------- -- Table `tconfig` -- ----------------------------------------------------- - INSERT INTO `tconfig` (`token`, `value`) VALUES -('enable_pass_policy', 0), -('pass_size', 4), -('pass_needs_numbers', 0), -('pass_needs_symbols', 0), -('pass_expire', 0), -('first_login', 0), -('mins_fail_pass', 5), -('number_attempts', 5), -('enable_pass_policy_admin', 0), -('enable_pass_history', 0), -('compare_pass', 3), -('meta_style', 'meta_pandora'); + ('enable_pass_policy', 0), + ('pass_size', 4), + ('pass_needs_numbers', 0), + ('pass_needs_symbols', 0), + ('pass_expire', 0), + ('first_login', 0), + ('mins_fail_pass', 5), + ('number_attempts', 5), + ('enable_pass_policy_admin', 0), + ('enable_pass_history', 0), + ('compare_pass', 3), + ('meta_style', 'meta_pandora'); -- ----------------------------------------------------- -- Table `tpassword_history` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `tpassword_history` ( - `id_pass` int(10) unsigned NOT NULL auto_increment, - `id_user` varchar(60) NOT NULL, - `password` varchar(45) default NULL, - `date_begin` DATETIME NOT NULL DEFAULT 0, - `date_end` DATETIME NOT NULL DEFAULT 0, -PRIMARY KEY (`id_pass`) + `id_pass` int(10) unsigned NOT NULL auto_increment, + `id_user` varchar(60) NOT NULL, + `password` varchar(45) default NULL, + `date_begin` DATETIME NOT NULL DEFAULT 0, + `date_end` DATETIME NOT NULL DEFAULT 0, + PRIMARY KEY (`id_pass`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ----------------------------------------------------- -- Table `tconfig` -- ----------------------------------------------------- UPDATE tconfig SET `value`='comparation' -WHERE `token`= 'prominent_time'; + WHERE `token`= 'prominent_time'; -- ----------------------------------------------------- -- Table `tnetwork_component` -- ----------------------------------------------------- - ALTER TABLE tnetwork_component ADD `wizard_level` enum('basic','advanced','custom','nowizard') default 'nowizard'; ALTER TABLE tnetwork_component ADD `only_metaconsole` tinyint(1) unsigned default '0'; ALTER TABLE tnetwork_component ADD `macros` text; @@ -269,40 +247,23 @@ ALTER TABLE tnetwork_component ADD `macros` text; -- ----------------------------------------------------- -- Table `tagente_modulo` -- ----------------------------------------------------- - ALTER TABLE tagente_modulo ADD `wizard_level` enum('basic','advanced','custom','nowizard') default 'nowizard'; ALTER TABLE tagente_modulo ADD `macros` text; --- ----------------------------------------------------- --- Table `tusuario` --- ----------------------------------------------------- - -ALTER TABLE tusuario ADD `metaconsole_access` enum('basic','advanced','custom','all','only_console') default 'only_console'; - -- ----------------------------------------------------- -- Table `tplugin` -- ----------------------------------------------------- - ALTER TABLE tplugin ADD `macros` text; ALTER TABLE tplugin ADD `parameters` text; -- ----------------------------------------------------- -- Table `trecon_script` -- ----------------------------------------------------- - UPDATE trecon_script SET `description`='This script is used to automatically detect SNMP Interfaces on devices, used as Recon Custom Script in the recon task. Parameters used are: * custom_field1 = network. i.e.: 192.168.100.0/24 * custom_field2 = several communities separated by comma. For example: snmp_community,public,private * custom_field3 = optative parameter to force process downed interfaces (use: '-a'). Only up interfaces are processed by default See documentation for more information.' -WHERE id_recon_script=1; + WHERE id_recon_script = 1; -- ----------------------------------------------------- -- Table `trecon_task -- ----------------------------------------------------- ALTER TABLE trecon_task MODIFY subnet TEXT NOT NULL DEFAULT ''; -ALTER TABLE trecon_task MODIFY field1 TEXT NOT NULL DEFAULT ''; - - - -ALTER TABLE tagente_modulo ADD `critical_instructions` text; -ALTER TABLE tagente_modulo ADD `warning_instructions` text; -ALTER TABLE tagente_modulo ADD `unknown_instructions` text; - - +ALTER TABLE trecon_task MODIFY field1 TEXT NOT NULL DEFAULT ''; \ No newline at end of file diff --git a/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql b/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql index 5f307cc29a..3dec657472 100644 --- a/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql +++ b/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql @@ -1,67 +1,73 @@ -- ----------------------------------------------------- -- Table `tusuario` -- ----------------------------------------------------- +ALTER TABLE tusuario ADD COLUMN (disabled NUMBER(10,0) DEFAULT 0 NOT NULL); +ALTER TABLE tusuario ADD COLUMN (shortcut NUMBER(5, 0) DEFAULT 0); +ALTER TABLE tusuario ADD COLUMN (force_change_pass NUMBER(5,0) DEFAULT 0 NOT NULL); +ALTER TABLE tusuario ADD COLUMN (last_pass_change TIMESTAMP DEFAULT 0); +ALTER TABLE tusuario ADD COLUMN (last_failed_login TIMESTAMP DEFAULT 0); +ALTER TABLE tusuario ADD COLUMN (failed_attempt NUMBER(5,0) DEFAULT 0 NOT NULL); +ALTER TABLE tusuario ADD COLUMN (login_blocked NUMBER(5,0) DEFAULT 0 NOT NULL); +ALTER TABLE tusuario ADD COLUMN disabled NUMBER(10, 0) NOT NULL DEFAULT 0; +ALTER TABLE tusuario ADD COLUMN shortcut NUMBER(5, 0) DEFAULT 0; +ALTER TABLE tusuario ADD COLUMN shortcut_data CLOB DEFAULT ''; +ALTER TABLE tusuario ADD (section VARCHAR2(255) NOT NULL); +INSERT INTO tusuario (section) VALUES ('Default'); +ALTER TABLE tusuario ADD COLUMN (data_section VARCHAR2(255) NOT NULL); +ALTER TABLE tusuario ADD COLUMN (metaconsole_access VARCHAR2(100) DEFAULT 'only_console' NOT NULL); +ALTER TABLE tusuario ADD CONSTRAINT t_usuario_metaconsole_access_cons CHECK (metaconsole_access IN ('basic','advanced','custom','all','only_console')); +ALTER TABLE tusuario ADD COLUMN (not_login NUMBER(5,0) default 0 NOT NULL); -alter table tusuario add (disabled NUMBER(10,0) default 0 NOT NULL); -alter table tusuario add (shortcut NUMBER(5, 0) DEFAULT 0); - -- ----------------------------------------------------- -- Table "tnetflow_filter" -- ----------------------------------------------------- - CREATE TABLE tnetflow_filter ( -id_sg NUMBER(10, 0) NOT NULL PRIMARY KEY, -id_name VARCHAR2(600) NOT NULL, -id_group NUMBER(10, 0), -ip_dst CLOB NOT NULL, -ip_src CLOB NOT NULL, -dst_port CLOB NOT NULL, -src_port CLOB NOT NULL, -advanced_filter CLOB NOT NULL, -filter_args CLOB NOT NULL, -aggregate VARCHAR2(60), -output VARCHAR2(60) + id_sg NUMBER(10, 0) NOT NULL PRIMARY KEY, + id_name VARCHAR2(600) NOT NULL, + id_group NUMBER(10, 0), + ip_dst CLOB NOT NULL, + ip_src CLOB NOT NULL, + dst_port CLOB NOT NULL, + src_port CLOB NOT NULL, + advanced_filter CLOB NOT NULL, + filter_args CLOB NOT NULL, + aggregate VARCHAR2(60), + output VARCHAR2(60) ); - CREATE SEQUENCE tnetflow_filter_s INCREMENT BY 1 START WITH 1; CREATE OR REPLACE TRIGGER tnetflow_filter_inc BEFORE INSERT ON tnetflow_filter REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tnetflow_filter_s.nextval INTO :NEW.ID_SG FROM dual; END tnetflow_filter_inc;; -- ----------------------------------------------------- -- Table "tnetflow_report" -- ----------------------------------------------------- - CREATE TABLE tnetflow_report ( -id_report NUMBER(10, 0) NOT NULL PRIMARY KEY, -id_name VARCHAR2(100) NOT NULL, -description CLOB default '', -id_group NUMBER(10, 0) + id_report NUMBER(10, 0) NOT NULL PRIMARY KEY, + id_name VARCHAR2(100) NOT NULL, + description CLOB default '', + id_group NUMBER(10, 0) ); - CREATE SEQUENCE tnetflow_report_s INCREMENT BY 1 START WITH 1; CREATE OR REPLACE TRIGGER tnetflow_report_inc BEFORE INSERT ON tnetflow_report REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tnetflow_report_s.nextval INTO :NEW.ID_REPORT FROM dual; END tnetflow_report_inc;; -- ----------------------------------------------------- -- Table "tnetflow_report_content" -- ----------------------------------------------------- - CREATE TABLE tnetflow_report_content ( -id_rc NUMBER(10, 0) NOT NULL PRIMARY KEY, -id_report NUMBER(10, 0) NOT NULL REFERENCES tnetflow_report(id_report) ON DELETE CASCADE, -id_filter NUMBER(10,0) NOT NULL REFERENCES tnetflow_filter(id_sg) ON DELETE CASCADE, -"date" NUMBER(20, 0) default 0 NOT NULL, -period NUMBER(11, 0) default 0 NOT NULL, -max NUMBER(11, 0) default 0 NOT NULL, -show_graph VARCHAR2(60), -"order" NUMBER(11,0) default 0 NOT NULL + id_rc NUMBER(10, 0) NOT NULL PRIMARY KEY, + id_report NUMBER(10, 0) NOT NULL REFERENCES tnetflow_report(id_report) ON DELETE CASCADE, + id_filter NUMBER(10,0) NOT NULL REFERENCES tnetflow_filter(id_sg) ON DELETE CASCADE, + "date" NUMBER(20, 0) default 0 NOT NULL, + period NUMBER(11, 0) default 0 NOT NULL, + max NUMBER(11, 0) default 0 NOT NULL, + show_graph VARCHAR2(60), + "order" NUMBER(11,0) default 0 NOT NULL ); - CREATE SEQUENCE tnetflow_report_content_s INCREMENT BY 1 START WITH 1; CREATE OR REPLACE TRIGGER tnetflow_report_content_inc BEFORE INSERT ON tnetflow_report_content REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tnetflow_report_content_s.nextval INTO :NEW.ID_RC FROM dual; END tnetflow_report_content_inc;; -- ----------------------------------------------------- -- Table `tincidencia` -- ----------------------------------------------------- - alter table tincidencia add (id_agent NUMBER(10,0) default 0 NULL); -- ----------------------------------------------------- @@ -72,13 +78,12 @@ alter table tagente add (url_address CLOB default '' NULL); -- ----------------------------------------------------- -- Table `talert_special_days` -- ----------------------------------------------------- - CREATE TABLE talert_special_days ( -id NUMBER(10,0) NOT NULL PRIMARY KEY, -date DATE default '0000-00-00' NOT NULL, -same_day VARCHAR2(20) default 'sunday', -description CLOB, -CONSTRAINT talert_special_days_same_day_cons CHECK (same_day IN ('monday','tuesday','wednesday','thursday','friday','saturday','sunday')) + id NUMBER(10,0) NOT NULL PRIMARY KEY, + date DATE default '0000-00-00' NOT NULL, + same_day VARCHAR2(20) default 'sunday', + description CLOB, + CONSTRAINT talert_special_days_same_day_cons CHECK (same_day IN ('monday','tuesday','wednesday','thursday','friday','saturday','sunday')) ); CREATE SEQUENCE talert_special_days_s INCREMENT BY 1 START WITH 1; @@ -87,7 +92,6 @@ CREATE OR REPLACE TRIGGER talert_special_days_inc BEFORE INSERT ON talert_specia -- ----------------------------------------------------- -- Table `talert_templates` -- ----------------------------------------------------- - alter table talert_templates add (special_day NUMBER(5,0) default 0); -- ----------------------------------------------------- @@ -171,20 +175,6 @@ ALTER TABLE tgraph ADD (id_graph_template NUMBER(11, 0) default 0 NOT NULL); UPDATE ttipo_modulo SET descripcion='Generic data' WHERE id_tipo=1; UPDATE ttipo_modulo SET descripcion='Generic data incremental' WHERE id_tipo=4; --- ----------------------------------------------------- --- Table `tusuario` --- ----------------------------------------------------- -ALTER TABLE tusuario ADD COLUMN disabled NUMBER(10, 0) NOT NULL DEFAULT 0; -ALTER TABLE tusuario ADD COLUMN shortcut NUMBER(5, 0) DEFAULT 0; -ALTER TABLE tusuario ADD COLUMN shortcut_data CLOB default ''; - --- ----------------------------------------------------- --- Table `tusuario` --- ----------------------------------------------------- -ALTER TABLE tusuario ADD (section VARCHAR2(255) NOT NULL); -INSERT INTO tusuario (section) VALUES ('Default'); -ALTER TABLE tusuario ADD (data_section VARCHAR2(255) NOT NULL); - -- ----------------------------------------------------- -- Table `treport_content_item` -- ----------------------------------------------------- @@ -207,16 +197,6 @@ alter table talert_compound add (special_day NUMBER(5,0) default 0); ALTER TABLE tnetwork_component ADD COLUMN unit CLOB default ''; --- ----------------------------------------------------- --- Table `tusuario` --- ----------------------------------------------------- - -alter table tusuario add (force_change_pass NUMBER(5,0) default 0 NOT NULL); -alter table tusuario add (last_pass_change TIMESTAMP default 0); -alter table tusuario add (last_failed_login TIMESTAMP default 0); -alter table tusuario add (failed_attempt NUMBER(5,0) default 0 NOT NULL); -alter table tusuario add (login_blocked NUMBER(5,0) default 0 NOT NULL); - -- ----------------------------------------------------- -- Table `talert_commands` -- ----------------------------------------------------- @@ -276,13 +256,6 @@ ALTER TABLE tagente_modulo ADD (wizard_level VARCHAR2(100) default 'nowizard' NO ALTER TABLE tagente_modulo ADD CONSTRAINT t_agente_modulo_wizard_level_cons CHECK (wizard_level IN ('basic','advanced','custom','nowizard')); ALTER TABLE tagente_modulo ADD (macros CLOB default ''); --- ----------------------------------------------------- --- Table `tusuario` --- ----------------------------------------------------- - -ALTER TABLE tusuario ADD (metaconsole_access VARCHAR2(100) default 'only_console' NOT NULL); -ALTER TABLE tusuario ADD CONSTRAINT t_usuario_metaconsole_access_cons CHECK (metaconsole_access IN ('basic','advanced','custom','all','only_console')); - -- ----------------------------------------------------- -- Table `tplugin` -- ----------------------------------------------------- diff --git a/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql b/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql index f228e24d5b..f536d66f11 100644 --- a/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql +++ b/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql @@ -1,9 +1,22 @@ -- ----------------------------------------------------- -- Table `tusuario` -- ----------------------------------------------------- - ALTER TABLE "tusuario" ADD COLUMN "disabled" INTEGER NOT NULL DEFAULT 0; ALTER TABLE "tusuario" ADD COLUMN "shortcut" SMALLINT DEFAULT 0; +ALTER TABLE "tusuario" ADD COLUMN "disabled" INTEGER NOT NULL DEFAULT 0; +ALTER TABLE "tusuario" ADD COLUMN "shortcut" SMALLINT DEFAULT 0; +ALTER TABLE "tusuario" ADD COLUMN "shortcut_data" text DEFAULT ''; +ALTER TABLE "tusuario" ADD COLUMN "section" varchar(255) NOT NULL DEFAULT ''; +INSERT INTO "tusuario" ("section") VALUES ("Default"); +ALTER TABLE "tusuario" ADD COLUMN "data_section" varchar(255) NOT NULL DEFAULT ''; +ALTER TABLE "tusuario" ADD COLUMN "force_change_pass" SMALLINT NOT NULL DEFAULT 0; +ALTER TABLE "tusuario" ADD COLUMN "last_pass_change" BIGINT NOT NULL DEFAULT 0; +ALTER TABLE "tusuario" ADD COLUMN "last_failed_login" BIGINT NOT NULL DEFAULT 0; +ALTER TABLE "tusuario" ADD COLUMN "failed_attempt" INTEGER NOT NULL DEFAULT 0; +ALTER TABLE "tusuario" ADD COLUMN "login_blocked" SMALLINT NOT NULL DEFAULT 0; +CREATE TYPE type_tusuario_metaconsole_access AS ENUM ('basic','advanced','custom','all','only_console'); +ALTER TABLE "tusuario" ADD COLUMN "metaconsole_access" type_tusuario_metaconsole_access DEFAULT 'only_console'; +ALTER TABLE "tusuario" ADD COLUMN "not_login" SMALLINT NOT NULL default 0; -- ----------------------------------------------------- -- Table `tnetflow_filter` @@ -163,20 +176,6 @@ ALTER TABLE "tgraph" ADD COLUMN "id_graph_template" INTEGER NOT NULL default 0; UPDATE "ttipo_modulo" SET "descripcion"='Generic data' WHERE "id_tipo"=1; UPDATE "ttipo_modulo" SET "descripcion"='Generic data incremental' WHERE "id_tipo"=4; --- ----------------------------------------------------- --- Table `tusuario` --- ----------------------------------------------------- -ALTER TABLE "tusuario" ADD COLUMN "disabled" INTEGER NOT NULL DEFAULT 0; -ALTER TABLE "tusuario" ADD COLUMN "shortcut" SMALLINT DEFAULT 0; -ALTER TABLE "tusuario" ADD COLUMN "shortcut_data" text default ''; - --- ----------------------------------------------------- --- Table `tusuario` --- ----------------------------------------------------- -ALTER TABLE "tusuario" ADD COLUMN "section" varchar(255) NOT NULL DEFAULT ''; -INSERT INTO "tusuario" ("section") VALUES ("Default"); -ALTER TABLE "tusuario" ADD COLUMN "data_section" varchar(255) NOT NULL DEFAULT ''; - -- ----------------------------------------------------- -- Table `treport_content_item` -- ----------------------------------------------------- @@ -199,16 +198,6 @@ ALTER TABLE "talert_compound" ADD COLUMN "special_day" SMALLINT default 0; ALTER TABLE "tnetwork_component" ADD COLUMN "unit" text default ''; --- ----------------------------------------------------- --- Table `tusuario` --- ----------------------------------------------------- - -ALTER TABLE "tusuario" ADD COLUMN "force_change_pass" SMALLINT NOT NULL default 0; -ALTER TABLE "tusuario" ADD COLUMN "last_pass_change" BIGINT NOT NULL default 0; -ALTER TABLE "tusuario" ADD COLUMN "last_failed_login" BIGINT NOT NULL default 0; -ALTER TABLE "tusuario" ADD COLUMN "failed_attempt" INTEGER NOT NULL DEFAULT 0; -ALTER TABLE "tusuario" ADD COLUMN "login_blocked" SMALLINT NOT NULL default 0; - -- ----------------------------------------------------- -- Table `talert_commands` -- ----------------------------------------------------- @@ -267,12 +256,6 @@ CREATE TYPE type_tagente_modulo_wizard_level AS ENUM ('basic','advanced','custom ALTER TABLE "tagente_modulo" ADD COLUMN "wizard_level" type_tagente_modulo_wizard_level default 'nowizard'; ALTER TABLE "tagente_modulo" ADD COLUMN "macros" TEXT default ''; --- ----------------------------------------------------- --- Table `tusuario` --- ----------------------------------------------------- - -CREATE TYPE type_tusuario_metaconsole_access AS ENUM ('basic','advanced','custom','all','only_console'); -ALTER TABLE "tusuario" ADD COLUMN "metaconsole_access" type_tusuario_metaconsole_access default 'only_console'; -- ----------------------------------------------------- -- Table `tplugin` -- ----------------------------------------------------- diff --git a/pandora_console/general/login_page.php b/pandora_console/general/login_page.php index 8045b6cd43..32777f8812 100644 --- a/pandora_console/general/login_page.php +++ b/pandora_console/general/login_page.php @@ -38,14 +38,14 @@ echo ' // Replace the following with your own URL and logo. // A mashup of the Pandora FMS logo and your companies highly preferred echo '  '; -if (defined ('PANDORA_ENTERPRISE')){ +if (defined ('PANDORA_ENTERPRISE')) { html_print_image ("images/pandora_login_enterprise.png", false, array ("alt" => "logo", "border" => 0)); } else { html_print_image ("images/pandora_login.png", false, array ("alt" => "logo", "border" => 0)); } echo ''; - + // This prints the current pandora console version. // For stable/live function it might be wise to comment it out @@ -61,9 +61,9 @@ if (!empty ($page) && !empty ($sec)) { } echo '
'.html_print_input_text_extended ("nick", '', "nick", '', '', '' , false, '', 'class="login"', true). - '
+ '

'.html_print_input_text_extended ("pass", '', "pass", '', '', '' ,false, '', 'class="login"', true, true). - '
'; + '
'; echo '
'; html_print_input_image ("Login", "images/login_botton.png", 'Login'); echo '
'; @@ -82,25 +82,24 @@ echo '
' . $pandora_version.(($develop_bypass == 1) ? ' '.__('B if (isset ($login_failed)) { - echo '
'; - - echo '
'; + echo '
'; + echo '
'; echo '' . $config["auth_error"] . ''; echo '
'; - + echo '
'; echo html_print_image('images/error_login.png', true, array("alt" => __('Login failed'), "border" => 0)); echo '
'; - + echo '
'; html_print_submit_button("Ok", 'hide-login-error', false, 'class="ui-button-dialog ui-widget ui-state-default ui-corner-all ui-button-text-only" style="width:100px;"'); echo '
'; echo '
'; - + echo '
'; } diff --git a/pandora_console/general/logon_failed.php b/pandora_console/general/logon_failed.php index 6989ea5c57..486a6dc3ee 100644 --- a/pandora_console/general/logon_failed.php +++ b/pandora_console/general/logon_failed.php @@ -19,7 +19,7 @@

- +

@@ -29,7 +29,7 @@ No access
- +

All actions, included failed login attempts are logged in Pandora FMS System logs, and these can be reviewed by each user, please report to admin any incident or malfunction.'); ?>
diff --git a/pandora_console/godmode/users/configure_user.php b/pandora_console/godmode/users/configure_user.php index 234d5b7802..c6d74a8d24 100644 --- a/pandora_console/godmode/users/configure_user.php +++ b/pandora_console/godmode/users/configure_user.php @@ -100,6 +100,7 @@ if ($new_user && $config['admin_can_add_user']) { $user_info['comments'] = ''; $user_info['is_admin'] = 0; $user_info['language'] = 'default'; + $user_info["not_login"] = false; if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) { $user_info['id_skin'] = ''; } @@ -137,6 +138,7 @@ if ($create_user) { $values['last_pass_change'] = date ("Y/m/d H:i:s", get_system_time()); $values['metaconsole_access'] = get_parameter ('metaconsole_access'); } + $values["not_login"] = (bool)get_parameter ('not_login', false); if ($id == '') { ui_print_error_message (__('User ID cannot be empty')); @@ -171,7 +173,7 @@ if ($create_user) { $info .= ' Skin: ' . $values['id_skin']; } - switch ($config['dbtype']){ + switch ($config['dbtype']) { case "mysql": case "postgresql": $result = create_user($id, $password_new, $values); @@ -180,7 +182,7 @@ if ($create_user) { } break; case "oracle": - $result = db_process_sql('/INSERT INTO tusuario (fullname, firstname, lastname, email, phone, comments, is_admin, language, id_skin, block_size, flash_chart, id_user, password, last_connect, registered) VALUES (\'' . $values['fullname'] . '\',\'\',\'\',\'\',\'\',\'\',' . $values['is_admin'] . ',\'' . $values['language'] .'\',' . $values['id_skin'] . ',' . $values['block_size'] . ',' . $values['flash_chart'] . ',\'' . $id . '\',\'' . $password_new . '\',0,\'' . get_system_time () . '\')'); + $result = db_process_sql('/INSERT INTO tusuario (fullname, firstname, lastname, email, phone, comments, is_admin, language, id_skin, block_size, flash_chart, id_user, password, last_connect, registered) VALUES (\'' . $values['fullname'] . '\',\'\',\'\',\'\',\'\',\'\',' . $values['is_admin'] . ',\'' . $values['language'] .'\',' . $values['id_skin'] . ',' . $values['block_size'] . ',' . $values['flash_chart'] . ',\'' . $id . '\',\'' . $password_new . '\',0,\'' . get_system_time () . '\')'); if ($result) { $res = db_process_sql('/INSERT INTO tpassword_history (id_user, password, date_begin) VALUES (\'' . $id . '\',\'' . md5($password_new) . '\',\'' . date ("Y/m/d H:i:s", get_system_time()) . '\')'); @@ -230,6 +232,7 @@ if ($update_user) { if(enterprise_installed()) { $values['metaconsole_access'] = get_parameter ('metaconsole_access'); } + $values["not_login"] = (bool)get_parameter ('not_login', false); $res1 = update_user ($id, $values); @@ -300,7 +303,7 @@ if ($update_user) { $user_info = $values; } -if ($status != -1){ +if ($status != -1) { ui_print_result_message ($status, __('User info successfully updated'), __('Error updating user info (no change?)')); @@ -443,6 +446,10 @@ if (enterprise_installed()) { '','',-1,true, false, false); } +$table->data[13][0] = __('Not Login'); +$table->data[13][0] .= ui_print_help_tip(__('The user with not login set only can access to API.'), true); +$table->data[13][1] = html_print_checkbox('not_login', 1, $user_info["not_login"], true); + echo '
'; html_print_table ($table); diff --git a/pandora_console/include/api.php b/pandora_console/include/api.php index f24ea79148..5168f87d66 100644 --- a/pandora_console/include/api.php +++ b/pandora_console/include/api.php @@ -50,7 +50,7 @@ $no_login_msg = ""; if (isInACL($ipOrigin)) { if(empty($apiPassword) || (!empty($apiPassword) && $api_password === $apiPassword)) { - $user_in_db = process_user_login($user, $password); + $user_in_db = process_user_login($user, $password, true); if ($user_in_db !== false) { $config['id_user'] = $user_in_db; $correctLogin = true; diff --git a/pandora_console/include/auth/mysql.php b/pandora_console/include/auth/mysql.php index 3731c185d1..f60311f36b 100644 --- a/pandora_console/include/auth/mysql.php +++ b/pandora_console/include/auth/mysql.php @@ -22,34 +22,36 @@ if (!isset ($config)) { die (' - -Pandora FMS - The Flexible Monitoring System - Console error - - - - - - - - - - - - -
-
-
-

You cannot access this file

-
- -
-
- ERROR: - You can\'t access this file directly! -
-
-
- + + Pandora FMS - The Flexible Monitoring System - Console error + + + + + + + + + + + + +
+
+
+

You cannot access this file

+
+ +
+
+ + ERROR: You can\'t access this file directly! + +
+
+
+
+ '); } @@ -69,30 +71,44 @@ $config["admin_can_make_admin"] = true; * * @param string $login * @param string $pass + * @param boolean $api * * @return mixed False in case of error or invalid credentials, the username in case it's correct. */ -function process_user_login ($login, $pass) { +function process_user_login ($login, $pass, $api = false) { global $config, $mysql_cache; - + // Always authenticate admins against the local database if (strtolower ($config["auth"]) == 'mysql' || is_user_admin ($login)) { // Connect to Database switch ($config["dbtype"]) { case "mysql": - $sql = sprintf ("SELECT `id_user`, `password` FROM `tusuario` WHERE `id_user` = '%s' AND `disabled` = 0", $login); + $sql = sprintf ("SELECT `id_user`, `password` + FROM `tusuario` + WHERE `id_user` = '%s' AND `not_login` = " . + ((int)$api) . " + AND `disabled` = 0", $login); break; case "postgresql": - $sql = sprintf ('SELECT "id_user", "password" FROM "tusuario" WHERE "id_user" = \'%s\' AND "disabled" = 0', $login); + $sql = sprintf ('SELECT "id_user", "password" + FROM "tusuario" + WHERE "id_user" = \'%s\' AND "not_login" = ' . + ((int)$api) . ' + AND "disabled" = 0', $login); break; case "oracle": - $sql = sprintf ('SELECT id_user, password FROM tusuario WHERE id_user = \'%s\' AND disabled = 0', $login); + $sql = sprintf ('SELECT id_user, password + FROM tusuario + WHERE id_user = \'%s\' AND not_login = ' . + ((int)$api) . ' + AND disabled = 0', $login); break; } $row = db_get_row_sql ($sql); //Check that row exists, that password is not empty and that password is the same hash - if ($row !== false && $row["password"] !== md5 ("") && $row["password"] == md5 ($pass)) { + if ($row !== false && $row["password"] !== md5 ("") + && $row["password"] == md5 ($pass)) { // Login OK // Nick could be uppercase or lowercase (select in MySQL // is not case sensitive) @@ -102,18 +118,21 @@ function process_user_login ($login, $pass) { return $row["id_user"]; } else { - $mysql_cache["auth_error"] = "User not found in database or incorrect password"; - $config["auth_error"] = "User not found in database or incorrect password"; + if (!user_can_login($login)) { + $mysql_cache["auth_error"] = "User only can use the API."; + $config["auth_error"] = "User only can use the API."; + } + else { + $mysql_cache["auth_error"] = "User not found in database or incorrect password"; + $config["auth_error"] = "User not found in database or incorrect password"; + } } - + return false; - - // Remote authentication } else { - + // Remote authentication switch ($config["auth"]) { - // LDAP case 'ldap': if (ldap_process_user_login ($login, $pass) === false) { @@ -121,7 +140,7 @@ function process_user_login ($login, $pass) { return false; } break; - + // Active Directory case 'ad': if (enterprise_hook ('ad_process_user_login', array ($login, $pass)) === false) { @@ -129,7 +148,7 @@ function process_user_login ($login, $pass) { return false; } break; - + // Remote Pandora FMS case 'pandora': if (enterprise_hook ('remote_pandora_process_user_login', array ($login, $pass)) === false) { @@ -137,7 +156,7 @@ function process_user_login ($login, $pass) { return false; } break; - + // Remote Babel Enterprise case 'babel': if (enterprise_hook ('remote_babel_process_user_login', array ($login, $pass)) === false) { @@ -145,7 +164,7 @@ function process_user_login ($login, $pass) { return false; } break; - + // Remote Integria case 'integria': if (enterprise_hook ('remote_integria_process_user_login', array ($login, $pass)) === false) { @@ -153,34 +172,39 @@ function process_user_login ($login, $pass) { return false; } break; - + // Unknown authentication method default: $config["auth_error"] = "User not found in database or incorrect password"; return false; + break; } // Authentication ok, check if the user exists in the local database if (is_user ($login)) { + if (!user_can_login($login)) { + return false; + } + return $login; } - + // The user does not exist and can not be created if ($config['autocreate_remote_users'] == 0 || is_user_blacklisted ($login)) { $config["auth_error"] = "Ooops User not found in database or incorrect password"; return false; } - + // Create the user in the local database if (create_user ($login, $pass, array ('fullname' => $login, 'comments' => 'Imported from ' . $config['auth'])) === false) { $config["auth_error"] = "User not found in database or incorrect password"; return false; } - + profile_create_user_profile ($login, $config['default_remote_profile'], $config['default_remote_group']); return $login; } - + return false; } @@ -192,15 +216,8 @@ function process_user_login ($login, $pass) { * @return bool True is the user is admin */ function is_user_admin ($id_user) { - /* This code below was here, but I don't understand WHY. This always returns TRUE ¿?¿? - - static $is_admin = -1; - - if ($is_admin !== -1) - return $is_admin; - */ - $is_admin = (bool) db_get_value ('is_admin', 'tusuario', 'id_user', $id_user); + return $is_admin; } @@ -216,14 +233,15 @@ function is_user_admin ($id_user) { * @return int User id of the mixed parameter. */ function get_user_id ($user) { - if (is_array ($user)){ + if (is_array ($user)) { if (isset ($user['id_user'])) return $user['id_user']; elseif (isset ($user['id_usuario'])) return $user['id_usuario']; else return false; - } else { + } + else { return $user; } } @@ -237,8 +255,20 @@ function get_user_id ($user) { */ function is_user ($user) { $user = db_get_row('tusuario', 'id_user', get_user_id ($user)); + if (! $user) return false; + + return true; +} + +function user_can_login($user) { + $not_login = db_get_value('not_login', 'tusuario', 'id_user', $user); + + if ($not_login != 0) { + return false; + } + return true; } @@ -301,7 +331,7 @@ function get_users ($order = "fullname", $filter = false, $fields = false) { $filter['order'] = $order." ASC"; } - + $output = array(); @@ -314,7 +344,7 @@ function get_users ($order = "fullname", $filter = false, $fields = false) { return $output; } - + /** * Sets the last login for a user * @@ -323,7 +353,7 @@ function get_users ($order = "fullname", $filter = false, $fields = false) { function process_user_contact ($id_user) { return db_process_sql_update ("tusuario", array ("last_connect" => get_system_time ()), - array ("id_user" => $id_user)); + array ("id_user" => $id_user)); } /** @@ -337,7 +367,7 @@ function create_user ($id_user, $password, $user_info) { $values["password"] = md5 ($password); $values["last_connect"] = 0; $values["registered"] = get_system_time (); - + return (@db_process_sql_insert ("tusuario", $values)) !== false; } @@ -350,7 +380,7 @@ function save_pass_history ($id_user, $password) { $values["id_user"] = $id_user; $values["password"] = md5 ($password); $values["date_begin"] = date ("Y/m/d H:i:s", get_system_time()); - + return (@db_process_sql_insert ("tpassword_history", $values)) !== false; } @@ -360,12 +390,14 @@ function save_pass_history ($id_user, $password) { * @param string User id */ function delete_user ($id_user) { - $result = db_process_sql_delete('tusuario_perfil', array('id_usuario' => $id_user)); + $result = db_process_sql_delete('tusuario_perfil', + array('id_usuario' => $id_user)); if ($result === false) { return false; } - $result = db_process_sql_delete('tusuario', array('id_user' => $id_user)); + $result = db_process_sql_delete('tusuario', + array('id_user' => $id_user)); if ($result === false) { return false; } @@ -413,38 +445,43 @@ function update_user ($id_user, $values) { */ function ldap_process_user_login ($login, $password) { global $config; - + if (! function_exists ("ldap_connect")) { - $config["auth_error"] = 'Your installation of PHP does not support LDAP'; + $config["auth_error"] = __('Your installation of PHP does not support LDAP'); + return false; } - + // Connect to the LDAP server $ds = @ldap_connect ($config["ldap_server"], $config["ldap_port"]); - + if (!$ds) { $config["auth_error"] = 'Error connecting to LDAP server'; + return false; } - + // Set the LDAP version ldap_set_option ($ds, LDAP_OPT_PROTOCOL_VERSION, $config["ldap_version"]); - + if ($config["ldap_start_tls"]) { if (!@ldap_start_tls ($ds)) { $config["auth_error"] = 'Could not start TLS for LDAP connection'; @ldap_close ($ds); + return false; } } - + if (strlen($password) == 0 || !@ldap_bind ($ds, $config["ldap_login_attr"]."=".$login.",".$config["ldap_base_dn"], $password)) { $config["auth_error"] = 'User not found in database or incorrect password'; @ldap_close ($ds); + return false; } - + @ldap_close ($ds); + return true; } @@ -470,4 +507,4 @@ function is_user_blacklisted ($user) { //Reference the global use authorization error to last auth error. $config["auth_error"] = &$mysql_cache["auth_error"]; -?> +?> \ No newline at end of file diff --git a/pandora_console/index.php b/pandora_console/index.php index d3e8485a06..72c45cbf65 100644 --- a/pandora_console/index.php +++ b/pandora_console/index.php @@ -133,13 +133,13 @@ $process_login = false; // Update user password $change_pass = get_parameter_post('renew_password', 0); - + if ($change_pass == 1) { $password_new = (string) get_parameter_post ('new_password', ''); $password_confirm = (string) get_parameter_post ('confirm_new_password', ''); $id = (string) get_parameter_post ('login', ''); - + $changed_pass = login_update_password_check ($password_new, $password_confirm, $id); } @@ -187,9 +187,12 @@ elseif (! isset ($config['id_user']) && isset ($_GET["login"])) { $expired_pass = false; - if (($nick_in_db != false)&& ((!is_user_admin($nick) || $config['enable_pass_policy_admin'])) && (defined('PANDORA_ENTERPRISE')) && ($config['enable_pass_policy'])) { + if (($nick_in_db != false) && ((!is_user_admin($nick) + || $config['enable_pass_policy_admin'])) + && (defined('PANDORA_ENTERPRISE')) + && ($config['enable_pass_policy'])) { include_once(ENTERPRISE_DIR."/include/auth/mysql.php"); - + $blocked = login_check_blocked($nick); if ($blocked) { @@ -209,7 +212,6 @@ elseif (! isset ($config['id_user']) && isset ($_GET["login"])) { login_change_password($nick); break; } - } if (($nick_in_db !== false) && $expired_pass) { //login ok and password has expired @@ -218,7 +220,8 @@ elseif (! isset ($config['id_user']) && isset ($_GET["login"])) { while (@ob_end_flush ()); exit (""); } - else if (($nick_in_db !== false) && (!$expired_pass)) { //login ok and password has not expired + else if (($nick_in_db !== false) && (!$expired_pass)) { + //login ok and password has not expired $process_login = true; unset ($_GET["sec2"]); @@ -307,7 +310,6 @@ elseif (! isset ($config['id_user']) && isset ($_GET["login"])) { } } elseif (! isset ($config['id_user'])) { - // There is no user connected require_once ('general/login_page.php'); while (@ob_end_flush ()); diff --git a/pandora_console/pandoradb.oracle.sql b/pandora_console/pandoradb.oracle.sql index 3cb4dc4c4b..6d1f4bad93 100644 --- a/pandora_console/pandoradb.oracle.sql +++ b/pandora_console/pandoradb.oracle.sql @@ -27,28 +27,33 @@ CREATE OR REPLACE FUNCTION UNIX_TIMESTAMP (oracletime IN DATE DEFAULT SYSDATE) RETURN INTEGER AS unixtime INTEGER; BEGIN unixtime := (oracletime - to_date('19700101','YYYYMMDD')) * 86400; RETURN unixtime; END;; CREATE OR REPLACE FUNCTION NOW RETURN TIMESTAMP AS t_now TIMESTAMP; BEGIN SELECT LOCALTIMESTAMP INTO t_now FROM dual; RETURN t_now; END;; +-- ----------------------------------------------------- +-- Table `taddress` +-- ----------------------------------------------------- CREATE TABLE taddress ( id_a NUMBER(10, 0) NOT NULL PRIMARY KEY, ip VARCHAR(60) default '', ip_pack NUMBER(10, 0) default 0 NOT NULL ); CREATE INDEX taddress_ip_idx ON taddress(ip); - CREATE SEQUENCE taddress_s INCREMENT BY 1 START WITH 1; - -- Triggers must end with double semicolons because Pandora installer need it CREATE OR REPLACE TRIGGER taddress_inc BEFORE INSERT ON taddress REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT taddress_s.nextval INTO :NEW.ID_A FROM dual; END;; +-- ----------------------------------------------------- +-- Table `taddress_agent` +-- ----------------------------------------------------- CREATE TABLE taddress_agent ( id_ag NUMBER(19, 0) NOT NULL PRIMARY KEY, id_a NUMBER(19, 0) default 0 NOT NULL, id_agent NUMBER(19, 0) default 0 NOT NULL ); - CREATE SEQUENCE taddress_agent_s INCREMENT BY 1 START WITH 1; - CREATE OR REPLACE TRIGGER taddress_agent_inc BEFORE INSERT ON taddress_agent REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT taddress_agent_s.nextval INTO :NEW.ID_AG FROM dual; END;; +-- ----------------------------------------------------- +-- Table `tagente` +-- ----------------------------------------------------- CREATE TABLE tagente ( id_agente NUMBER(10, 0) NOT NULL PRIMARY KEY, nombre VARCHAR2(600) default '', @@ -79,11 +84,12 @@ CREATE INDEX tagente_nombre_idx ON tagente(nombre); CREATE INDEX tagente_direccion_idx ON tagente(direccion); CREATE INDEX tagente_disabled_idx ON tagente(disabled); CREATE INDEX tagente_id_grupo_idx ON tagente(id_grupo); - CREATE SEQUENCE tagente_s INCREMENT BY 1 START WITH 1; - CREATE OR REPLACE TRIGGER tagente_inc BEFORE INSERT ON tagente REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tagente_s.nextval INTO :NEW.ID_AGENTE FROM dual; END;; +-- ----------------------------------------------------- +-- Table `tagente_datos` +-- ----------------------------------------------------- CREATE TABLE tagente_datos ( id_agente_modulo NUMBER(10, 0) default 0 NOT NULL, datos BINARY_DOUBLE default NULL, @@ -92,6 +98,9 @@ CREATE TABLE tagente_datos ( CREATE INDEX tagente_datos_id_agent_mod_idx ON tagente_datos(id_agente_modulo); CREATE INDEX tagente_datos_utimestamp_idx ON tagente_datos(utimestamp); +-- ----------------------------------------------------- +-- Table `tagente_datos_inc` +-- ----------------------------------------------------- CREATE TABLE tagente_datos_inc ( id_adi NUMBER(10, 0) NOT NULL PRIMARY KEY, id_agente_modulo NUMBER(10, 0) default 0 NOT NULL, @@ -99,11 +108,12 @@ CREATE TABLE tagente_datos_inc ( utimestamp NUMBER(10, 0) default 0 NOT NULL ); CREATE INDEX tagente_datos_inc_id_ag_mo_idx ON tagente_datos_inc(id_agente_modulo); - CREATE SEQUENCE tagente_datos_inc_s INCREMENT BY 1 START WITH 1; - CREATE OR REPLACE TRIGGER tagente_datos_inc_inc BEFORE INSERT ON tagente_datos_inc REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tagente_datos_inc_s.nextval INTO :NEW.ID_ADI FROM dual; END;; +-- ----------------------------------------------------- +-- Table `tagente_datos_string` +-- ----------------------------------------------------- CREATE TABLE tagente_datos_string ( id_agente_modulo NUMBER(10, 0) NOT NULL, datos CLOB NOT NULL, @@ -111,6 +121,9 @@ CREATE TABLE tagente_datos_string ( ); CREATE INDEX tagente_datos_string_utsta_idx ON tagente_datos_string(utimestamp); +-- ----------------------------------------------------- +-- Table `tagente_datos_log4x` +-- ----------------------------------------------------- CREATE TABLE tagente_datos_log4x ( id_tagente_datos_log4x NUMBER(19, 0) NOT NULL PRIMARY KEY, id_agente_modulo NUMBER(10, 0) default 0 NOT NULL, @@ -120,11 +133,12 @@ CREATE TABLE tagente_datos_log4x ( utimestamp NUMBER(10, 0) default 0 NOT NULL ); CREATE INDEX tagente_datos_log4x_id_a_m_idx ON tagente_datos_log4x(id_agente_modulo); - CREATE SEQUENCE tagente_datos_log4x_s INCREMENT BY 1 START WITH 1; - CREATE OR REPLACE TRIGGER tagente_datos_log4x_inc BEFORE INSERT ON tagente_datos_log4x REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tagente_datos_log4x_s.nextval INTO :NEW.ID_TAGENTE_DATOS_LOG4X FROM dual; END;; +-- ----------------------------------------------------- +-- Table `tagente_estado` +-- ----------------------------------------------------- CREATE TABLE tagente_estado ( id_agente_estado NUMBER(10, 0) NOT NULL PRIMARY KEY, id_agente_modulo NUMBER(10, 0) default 0 NOT NULL, @@ -861,6 +875,9 @@ CREATE SEQUENCE ttrap_s INCREMENT BY 1 START WITH 1; CREATE OR REPLACE TRIGGER ttrap_inc BEFORE INSERT ON ttrap REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT ttrap_s.nextval INTO :NEW.ID_TRAP FROM dual; END ttrap_inc;; +-- ----------------------------------------------------- +-- Table `tusuario` +-- ----------------------------------------------------- CREATE TABLE tusuario ( id_user VARCHAR2(60) NOT NULL PRIMARY KEY, fullname VARCHAR2(255) NOT NULL, @@ -890,9 +907,13 @@ CREATE TABLE tusuario ( failed_attempt NUMBER(5,0) default 0 NOT NULL, login_blocked NUMBER(5,0) default 0 NOT NULL, metaconsole_access VARCHAR2(100) default 'only_console' NOT NULL, + not_login NUMBER(5,0) default 0 NOT NULL, CONSTRAINT t_usuario_metaconsole_access_cons CHECK (metaconsole_access IN ('basic','advanced','custom','all','only_console')) ); +-- ----------------------------------------------------- +-- Table `tusuario_perfil` +-- ----------------------------------------------------- CREATE TABLE tusuario_perfil ( id_up NUMBER(19, 0) NOT NULL PRIMARY KEY, id_usuario VARCHAR2(100) default '', diff --git a/pandora_console/pandoradb.postgreSQL.sql b/pandora_console/pandoradb.postgreSQL.sql index 6de4a8b046..def3ff80b0 100644 --- a/pandora_console/pandoradb.postgreSQL.sql +++ b/pandora_console/pandoradb.postgreSQL.sql @@ -30,11 +30,28 @@ CREATE OR REPLACE LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION unix_timestamp(TIMESTAMP without time zone = CURRENT_TIMESTAMP) RETURNS double precision AS 'SELECT ceil(date_part(''epoch'', $1)); ' LANGUAGE SQL; -CREATE TABLE "taddress" ("id_a" SERIAL NOT NULL PRIMARY KEY,"ip" VARCHAR(60) NOT NULL default '',"ip_pack" INTEGER NOT NULL default 0); +-- ----------------------------------------------------- +-- Table `taddress` +-- ----------------------------------------------------- +CREATE TABLE "taddress" ( + "id_a" SERIAL NOT NULL PRIMARY KEY, + "ip" VARCHAR(60) NOT NULL default '', + "ip_pack" INTEGER NOT NULL default 0 +); CREATE INDEX "taddress_ip_idx" ON "taddress"("ip"); -CREATE TABLE "taddress_agent" ("id_ag" BIGSERIAL NOT NULL PRIMARY KEY,"id_a" BIGINT NOT NULL default 0,"id_agent" BIGINT NOT NULL default 0); +-- ----------------------------------------------------- +-- Table `taddress_agent` +-- ----------------------------------------------------- +CREATE TABLE "taddress_agent" ( + "id_ag" BIGSERIAL NOT NULL PRIMARY KEY, + "id_a" BIGINT NOT NULL default 0, + "id_agent" BIGINT NOT NULL default 0 +); +-- ----------------------------------------------------- +-- Table `tagente` +-- ----------------------------------------------------- CREATE TABLE "tagente" ( "id_agente" SERIAL NOT NULL PRIMARY KEY, "nombre" varchar(600) NOT NULL default '', @@ -66,6 +83,9 @@ CREATE INDEX "tagente_direccion_idx" ON "tagente"("direccion"); CREATE INDEX "tagente_disabled_idx" ON "tagente"("disabled"); CREATE INDEX "tagente_id_grupo_idx" ON "tagente"("id_grupo"); +-- ----------------------------------------------------- +-- Table `tagente_datos` +-- ----------------------------------------------------- CREATE TABLE "tagente_datos" ( "id_agente_modulo" INTEGER NOT NULL default 0, "datos" DOUBLE PRECISION default NULL, @@ -74,6 +94,9 @@ CREATE TABLE "tagente_datos" ( CREATE INDEX "tagente_datos_id_agente_modulo_idx" ON "tagente_datos"("id_agente_modulo"); CREATE INDEX "tagente_datos_utimestamp_idx" ON "tagente_datos"("utimestamp"); +-- ----------------------------------------------------- +-- Table `tagente_datos_inc` +-- ----------------------------------------------------- CREATE TABLE "tagente_datos_inc" ( "id_adi" SERIAL NOT NULL PRIMARY KEY, "id_agente_modulo" INTEGER NOT NULL default 0, @@ -82,8 +105,9 @@ CREATE TABLE "tagente_datos_inc" ( ); CREATE INDEX "tagente_datos_inc_id_agente_modulo_idx" ON "tagente_datos_inc"("id_agente_modulo"); - - +-- ----------------------------------------------------- +-- Table `tagente_datos_string` +-- ----------------------------------------------------- CREATE TABLE "tagente_datos_string" ( "id_agente_modulo" INTEGER NOT NULL default 0, "datos" TEXT NOT NULL, @@ -92,20 +116,22 @@ CREATE TABLE "tagente_datos_string" ( CREATE INDEX "tagente_datos_string_id_agente_modulo_idx" ON "tagente_datos_string"("id_agente_modulo"); CREATE INDEX "tagente_datos_string_utimestamp_idx" ON "tagente_datos_string"("utimestamp"); - - +-- ----------------------------------------------------- +-- Table `tagente_datos_log4x` +-- ----------------------------------------------------- CREATE TABLE "tagente_datos_log4x" ( "id_tagente_datos_log4x" BIGSERIAL NOT NULL PRIMARY KEY, "id_agente_modulo" INTEGER NOT NULL default 0, - "severity" text NOT NULL, "message" text NOT NULL, "stacktrace" text NOT NULL, - "utimestamp" INTEGER NOT NULL default 0 ); CREATE INDEX "tagente_datos_log4x_id_agente_modulo_idx" ON "tagente_datos_log4x"("id_agente_modulo"); +-- ----------------------------------------------------- +-- Table `tagente_estado` +-- ----------------------------------------------------- CREATE TABLE "tagente_estado" ( "id_agente_estado" SERIAL NOT NULL PRIMARY KEY, "id_agente_modulo" INTEGER NOT NULL default 0, @@ -664,6 +690,9 @@ CREATE TABLE "tsesion" ( CREATE INDEX "tsesion_utimestamp_idx" ON "tsesion"("utimestamp"); CREATE INDEX "tsesion_id_usuario_idx" ON "tsesion"("id_usuario"); +-- ----------------------------------------------------- +-- Table `ttipo_modulo` +-- ----------------------------------------------------- CREATE TABLE "ttipo_modulo" ( "id_tipo" SERIAL NOT NULL PRIMARY KEY, "nombre" varchar(100) NOT NULL default '', @@ -672,6 +701,9 @@ CREATE TABLE "ttipo_modulo" ( "icon" varchar(100) default NULL ); +-- ----------------------------------------------------- +-- Table `ttrap` +-- ----------------------------------------------------- CREATE TABLE "ttrap" ( "id_trap" BIGSERIAL NOT NULL PRIMARY KEY, "source" varchar(50) NOT NULL default '', @@ -691,6 +723,9 @@ CREATE TABLE "ttrap" ( "severity" INTEGER NOT NULL default 2 ); +-- ----------------------------------------------------- +-- Table `tusuario` +-- ----------------------------------------------------- CREATE TYPE type_tusuario_metaconsole_access AS ENUM ('basic','advanced','custom','all','only_console'); CREATE TABLE "tusuario" ( "id_user" varchar(60) NOT NULL PRIMARY KEY, @@ -720,9 +755,13 @@ CREATE TABLE "tusuario" ( "last_failed_login" BIGINT NOT NULL default 0, "failed_attempt" INTEGER NOT NULL DEFAULT 0, "login_blocked" SMALLINT NOT NULL default 0, + "not_login" SMALLINT NOT NULL default 0, "metaconsole_access" type_tusuario_metaconsole_access default 'only_console' ); +-- ----------------------------------------------------- +-- Table `tusuario_perfil` +-- ----------------------------------------------------- CREATE TABLE "tusuario_perfil" ( "id_up" BIGSERIAL NOT NULL PRIMARY KEY, "id_usuario" varchar(100) NOT NULL default '', @@ -732,6 +771,9 @@ CREATE TABLE "tusuario_perfil" ( "id_policy" INTEGER DEFAULT 0 NOT NULL ); +-- ----------------------------------------------------- +-- Table `tnews` +-- ----------------------------------------------------- CREATE TABLE "tnews" ( "id_news" SERIAL NOT NULL PRIMARY KEY, "author" varchar(255) NOT NULL DEFAULT '', @@ -740,6 +782,9 @@ CREATE TABLE "tnews" ( "timestamp" TIMESTAMP without time zone default '1970-01-01 00:00:00' ); +-- ----------------------------------------------------- +-- Table `tgraph` +-- ----------------------------------------------------- CREATE TABLE "tgraph" ( "id_graph" SERIAL NOT NULL PRIMARY KEY, "id_user" varchar(100) NOT NULL default '', @@ -755,6 +800,9 @@ CREATE TABLE "tgraph" ( "id_graph_template" INTEGER NOT NULL default 0 ); +-- ----------------------------------------------------- +-- Table `tgraph_source` +-- ----------------------------------------------------- CREATE TABLE "tgraph_source" ( "id_gs" SERIAL NOT NULL PRIMARY KEY, "id_graph" BIGINT NOT NULL default 0, @@ -824,6 +872,9 @@ CREATE TABLE "treport_content" ( "server_name" TEXT DEFAULT '' ); +-- ----------------------------------------------------- +-- Table "treport_content_sla_combined" +-- ----------------------------------------------------- CREATE TABLE "treport_content_sla_combined" ( "id" SERIAL NOT NULL PRIMARY KEY, "id_report_content" INTEGER NOT NULL REFERENCES treport_content("id_rc") ON UPDATE CASCADE ON DELETE CASCADE, @@ -834,6 +885,9 @@ CREATE TABLE "treport_content_sla_combined" ( "server_name" TEXT DEFAULT '' ); +-- ----------------------------------------------------- +-- Table "treport_content_item" +-- ----------------------------------------------------- CREATE TABLE "treport_content_item" ( "id" SERIAL NOT NULL PRIMARY KEY, "id_report_content" INTEGER NOT NULL REFERENCES treport_content("id_rc") ON UPDATE CASCADE ON DELETE CASCADE, @@ -842,12 +896,18 @@ CREATE TABLE "treport_content_item" ( "operation" TEXT DEFAULT '' ); +-- ----------------------------------------------------- +-- Table "treport_custom_sql" +-- ----------------------------------------------------- CREATE TABLE "treport_custom_sql" ( "id" SERIAL NOT NULL PRIMARY KEY, "name" varchar(150) NOT NULL default '', "sql" TEXT default NULL ); +-- ----------------------------------------------------- +-- Table "tlayout" +-- ----------------------------------------------------- CREATE TABLE "tlayout" ( "id" SERIAL NOT NULL PRIMARY KEY, "name" varchar(50) NOT NULL, @@ -858,6 +918,9 @@ CREATE TABLE "tlayout" ( "width" INTEGER NOT NULL default 0 ); +-- ----------------------------------------------------- +-- Table "tlayout_data" +-- ----------------------------------------------------- CREATE TABLE "tlayout_data" ( "id" SERIAL NOT NULL PRIMARY KEY, "id_layout" INTEGER NOT NULL default 0, diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index cb8e84c6dd..e250fe4673 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -163,67 +163,66 @@ CREATE TABLE `tagente_estado` ( -- 7 - WEB Server (enteprise) CREATE TABLE IF NOT EXISTS `tagente_modulo` ( - `id_agente_modulo` int(10) unsigned NOT NULL auto_increment, - `id_agente` int(10) unsigned NOT NULL default '0', - `id_tipo_modulo` smallint(5) NOT NULL default '0', - `descripcion` TEXT NOT NULL, - `extended_info` TEXT NOT NULL, - `nombre` text NOT NULL, - `unit` text, - `id_policy_module` INTEGER unsigned NOT NULL default '0', - `max` bigint(20) default '0', - `min` bigint(20) default '0', - `module_interval` int(4) unsigned default '0', - `module_ff_interval` int(4) unsigned default '0', - `tcp_port` int(4) unsigned default '0', - `tcp_send` TEXT, - `tcp_rcv` TEXT, - `snmp_community` varchar(100) default '', - `snmp_oid` varchar(255) default '0', - `ip_target` varchar(100) default '', - `id_module_group` int(4) unsigned default '0', - `flag` tinyint(1) unsigned default '1', - `id_modulo` int(10) unsigned default '0', - `disabled` tinyint(1) unsigned NOT NULL default '0', - `id_export` smallint(4) unsigned default '0', - `plugin_user` text, - `plugin_pass` text, - `plugin_parameter` text, - `id_plugin` int(10) default '0', - `post_process` double(18,5) default NULL, - `prediction_module` bigint(14) default '0', - `max_timeout` int(4) unsigned default '0', - `custom_id` varchar(255) default '', - `history_data` tinyint(1) unsigned default '1', - `min_warning` double(18,2) default 0, - `max_warning` double(18,2) default 0, - `str_warning` text, - `min_critical` double(18,2) default 0, - `max_critical` double(18,2) default 0, - `str_critical` text, - `min_ff_event` int(4) unsigned default '0', - `delete_pending` int(1) unsigned default 0, - `policy_linked` tinyint(1) unsigned not null default 0, - `policy_adopted` tinyint(1) unsigned not null default 0, - `custom_string_1` text, - `custom_string_2` text, - `custom_string_3` text, - `custom_integer_1` int(10) default 0, - `custom_integer_2` int(10) default 0, - `wizard_level` enum('basic','advanced','custom','nowizard') default 'nowizard', - `macros` text, - `critical_instructions` text, - `warning_instructions` text, - `unknown_instructions` text, - - PRIMARY KEY (`id_agente_modulo`), - KEY `main_idx` (`id_agente_modulo`,`id_agente`), - KEY `tam_agente` (`id_agente`), - KEY `id_tipo_modulo` (`id_tipo_modulo`), - KEY `disabled` (`disabled`), - KEY `module` (`id_modulo`), - KEY `nombre` (`nombre` (255)), - KEY `module_group` (`id_module_group`) using btree + `id_agente_modulo` int(10) unsigned NOT NULL auto_increment, + `id_agente` int(10) unsigned NOT NULL default '0', + `id_tipo_modulo` smallint(5) NOT NULL default '0', + `descripcion` TEXT NOT NULL, + `extended_info` TEXT NOT NULL, + `nombre` text NOT NULL, + `unit` text, + `id_policy_module` INTEGER unsigned NOT NULL default '0', + `max` bigint(20) default '0', + `min` bigint(20) default '0', + `module_interval` int(4) unsigned default '0', + `module_ff_interval` int(4) unsigned default '0', + `tcp_port` int(4) unsigned default '0', + `tcp_send` TEXT, + `tcp_rcv` TEXT, + `snmp_community` varchar(100) default '', + `snmp_oid` varchar(255) default '0', + `ip_target` varchar(100) default '', + `id_module_group` int(4) unsigned default '0', + `flag` tinyint(1) unsigned default '1', + `id_modulo` int(10) unsigned default '0', + `disabled` tinyint(1) unsigned NOT NULL default '0', + `id_export` smallint(4) unsigned default '0', + `plugin_user` text, + `plugin_pass` text, + `plugin_parameter` text, + `id_plugin` int(10) default '0', + `post_process` double(18,5) default NULL, + `prediction_module` bigint(14) default '0', + `max_timeout` int(4) unsigned default '0', + `custom_id` varchar(255) default '', + `history_data` tinyint(1) unsigned default '1', + `min_warning` double(18,2) default 0, + `max_warning` double(18,2) default 0, + `str_warning` text, + `min_critical` double(18,2) default 0, + `max_critical` double(18,2) default 0, + `str_critical` text, + `min_ff_event` int(4) unsigned default '0', + `delete_pending` int(1) unsigned default 0, + `policy_linked` tinyint(1) unsigned not null default 0, + `policy_adopted` tinyint(1) unsigned not null default 0, + `custom_string_1` text, + `custom_string_2` text, + `custom_string_3` text, + `custom_integer_1` int(10) default 0, + `custom_integer_2` int(10) default 0, + `wizard_level` enum('basic','advanced','custom','nowizard') default 'nowizard', + `macros` text, + `critical_instructions` text, + `warning_instructions` text, + `unknown_instructions` text, + PRIMARY KEY (`id_agente_modulo`), + KEY `main_idx` (`id_agente_modulo`,`id_agente`), + KEY `tam_agente` (`id_agente`), + KEY `id_tipo_modulo` (`id_tipo_modulo`), + KEY `disabled` (`disabled`), + KEY `module` (`id_modulo`), + KEY `nombre` (`nombre` (255)), + KEY `module_group` (`id_module_group`) using btree ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- snmp_oid is also used for WMI query @@ -657,99 +656,110 @@ CREATE TABLE IF NOT EXISTS `tnota` ( KEY `id_incident` (`id_incident`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +-- ----------------------------------------------------- +-- Table `torigen` +-- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `torigen` ( - `origen` varchar(100) NOT NULL default '' + `origen` varchar(100) NOT NULL default '' ) ENGINE=InnoDB DEFAULT CHARSET=utf8; - +-- ----------------------------------------------------- +-- Table `tperfil` +-- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `tperfil` ( - `id_perfil` int(10) unsigned NOT NULL auto_increment, - `name` TEXT NOT NULL, - `incident_edit` tinyint(3) NOT NULL default '0', - `incident_view` tinyint(3) NOT NULL default '0', - `incident_management` tinyint(3) NOT NULL default '0', - `agent_view` tinyint(3) NOT NULL default '0', - `agent_edit` tinyint(3) NOT NULL default '0', - `alert_edit` tinyint(3) NOT NULL default '0', - `user_management` tinyint(3) NOT NULL default '0', - `db_management` tinyint(3) NOT NULL default '0', - `alert_management` tinyint(3) NOT NULL default '0', - `pandora_management` tinyint(3) NOT NULL default '0', - PRIMARY KEY (`id_perfil`) + `id_perfil` int(10) unsigned NOT NULL auto_increment, + `name` TEXT NOT NULL, + `incident_edit` tinyint(3) NOT NULL default '0', + `incident_view` tinyint(3) NOT NULL default '0', + `incident_management` tinyint(3) NOT NULL default '0', + `agent_view` tinyint(3) NOT NULL default '0', + `agent_edit` tinyint(3) NOT NULL default '0', + `alert_edit` tinyint(3) NOT NULL default '0', + `user_management` tinyint(3) NOT NULL default '0', + `db_management` tinyint(3) NOT NULL default '0', + `alert_management` tinyint(3) NOT NULL default '0', + `pandora_management` tinyint(3) NOT NULL default '0', + PRIMARY KEY (`id_perfil`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +-- ----------------------------------------------------- +-- Table `trecon_script` +-- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `trecon_script` ( - `id_recon_script` int(10) NOT NULL auto_increment, - `name` varchar(100) default '', - `description` TEXT, - `script` varchar(250) default '', - PRIMARY KEY (`id_recon_script`) + `id_recon_script` int(10) NOT NULL auto_increment, + `name` varchar(100) default '', + `description` TEXT, + `script` varchar(250) default '', + PRIMARY KEY (`id_recon_script`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +-- ----------------------------------------------------- +-- Table `trecon_task` +-- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `trecon_task` ( - `id_rt` int(10) unsigned NOT NULL auto_increment, - `name` varchar(100) NOT NULL default '', - `description` varchar(250) NOT NULL default '', - `subnet` text NOT NULL default '', - `id_network_profile` int(10) unsigned NOT NULL default '0', - `create_incident` tinyint(3) unsigned NOT NULL default '0', - `id_group` int(10) unsigned NOT NULL default '1', - `utimestamp` bigint(20) unsigned NOT NULL default '0', - `status` tinyint(4) NOT NULL default '0', - `interval_sweep` int(10) unsigned NOT NULL default '0', - `id_recon_server` int(10) unsigned NOT NULL default '0', - `id_os` tinyint(4) NOT NULL default '0', - `recon_ports` varchar(250) NOT NULL default '', - `snmp_community` varchar(64) NOT NULL default 'public', - `id_recon_script` int(10), - `field1` text NOT NULL default '', - `field2` varchar(250) NOT NULL default '', - `field3` varchar(250) NOT NULL default '', - `field4` varchar(250) NOT NULL default '', - `os_detect` tinyint(1) unsigned default '0', - `resolve_names` tinyint(1) unsigned default '0', - `parent_detection` tinyint(1) unsigned default '0', - `parent_recursion` tinyint(1) unsigned default '0', - `disabled` tinyint(1) unsigned NOT NULL DEFAULT '0', - PRIMARY KEY (`id_rt`), - KEY `recon_task_daemon` (`id_recon_server`) + `id_rt` int(10) unsigned NOT NULL auto_increment, + `name` varchar(100) NOT NULL default '', + `description` varchar(250) NOT NULL default '', + `subnet` text NOT NULL default '', + `id_network_profile` int(10) unsigned NOT NULL default '0', + `create_incident` tinyint(3) unsigned NOT NULL default '0', + `id_group` int(10) unsigned NOT NULL default '1', + `utimestamp` bigint(20) unsigned NOT NULL default '0', + `status` tinyint(4) NOT NULL default '0', + `interval_sweep` int(10) unsigned NOT NULL default '0', + `id_recon_server` int(10) unsigned NOT NULL default '0', + `id_os` tinyint(4) NOT NULL default '0', + `recon_ports` varchar(250) NOT NULL default '', + `snmp_community` varchar(64) NOT NULL default 'public', + `id_recon_script` int(10), + `field1` text NOT NULL default '', + `field2` varchar(250) NOT NULL default '', + `field3` varchar(250) NOT NULL default '', + `field4` varchar(250) NOT NULL default '', + `os_detect` tinyint(1) unsigned default '0', + `resolve_names` tinyint(1) unsigned default '0', + `parent_detection` tinyint(1) unsigned default '0', + `parent_recursion` tinyint(1) unsigned default '0', + `disabled` tinyint(1) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`id_rt`), + KEY `recon_task_daemon` (`id_recon_server`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - +-- ----------------------------------------------------- +-- Table `tserver` +-- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `tserver` ( - `id_server` int(10) unsigned NOT NULL auto_increment, - `name` varchar(100) NOT NULL default '', - `ip_address` varchar(100) NOT NULL default '', - `status` int(11) NOT NULL default '0', - `laststart` datetime NOT NULL default '1970-01-01 00:00:00', - `keepalive` datetime NOT NULL default '1970-01-01 00:00:00', - `snmp_server` tinyint(3) unsigned NOT NULL default '0', - `network_server` tinyint(3) unsigned NOT NULL default '0', - `data_server` tinyint(3) unsigned NOT NULL default '0', - `master` tinyint(3) unsigned NOT NULL default '0', - `checksum` tinyint(3) unsigned NOT NULL default '0', - `description` varchar(255) default NULL, - `recon_server` tinyint(3) unsigned NOT NULL default '0', - `version` varchar(20) NOT NULL default '', - `plugin_server` tinyint(3) unsigned NOT NULL default '0', - `prediction_server` tinyint(3) unsigned NOT NULL default '0', - `wmi_server` tinyint(3) unsigned NOT NULL default '0', - `export_server` tinyint(3) unsigned NOT NULL default '0', - `server_type` tinyint(3) unsigned NOT NULL default '0', - `queued_modules` int(5) unsigned NOT NULL default '0', - `threads` int(5) unsigned NOT NULL default '0', - `lag_time` int(11) NOT NULL default 0, - `lag_modules` int(11) NOT NULL default 0, - `total_modules_running` int(11) NOT NULL default 0, - `my_modules` int(11) NOT NULL default 0, - `stat_utimestamp` bigint(20) NOT NULL default '0', - PRIMARY KEY (`id_server`), + `id_server` int(10) unsigned NOT NULL auto_increment, + `name` varchar(100) NOT NULL default '', + `ip_address` varchar(100) NOT NULL default '', + `status` int(11) NOT NULL default '0', + `laststart` datetime NOT NULL default '1970-01-01 00:00:00', + `keepalive` datetime NOT NULL default '1970-01-01 00:00:00', + `snmp_server` tinyint(3) unsigned NOT NULL default '0', + `network_server` tinyint(3) unsigned NOT NULL default '0', + `data_server` tinyint(3) unsigned NOT NULL default '0', + `master` tinyint(3) unsigned NOT NULL default '0', + `checksum` tinyint(3) unsigned NOT NULL default '0', + `description` varchar(255) default NULL, + `recon_server` tinyint(3) unsigned NOT NULL default '0', + `version` varchar(20) NOT NULL default '', + `plugin_server` tinyint(3) unsigned NOT NULL default '0', + `prediction_server` tinyint(3) unsigned NOT NULL default '0', + `wmi_server` tinyint(3) unsigned NOT NULL default '0', + `export_server` tinyint(3) unsigned NOT NULL default '0', + `server_type` tinyint(3) unsigned NOT NULL default '0', + `queued_modules` int(5) unsigned NOT NULL default '0', + `threads` int(5) unsigned NOT NULL default '0', + `lag_time` int(11) NOT NULL default 0, + `lag_modules` int(11) NOT NULL default 0, + `total_modules_running` int(11) NOT NULL default 0, + `my_modules` int(11) NOT NULL default 0, + `stat_utimestamp` bigint(20) NOT NULL default '0', + PRIMARY KEY (`id_server`), KEY `name` (`name`), KEY `keepalive` (`keepalive`), KEY `status` (`status`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -- server types: -- 0 data -- 1 network @@ -763,82 +773,93 @@ CREATE TABLE IF NOT EXISTS `tserver` ( -- 9 web -- TODO: drop 2.x xxxx_server fields, unused since server_type exists. +-- ----------------------------------------------------- +-- Table `tsesion` +-- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `tsesion` ( - `id_sesion` bigint(20) unsigned NOT NULL auto_increment, - `id_usuario` varchar(60) NOT NULL default '0', - `ip_origen` varchar(100) NOT NULL default '', - `accion` varchar(100) NOT NULL default '', - `descripcion` text NOT NULL, - `fecha` datetime NOT NULL default '1970-01-01 00:00:00', - `utimestamp` bigint(20) unsigned NOT NULL default '0', - PRIMARY KEY (`id_sesion`), - KEY `idx_utimestamp` (`utimestamp`), - KEY `idx_user` (`id_usuario`) + `id_sesion` bigint(20) unsigned NOT NULL auto_increment, + `id_usuario` varchar(60) NOT NULL default '0', + `ip_origen` varchar(100) NOT NULL default '', + `accion` varchar(100) NOT NULL default '', + `descripcion` text NOT NULL, + `fecha` datetime NOT NULL default '1970-01-01 00:00:00', + `utimestamp` bigint(20) unsigned NOT NULL default '0', + PRIMARY KEY (`id_sesion`), + KEY `idx_utimestamp` (`utimestamp`), + KEY `idx_user` (`id_usuario`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; - +-- ----------------------------------------------------- +-- Table `ttipo_modulo` +-- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `ttipo_modulo` ( - `id_tipo` smallint(5) unsigned NOT NULL auto_increment, - `nombre` varchar(100) NOT NULL default '', - `categoria` int(11) NOT NULL default '0', - `descripcion` varchar(100) NOT NULL default '', - `icon` varchar(100) default NULL, - PRIMARY KEY (`id_tipo`) + `id_tipo` smallint(5) unsigned NOT NULL auto_increment, + `nombre` varchar(100) NOT NULL default '', + `categoria` int(11) NOT NULL default '0', + `descripcion` varchar(100) NOT NULL default '', + `icon` varchar(100) default NULL, + PRIMARY KEY (`id_tipo`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; - +-- ----------------------------------------------------- +-- Table `ttrap` +-- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `ttrap` ( - `id_trap` bigint(20) unsigned NOT NULL auto_increment, - `source` varchar(50) NOT NULL default '', - `oid` text NOT NULL, - `oid_custom` text, - `type` int(11) NOT NULL default '0', - `type_custom` varchar(100) default '', - `value` text, - `value_custom` text, - `alerted` smallint(6) NOT NULL default '0', - `status` smallint(6) NOT NULL default '0', - `id_usuario` varchar(150) default '', - `timestamp` datetime NOT NULL default '1970-01-01 00:00:00', - `priority` tinyint(4) unsigned NOT NULL default '2', - `text` varchar(255) default '', - `description` varchar(255) default '', - `severity` tinyint(4) unsigned NOT NULL default '2', - PRIMARY KEY (`id_trap`), - INDEX timestamp (`timestamp`), - INDEX status (`status`) + `id_trap` bigint(20) unsigned NOT NULL auto_increment, + `source` varchar(50) NOT NULL default '', + `oid` text NOT NULL, + `oid_custom` text, + `type` int(11) NOT NULL default '0', + `type_custom` varchar(100) default '', + `value` text, + `value_custom` text, + `alerted` smallint(6) NOT NULL default '0', + `status` smallint(6) NOT NULL default '0', + `id_usuario` varchar(150) default '', + `timestamp` datetime NOT NULL default '1970-01-01 00:00:00', + `priority` tinyint(4) unsigned NOT NULL default '2', + `text` varchar(255) default '', + `description` varchar(255) default '', + `severity` tinyint(4) unsigned NOT NULL default '2', + PRIMARY KEY (`id_trap`), + INDEX timestamp (`timestamp`), + INDEX status (`status`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +-- ----------------------------------------------------- +-- Table `tusuario` +-- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `tusuario` ( - `id_user` varchar(60) NOT NULL default '0', - `fullname` varchar(255) NOT NULL, - `firstname` varchar(255) NOT NULL, - `lastname` varchar(255) NOT NULL, - `middlename` varchar(255) NOT NULL, - `password` varchar(45) default NULL, - `comments` varchar(200) default NULL, - `last_connect` bigint(20) NOT NULL default '0', - `registered` bigint(20) NOT NULL default '0', - `email` varchar(100) default NULL, - `phone` varchar(100) default NULL, - `is_admin` tinyint(1) unsigned NOT NULL default '0', - `language` varchar(10) default NULL, - `timezone` varchar(50) default '', - `block_size` int(4) NOT NULL DEFAULT 20, - `flash_chart` int(4) NOT NULL DEFAULT 1, - `id_skin` int(10) unsigned NOT NULL, - `disabled` int(4) NOT NULL DEFAULT 0, - `shortcut` tinyint(1) DEFAULT 0, - `shortcut_data` text, - `section` TEXT NOT NULL, - `data_section` TEXT NOT NULL, - `force_change_pass` tinyint(1) unsigned NOT NULL default 0, - `last_pass_change` DATETIME NOT NULL DEFAULT 0, - `last_failed_login` DATETIME NOT NULL DEFAULT 0, - `failed_attempt` int(4) NOT NULL DEFAULT 0, - `login_blocked` tinyint(1) unsigned NOT NULL default 0, - `metaconsole_access` enum('basic','advanced','custom','all','only_console') default 'only_console', - UNIQUE KEY `id_user` (`id_user`) + `id_user` varchar(60) NOT NULL default '0', + `fullname` varchar(255) NOT NULL, + `firstname` varchar(255) NOT NULL, + `lastname` varchar(255) NOT NULL, + `middlename` varchar(255) NOT NULL, + `password` varchar(45) default NULL, + `comments` varchar(200) default NULL, + `last_connect` bigint(20) NOT NULL default '0', + `registered` bigint(20) NOT NULL default '0', + `email` varchar(100) default NULL, + `phone` varchar(100) default NULL, + `is_admin` tinyint(1) unsigned NOT NULL default '0', + `language` varchar(10) default NULL, + `timezone` varchar(50) default '', + `block_size` int(4) NOT NULL DEFAULT 20, + `flash_chart` int(4) NOT NULL DEFAULT 1, + `id_skin` int(10) unsigned NOT NULL, + `disabled` int(4) NOT NULL DEFAULT 0, + `shortcut` tinyint(1) DEFAULT 0, + `shortcut_data` text, + `section` TEXT NOT NULL, + `data_section` TEXT NOT NULL, + `force_change_pass` tinyint(1) unsigned NOT NULL default 0, + `last_pass_change` DATETIME NOT NULL DEFAULT 0, + `last_failed_login` DATETIME NOT NULL DEFAULT 0, + `failed_attempt` int(4) NOT NULL DEFAULT 0, + `login_blocked` tinyint(1) unsigned NOT NULL default 0, + `metaconsole_access` enum('basic','advanced','custom','all','only_console') default 'only_console', + `not_login` tinyint(1) unsigned NOT NULL DEFAULT 0, + UNIQUE KEY `id_user` (`id_user`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `tusuario_perfil` ( @@ -993,79 +1014,94 @@ CREATE TABLE IF NOT EXISTS `tlayout` ( PRIMARY KEY(`id`) ) ENGINE = InnoDB DEFAULT CHARSET=utf8; +-- ----------------------------------------------------- +-- Table `tlayout_data` +-- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `tlayout_data` ( - `id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, - `id_layout` INTEGER UNSIGNED NOT NULL default 0, - `pos_x` INTEGER UNSIGNED NOT NULL default 0, - `pos_y` INTEGER UNSIGNED NOT NULL default 0, - `height` INTEGER UNSIGNED NOT NULL default 0, - `width` INTEGER UNSIGNED NOT NULL default 0, - `label` varchar(200) DEFAULT "", - `image` varchar(200) DEFAULT "", - `type` tinyint(1) UNSIGNED NOT NULL default 0, - `period` INTEGER UNSIGNED NOT NULL default 3600, - `id_agente_modulo` mediumint(8) unsigned NOT NULL default '0', - `id_agent` int(10) unsigned NOT NULL default 0, - `id_layout_linked` INTEGER unsigned NOT NULL default '0', - `parent_item` INTEGER UNSIGNED NOT NULL default 0, - `label_color` varchar(20) DEFAULT "", - `no_link_color` tinyint(1) UNSIGNED NOT NULL default 0, - PRIMARY KEY(`id`) + `id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, + `id_layout` INTEGER UNSIGNED NOT NULL default 0, + `pos_x` INTEGER UNSIGNED NOT NULL default 0, + `pos_y` INTEGER UNSIGNED NOT NULL default 0, + `height` INTEGER UNSIGNED NOT NULL default 0, + `width` INTEGER UNSIGNED NOT NULL default 0, + `label` varchar(200) DEFAULT "", + `image` varchar(200) DEFAULT "", + `type` tinyint(1) UNSIGNED NOT NULL default 0, + `period` INTEGER UNSIGNED NOT NULL default 3600, + `id_agente_modulo` mediumint(8) unsigned NOT NULL default '0', + `id_agent` int(10) unsigned NOT NULL default 0, + `id_layout_linked` INTEGER unsigned NOT NULL default '0', + `parent_item` INTEGER UNSIGNED NOT NULL default 0, + `label_color` varchar(20) DEFAULT "", + `no_link_color` tinyint(1) UNSIGNED NOT NULL default 0, + PRIMARY KEY(`id`) ) ENGINE = InnoDB DEFAULT CHARSET=utf8; +-- ----------------------------------------------------- +-- Table `tplugin` +-- ----------------------------------------------------- +-- The fields "net_dst_opt", "net_port_opt", "user_opt" and +-- "pass_opt" are deprecated for the 5.1. CREATE TABLE IF NOT EXISTS `tplugin` ( - `id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, - `name` varchar(200) NOT NULL, - `description` mediumtext, - `max_timeout` int(4) UNSIGNED NOT NULL default 0, - `execute` varchar(250) NOT NULL, - `net_dst_opt` varchar(50) default '', - `net_port_opt` varchar(50) default '', - `user_opt` varchar(50) default '', - `pass_opt` varchar(50) default '', - `plugin_type` int(2) UNSIGNED NOT NULL default 0, - `macros` text, - `parameters` text, - PRIMARY KEY(`id`) + `id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, + `name` varchar(200) NOT NULL, + `description` mediumtext, + `max_timeout` int(4) UNSIGNED NOT NULL default 0, + `execute` varchar(250) NOT NULL, + `net_dst_opt` varchar(50) default '', + `net_port_opt` varchar(50) default '', + `user_opt` varchar(50) default '', + `pass_opt` varchar(50) default '', + `plugin_type` int(2) UNSIGNED NOT NULL default 0, + `macros` text, + `parameters` text, + PRIMARY KEY(`id`) ) ENGINE = InnoDB DEFAULT CHARSET=utf8; - +-- ----------------------------------------------------- +-- Table `tmodule` +-- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `tmodule` ( - `id_module` int(11) unsigned NOT NULL auto_increment, - `name` varchar(100) NOT NULL default '', - PRIMARY KEY (`id_module`) + `id_module` int(11) unsigned NOT NULL auto_increment, + `name` varchar(100) NOT NULL default '', + PRIMARY KEY (`id_module`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; - +-- ----------------------------------------------------- +-- Table `tserver_export` +-- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `tserver_export` ( - `id` int(10) unsigned NOT NULL auto_increment, - `name` varchar(100) NOT NULL default '', - `preffix` varchar(100) NOT NULL default '', - `interval` int(5) unsigned NOT NULL default '300', - `ip_server` varchar(100) NOT NULL default '', - `connect_mode` enum ('tentacle', 'ssh', 'local') default 'local', - `id_export_server` int(10) unsigned default NULL, - `user` varchar(100) NOT NULL default '', - `pass` varchar(100) NOT NULL default '', - `port` int(4) unsigned default '0', - `directory` varchar(100) NOT NULL default '', - `options` varchar(100) NOT NULL default '', - `timezone_offset` TINYINT(2) NULL DEFAULT '0' COMMENT 'Number of hours of diference with the server timezone' , - PRIMARY KEY (`id`), - INDEX id_export_server (`id_export_server`) + `id` int(10) unsigned NOT NULL auto_increment, + `name` varchar(100) NOT NULL default '', + `preffix` varchar(100) NOT NULL default '', + `interval` int(5) unsigned NOT NULL default '300', + `ip_server` varchar(100) NOT NULL default '', + `connect_mode` enum ('tentacle', 'ssh', 'local') default 'local', + `id_export_server` int(10) unsigned default NULL, + `user` varchar(100) NOT NULL default '', + `pass` varchar(100) NOT NULL default '', + `port` int(4) unsigned default '0', + `directory` varchar(100) NOT NULL default '', + `options` varchar(100) NOT NULL default '', + `timezone_offset` TINYINT(2) NULL DEFAULT '0' COMMENT 'Number of hours of diference with the server timezone' , + PRIMARY KEY (`id`), + INDEX id_export_server (`id_export_server`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +-- ----------------------------------------------------- +-- Table `tserver_export_data` +-- ----------------------------------------------------- -- id_export_server is real pandora fms export server process that manages this server -- id is the "destination" server to export CREATE TABLE IF NOT EXISTS `tserver_export_data` ( - `id` int(20) unsigned NOT NULL auto_increment, - `id_export_server` int(10) unsigned default NULL, - `agent_name` varchar(100) NOT NULL default '', - `module_name` varchar(100) NOT NULL default '', - `module_type` varchar(100) NOT NULL default '', - `data` varchar(255) default NULL, - `timestamp` datetime NOT NULL default '1970-01-01 00:00:00', - PRIMARY KEY (`id`) + `id` int(20) unsigned NOT NULL auto_increment, + `id_export_server` int(10) unsigned default NULL, + `agent_name` varchar(100) NOT NULL default '', + `module_name` varchar(100) NOT NULL default '', + `module_type` varchar(100) NOT NULL default '', + `data` varchar(255) default NULL, + `timestamp` datetime NOT NULL default '1970-01-01 00:00:00', + PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `tplanned_downtime` (