Commit Graph

20 Commits (a329e0a3b9abb5ee7a844f3acd921fefa93b56b8)

Author SHA1 Message Date
Lukas Sismis a329e0a3b9 firewall: reject flow scope for the pre-flow hook
Action scopes for packet hook default policies were validated per hook
class, so `flow` was accepted for every packet hook. The pre_flow hook is
a special case as it is evaluated before Suricata obtains a flow record.
Firewall rules on the pre_flow hook were not validated at all, so `flow`
and `tx` scopes were accepted there as well.

This commit adds extra validation to scope parsing for the pre_flow
hook default policy and validates pre_flow firewall rules against the
same scopes.

Ticket: 8967
3 weeks ago
Victor Julien 2630c6a5d3 detect: log the hook for sub-state firewall rules
Alerts and drops for firewall rules hooked at a sub-state (http2
stream/global) had no firewall.hook field: the logger resolved the state
name without the sub-state, so the lookup found nothing.

Keep the rule's sub-state on the Signature next to app_progress_hook,
set it from the hook and for the default policy signatures, resolve the
name in the sub-state table, and fall back to the plain state name when
that lookup fails.

Ticket: #8944.
3 weeks ago
Victor Julien 9419f15779 detect/firewall: reject unsatisfiable app-layer-state rules
An app-layer-state comparison that can never hold - mode '>' at or beyond
the completion state, or mode '<' at the starting state - can never match.
Both are fatal at rule load, so reject them at parsing.

The LTE (<hook) form at the first state (progress 0) is accepted and is
equivalent to the plain hook form: there are no prior states to auto-accept.

Derive the completion state from the direction the keyword resolved in
instead of the rule's flags, and document the new load time rejections.

Ticket: #8944.
3 weeks ago
Victor Julien fa695d3563 doc/userguide: TLS firewall state phase rename
The firewall userguide pages still described the old TLS completion
milestones, and an upgrade from the old state names had no guidance.

Update the firewall design and example pages to the phase names,
list the migration page in the firewall index, and add the migration
page itself: the old/new state name mapping, the load-time
validation of rules and config keys, monitoring of ts_progress, and
the semantic changes - the fragmented hello decision, the removed
flight-completion state, one decision per state, the new ja3/ja3s
event timing, and the SSLv2 track behaviour. The 9.0.0 upgrade
guide gains Major Changes (a rule with an old state name fails to
load and is not enforced; config keys renamed) and Logging Changes
(ts_progress/tc_progress values) entries, both linking the
migration page.

Ticket: #9047.
3 weeks ago
Lukas Sismis 3f0d99d9c2 fw: document config action in FW mode 2 months ago
Lukas Sismis 092ae272e2 firewall: validate action scope against the hook class
Validate the resolved scope against the class of hook it is being applied
to and fail at startup if it does not fit.

Ticket: 8712
2 months ago
Lukas Sismis 0aaa80d4f3 firewall: add default-policy to policy config
Every hook has a built-in default policy, but expressing anything other
than the built-in meant naming each hook explicitly.
This commit adds a `default-policy` setting that covers all hooks below it.
For any hook the most specific setting present wins.

DoParseAppSubStatePolicy() collapses into DoParseAppPolicy() as a sub state
hook only differs by an extra path segment.

Ticket: 8712
2 months ago
Lukas Sismis b82b4496af detect/firewall: group policies under packet and app nodes
The policy config was a flat map mixing packet hooks and app-layer
protocols: `packet-filter` next to `dns`. There was no node that meant
"the packet hooks" or "the app-layer hooks", so a setting could not be
scoped to one group.

Move each group under its own node:

    packet-filter     -> packet.filter
    packet-pre-flow   -> packet.pre-flow
    packet-pre-stream -> packet.pre-stream
    <proto>.<hook>    -> app.<proto>.<hook>

Ticket: 8712
2 months ago
Lukas Sismis 04c9fd9e22 detect/firewall: address HTTP/1 policies as http1
AppProtoToString(ALPROTO_HTTP1) returns "http", so an HTTP/1 policy had to
be written as `http:` while its rule hooks were already spelled `http1:`.
Use the same name in both places.

Ticket: 8712
2 months ago
Victor Julien 8728f9ffc0 doc/userguide: document firewall lte rule support 5 months ago
Victor Julien ac59883c26 doc/userguide: fix default policies for pre_* hooks
Minor other cleanups.
5 months ago
Victor Julien da6af0879e doc: update firewall design
Bring in line with recent changes.
5 months ago
Victor Julien e6381a3c22 doc/userguide: add note on rule reloads
Cannot be combined with --firewall-rules-exclusive
7 months ago
Victor Julien f99b86beab doc/userguide: document L2 firewall handling of ARP 7 months ago
Victor Julien e62eb00459 doc/userguide: add ips chapter; add concept
Move setup guides into the new chapter as well.

Explain `stream.inline` logic.

Ticket: #5513.
Ticket: #6284.
1 year ago
Shivani Bhardwaj 9ed5ac7669 doc: make firewall table names consistent 1 year ago
Shivani Bhardwaj 7fec1883cd doc: add more info to firewall design
Add information about:
- available tables, default policies and rule ordering
- Packet layer and applayer tables and hooks
- engine analysis output
- commandline options available
- how to load firewall rules

Also, reorganize sections and content to assist the definitions.
1 year ago
Jason Ish 7535b5aa1d doc/lua-functions: update lua-function documentation
- cleanup usage and documentation around needs
- mentiond that rule hooks are used instead of "needs" keywords with
  link with rule hooks (which is still in the firewall-design doc)
1 year ago
Philippe Antoine daabab7381 doc/ssh: document hooks
Ticket: 7607
2 years ago
Victor Julien 5c7173c6df doc/firewall: start of documentation 2 years ago