Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Test

Updated test to ensure that the engine accepts the `bypass` keyword in a firewall
mode, in a firweall rule.

The accepted firewall rule matches the decoded HTTP host
`www.testmyids.com`, then accepts and bypasses the flow at the
`http1:request_headers` hook.

## Ticket

Related to
https://redmine.openinfosecfoundation.org/issues/8459.
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,35 @@ pcap: ../../flowbit-oring/input.pcap
args:
- --simulate-ips
- -k none
exit-code: 1

checks:
# We're enabling bypass in firewall rules only, in firewall mode
- shell:
args: grep "keyword 'bypass' is not allowed in firewall mode" stderr | wc -l
expect: 0
- filter:
# Would be 1 if bypass were enabled in firewall rules.
count: 0
# Expected 1 with bypass enabled in firewall rules.
count: 1
match:
event_type: alert
alert.signature_id: 2000001
http.hostname: www.testmyids.com
- filter:
# Would remain 0 if bypass were enabled and suppressed TD inspection.
# Remains 0 if bypass is enabled and suppressed TD inspection.
count: 0
match:
event_type: alert
alert.signature_id: 100001
- filter:
# Would be 1 if bypass were enabled in firewall rules.
count: 0
# Should be 1 if bypass is enabled in firewall rules.
count: 1
match:
event_type: flow
flow.state: bypassed
flow.bypass: local
- filter:
# Would be 1 if bypass were enabled in firewall rules.
count: 0
# Should be 1 if bypass is enabled in firewall rules.
count: 1
match:
event_type: stats
stats.flow_bypassed.local_pkts: 6
- shell:
args: grep "keyword 'bypass' is not allowed in firewall mode" stderr | wc -l
expect: 1

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Test

Ensure that the engine throws an error if the `bypass` keyword is used
in threat detection rules, as it's banned in firewall mode.
in threat detection rules, as it's banned in firewall mode, for those.

## Ticket

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ exit-code: 1

checks:
- shell:
args: grep "keyword 'bypass' is not allowed in firewall mode" stderr | wc -l
args: grep "keyword 'bypass' is not allowed in threat detection rules with firewall mode" stderr | wc -l
expect: 1

14 changes: 14 additions & 0 deletions tests/firewall/ruletype-firewall-144-bypass-keyword-drop/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Test that the engine properly errors out when an invalid rule action + bypass
keyword is used.

`bypass` cannot be used with `drop`, `reject`, `accept:packet`, `accept:hook`, `accept:tx`.

PCAP
====

Reused from test tls-random

Ticket
======

https://redmine.openinfosecfoundation.org/issues/8459
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
drop:packet tcp:all any any -> any any (alert; bypass; sid:99;)
accept:flow tcp:flow_start any any -> any 443 (alert; flow:to_server; sid:1;)
drop:flow tcp:flow_start any any -> any any (sid:2;)
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
%YAML 1.1
---

# Global stats configuration
stats:
enabled: yes
interval: 8

# Configure the type of alert (and other) logging you would like.
outputs:
- eve-log:
enabled: yes
filetype: regular #regular|syslog|unix_dgram|unix_stream|redis
filename: eve.json
types:
- stats
- flow
- alert
- tls:
extended: yes # enable this for extended logging information
- drop:
alerts: yes # log alerts that caused drops
flows: all # start or all: 'start' logs only a single drop
15 changes: 15 additions & 0 deletions tests/firewall/ruletype-firewall-144-bypass-keyword-drop/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
requires:
min-version: 9

pcap: ../../tls/tls-random/input.pcap

# the invalid combination rules should make the engine error out
exit-code: 1

args:
- --simulate-ips

checks:
- shell:
args: grep "keyword 'bypass' cannot be used in combination with 'drop' action" stderr | wc -l
expect: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Test that the engine properly errors out when an invalid rule action + bypass
keyword is used.

`bypass` cannot be used with `drop`, `reject`, `accept:packet`, `accept:hook`, `accept:tx`.

PCAP
====

Reused from test tls-random

Ticket
======

https://redmine.openinfosecfoundation.org/issues/8459
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
reject:packet tcp:all any any -> any any (alert; bypass; sid:99;)
accept:flow tcp:flow_start any any -> any 443 (alert; flow:to_server; sid:1;)
reject:flow tcp:flow_start any any -> any any (sid:2;)
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
%YAML 1.1
---

# Global stats configuration
stats:
enabled: yes
interval: 8

