From 87dc92ffd9a72db313831e56a2af936cb116f8d9 Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Tue, 18 Feb 2020 13:24:22 +0100 Subject: [PATCH] Ent 5457 suid nodos elastic --- pandora_console/extras/mr/36.sql | 14 ++++++++++++++ .../extras/pandoradb_migrate_6.0_to_7.0.mysql.sql | 2 ++ pandora_console/pandoradb.sql | 6 ++++-- pandora_console/pandoradb_data.sql | 3 ++- 4 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 pandora_console/extras/mr/36.sql diff --git a/pandora_console/extras/mr/36.sql b/pandora_console/extras/mr/36.sql new file mode 100644 index 0000000000..2efc2409e7 --- /dev/null +++ b/pandora_console/extras/mr/36.sql @@ -0,0 +1,14 @@ +START TRANSACTION; + +ALTER TABLE `tmetaconsole_setup` ADD COLUMN `server_uid` TEXT NOT NULL default ''; +SET @st_oum744 = (SELECT IF( + (SELECT COUNT(*) FROM tconfig WHERE token LIKE 'server_unique_identifier') > 0, + "SELECT 1", + "INSERT INTO `tconfig` (`token`, `value`) VALUES ('server_unique_identifier', replace(uuid(),'-',''))" +)); + +PREPARE pr_oum744 FROM @st_oum744; +EXECUTE pr_oum744; +DEALLOCATE PREPARE pr_oum744; + +COMMIT; \ No newline at end of file diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql index 20451647a1..d4c9184242 100644 --- a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql @@ -392,6 +392,8 @@ ALTER TABLE `tmetaconsole_setup` MODIFY COLUMN `meta_dbuser` text NULL, MODIFY COLUMN `meta_dbport` text NULL, MODIFY COLUMN `meta_dbname` text NULL; +ALTER TABLE `tmetaconsole_setup` ADD COLUMN `server_uid` TEXT NOT NULL default ''; + -- --------------------------------------------------------------------- -- Table `tprofile_view` -- --------------------------------------------------------------------- diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 741a0dc1d8..46a42ee82c 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -2579,7 +2579,7 @@ CREATE TABLE IF NOT EXISTS `ttrap_custom_values` ( -- Table `tmetaconsole_setup` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `tmetaconsole_setup` ( - `id` int(10) NOT NULL auto_increment primary key, + `id` int(10) NOT NULL auto_increment, `server_name` text, `server_url` text, `dbuser` text, @@ -2596,7 +2596,9 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_setup` ( `id_group` int(10) unsigned NOT NULL default 0, `api_password` text NOT NULL, `disabled` tinyint(1) unsigned NOT NULL default '0', - `last_event_replication` bigint(20) default '0' + `last_event_replication` bigint(20) default '0', + `server_uid` text NOT NULL default '', + PRIMARY KEY (`id`) ) ENGINE=InnoDB COMMENT = 'Table to store metaconsole sources' DEFAULT CHARSET=utf8; diff --git a/pandora_console/pandoradb_data.sql b/pandora_console/pandoradb_data.sql index 1cdba8578f..fc2e8ce131 100644 --- a/pandora_console/pandoradb_data.sql +++ b/pandora_console/pandoradb_data.sql @@ -141,7 +141,8 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_incident_content', ''), ('sample_agent', '0'), ('gotty', '/usr/bin/gotty'), -('custom_module_units', '{"bytes":"bytes","entries":"entries","files":"files","hits":"hits","sessions":"sessions","users":"users","ºC":"ºC","ºF":"ºF"}'); +('custom_module_units', '{"bytes":"bytes","entries":"entries","files":"files","hits":"hits","sessions":"sessions","users":"users","ºC":"ºC","ºF":"ºF"}'), +('server_unique_identifier', replace(uuid(),'-','')); UNLOCK TABLES; --