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

output/eve: add 'verdict' field to 'alert' and 'drop' events - v10 #9220

Closed
wants to merge 5 commits into from

Conversation

jufajardini
Copy link
Contributor

Link to redmine ticket:
https://redmine.openinfosecfoundation.org/issues/5464

Previous PR: #9162

Describe changes from previous PR:

  • try a different approach for verdict.action: pass cases

SV_BRANCH=pr/1310
OISF/suricata-verify#1310

Some output samples:

# IPS mode, reject rule, TCP-reset
  "event_type": "alert",
  "src_ip": "10.16.1.11",
  "src_port": 54186,
  "dest_ip": "82.165.177.154",
  "dest_port": 80,
  "proto": "TCP",
  "pkt_src": "wire/pcap",
  "alert": {
    "action": "blocked",
    "gid": 1,
    "signature_id": 2,
    "rev": 1,
    "signature": "",
    "category": "",
    "severity": 3
  },
  "verdict": {
    "action": "drop",
    "reject_target": "destination",
    "reject": [
      "tcp-reset"
    ]
  }
# packet with alert and pass rules triggered:
{
 "event_type": "alert",
  "verdict": {
    "action": "pass"
  }
}

The `field action` portion seemed to be comprised of a more generic
section that followed it. Also formatted the section for lines to be
within the character limit.
@suricata-qa
Copy link

Information: QA ran without warnings.

Pipeline 15150

alerts: yes # log alerts that caused drops
flows: all # start or all: 'start' logs only a single drop
# per flow direction. All logs each dropped pkt.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

verdict option is missing here

JB_SET_STRING(jb, "reject_target", "both");
}
jb_open_array(jb, "reject");
switch (p->proto) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need UDP in here too

JB_SET_STRING(jb, "action", "alert");
}
if (PacketCheckAction(p, ACTION_REJECT)) {
JB_SET_STRING(jb, "reject_target", "source");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wonder if it would be clearer to use to_client / to_server here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it better to keep closer to what the reject keywords have?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think being more explicit about the direction is best, using language we already have. Since we're already thinking about to_server & to_client for most output, I think it makes sense to use it here too

* \param p Pointer to Packet current being logged
*
*/
void GetVerdictJson(JsonBuilder *jb, const Packet *p)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since this is a public function, lets name this something like EveAddVerdict

# Enable logging the final action taken on a packet by the engine
# (e.g: the alert may have action 'allowed' but the verdict be
# 'drop' due to another alert. That's the engine's verdict)
verdict: yes
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure about enabling by default here, esp since it will only be slightly useful for the common IDS use case

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a mistake on my end, will fix.

@victorjulien
Copy link
Member

Is this still current? Not seeing an example of it in the SV tests.

# packet with alert and pass rules triggered:
{
 "event_type": "alert",
  "verdict": {
    "action": "pass"
  }
}

@jufajardini
Copy link
Contributor Author

Is this still current? Not seeing an example of it in the SV tests.

# packet with alert and pass rules triggered:
{
 "event_type": "alert",
  "verdict": {
    "action": "pass"
  }
}

Tests bug-5464-verdict-04 and bug-5464-verdict-05 should showcase it:

{
  "timestamp": "2019-05-15T08:11:18.738996+0000",
  "flow_id": 1766592176856578,
  "pcap_cnt": 1,
  "event_type": "alert",
  "alert": {
    "action": "allowed",
    "gid": 1,
    "signature_id": 3,
    "rev": 0,
    "signature": "",
    "category": "",
    "severity": 3
  },
  "verdict": {
    "action": "pass"
  }
}

@jufajardini
Copy link
Contributor Author

Feedback incorporated in #9230

@jufajardini jufajardini deleted the alert-action/v10 branch July 14, 2023 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants