Project

General

Profile

Actions

Feature #8712

closed
VJ LS

firewall: add default app policy options

Feature #8712: firewall: add default app policy options

Added by Victor Julien 2 months ago. Updated 8 days ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Effort:
Difficulty:
Label:

Description

Add options to specific a default policy for policies that aren't specified.

firewall:
  policies:
    default-policy:
      - "accept:hook" 

    http:
      default-policy:
        - "accept:hook" 

      request-started:
        - "accept:hook" 
      request-trailer:
        - "accept:hook" 
      request-complete:
        - "accept:hook" 
      # implied request-body uses firewall.policies.http.default-policy

   # implied tls uses firewall.policies.default-policy


Subtasks 1 (0 open1 closed)

Feature #8770: firewall: add default app policy options (8.0.x backport)ClosedLukas SismisActions

Related issues 3 (2 open1 closed)

Related to Suricata - Feature #7701: firewall: configurable default policiesClosedVictor JulienActions
Related to Suricata - Bug #8389: firewall: Add monitor/observe mode to preview firewall policy without enforcing dropsTriagedOISF DevActions
Related to Suricata - Feature #8781: firewall: allow bypass as a default policyNewJuliana Fajardini ReichowActions

VJ Updated by Victor Julien 2 months ago Actions #1

  • Related to Feature #7701: firewall: configurable default policies added
  • Related to Bug #8389: firewall: Add monitor/observe mode to preview firewall policy without enforcing drops added

VJ Updated by Victor Julien 2 months ago Actions #2

  • Subject changed from firewall: add default app policy to firewall: add default app policy options

LS Updated by Lukas Sismis 2 months ago Actions #3

  • Status changed from New to Assigned
  • Assignee set to Lukas Sismis
  • Target version changed from TBD to 9.0.0-beta1

LS Updated by Lukas Sismis about 2 months ago Actions #4

Would it be ok to redefine the policy section of the configuration file to a format like this?
The current format as is in: https://github.com/OISF/suricata/blob/43bc2db41e4f7356f6cadb3247750d66e27ea8fe/suricata.yaml.in#L2396
Feels ambiguous, especially since it doesn't allow defining policies to packet-related tables only (hence adding a "packet" node).
The same would be for defining global app policy option (hence adding "app" configuration node)

firewall:
  policies:
    default-policy: ["accept:hook"]     # global fallback (all hooks)
    packet:
      default-policy: ["drop:packet"]   # fallback for packet hooks
      filter:     ["drop:packet"]
      pre-flow:   ["accept:hook"]
      pre-stream: ["accept:hook"]
    app:
      default-policy: ["drop:flow"]     # fallback for all app hooks
      dns:
        default-policy: ["drop:flow"]   # fallback for dns hooks
        request-started: ["accept:hook"]
        request-complete: ["drop:flow", "alert"]
        response-started: ["accept:tx"]

VJ Updated by Victor Julien about 2 months ago Actions #5

I think it makes sense. @Yash Datre any opinions?

LS Updated by Lukas Sismis about 2 months ago Actions #6

Not particularly related to this ticket, but I would like to propose the change of the app layer policy from "http" to "http1" to be in line with FW rules.

YD Updated by Yash Datre about 2 months ago Actions #7

Yes, this should solve the use-case.

AP Updated by Aneesh Patel about 1 month ago Actions #8

Any update on this ticket? This is a pretty critical one for us

LS Updated by Lukas Sismis about 1 month ago Actions #9

Hello, yes, it is on top of my list. I have it implemented, and after my testing/review, I expect I'll create a PR on Monday/Tuesday.

JI Updated by Jason Ish about 1 month ago Actions #10

  • Status changed from Assigned to In Progress
  • Priority changed from Normal to High

LS Updated by Lukas Sismis about 1 month ago Actions #11

  • Status changed from In Progress to In Review

LS Updated by Lukas Sismis about 1 month ago Actions #12

  • Label Needs backport to 8.0 added

OT Updated by OISF Ticketbot about 1 month ago Actions #13

  • Subtask #8770 added

OT Updated by OISF Ticketbot about 1 month ago Actions #14

  • Label deleted (Needs backport to 8.0)

JF Updated by Juliana Fajardini Reichow about 1 month ago Actions #15

  • Related to Feature #8781: firewall: allow bypass as a default policy added

LS Updated by Lukas Sismis 16 days ago Actions #17

As thinking through the usability I thought of one extra improvement.

Currently, protocols with substates follow this hierarchy:
``app.<proto>.<sub state>.<hook / generic_state>`` >``app.<proto>.<sub state>.default-policy`` > ``app.<proto>.default-policy`` > ``app.default-policy`` > ``policies.default-policy`` > built-in (``drop:flow``)

But in case, e.g. for http2, the user wants to set both stream and global substates to the same values, then the config needs to be defined for every substate.
Allowing to set hook name on the protocol level could have save this explicitness on the substate level.

The final chain could look like:
``app.<proto>.<sub state>.<hook / generic_state>`` > ``app.<proto>.<hook / generic_state>`` >``app.<proto>.<sub state>.default-policy`` > ``app.<proto>.default-policy`` > ``app.default-policy`` > ``policies.default-policy`` > built-in (``drop:flow``)

And in the config:

From this:

    firewall:
      policies: 
          http2:
            stream:
              request-started: ["accept:hook"]
              request-completed: ["accept:hook"]
              response-started: ["accept:hook"]
              response-completed: ["accept:hook"]
            global:
              request-started: ["accept:hook"]
              request-completed: ["accept:hook"]
              response-started: ["accept:hook"]
              response-completed: ["accept:hook"]

to this:

    firewall:
      policies: 
          http2:
              request-started: ["accept:hook"]
              request-completed: ["accept:hook"]
              response-started: ["accept:hook"]
              response-completed: ["accept:hook"]

Leaving this for a discussion for now, it not part of the current PR.

LS Updated by Lukas Sismis 8 days ago Actions #18

  • Status changed from In Review to Resolved

LS Updated by Lukas Sismis 8 days ago Actions #19

  • Status changed from Resolved to Closed
Actions

Also available in: PDF Atom