Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logtest from the app #1434

Closed
12 tasks done
jctello opened this issue May 7, 2019 · 11 comments
Closed
12 tasks done

Logtest from the app #1434

jctello opened this issue May 7, 2019 · 11 comments
Assignees
Labels
type/enhancement Enhancement issue UI/UX Generic label for things related to the font-end side
Projects

Comments

@jctello
Copy link
Contributor

jctello commented May 7, 2019

With the amazing enhancements and capabilities done to the app with version 3.9.0 the experience of creating custom decoders and rules has been greatly improved.

Almost everything can now be done through the web interface while also having the added benefit of syntax and general verification as the files are being edited.

It feels only natural to provide the users with the ability to test log messages as their rules and decoders are being written in that interface, with the possibility of providing even better feedback.

So this issue is to request a tool to test how the ruleset would react to specific log messages. As an enhancement upon the ossec-logtest, it could visually provide an interactive tree of all the rules showing the "path" taken by analysisd and highlighting why each rule and decoder matched (so like ossec-logtest -v but interactive).


(@jesusgn90 added)

The main target of this ticket is to give the user the ability to do not need to log in using SSH into the Wazuh manager instance for testing a sample log.

  • Components
    • Input box for reading the sample log.
    • Button/action element for sending the sample log.
    • Output box for showing the results.
  • Design
    • This feature should be easily accessible from almost every Ruleset section, the user may want to test a log when modifying decoders or after saving a new rule for example.
    • By default it should be hidden.
    • It should not be very intrusive, should work at the same time you are editing or creating a ruleset file. Think about a user with the strategy trial and error, the user would expect to quickly try the sample log multiple times until the ruleset modification is done.

Update 24/09/2019
Pending-api and Pending-core wazuh/wazuh-api#449

  • Logic
    • Connect with an API endpoint.
    • Handle unexpected results properly.
    • Limit the input so we don't crash the API or the logtest tool.
@jctello jctello added type/enhancement Enhancement issue request/operational Operational requests labels May 7, 2019
@jctello jctello added this to To do in Wazuh TBD via automation May 7, 2019
@jesusgn90 jesusgn90 removed this from To do in Wazuh TBD May 28, 2019
@jesusgn90 jesusgn90 added this to To do in Wazuh 3.11.0 via automation May 28, 2019
@jesusgn90 jesusgn90 added this to the 27th week sprint milestone Jun 28, 2019
@juankaromo juankaromo self-assigned this Sep 3, 2019
@juankaromo juankaromo moved this from To do to In progress in Wazuh 3.11.0 Sep 3, 2019
@jesusgn90 jesusgn90 added priority/medium UI/UX Generic label for things related to the font-end side and removed request/operational Operational requests priority/high labels Sep 3, 2019
@jesusgn90 jesusgn90 moved this from In progress to To do in Wazuh 3.11.0 Sep 3, 2019
@jesusgn90 jesusgn90 assigned juankaromo and unassigned juankaromo Sep 3, 2019
@jesusgn90 jesusgn90 added this to the 36th week sprint milestone Sep 3, 2019
@juankaromo juankaromo moved this from To do to In progress in Wazuh 3.11.0 Sep 3, 2019
@juankaromo
Copy link
Contributor

Hi team,

For the first iteration of this issue, I've designed de solution below:

A new button for open de logtest section would be added on rules and decoders sections:
image

This button would open a new section with an empty text area where introduce the log, and a text viewer on seeing the logtest result:

image

It will be possible thanks to a new API endpoint that sending a log in string fromat e.g.:

{"timestamp":"2019-09-03T13:22:27.950+0000","rule":{"level":7,"description":"python: Undocumented local_file protocol allows remote attackers to bypass protection mechanisms","id":"23504","firedtimes":33,"mail":false,"groups":["vulnerability-detector"],"gdpr":["IV_35.7.d"]},"agent":{"id":"000","name":"a205e5b2a1aa"},"manager":{"name":"a205e5b2a1aa"},"id":"1567516947.252273","cluster":{"name":"wazuh","node":"master"},"decoder":{"name":"json"},"data":{"vulnerability":{"cve":"CVE-2019-9948","title":"python: Undocumented local_file protocol allows remote attackers to bypass protection mechanisms","severity":"Medium","published":"2019-03-23T00:00:00+00:00","state":"Fixed","cvss":{"cvss3_score":"7.400000"},"package":{"name":"python","version":"2.7.5-80.el7_6","condition":"less than 2.7.5-86.el7"},"advisories":"RHSA-2019:2030,RHSA-2019:1700","cwe_reference":"CWE-749","bugzilla_reference":"https://bugzilla.redhat.com/show_bug.cgi?id=1695570","reference":"https://access.redhat.com/security/cve/CVE-2019-9948"}},"location":"vulnerability-detector"}

Returns us a logtest result in plain text as well e.g.:

