Skip to content

Commit

Permalink
tests/pgsql: add test for bug 6983
Browse files Browse the repository at this point in the history
Related to
Bug #6983
  • Loading branch information
jufajardini authored and victorjulien committed Jun 5, 2024
1 parent e90f2a6 commit be095e1
Show file tree
Hide file tree
Showing 8 changed files with 110 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/pgsql/pgsql-bug-6983-ids/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Description

Tests that alerts for the pgsql app-proto will include pgsql app-proto metadata.

## PCAP

Pcap file reused from pgsql-ssl-rejected-md5-auth-simple-query

## Redmine ticket

https://redmine.openinfosecfoundation.org/issues/6983
https://redmine.openinfosecfoundation.org/issues/7000
18 changes: 18 additions & 0 deletions tests/pgsql/pgsql-bug-6983-ids/suricata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
%YAML 1.1
---

outputs:
- eve-log:
enabled: yes
filetype: regular
filename: eve.json
types:
- pgsql:
enabled: yes
passwords: yes
- alert

app-layer:
protocols:
pgsql:
enabled: yes
1 change: 1 addition & 0 deletions tests/pgsql/pgsql-bug-6983-ids/test.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alert pgsql any any -> any any (msg:"PGSQL Test Rule"; content:"select * from"; sid:1; rev:1;)
25 changes: 25 additions & 0 deletions tests/pgsql/pgsql-bug-6983-ids/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
requires:
min-version: 7.0

pcap: ../pgsql-ssl-rejected-md5-auth-simple-query/input.pcap

args:
- -k none

checks:
- filter:
count: 7
match:
event_type: pgsql
- filter:
count: 1
match:
event_type: alert
alert.signature_id: 1
- filter:
min-version: 8
count: 1
match:
event_type: alert
flow.pkts_toserver: 10
flow.pkts_toclient: 10
16 changes: 16 additions & 0 deletions tests/pgsql/pgsql-bug-6983-ips/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Description

Tests that alerts for the pgsql app-proto will include pgsql app-proto metadata,
in IPS mode.

As this test uses a stream rule, in IPS mode the engine generating two alerts is
expected.

## PCAP

Pcap file reused from pgsql-ssl-rejected-md5-auth-simple-query

## Redmine ticket

https://redmine.openinfosecfoundation.org/issues/6983
https://redmine.openinfosecfoundation.org/issues/7000
18 changes: 18 additions & 0 deletions tests/pgsql/pgsql-bug-6983-ips/suricata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
%YAML 1.1
---

outputs:
- eve-log:
enabled: yes
filetype: regular
filename: eve.json
types:
- pgsql:
enabled: yes
passwords: yes
- alert

app-layer:
protocols:
pgsql:
enabled: yes
1 change: 1 addition & 0 deletions tests/pgsql/pgsql-bug-6983-ips/test.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alert pgsql any any -> any any (msg:"PGSQL Test Rule"; content:"select * from"; sid:1; rev:1;)
19 changes: 19 additions & 0 deletions tests/pgsql/pgsql-bug-6983-ips/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
requires:
min-version: 7.0

pcap: ../pgsql-ssl-rejected-md5-auth-simple-query/input.pcap

args:
- -k none
- --simulate-ips

checks:
- filter:
count: 7
match:
event_type: pgsql
- filter:
count: 2
match:
event_type: alert
alert.signature_id: 1

0 comments on commit be095e1

Please sign in to comment.