Feature #7701
openfirewall: configurable default policies
Added by Victor Julien about 1 year ago. Updated 7 days ago.
Description
For discussion. There are 2 ideas here:
1. allow different actions than plain drop: e.g. reject.
2. allow default accept:hook hooks so we can insert new hooks w/o breaking existing rulesets
Also, so far it seems like the request_started/response_started hooks would most likely fit a default accept:hook as well.
VJ Updated by Victor Julien 10 months ago Actions #1
- Related to Story #7583: 9.0.0: usecase: improve firewall usecase added
VJ Updated by Victor Julien 5 months ago Actions #2
- Has duplicate Feature #8203: firewall: add configuration option for a reject default action. added
VJ Updated by Victor Julien 3 months ago Actions #3
- Has duplicate Feature #8281: Add reject as a default action for firewall mode added
JL Updated by Jamie Lavigne 2 months ago Actions #4
It kind of combines 1 and 2, but allowing a default action of accept:hook combined with visibility into what the default action matches would be very valuable for testing new rulesets in a non-destructive way before enabling enforcement.
Inserting a firewall into an existing environment is a potentially dangerous operation if it ends up blocking traffic unintentionally. The two ideas above would allow a user to first configure the firewall in a way that evaluates rules and tells you what it would block but does not take any blocking action, so the user can validate the ruleset before switching the default action to blocking.
VJ Updated by Victor Julien about 2 months ago Actions #5
How about a simple YAML structure like this?
firewall:
policies:
packet:
filter: "drop:packet"
pre_flow: "accept:hook"
pre_stream: "accept:hook"
app:
http1:
request_started: "accept:hook"
request_line: "accept:hook"
request_headers: "drop:flow"
tls:
client_in_progress: "accept:hook"
client_hello_done: "drop:flow"
YD Updated by Yash Datre about 2 months ago Actions #6
We also need configurable alerts on the default action for monitoring.
AP Updated by Aneesh Patel about 1 month ago Actions #7
For default actions we are thinking to have the following settings:
- Verdict scope:
- hook (existing)
- packet (existing)
- flow (existing)
- tx (existing)
In addition to the above, * we would like the equivalent of flow and packet scope that will still send packets to the IPS engine* (flow and packet bypass right now and tx is not a true flow-scoped verdict)
- Action:
- drop (existing)
- accept (existing)
- reject
- accept with alert (this one would accept, but log an alert log as well showing that the default action was hit at that hook)
JL Updated by Jamie Lavigne about 1 month ago Actions #8
Victor Julien wrote in #note-5:
How about a simple YAML structure like this?
[...]
I think this would be great to support configuring default actions per hook. I suppose doing that could also help (partially) solve the problem of introducing new hook points later, because Suricata effectively punts that problem to its users. It would be useful to have something like an explicit mode that forces you to fully specify them all in the yaml (no implicit defaults). That would take the surprises out of upgrading because you would be forced to notice the addition of new hook points and to provide a default action for them.
AP Updated by Aneesh Patel about 1 month ago Actions #9
I think that makes sense and would definitely fit our use-case - I was envisioning something similar as well
VJ Updated by Victor Julien about 1 month ago Actions #10
- Related to Feature #8480: firewall: allow specifying multiple actions added
VJ Updated by Victor Julien 20 days ago Actions #11
- Status changed from Feedback to In Progress
- Target version changed from TBD to 9.0.0-beta1
VJ Updated by Victor Julien 20 days ago Actions #12
One annoying issue popped up: our yaml parser doesn't like underscores in the keys. So to make it work a snipped would look like this
firewall:
policies:
dns:
request-started:
- "accept:hook"
request-complete:
- "drop:flow"
response-started:
- "accept:hook"
response-complete:
- "drop:flow"
Wonder if that should mean we also update the rule syntax to match it. So
accept:hook dns:request-started any any -> any any (...).VJ Updated by Victor Julien 20 days ago Actions #13
Another thing I didn't realize before: when we invoke the default policy we have no signature, so we can't raise an alert either. I was thinking about adding alert the example above:
firewall:
policies:
dns:
request-started:
- "accept:hook"
request-complete:
- "drop:flow"
- "alert"
response-started:
- "accept:hook"
response-complete:
- "drop:flow"
However that would not make sense currently. Alerts needs signatures. Need to think about that or if that alert is simply the wrong tool here and we need a dedicated log type (#8479).
VJ Updated by Victor Julien 18 days ago Actions #14
- Status changed from In Progress to In Review
First draft in https://github.com/OISF/suricata/pull/15320
AP Updated by Aneesh Patel 11 days ago Actions #15
We would want the alerts from default hooks to be emitted in the eve alert logs if possible
JI Updated by Jason Ish 9 days ago Actions #16
Was thinking about mixing default policies into the rule file as I noticed I was missing that while testing this work. I just wanted to drop an idea of what this could look like, perhaps future work:
default accept:hook packet:filter (sid:9000001; msg:"firewall default packet filter";) default accept:flow tls:client_in_progress (sid:9000200; msg:"firewall default TLS client in progress";)
Additionally it gives the defaults a signature.
VJ Updated by Victor Julien 8 days ago Actions #17
- Status changed from In Review to Resolved
VJ Updated by Victor Julien 8 days ago Actions #18
- Related to Feature #8566: firewall: support generating alerts on default policy added
VJ Updated by Victor Julien 7 days ago Actions #20
- Label Needs backport to 8.0 added
OT Updated by OISF Ticketbot 7 days ago Actions #21
- Subtask #8574 added
OT Updated by OISF Ticketbot 7 days ago Actions #22
- Label deleted (
Needs backport to 8.0)