**Phase 1: Completed pre-decoding.
       full event: 'timestamp:2019-09-03T13:22:27.950+0000 rule:level:7 rule:description:python: Undocumented local_file protocol allows remote attackers to bypass protection mechanisms rule:id:23504 rule:firedtimes:33 rule:mail:false rule:groups:[vulnerability-detector] rule:gdpr:[IV_35.7.d] agent:id:000 agent:name:a205e5b2a1aa manager:{name:a205e5b2a1aa} id:1567516947.252273 cluster:name:wazuh cluster:node:master decoder:{name:json} data:{vulnerability:cve:CVE-2019-9948} data:{vulnerability:title:python: Undocumented local_file protocol allows remote attackers to bypass protection mechanisms} data:{vulnerability:severity:Medium} data:{vulnerability:published:2019-03-23T00:00:00+00:00} data:{vulnerability:state:Fixed} data:{vulnerability:cvss:{cvss3_score:7.400000}} data:{vulnerability:package:name:python} data:{vulnerability:package:version:2.7.5-80.el7_6} data:{vulnerability:package:condition:less than 2.7.5-86.el7} data:{vulnerability:advisories:RHSA-2019:2030,RHSA-2019:1700} data:{vulnerability:cwe_reference:CWE-749} data:{vulnerability:bugzilla_reference:https://bugzilla.redhat.com/show_bug.cgi?id=1695570} data:{vulnerability:reference:https://access.redhat.com/security/cve/CVE-2019-9948} location:vulnerability-detector'
       timestamp: '(null)'
       hostname: 'a205e5b2a1aa'
       program_name: '(null)'
       log: 'timestamp:2019-09-03T13:22:27.950+0000 rule:level:7 rule:description:python: Undocumented local_file protocol allows remote attackers to bypass protection mechanisms rule:id:23504 rule:firedtimes:33 rule:mail:false rule:groups:[vulnerability-detector] rule:gdpr:[IV_35.7.d] agent:id:000 agent:name:a205e5b2a1aa manager:{name:a205e5b2a1aa} id:1567516947.252273 cluster:name:wazuh cluster:node:master decoder:{name:json} data:{vulnerability:cve:CVE-2019-9948} data:{vulnerability:title:python: Undocumented local_file protocol allows remote attackers to bypass protection mechanisms} data:{vulnerability:severity:Medium} data:{vulnerability:published:2019-03-23T00:00:00+00:00} data:{vulnerability:state:Fixed} data:{vulnerability:cvss:{cvss3_score:7.400000}} data:{vulnerability:package:name:python} data:{vulnerability:package:version:2.7.5-80.el7_6} data:{vulnerability:package:condition:less than 2.7.5-86.el7} data:{vulnerability:advisories:RHSA-2019:2030,RHSA-2019:1700} data:{vulnerability:cwe_reference:CWE-749} data:{vulnerability:bugzilla_reference:https://bugzilla.redhat.com/show_bug.cgi?id=1695570} data:{vulnerability:reference:https://access.redhat.com/security/cve/CVE-2019-9948} location:vulnerability-detector'
**Phase 2: Completed decoding.
       No decoder matched.
**Phase 3: Completed filtering (rules).
       Rule id: '1002'
       Level: '2'
       Description: 'Unknown problem somewhere in the system.'

The API issue is this wazuh/wazuh-api#449

Regards.

@juankaromo
Copy link
Contributor

Update 04/09/2019

Today I implemented a new ruleset shortcuts component. From these shortcuts, you can create a new file (either rule, decoder or lists), upload files, and open the Logtest.

For this, I have used the eui Key Pad Menu component and the Item buttons.

shortcuts

On the other hand, for the Logtest, the requests have been mocked, and a component has been created consisting of a text area where the log would be introduced, and on the other hand, a config-viewer where the result would be seen.

logtest

@juankaromo
Copy link
Contributor

Update 05/09/2019

Today the navigation in ruleset tabs was changed. The right sidebar was deprecated by an improved action bar inside the tables. On the other hand, the way to show the result of the test has been changed from wz-xml-file-viewer to eui CodeBlock.

logtest2

Additionally, the design of the ruleset tables has been improved to adapt them to the look and feel of eui tables (they are not going to be migrated still).

image

@juankaromo
Copy link
Contributor

Update 06/09/2019

Today the design and logic of the testlog have been improved. In addition, the ruleset tables have been redesigned to resemble eui, and the navigability of the section has been improved.

Finally, the upload-files component has been integrated into the branch.

refactor_ruleset

Branch: https://github.com/wazuh/wazuh-kibana-app/tree/logtest

@juankaromo
Copy link
Contributor

Update 09/09/2019

Today I've done an alternative mode to show de logtest. I renamed de Dev tools section by Tools. In this section, I would show selectable cards with some options. The first would be the old dev tools console, named now API Dev console, and a second option that would be the logtest.

It looks like this:

wazuh-tools

@Joanes04
Copy link
Contributor

Update 13/07/2020

The implementation of Logtest from the app has been resumed. We have added a new login menu and a new view for Logtest:

new_view_logtest

We've also added some accesses from the Rules, Decoders and CDB Lists view, which keeps the session open while you browse these sections, so you can try out the different options:

flyout

@juankaromo juankaromo modified the milestones: Sprint 114, Sprint 115 Jul 17, 2020
@juankaromo juankaromo modified the milestones: Sprint 115, Sprint 116 Aug 10, 2020
@juankaromo juankaromo modified the milestones: Sprint 116, Sprint 117 Aug 28, 2020
@snaow snaow unpinned this issue Sep 1, 2020
@jsanchez91 jsanchez91 modified the milestones: Sprint 117, Sprint 118 Sep 21, 2020
@jsanchez91 jsanchez91 modified the milestones: Sprint 118, Sprint 119 Oct 19, 2020
@frankeros frankeros added priority/high and removed pending-api Task blocked by the Wazuh API priority/medium labels Mar 3, 2021
@gabiwassan gabiwassan self-assigned this Mar 4, 2021
@gabiwassan
Copy link
Contributor

Working on this PR (draft).

  • Requests have already been added

@gabiwassan
Copy link
Contributor

gabiwassan commented Mar 9, 2021

PR on revision.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement Enhancement issue UI/UX Generic label for things related to the font-end side
Projects
No open projects
Wazuh 4.0
  
Awaiting triage
Development

No branches or pull requests

8 participants