From 0269ccc00fa04708c653584d68ae2e94948571be Mon Sep 17 00:00:00 2001 From: jesmg Date: Tue, 12 Jul 2016 09:11:52 +0000 Subject: [PATCH] Minor fixes. Last FIM and rootcheck events in agents tab --- public/controllers/agents.js | 14 + public/templates/agents-metrics.html | 2 +- public/templates/agents.html | 44 ++- public/templates/compliance-pci.html | 2 +- public/templates/compliance-rcdashboard.html | 2 +- public/templates/compliance.html | 2 +- public/templates/fim.html | 2 +- public/templates/manager-osseclog.html | 2 +- public/templates/manager.html | 2 +- public/templates/ruleset-decoders.html | 220 ++++++----- public/templates/ruleset-rules.html | 374 +++++++++---------- public/templates/ruleset-update.html | 120 +++--- public/utils/kibanaUrlFormatter.js | 25 ++ 13 files changed, 435 insertions(+), 376 deletions(-) diff --git a/public/controllers/agents.js b/public/controllers/agents.js index 4e0e528d4..aa8aff75c 100644 --- a/public/controllers/agents.js +++ b/public/controllers/agents.js @@ -108,6 +108,20 @@ app.controller('agentsController', function ($scope, $route, alertify, sharedPro }, printError); }; + $scope.fetchFim = function (agent) { + DataFactory.getAndClean('get', '/syscheck/' + agent.id + '/files', { 'offset': 0, 'limit': 5 }) + .then(function (data) { + $scope.agentFetchInfo[agent.id].syscheckEvents = data.data.items; + }, printError); + }; + + $scope.fetchRootcheck = function (agent) { + DataFactory.getAndClean('get', '/rootcheck/' + agent.id, { 'offset': 0, 'limit': 5 }) + .then(function (data) { + $scope.agentFetchInfo[agent.id].rootcheckEvents = data.data.items; + }, printError); + }; + $scope.restart = function (agent) { alertify.delay(5000).closeLogOnClick(true).log('Restarting agent...'); DataFactory.getAndClean('put', '/agents/'+agent.id+'/restart', {}) diff --git a/public/templates/agents-metrics.html b/public/templates/agents-metrics.html index 850bab5e0..b8f63242e 100644 --- a/public/templates/agents-metrics.html +++ b/public/templates/agents-metrics.html @@ -1,4 +1,4 @@ -
+
  • Overview
  • Metrics
  • diff --git a/public/templates/agents.html b/public/templates/agents.html index 666398516..d9fed6da4 100644 --- a/public/templates/agents.html +++ b/public/templates/agents.html @@ -1,4 +1,4 @@ -
    +
      +
    • + + Details + +
    • Restart scan diff --git a/public/templates/compliance-pci.html b/public/templates/compliance-pci.html index 928d78226..cd25e1ba1 100644 --- a/public/templates/compliance-pci.html +++ b/public/templates/compliance-pci.html @@ -1,4 +1,4 @@ -
      +
      • Rootcheck
      • Rootcheck dashboard
      • diff --git a/public/templates/compliance-rcdashboard.html b/public/templates/compliance-rcdashboard.html index 27d1a00a9..f573d65a9 100644 --- a/public/templates/compliance-rcdashboard.html +++ b/public/templates/compliance-rcdashboard.html @@ -1,4 +1,4 @@ -
        +
        • Rootcheck
        • Rootcheck dashboard
        • diff --git a/public/templates/compliance.html b/public/templates/compliance.html index 745e0ccb9..da9bea8ee 100644 --- a/public/templates/compliance.html +++ b/public/templates/compliance.html @@ -1,4 +1,4 @@ -
          +
          • Rootcheck
          • Rootcheck dashboard
          • diff --git a/public/templates/fim.html b/public/templates/fim.html index 6f4b92229..0d73900d0 100644 --- a/public/templates/fim.html +++ b/public/templates/fim.html @@ -1,4 +1,4 @@ -
            +
            • Overview
            • Dashboard
            • diff --git a/public/templates/manager-osseclog.html b/public/templates/manager-osseclog.html index ce7e6cbad..9deb24d5e 100644 --- a/public/templates/manager-osseclog.html +++ b/public/templates/manager-osseclog.html @@ -1,4 +1,4 @@ -
              +
              • Overview
              • OSSEC Logs
              • diff --git a/public/templates/manager.html b/public/templates/manager.html index 703de08bd..4d8d04406 100644 --- a/public/templates/manager.html +++ b/public/templates/manager.html @@ -1,4 +1,4 @@ -
                +
                • Overview
                • OSSEC Logs
                • diff --git a/public/templates/ruleset-decoders.html b/public/templates/ruleset-decoders.html index 08148e34d..ab39368bf 100644 --- a/public/templates/ruleset-decoders.html +++ b/public/templates/ruleset-decoders.html @@ -1,124 +1,122 @@ -
                  -
                  - +
                  + +
                  +
                  +
                  +
                  -
                  -
                  - -
                  -
                  -
                  {{ message }}
                  -
                  -

                  Decoders

                  -
                  -
                  -
                  -
                  - - +
                  +
                  {{ message }}
                  +
                  +

                  Decoders

                  +
                  +
                  + +
                  + + +
                  + +
                  +
                  +
                  +
                  All decoders
                  +
                  Parents
                  +
                  +
                  + Selected file: {{formatFile(dfFile)}} +
                  +
                  + Selected parent: {{dfId}} +
                  +
                  +
                  +
                  +
                  +
                  +
                  {{decoder.name}}
                  - -
                  -
                  -
                  -
                  All decoders
                  -
                  Parents
                  -
                  -
                  - Selected file: {{formatFile(dfFile)}} -
                  -
                  - Selected parent: {{dfId}} -
                  -
                  -
                  -
                  -
                  -
                  -
                  {{decoder.name}}
                  -
                  -
                  -
                  {{decoder.position}}
                  -
                  +
                  +
                  {{decoder.position}}
                  -
                  -
                  -
                  -
                  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                  Name{{decoder.name}}
                  File{{decoder.file}}
                  Full path{{decoder.full_path}}
                  Position{{decoder.position}}
                  Parent{{decoder.details.parent}}
                  Advanced details
                  {{detailk}}{{detailv}}{{colorRegex(detailv)}}{{colorOrder(detailv)}}
                  -
                  +
                  +
                  +
                  +
                  +
                  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
                  Name{{decoder.name}}
                  File{{decoder.file}}
                  Full path{{decoder.full_path}}
                  Position{{decoder.position}}
                  Parent{{decoder.details.parent}}
                  Advanced details
                  {{detailk}}{{detailv}}{{colorRegex(detailv)}}{{colorOrder(detailv)}}
                  - -
                  + +
                  -
                  -
                  - - - - - - - - - - -
                  {{formatFile(file)}}
                  - - -
                  -
                  +
                  +
                  +
                  + + + + + + + + + + +
                  {{formatFile(file)}}
                  + + +
                  diff --git a/public/templates/ruleset-rules.html b/public/templates/ruleset-rules.html index f0f266536..cc71ef9f0 100644 --- a/public/templates/ruleset-rules.html +++ b/public/templates/ruleset-rules.html @@ -1,201 +1,199 @@ -
                  -
                  - +
                  + +
                  +
                  +
                  +
                  -
                  -
                  - -
                  -
                  -
                  {{ message }}
                  -
                  -

                  Rules

                  -
                  -
                  -
                  -
                  - - +
                  +
                  {{ message }}
                  +
                  +

                  Rules

                  +
                  +
                  + +
                  + + +
                  + +
                  +
                  +
                  +
                  Enabled
                  +
                  Disabled
                  +
                  +
                  + + + + + +
                  +
                  +
                  +
                  + Selected file: {{rfFiles}} + +
                  +
                  + Selected group: {{rfGroups}} +
                  +
                  + Selected PCI group: {{rfPci}} +
                  +
                  +
                  +
                  +
                  +
                  {{rule.id}}
                  +
                  +
                  {{rule.description}}
                  - -
                  -
                  -
                  -
                  Enabled
                  -
                  Disabled
                  -
                  -
                  - - - - - -
                  -
                  -
                  -
                  - Selected file: {{rfFiles}} - -
                  -
                  - Selected group: {{rfGroups}} -
                  -
                  - Selected PCI group: {{rfPci}} -
                  -
                  -
                  -
                  -
                  -
                  {{rule.id}}
                  -
                  -
                  {{rule.description}}
                  -
                  -
                  -
                  -
                  -
                  -
                  {{rule.level}}
                  -
                  +
                  +
                  -
                  -
                  -
                  -
                  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                  ID{{rule.id}}
                  Description{{rule.description}}
                  Level{{rule.level}}
                  File{{rule.file}}
                  Groups
                  {{group}}
                  PCI groups
                  {{pci}}
                  Advanced details
                  {{detailk}}{{detailv}}
                  -
                  - +
                  +
                  {{rule.level}}
                  +
                  +
                  +
                  +
                  +
                  +
                  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
                  ID{{rule.id}}
                  Description{{rule.description}}
                  Level{{rule.level}}
                  File{{rule.file}}
                  Groups
                  {{group}}
                  PCI groups
                  {{pci}}
                  Advanced details
                  {{detailk}}{{detailv}}
                  +
                  - -
                  + +
                  -
                  -
                  - -
                  -
                  - - - - - - - - - - -
                  {{file.name}}
                  - - -
                  - - - - - - - - - - -
                  {{group}}
                  - - -
                  - - - - - - - - - - -
                  {{pci}}
                  - - -
                  -
                  +
                  +
                  +
                  + +
                  +
                  + + + + + + + + + + +
                  {{file.name}}
                  + + +
                  + + + + + + + + + + +
                  {{group}}
                  + + +
                  + + + + + + + + + + +
                  {{pci}}
                  + + +
                  diff --git a/public/templates/ruleset-update.html b/public/templates/ruleset-update.html index d7e60428c..7fd97dc82 100644 --- a/public/templates/ruleset-update.html +++ b/public/templates/ruleset-update.html @@ -1,65 +1,63 @@ -
                  -
                  - +
                  + +
                  +
                  +
                  +
                  -
                  -
                  - -
                  -
                  -
                  {{ message }}
                  -
                  -

                  Update

                  -
                  - - - - - - - - - - - - - - - - - - - - - - - -
                  1. Select what you want to update:
                  -
                  Rules
                  -
                  Rootcheck
                  -
                  Both
                  -
                  2. Do you want to force it?
                  -
                  No
                  -
                  Update the outdated rules (Manager will be restarted only if enabled rules are updated)
                  -
                  Yes
                  -
                  Overwrite all the rules (OSSEC manager is going to be restarted)
                  -
                  - -
                  - - -
                  +
                  +
                  {{ message }}
                  +
                  +

                  Update

                  +
                  + + + + + + + + + + + + + + + + + + + + + + + +
                  1. Select what you want to update:
                  +
                  Rules
                  +
                  Rootcheck
                  +
                  Both
                  +
                  2. Do you want to force it?
                  +
                  No
                  +
                  Update the outdated rules (Manager will be restarted only if enabled rules are updated)
                  +
                  Yes
                  +
                  Overwrite all the rules (OSSEC manager is going to be restarted)
                  +
                  + +
                  + +
                  diff --git a/public/utils/kibanaUrlFormatter.js b/public/utils/kibanaUrlFormatter.js index 13bd02083..f72fd4ac7 100644 --- a/public/utils/kibanaUrlFormatter.js +++ b/public/utils/kibanaUrlFormatter.js @@ -30,6 +30,11 @@ exports.newDashboard = function (structure, filter, time, url) { } if (filter == '') { filter = '*'; + } else { + filter = filter.replace(/'/g, "!'"); + filter = filter.replace(/\\/g, "\\\\"); + filter = filter.replace(/!/g, "!!"); + filter = encodeURIComponent(filter); } if (url) { return util.format('/app/kibana#/dashboard?_g=(refreshInterval:(display:Off,pause:!f,value:0),time:(%s))&_a=(filters:!(),options:(darkTheme:!f),panels:!%s,query:(query_string:(analyze_wildcard:!t,query:\'%s\')),title:\'%s\',uiState:())', time, structure, filter, 'New dashboard'); @@ -50,6 +55,11 @@ exports.getDashboard = function (dashboard, filter, time, url) { } if (filter == '') { filter = '*'; + } else { + filter = filter.replace(/'/g, "!'"); + filter = filter.replace(/\\/g, "\\\\"); + filter = filter.replace(/!/g, "!!"); + filter = encodeURIComponent(filter); } if (dashboards[dashboard] != undefined) { var structure = dashboards[dashboard]; @@ -75,6 +85,11 @@ exports.getAlerts = function (index, query, time, url) { } if (query == '') { query = '*'; + } else { + query = query.replace(/'/g, "!'"); + query = query.replace(/\\/g, "\\\\"); + query = query.replace(/!/g, "!!"); + query = encodeURIComponent(query); } if (url) { return util.format('/app/kibana#/discover?_a=(columns:!(_source),index:\'%s\',interval:auto,query:(query_string:(analyze_wildcard:!t,query:\'%s\')),sort:!(\'@timestamp\',desc))&_g=(refreshInterval:(display:Off,pause:!f,value:0),time:(%s))', index, query, time); @@ -95,6 +110,11 @@ exports.getVisualization = function (visualization, filter, time, url) { } if (filter == '') { filter = '*'; + } else { + filter = filter.replace(/'/g, "!'"); + filter = filter.replace(/\\/g, "\\\\"); + filter = filter.replace(/!/g, "!!"); + filter = encodeURIComponent(filter); } if (visualizations[visualization] != undefined) { var structure = visualizations[visualization]; @@ -121,6 +141,11 @@ exports.newVisualization = function (type, structuredata, filter, time, url) { } if (filter == '') { filter = '*'; + } else { + filter = filter.replace(/'/g, "!'"); + filter = filter.replace(/\\/g, "\\\\"); + filter = filter.replace(/!/g, "!!"); + filter = encodeURIComponent(filter); } if (url) { return util.format('/app/kibana#/visualize/create?indexPattern=ossec-*&type=%s&_g=(refreshInterval:(display:Off,pause:!f,value:0),time:(%s))&_a=(filters:!(),linked:!f,query:(query_string:(analyze_wildcard:!t,query:\'%s\')),uiState:(),%s', type, time, filter, structuredata);