# Configure the type of alert (and other) logging you would like.
outputs:
- eve-log:
enabled: yes
filetype: regular #regular|syslog|unix_dgram|unix_stream|redis
filename: eve.json
types:
- stats
- flow
- alert
- tls:
extended: yes # enable this for extended logging information
- drop:
alerts: yes # log alerts that caused drops
flows: all # start or all: 'start' logs only a single drop
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
requires:
min-version: 9
features:
- LIBNET1.1

pcap: ../../tls/tls-random/input.pcap

# the invalid combination rules should make the engine error out
exit-code: 1

args:
- --simulate-ips

checks:
- shell:
args: grep "keyword 'bypass' cannot be used in combination with 'reject' action" stderr | wc -l
expect: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Test that the engine properly errors out when an invalid rule action + bypass
keyword is used.

`bypass` cannot be used with `drop`, `reject`, `accept:packet`, `accept:hook`, `accept:tx`.

PCAP
====

Reused from test tls-random

Ticket
======

https://redmine.openinfosecfoundation.org/issues/8459
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accept:packet tcp:all any any -> any any (alert; bypass; sid:99;)
accept:flow tcp:flow_start any any -> any 443 (alert; flow:to_server; sid:1;)
accept:flow tcp:flow_start any any -> any any (sid:2;)
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
%YAML 1.1
---

# Global stats configuration
stats:
enabled: yes
interval: 8

# Configure the type of alert (and other) logging you would like.
outputs:
- eve-log:
enabled: yes
filetype: regular #regular|syslog|unix_dgram|unix_stream|redis
filename: eve.json
types:
- stats
- flow
- alert
- tls:
extended: yes # enable this for extended logging information
- drop:
alerts: yes # log alerts that caused drops
flows: all # start or all: 'start' logs only a single drop
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
requires:
min-version: 9

pcap: ../../tls/tls-random/input.pcap

# the invalid combination rules should make the engine error out
exit-code: 1

args:
- --simulate-ips

checks:
- shell:
args: grep "keyword 'bypass' cannot be used in combination with 'packet' scope" stderr | wc -l
expect: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Test that the engine properly errors out when an invalid rule action + bypass
keyword is used.

`bypass` cannot be used with `drop`, `reject`, `accept:packet`, `accept:hook`, `accept:tx`.

PCAP
====

Reused from test tls-random

Ticket
======

https://redmine.openinfosecfoundation.org/issues/8459
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
config:packet tcp:all any any -> any any (alert; bypass; sid:99;)
accept:flow tcp:flow_start any any -> any 443 (alert; flow:to_server; sid:1;)
drop:flow tcp:flow_start any any -> any any (sid:2;)
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
%YAML 1.1
---

# Global stats configuration
stats:
enabled: yes
interval: 8

# Configure the type of alert (and other) logging you would like.
outputs:
- eve-log:
enabled: yes
filetype: regular #regular|syslog|unix_dgram|unix_stream|redis
filename: eve.json
types:
- stats
- flow
- alert
- tls:
extended: yes # enable this for extended logging information
- drop:
alerts: yes # log alerts that caused drops
flows: all # start or all: 'start' logs only a single drop
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
requires:
min-version: 9

pcap: ../../tls/tls-random/input.pcap

# the invalid combination rules should make the engine error out
exit-code: 1

args:
- --simulate-ips

checks:
- shell:
args: grep "keyword 'bypass' cannot be used in combination with 'config' action" stderr | wc -l
expect: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Test that the engine properly errors out when an invalid rule action + bypass
keyword is used.

`bypass` cannot be used with `drop`, `reject`, `accept:packet`, `accept:hook`, `accept:tx`.

PCAP
====

Reused from test tls-random

Ticket
======

https://redmine.openinfosecfoundation.org/issues/8459
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accept:hook tcp:all any any -> any any (alert; bypass; sid:99;)
accept:flow tcp:flow_start any any -> any 443 (alert; flow:to_server; sid:1;)
accept:flow tcp:flow_start any any -> any any (sid:2;)
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
%YAML 1.1
---

# Global stats configuration
stats:
enabled: yes
interval: 8

# Configure the type of alert (and other) logging you would like.
outputs:
- eve-log:
enabled: yes
filetype: regular #regular|syslog|unix_dgram|unix_stream|redis
filename: eve.json
types:
- stats
- flow
- alert
- tls:
extended: yes # enable this for extended logging information
- drop:
alerts: yes # log alerts that caused drops
flows: all # start or all: 'start' logs only a single drop
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
requires:
min-version: 9

pcap: ../../tls/tls-random/input.pcap

# the invalid combination rules should make the engine error out
exit-code: 1

args:
- --simulate-ips

checks:
- shell:
args: grep "keyword 'bypass' cannot be used in combination with 'hook' scope" stderr | wc -l
expect: 1
Loading
Loading